utils.simulate_magnitudes#

seismostats.utils.simulate_magnitudes(n: int, beta: float, mc: float, mag_max: float | None = None) ndarray#

Generates a vector of n elements drawn from an exponential distribution \(f = e^{-beta*M}\).

Parameters:
  • n – Number of sample magnitudes.

  • beta – Scale factor of the exponential distribution.

  • mc – Cut-off magnitude.

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

Returns:

mags – Vector of length n of magnitudes drawn from an exponential distribution.

Examples

>>> from seismostats.utils import simulate_magnitudes
>>> simulate_magnitudes(4, 1, 0, 5)
array([1.39701219, 0.09509761, 2.68367219, 0.73664695]) #random
>>> simulate_magnitudes(4, 1, 1)
array([1.3249975 , 1.63120196, 3.56443043, 1.15384524]) #random

See also

simulate_magnitudes_binned()