Catalog.estimate_b#
- Catalog.estimate_b(mc: float | None = None, delta_m: float | None = None, weights: list | None = None, method: ~seismostats.analysis.bvalue.base.BValueEstimator = <class 'seismostats.analysis.bvalue.classic.ClassicBValueEstimator'>, **kwargs) BValueEstimator#
Estimates b-value of the Gutenberg-Richter (GR) law, using the magnitudes in the Catalog. Sets attribute b-value to the computed value, but also returns the b-value estimator object.
- Parameters:
mc – Completeness magnitude, either given as parameter or taken from the object attribute.
delta_m – Discretization of magnitudes, either given as parameter or taken from the object attribute.
weights – Weights of each magnitude can be specified here.
method – BValueEstimator class to use for calculation.
**kwargs – Additional parameters to be passed to the BValueEstimator.calculate method.
- Returns:
estimator – Object of type
ClassicBValueEstimator()or of the type provided by the method parameter.
See also
By default uses
ClassicBValueEstimator()as estimator. All available estimators can be found in the bvalues module.Examples
The estimate_b method sets the b_value attribute of the catalog to the computed value.
>>> from seismostats import Catalog >>> cat = Catalog.from_dict({ ... 'longitude': [42.35, 1.35, 2.35], ... 'latitude': [3.34444, 5.135, 2.134], ... 'magnitude': [1.0, 2.5, 3.9] ... }) >>> cat.estimate_b(mc=1.0, delta_m=0.1) >>> cat.b_value 0.28645181449530005
The returned estimator can be used to access the remaining results, see the documentation of
ClassicBValueEstimator()or the explicitly used estimator for more information.>>> estimator = cat.estimate_b(mc=1.0, delta_m=0.1) >>> estimator.beta, estimator.std (0.6595796779179737, 0.15820210898689366)
Using for example the
BPositiveBValueEstimator(), thetimeparameter can either be passed in thekwargs, like the additionaldmcparameter. If not passed, it will be taken from the catalog columns directly.>>> from datetime import datetime >>> from seismostats.analysis import BPositiveBValueEstimator >>> cat['time'] = [datetime(2000, 1, 1), ... datetime(2000, 1, 2), ... datetime(2000, 1, 3)] >>> estimator = cat.estimate_b(mc=1.0, delta_m=0.1, ... method=BPositiveBValueEstimator, dmc=0.3) >>> type(estimator) <class 'seismostats.analysis.BPositiveBValueEstimator'>