Skip to content

Commit

Permalink
adding sorting by time to Catalog.estimate_b() when b-positive method…
Browse files Browse the repository at this point in the history
… is applied
  • Loading branch information
martahan committed Jun 7, 2024
1 parent 86242d4 commit 85f0712
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion seismostats/seismicity/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,16 @@ def estimate_b(
if delta_m is None:
delta_m = self.delta_m

b_estimate = estimate_b(self.magnitude,
if method == "positive":
# dataframe needs 'time' column to be sorted
if 'time' not in self.columns:
raise ValueError('"time" column needs to be set in order to use \
b-positive method')
mags = self.sort_values("time").magnitude
else:
mags = self.magnitude

b_estimate = estimate_b(mags,
mc,
delta_m,
weights,
Expand Down

0 comments on commit 85f0712

Please sign in to comment.