utils.get_fmd#
- seismostats.utils.get_fmd(magnitudes: ndarray, fmd_bin: float, weights: ndarray | None = None, bin_position: str = 'center') tuple[ndarray, ndarray, ndarray]#
Calculates event counts per magnitude bin. Note that the returned bins array contains the center point of each bin unless
bin_position = 'left'.- Parameters:
magnitudes – Array of magnitudes.
fmd_bin – Bin size for the FMD. This can be independent of the discretization of the magnitudes. The optimal value would be as small as possible while at the same time ensuring that there are enough magnitudes in each bin.
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).
counts – Counts for each bin.
mags_binned – Array of magnitudes binned to
fmd_bin.
Examples
>>> from seismostats.utils import get_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_fmd(magnitudes, fmd_bin) >>> bins array([1., 2.]) >>> counts array([4, 3]) >>> mags_binned array([1., 1., 1., 1., 2., 2., 2.])
See also
get_cum_fmd()