utils.simulate_magnitudes_binned#

seismostats.utils.simulate_magnitudes_binned(n: int, b: float | ndarray, mc: float, delta_m: float, mag_max: float | None = None, b_parameter: str = 'b_value') ndarray#

Simulate magnitudes and bin them to a given precision delta_m. Input b can be specified to be ‘beta’ or the ‘b-value’, depending on the b_parameter input.

Parameters:
  • n – Number of magnitudes to simulate.

  • b – b-value or beta of the distribution from which magnitudes are simulated. If b is np.ndarray, it must have the length n. Then each magnitude is simulated from the corresponding b-value.

  • mc – Magnitude of completeness.

  • delta_m – Magnitude bin width.

  • mag_max – Maximum magnitude. If it is not None, the exponential distribution is truncated at mag_max.

  • b_parameter – ‘b_value’ or ‘beta’

Returns:

mags – Array of magnitudes.

Examples

>>> from seismostats.utils import simulate_magnitudes_binned
>>> simulate_magnitudes_binned(5, 1, 0, 1, 5)
array([1., 0., 1., 1., 0.])
>>> simulate_magnitudes_binned(5, 1, 1, 0.1)
array([1.1., 1., 1.6, 1.2, 1.3])

See also

simulate_magnitudes()