Skip to content

Commit

Permalink
triggering: correct length of index array
Browse files Browse the repository at this point in the history
np.diff() ends up with shorter array by one item, numpy was always
silently expanding the index array so far but with 1.10 is showing a
deprecation warning and likely gonna raise in the future.
  • Loading branch information
megies committed Oct 16, 2015
1 parent 70097b6 commit 5ecc221
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion obspy/signal/trigger.py
Expand Up @@ -346,7 +346,11 @@ def triggerOnset(charfct, thres1, thres2, max_len=9e99, max_len_delete=False):
#
on = deque([ind1[0]])
of = deque([-1])
of.extend(ind2[np.diff(ind2) > 1].tolist())
# determine the indices where charfct falls below off-threshold
ind2_ = np.empty_like(ind2, dtype=bool)
ind2_[:-1] = np.diff(ind2) > 1
ind2_[-1] = False
of.extend(ind2[ind2_[:-1]].tolist())
on.extend(ind1[np.where(np.diff(ind1) > 1)[0] + 1].tolist())
# include last pick if trigger is on or drop it
if max_len_delete:
Expand Down

0 comments on commit 5ecc221

Please sign in to comment.