pygmi.seis.graphs#

Plot Seismology Data.

This module provides a variety of methods to plot raster data via the context menu.

Classes#

MyMplCanvas

Matplotlib canvas widget for the actual plot.

PlotQC

GUI to plot QC graphs.

PlotIso

GUI to plot isolines.

PlotTempB

GUI to plot temporal b-values.

Functions#

contourtopoly(cntr)

Convert Matplotlib contours to Polygons.

import_for_plots(dat)

Import data to plot.

eigsorted(cov)

Calculate and sort eigenvalues.

bvalue(data1a[, mbin, bins])

Update the b value plot.

fmd(mag[, mbin])

Frequency magnitude distribution.

maxc(mag[, mbin])

MAXC method to find magnitude of completeness.

Module Contents#

class pygmi.seis.graphs.MyMplCanvas(parent=None)#

Bases: matplotlib.backends.backend_qtagg.FigureCanvasQTAgg

Matplotlib canvas widget for the actual plot.

Parameters:

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

update_ellipse(datd, dats, nodepth=False)#

Update error ellipse plot.

Parameters:
  • datd (dictionary) – Dictionary containing latitudes and longitudes

  • dats (list) – Data list.

  • nodepth (bool, optional) – Flag to determine if there are depths. The default is False.

Return type:

None.

update_hexbin(data1, data2, *, xlbl='Time', ylbl='ML', xbin=None, xrng=None)#

Update the hexbin plot.

Parameters:
  • data1 (numpy array) – raster dataset to be used

  • data2 (numpy array) – raster dataset to be used

  • xlbl (str, optional) – X-axis label. The default is ‘Time’.

  • ylbl (str, optional) – Y-axis label. The default is ‘ML’.

  • xbin (int, optional) – Number of bins in the x direction. The default is None.

  • xrng (list, optional) – X-range. The default is None.

Return type:

None.

update_hist(data1, *, xlbl='Data Value', ylbl='Number of Observations', bins='doane', rng=None)#

Update the histogram plot.

Parameters:
  • data1 (numpy array.) – raster dataset to be used

  • xlbl (str, optional) – X-axis label. The default is ‘Data Value’.

  • ylbl (str, optional) – Y-axis label. The default is ‘Number of Observations’.

  • bins (int or str, optional) – Number of bins or binning strategy. See matplotlib.pyplot.hist. The default is ‘doane’.

  • rng (tuple or None, optional) – Bin range. The default is None.

Return type:

None.

update_bvalue(data1a, bins='doane')#

Update the b value plot.

Parameters:
  • data1a (numpy array) – Data array.

  • bins (int or str, optional) – Number of bins or binning strategy. See matplotlib.pyplot.hist. The default is ‘doane’.

Return type:

None.

update_pres(data1, phase='P')#

Update the plot.

Parameters:
  • data1 (numpy array) – Data array.

  • phase (str, optional) – Phase. The default is ‘P’.

Return type:

None.

update_residual(dat, res='ML')#

Update the residual plot.

Parameters:
  • data1 (numpy array) – Data array.

  • res (str, optional) – Response type. The default is ‘ML’.

Return type:

None.

update_wadati(dat, min_wad=5, min_vps=1.53, max_vps=1.93)#

Update the wadati plot.

Parameters:
  • dat (list) – List of events.

  • min_wad (int, optional) – Minimum data length for plot. The default is 5.

  • min_vps (float, optional) – Minimum VPS. The default is 1.53.

  • max_vps (float, optional) – Maximum VPS. The default is 1.93.

Return type:

None.

update_isohull(datd)#

Update isoseismic plot using convex hull method.

Parameters:

datd (GeoDatFrame) – Macroseismic data.

Return type:

None.

update_isocontour(datd)#

Update isoseismic plot using contours.

Parameters:

datd (GeoDatFrame) – Macroseismic data.

Return type:

None.

update_tempb(btot, datetot)#

Update temporal b value plot.

Parameters:
  • btot (numpy array) – Array of b values.

  • datetot (list) – list of dates.

Return type:

None.

class pygmi.seis.graphs.PlotQC(parent=None)#

Bases: pygmi.misc.ContextModule

GUI to plot QC graphs.

Parameters:

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

change_band()#

Combo box to choose band.

Return type:

None.

run()#

Entry point into the routine, used to run context menu item.

Return type:

None.

save_shp()#

Save shapefile.

Returns:

True if successful, False otherwise.

Return type:

bool

class pygmi.seis.graphs.PlotIso(parent=None)#

Bases: pygmi.misc.ContextModule

GUI to plot isolines.

Parameters:

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

change_band()#

Combo box to choose band.

Return type:

None.

run()#

Entry point into the routine, used to run context menu item.

Return type:

None.

save_shp()#

Save shapefile.

Returns:

True if successful, False otherwise.

Return type:

bool

class pygmi.seis.graphs.PlotTempB(parent=None)#

Bases: pygmi.misc.ContextModule

GUI to plot temporal b-values.

Parameters:

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

change_window()#

Edit box to change window length.

Return type:

None.

run()#

Entry point into the routine, used to run context menu item.

Return type:

None.

save_shp()#

Save shapefile.

Returns:

True if successful, False otherwise.

Return type:

bool

pygmi.seis.graphs.contourtopoly(cntr)#

Convert Matplotlib contours to Polygons.

Parameters:

cntr (Matplotlib countour) – Contour collection.

Returns:

plist – List of Polygon objects.

Return type:

list

pygmi.seis.graphs.import_for_plots(dat)#

Import data to plot.

Parameters:

dat (list) – List of events.

Returns:

datd – Dictionary of data to plot.

Return type:

dictionary

pygmi.seis.graphs.eigsorted(cov)#

Calculate and sort eigenvalues.

Parameters:

cov (numpy array) – matrix to perform calculations on.

Returns:

  • vals (numpy array) – Sorted eigenvalues.

  • vecs (numpy array) – Sorted eigenvectors.

pygmi.seis.graphs.bvalue(data1a, mbin=0.1, bins='doane')#

Update the b value plot.

Parameters:
  • data1a (numpy array) – Data array.

  • bins (int or str, optional) – Number of bins or binning strategy. See matplotlib.pyplot.hist. The default is ‘doane’.

Returns:

out – Dictionary containing ‘a-value’, ‘b-value’ etc.

Return type:

dict

pygmi.seis.graphs.fmd(mag, mbin=0.1)#

Frequency magnitude distribution.

Mignan, A. & Woessner, Jochen. (2012). Estimating the magnitude of completeness for earthquake catalogs. Community Online Resource for Statistical Seismicity Analysis. 10.5078/corssa-00180805.

Parameters:
  • mag (numpy array) – Data array of magnitudes.

  • mbin (float, optional) – Length of magnitude bin in FMD. The default is 0.1.

Returns:

res – Dictionary containing M vs cumulative and non cumulative counts.

Return type:

dict

pygmi.seis.graphs.maxc(mag, mbin=0.1)#

MAXC method to find magnitude of completeness.

Mignan, A. & Woessner, Jochen. (2012). Estimating the magnitude of completeness for earthquake catalogs. Community Online Resource for Statistical Seismicity Analysis. 10.5078/corssa-00180805.

Parameters:
  • mag (numpy array) – Data array of magnitudes.

  • mbin (float, optional) – Length of magnitude bin in FMD. The default is 0.1.

Returns:

Mc – Magnitude of completeness.

Return type:

float