Stats#

bruces.stats.poisson_process(times, rates)[source]#

Simulate a (non)-stationary Poisson process.

Parameters:
  • times (sequence of scalar or sequence of datetime_like) –

    Simulation time period of the Poisson process (in years if scalar):

    • If rates is a scalar: (start_time, end_time) corresponding to first and maximum time

    • If rates is an array_like: time associated to each rate value

  • rates (scalar or array_like) – Constant or time-dependent rate (in 1/year).

Returns:

Simulated times.

Return type:

sequence of scalar or sequence of datetime_like

bruces.stats.sample_magnitude(low=0.0, high=None, b=1.0, size=1)[source]#

Draw magnitude samples following Gutenberg-Richter law.

Parameters:
  • low (scalar, optional, default 0.0) – Minimum magnitude.

  • high (scalar or None, optional, default None) – Maximum magnitude.

  • b (scalar, optional, default 1.0) – b-value.

  • size (int, optional, default 1) – Number of samples.

Returns:

Sampled magnitudes.

Return type:

scalar or array_like