[bugfix] handle to short zero crossings window

This commit is contained in:
Darius Arnold 2017-08-21 13:19:22 +02:00 committed by Marcel
parent afd03da178
commit 0852bf0f80

View File

@ -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, t = np.arange(0, Xraw[0].stats.npts / Xraw[0].stats.sampling_rate,
Xraw[0].stats.delta) Xraw[0].stats.delta)
# get pick window # get pick window
ipick = np.where( ipick = np.where((t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick))
(t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick)) if len(ipick[0]) <= 1:
print('fmpicker: Zero crossings window to short!')
return
# remove mean # remove mean
xraw[ipick] = xraw[ipick] - np.mean(xraw[ipick]) xraw[ipick] = xraw[ipick] - np.mean(xraw[ipick])
xfilt[ipick] = xfilt[ipick] - np.mean(xfilt[ipick]) xfilt[ipick] = xfilt[ipick] - np.mean(xfilt[ipick])