utils.get_cum_fmd#
- seismostats.utils.get_cum_fmd(magnitudes: ndarray, fmd_bin: float, weights: ndarray | None = None, bin_position: str = 'center') tuple[ndarray, ndarray, ndarray]#
Calculates cumulative event counts across all magnitude units (summed from the right). Note that the returned bins array contains the center point of each bin unless
bin_position = 'left'is used.- Parameters:
magnitudes – Array of magnitudes.
fmd_bin – Discretization of the magnitudes. It is possible to provide a value that is larger than the actual discretization of the magnitudes. In this case, the magnitudes will be binned to the given
fmd_bin. This might be useful for visualization purposes.weights – Array of weights for each magnitude.
bin_position – Position of the bin, options are ‘center’ and ‘left’. Accordingly, left edges of bins or center points are returned.
- Returns:
bins – Array of bin centers (left to right).
c_counts – Cumulative counts for each bin.
mags_binned – Array of magnitudes binned to
fmd_bin.
Examples
>>> from seismostats.utils import get_cum_fmd
>>> magnitudes = [0.9, 1.1, 1.2, 1.3, 2.1, 2.2, 2.3] >>> fmd_bin = 1.0 >>> bins, counts, mags_binned = get_cum_fmd(magnitudes, fmd_bin) >>> bins array([1., 2.]) >>> counts array([7, 3]) >>> mags_binned array([1., 1., 1., 2., 2., 2., 2.])
See also
get_fmd()