analysis.BMorePositiveBValueEstimator.calculate#
- BMorePositiveBValueEstimator.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 – Margin by which the latter magnitude has to be larger than the former. If None, the default value is delta_m.
- Returns:
b – b-value of the Gutenberg-Richter law.
Examples
>>> import numpy as np >>> from seismostats.analysis.bvalue import ... BMorePositiveBValueEstimator >>> 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 = BMorePositiveBValueEstimator() >>> b_value = my_estimator.calculate( ... magnitudes=magnitudes, mc=2.0, delta_m=0.1, dmc=0.2) >>> print(b_value) 2.253092817258629