Skip to content

Commit

Permalink
a-value: rename T to scaling_factor to allow for more flexibility and…
Browse files Browse the repository at this point in the history
… avoid stupid names
  • Loading branch information
RitzVanille committed Jul 8, 2024
1 parent 4a6ea10 commit 30219d3
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions seismostats/analysis/estimate_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ def estimate_a(magnitudes: np.ndarray,
mc: float | None = None,
m_ref: float | None = None,
b_value: float | None = None,
T: float | None = None,
scaling_factor: float | None = None,
) -> float:
"""Estimate the a-value of the Gutenberg-Richter (GR) law.
N = 10 ** (a - b * (m_ref - mc)) (1)
where N is the number of events with magnitude greater than m_ref, which
occurred in the time interval T. T should be given as a float- to begit
precise, it should be the time interval scaled to the time-unit of interest.
E.g., if the number of events per year are of interest, T should be the
number of years in which the events occurred.
occurred in the timeframe of the catalogue. The scaling_factor should be
given as a float- to be precise, and most of the time stands for the time
interval scaled to the time-unit of interest. E.g., if the number of events
per year are of interest, scaling_factor should be the number of years in
which the events occurred. The a-value can also be scaled by volume or area
using scaling_factor.
If only the magnitudes are given, the a-value is estimated at the lowest
magnitude in the sample, with mc = min(magnitudes). Eq. (1) then simplifies
Expand All @@ -33,8 +35,9 @@ def estimate_a(magnitudes: np.ndarray,
m_ref: Reference magnitude for which the a-value is estimated. If
None, the a-value is estimated at mc.
b_value: b-value of the Gutenberg-Richter distribution
T: Relative length of the time interval in which the events
occurred (relative to the time unit of interest, e.g., years)
scaling_factor: Scaling factor. For example: Relative length of the time
interval in which the events occurred (relative to the time unit
of interest, e.g., years)
Returns:
a: a-value of the Gutenberg-Richter distribution
Expand All @@ -57,8 +60,8 @@ def estimate_a(magnitudes: np.ndarray,
"b_value must be provided if m_ref is given")
a = a - b_value * (m_ref - mc)

# scale to reference time-interval
if T is not None:
a = a - np.log10(T)
# scale to reference time-interval / volume / area ...
if scaling_factor is not None:
a = a - np.log10(scaling_factor)

return a

0 comments on commit 30219d3

Please sign in to comment.