From c765e7c66bbf84f94c04610d53c6abbd3e190440 Mon Sep 17 00:00:00 2001 From: Marcel Office Desktop Date: Thu, 29 Aug 2024 16:33:16 +0200 Subject: [PATCH] [bugfix] fixed import for tukey in newer scipy versions which moved to signal.windows module --- pylot/core/pick/charfuns.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pylot/core/pick/charfuns.py b/pylot/core/pick/charfuns.py index d5e0bee8..afb21475 100644 --- a/pylot/core/pick/charfuns.py +++ b/pylot/core/pick/charfuns.py @@ -17,7 +17,10 @@ autoregressive prediction: application ot local and regional distances, Geophys. :author: MAGS2 EP3 working group """ import numpy as np -from scipy import signal +try: + from scipy.signal import tukey +except ImportError: + from scipy.signal.windows import tukey from obspy.core import Stream from pylot.core.pick.utils import PickingFailedException @@ -227,7 +230,7 @@ class AICcf(CharacteristicFunction): ind = np.where(~np.isnan(xnp))[0] if ind.size: xnp[:ind[0]] = xnp[ind[0]] - xnp = signal.tukey(len(xnp), alpha=0.05) * xnp + xnp = tukey(len(xnp), alpha=0.05) * xnp xnp = xnp - np.mean(xnp) datlen = len(xnp) k = np.arange(1, datlen)