Skip to content

Commit

Permalink
Fix selection of values that pass the K_p criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs committed Aug 19, 2024
1 parent b579aec commit 3090294
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stglib/core/waves.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ def define_cutoff(f, Pxx, Kp, noise=0.9):

fpeakcut = 1.1 * f[np.argmax(Pxx)]
fpeakcutind = np.searchsorted(f, fpeakcut) # cutoff based on 1.1*fp
Kpcutind = np.argmax(Kp <= 0.1) # cutoff based on Kp<=0.1
Kpcutind = np.nonzero(Kp > 0.1)[0][-1] # cutoff keeping only Kp > 0.1

# take the more conservative of either K_p or noise cutoff
if (noisecutind > fpeakcutind) and (noisecutind <= Kpcutind):
tailind = noisecutind
elif (noisecutind > fpeakcutind) and (noisecutind > Kpcutind):
Expand Down

0 comments on commit 3090294

Please sign in to comment.