pygmi.clust.graphtool#

Multi-function graphing tool for use with cluster analysis.

Classes#

GraphHist

Histogram graph widget.

GraphMap

Map widget.

PolygonInteractor

Polygon Interactor for the graph tool.

ScatterPlot

Main graph tool GUI routine.

Functions#

dist_point_to_segment(p, s0, s1)

Distance of a point to a line segment.

Module Contents#

class pygmi.clust.graphtool.GraphHist(parent=None)#

Bases: matplotlib.backends.backend_qtagg.FigureCanvasQTAgg

Histogram graph widget.

Parameters:

parent (parent, optional) – Reference to the parent routine. The default is None.

get_hist(bins)#

Routine to get the scattergram with histogram overlay.

Parameters:

bins (int) – Number of bins.

Returns:

xymahist – Output data.

Return type:

numpy array

get_clust_scat(bins, dattmp, ctmp)#

Routine to get the scattergram with cluster overlay.

Parameters:
  • bins (int) – Number of bins.

  • dattmp (list) – List of PyGMI raster data (pygmi.raster.datatypes.Data).

  • ctmp (list) – Cluster indices.

Returns:

xymahist – Output data.

Return type:

numpy array

init_graph()#

Initialize the Graph.

Return type:

None.

polyint()#

Polygon Interactor routine.

Return type:

None.

setup_coords()#

Routine to setup the coordinates for the scattergram.

Return type:

None.

setup_hist()#

Routine to setup the 1D histograms.

Return type:

None.

update_graph(clearaxis=False)#

Draw Routine.

Parameters:

clearaxis (bool, optional) – True to clear the axis. The default is False.

Return type:

None.

class pygmi.clust.graphtool.GraphMap(parent=None)#

Bases: matplotlib.backends.backend_qtagg.FigureCanvasQTAgg

Map widget.

Parameters:

parent (parent, optional) – Reference to the parent routine. The default is None.

init_graph()#

Initialize the Graph.

Return type:

None.

polyint()#

Polygon Integrator.

Return type:

None.

update_graph()#

Draw routine.

Return type:

None.

class pygmi.clust.graphtool.PolygonInteractor(axtmp, pntxy)#

Bases: PyQt6.QtCore.QObject

Polygon Interactor for the graph tool.

Parameters:

parent (parent, optional) – Reference to the parent routine. The default is None.

epsilon#

Epsilon tolerance for index detection.

Type:

int

polyi_changed#

Qt signal when polygon has changed.

Type:

QtCore.pyqtSignal

draw_callback()#

Draw callback.

Return type:

None.

new_poly(npoly)#

Create new Polygon.

Parameters:

npoly (list) – New polygon coordinates.

Return type:

None.

get_ind_under_point(event)#

Get the index of vertex under point if within epsilon tolerance.

Parameters:

event (matplotlib.backend_bases.MouseEvent) – Mouse event.

Returns:

ind – Index of vertex under point.

Return type:

int or None

button_press_callback(event)#

Button press callback.

Parameters:

event (matplotlib.backend_bases.MouseEvent) – Mouse event.

Return type:

None.

button_release_callback(event)#

Button release callback.

Parameters:

event (matplotlib.backend_bases.MouseEvent) – Mouse event.

Return type:

None.

update_plots()#

Update plots.

Return type:

None.

motion_notify_callback(event)#

Mouse notify callback.

Parameters:

event (matplotlib.backend_bases.MouseEvent) – Mouse event.

Return type:

None.

class pygmi.clust.graphtool.ScatterPlot(parent=None)#

Bases: pygmi.misc.BasicModule

Main graph tool GUI routine.

Parameters:

parent (parent, optional) – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

Return type:

None.

on_cp_dpoly()#

On cross plot, delete polygon.

Return type:

None.

on_map_dpoly()#

On map delete polygon.

Return type:

None.

on_cp_combo()#

On cross plot, combo.

Return type:

None.

on_cp_combo2()#

On cross plot, combo 2.

Return type:

None.

on_cp_combo3()#

On cross plot, combo 3.

Return type:

None.

on_map_combo()#

On map combo.

Return type:

None.

on_map_combo2()#

On map combo 2.

Return type:

None.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool, optional) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

Return type:

None.

update_map()#

Update map.

Return type:

None.

update_hist()#

Update histogram.

Return type:

None.

pygmi.clust.graphtool.dist_point_to_segment(p, s0, s1)#

Distance of a point to a line segment.

Reimplementation of Matplotlib’s dist_point_to_segment, after it was depreciated. Follows http://geomalgorithms.com/a02-_lines.html

Parameters:
  • p (numpy array) – Point.

  • s0 (numpy array) – Start of segment.

  • s1 (numpy array) – End of segment.

Returns:

Distance of point to segment.

Return type:

numpy array