Skip to content

Commit

Permalink
Merge pull request #3437 from obspy/deprecations
Browse files Browse the repository at this point in the history
adjust to a function name change in scipy
  • Loading branch information
megies committed Apr 30, 2024
2 parents 247db64 + b8732ee commit a74d6b5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions obspy/signal/array_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from matplotlib.dates import datestr2num
import numpy as np
from scipy.integrate import cumtrapz
from scipy.integrate import cumulative_trapezoid

from obspy.core import Stream
from obspy.signal.headers import clibsignal
Expand Down Expand Up @@ -830,7 +830,7 @@ def array_transff_freqslowness(coords, slim, sstep, fmin, fmax, fstep,
complex(0., (coords[l, 0] * sx + coords[l, 1] * sy) *
2 * np.pi * f))
buff[k] = abs(_sum) ** 2
transff[i, j] = cumtrapz(buff, dx=fstep)[-1]
transff[i, j] = cumulative_trapezoid(buff, dx=fstep)[-1]

transff /= transff.max()
return transff
Expand Down
6 changes: 3 additions & 3 deletions obspy/signal/cpxtrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
import numpy as np
from scipy import signal
from scipy.integrate import cumtrapz
from scipy.integrate import cumulative_trapezoid

from . import util

Expand Down Expand Up @@ -94,7 +94,7 @@ def normalized_envelope(data, fs, smoothie, fk):
# (dA/dt) / 2*PI*smooth(A)*fs/2
t_ = t / (2. * np.pi * (a_win_smooth) * (fs / 2.0))
# Integral within window
t_ = cumtrapz(t_, dx=(1. / fs))
t_ = cumulative_trapezoid(t_, dx=(1. / fs))
t_ = np.concatenate((t_[0:1], t_))
anorm[i] = ((np.exp(np.mean(t_))) - 1) * 100
i = i + 1
Expand Down Expand Up @@ -123,7 +123,7 @@ def normalized_envelope(data, fs, smoothie, fk):
a_win_smooth[a_win_smooth < 1] = 1
t_ = t / (2. * np.pi * (a_win_smooth) * (fs / 2.0))
# Integral within window
t_ = cumtrapz(t_, dx=(1.0 / fs))
t_ = cumulative_trapezoid(t_, dx=(1.0 / fs))
t_ = np.concatenate((t_[0:1], t_))
anorm = ((np.exp(np.mean(t_))) - 1) * 100
return anorm
Expand Down
2 changes: 1 addition & 1 deletion obspy/signal/differentiate_and_integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def integrate_cumtrapz(data, dx, **kwargs):
# length of the array.
# (manually adding the zero and not using `cumtrapz(..., initial=0)` is a
# backwards compatibility fix for scipy versions < 0.11.
ret = scipy.integrate.cumtrapz(data, dx=dx)
ret = scipy.integrate.cumulative_trapezoid(data, dx=dx)
return np.concatenate([np.array([0], dtype=ret.dtype), ret])


Expand Down

0 comments on commit a74d6b5

Please sign in to comment.