Skip to content

Commit

Permalink
make_mre incomplete: magnitude must be ordered in time
Browse files Browse the repository at this point in the history
  • Loading branch information
aronsho committed Jun 8, 2024
1 parent ec1f1e4 commit 0b48561
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions seismostats/analysis/estimate_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ def make_more_incomplete(
"""

# sort magnitudes in time
idx_sort = np.argsort(times)
magnitudes = magnitudes[idx_sort]
times = times[idx_sort]

incomplete = False
while incomplete is False:
incomplete = True
Expand Down
6 changes: 3 additions & 3 deletions seismostats/analysis/tests/test_estimate_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,16 @@ def test_estimate_b_more_positive(


def test_make_more_incomplete():
magnitudes = [1, 2, 20, 3, 4, 9, 3]
times = [
magnitudes = np.array([1, 2, 20, 3, 4, 9, 3])
times = np.array([
dt.datetime(2020, 1, 1),
dt.datetime(2020, 1, 2),
dt.datetime(2020, 1, 3),
dt.datetime(2020, 1, 4),
dt.datetime(2020, 1, 5),
dt.datetime(2020, 1, 6),
dt.datetime(2020, 1, 7),
]
])

mags_inc, times_inc = make_more_incomplete(
magnitudes, times, delta_t=np.timedelta64(49, "h")
Expand Down

0 comments on commit 0b48561

Please sign in to comment.