From c45464061919d53ca47ba80a5f07be3d982d31c8 Mon Sep 17 00:00:00 2001 From: Darius Arnold Date: Mon, 21 Aug 2017 13:19:22 +0200 Subject: [PATCH] [bugfix] handle to short zero crossings window --- pylot/core/pick/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index f5177737..873c228b 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -205,8 +205,10 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None): t = np.arange(0, Xraw[0].stats.npts / Xraw[0].stats.sampling_rate, Xraw[0].stats.delta) # get pick window - ipick = np.where( - (t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick)) + ipick = np.where((t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick)) + if len(ipick[0]) <= 1: + print('fmpicker: Zero crossings window to short!') + return # remove mean xraw[ipick] = xraw[ipick] - np.mean(xraw[ipick]) xfilt[ipick] = xfilt[ipick] - np.mean(xfilt[ipick])