openquake.hmtk.seismicity.occurrence package¶
Submodules¶
openquake.hmtk.seismicity.occurrence.aki_maximum_likelihood module¶
- 
class openquake.hmtk.seismicity.occurrence.aki_maximum_likelihood.AkiMaxLikelihood[source]¶
- Bases: - openquake.hmtk.seismicity.occurrence.base.SeismicityOccurrence- 
calculate(catalogue, config=None, completeness=None)[source]¶
- Calculation of b-value and its uncertainty for a given catalogue, using the maximum likelihood method of Aki (1965), with a correction for discrete bin width (Bender, 1983). - Parameters: - catalogue – See openquake.hmtk.seismicity.occurrence.base.pyfor further explanation
- config – The configuration in this case do not contains specific information
- completeness (float) – Completeness magnitude
 - Return float bval: - b-value of the Gutenberg-Richter relationship - Return float sigma_b: - Standard deviation of the GR b-value 
- catalogue – See 
 
- 
openquake.hmtk.seismicity.occurrence.b_maximum_likelihood module¶
- 
class openquake.hmtk.seismicity.occurrence.b_maximum_likelihood.BMaxLikelihood[source]¶
- Bases: - openquake.hmtk.seismicity.occurrence.base.SeismicityOccurrence- Implements maximum likelihood calculations taking into account time variation in completeness” - 
calculate(catalogue, config, completeness=None)[source]¶
- Calculates recurrence parameters a_value and b_value, and their respective uncertainties - Parameters: - catalogue – Earthquake Catalogue
An instance of openquake.hmtk.seismicity.catalogue
- config (dict) – A configuration dictionary; the only parameter that can be defined in this case if the type of average to be applied in the calculation
- or numpy.ndarray completeness (list) – Completeness table
 
- catalogue – Earthquake Catalogue
An instance of 
 
- 
openquake.hmtk.seismicity.occurrence.base module¶
- 
class openquake.hmtk.seismicity.occurrence.base.SeismicityOccurrence[source]¶
- Bases: - object- Implements recurrence calculations for instrumental seismicity - 
calculate(catalogue, config, completeness=None)[source]¶
- Implements recurrence calculation - Parameters: - catalogue – An instance of openquake.hmtk.seismicity.catalogue
- config (dict) – The config contains the necessary information to run a specific algorithm.
- completeness (numpy.ndarray) – The completeness matrix
 
- catalogue – An instance of 
 
- 
openquake.hmtk.seismicity.occurrence.kijko_smit module¶
- 
class openquake.hmtk.seismicity.occurrence.kijko_smit.KijkoSmit[source]¶
- Bases: - openquake.hmtk.seismicity.occurrence.base.SeismicityOccurrence- Class to Implement the Kijko & Smit (2012) algorithm for estimation of a- and b-value 
openquake.hmtk.seismicity.occurrence.penalized_mle module¶
- 
class openquake.hmtk.seismicity.occurrence.penalized_mle.PenalizedMLE[source]¶
- Bases: - openquake.hmtk.seismicity.occurrence.base.SeismicityOccurrence- Test Implementation of the Penalized Maximum Likelihood function - 
IERR= {1: 'No events in catalogue - returning prior', 2: 'Failure of convergence - returning prior'}¶
 - 
calculate(catalogue, config, completeness)[source]¶
- Calculates the b-value and rates (and their corresponding standard deviations) using the Penalized MLE approach - Parameters: - config (dict) – Configuration parameters
- catalogue – Earthquake catalogue as instance of :class: openquake.hmtk.seismicity.catalogue.Catalogue
- completeness – Completeness table
 - Returns: - b-value, standard deviation on b, rate (or a-value), standard deviation on a 
 
- 
openquake.hmtk.seismicity.occurrence.utils module¶
- 
openquake.hmtk.seismicity.occurrence.utils.downsample_completeness_table(comp_table, sample_width=0.1, mmax=None)[source]¶
- Re-sample the completeness table to a specified sample_width 
- 
openquake.hmtk.seismicity.occurrence.utils.generate_synthetic_magnitudes(aval, bval, mmin, mmax, nyears)[source]¶
- Generates a synthetic catalogue for a specified number of years, with magnitudes distributed according to a truncated Gutenberg-Richter distribution - Parameters: - aval (float) – a-value
- bval (float) – b-value
- mmin (float) – Minimum Magnitude
- mmax (float) – Maximum Magnitude
- nyears (int) – Number of years
 - Returns: - Synthetic catalogue (dict) with year and magnitude attributes 
- 
openquake.hmtk.seismicity.occurrence.utils.generate_trunc_gr_magnitudes(bval, mmin, mmax, nsamples)[source]¶
- Generate a random list of magnitudes distributed according to a truncated Gutenberg-Richter model - Parameters: - bval (float) – b-value
- mmin (float) – Minimum Magnitude
- mmax (float) – Maximum Magnitude
- nsamples (int) – Number of samples
 - Returns: - Vector of generated magnitudes 
- 
openquake.hmtk.seismicity.occurrence.utils.get_completeness_counts(catalogue, completeness, d_m)[source]¶
- Returns the number of earthquakes in a set of magnitude bins of specified with, along with the corresponding completeness duration (in years) of the bin - Parameters: - catalogue – Earthquake catalogue as instance of :class: openquake.hmtk.seisimicity.catalogue.Catalogue
- completeness (numpy.ndarray) – Completeness table [year, magnitude]
- d_m (float) – Bin size
 - Returns: - cent_mag - array indicating center of magnitude bins
- t_per - array indicating total duration (in years) of completeness
- n_obs - number of events in completeness period
 
- 
openquake.hmtk.seismicity.occurrence.utils.input_checks(catalogue, config, completeness)[source]¶
- Performs a basic set of input checks on the data 
- 
openquake.hmtk.seismicity.occurrence.utils.recurrence_table(mag, dmag, year, time_interval=None)[source]¶
- Table of recurrence statistics for each magnitude [Magnitude, Number of Observations, Cumulative Number of Observations >= M, Number of Observations (normalised to annual value), Cumulative Number of Observations (normalised to annual value)] Counts number and cumulative number of occurrences of each magnitude in catalogue - Parameters: - mag (numpy.ndarray) – Catalog matrix magnitude column
- dmag (numpy.ndarray) – Magnitude interval
- year (numpy.ndarray) – Catalog matrix year column
 - Returns numpy.ndarray recurrence table: - Recurrence table 
openquake.hmtk.seismicity.occurrence.weichert module¶
- 
class openquake.hmtk.seismicity.occurrence.weichert.Weichert[source]¶
- Bases: - openquake.hmtk.seismicity.occurrence.base.SeismicityOccurrence- Class to Implement Weichert Algorithm - 
calculate(catalogue, config, completeness=None)[source]¶
- Calculates recurrence using the Weichert (1980) method 
 - 
weichert_algorithm(tper, fmag, nobs, mrate=0.0, bval=1.0, itstab=1e-05, maxiter=1000)[source]¶
- Weichert algorithm - Parameters: - tper (numpy.ndarray (float)) – length of observation period corresponding to magnitude
- fmag (numpy.ndarray (float)) – central magnitude
- nobs (numpy.ndarray (int)) – number of events in magnitude increment
- mrate (float) – reference magnitude
- bval – initial value for b-value
- itstab (float) – stabilisation tolerance
- maxiter (Int) – Maximum number of iterations
 - Returns: - b-value, sigma_b, a-value, sigma_a - Return type: - float 
 
-