analysis.BPositiveBValueEstimator.calculate#

BPositiveBValueEstimator.calculate(magnitudes: ndarray, mc: float, delta_m: float, weights: ndarray | None = None, times: ndarray | None = None, dmc: float | None = None) float#

Calculates the b-value of the Gutenberg-Richter (GR) law.

Parameters:
  • magnitudes – Array of magnitudes.

  • mc – Completeness magnitude.

  • delta_m – Bin size of discretized magnitudes.

  • weights – Array of weights for the magnitudes.

  • times – Array of times of the events, in any format (datetime, float, etc.). If None, it is assumed that the events are ordered in time.

  • dmc – Cutoff value for the differences (differences below this value are not considered). If None, the cutoff is set to delta_m.

Returns:

b – b-value of the Gutenberg-Richter law.

Examples

>>> import numpy as np
>>> from seismostats.analysis import BPositiveBValueEstimator

>>> magnitudes = np.array([2. , 2.5, 2.1, 2.2, 2.5, 2.2, 2.6,
...                        2.3, 2.7, 2.2, 2.4, 2. , 2.7, 2.2,
...                        2.3, 2.1, 2.4, 2.6, 2.2, 2.2, 2.7,
...                        2.4, 2.2, 2.5])

>>> my_estimator = BPositiveBValueEstimator()
>>> b_value = my_estimator.calculate(
...     magnitudes=magnitudes, mc=2.0, delta_m=0.1, dmc=0.2)

>>> b_value

1.9188552623891313