From 1f3af9832f47a9b2ba087c56b2c6d83e339a1f0a Mon Sep 17 00:00:00 2001
From: Xiaotao Yang <stcyang@gmail.com>
Date: Tue, 23 Apr 2024 09:25:24 -0400
Subject: [PATCH] hann window compatibility bug fix

---
 changes.txt     | 6 ++++++
 seisgo/utils.py | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/changes.txt b/changes.txt
index e6fb272..5c72eae 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,3 +1,9 @@
+Updates in v0.8.3:
+UTILS:
+1. Replace obspy.core.util.base._get_function_from_entry_point for 
+  taper hann window with scipy.signal.windows.hann for compatibility with new scipy. 
+
+=============================================================
 Updates in v0.8.1
 TYPES:
 1. Types.CorrData.subset: clarified documentary of overwrite option. Default False.
diff --git a/seisgo/utils.py b/seisgo/utils.py
index c458057..b045aa7 100644
--- a/seisgo/utils.py
+++ b/seisgo/utils.py
@@ -12,10 +12,10 @@
 import matplotlib.pyplot  as plt
 from collections import OrderedDict
 from scipy.signal import hilbert
-from scipy.signal.windows import tukey
+from scipy.signal.windows import tukey,hann
 from obspy.clients.fdsn import Client
 from obspy.core import Stream, Trace, read
-from obspy.core.util.base import _get_function_from_entry_point
+# from obspy.core.util.base import _get_function_from_entry_point
 from obspy.signal.util import _npts2nfft
 from obspy.signal.filter import bandpass
 from scipy.fftpack import fft,ifft,fftfreq,next_fast_len
@@ -2182,7 +2182,7 @@ def taper(data,fraction=0.05,maxlen=20):
         if wlen>maxlen:wlen = maxlen
 
         # taper values
-        func = _get_function_from_entry_point('taper', 'hann')
+        func = hann #_get_function_from_entry_point('taper', 'hann')
         if 2*wlen == npts:
             taper_sides = func(2*wlen)
         else:
@@ -2196,7 +2196,7 @@ def taper(data,fraction=0.05,maxlen=20):
         wlen = int(npts*fraction)
         if wlen>maxlen:wlen = maxlen
         # taper values
-        func = _get_function_from_entry_point('taper', 'hann')
+        func = hann #_get_function_from_entry_point('taper', 'hann')
         if 2*wlen == npts:
             taper_sides = func(2*wlen)
         else: