diff --git a/qutil/signal_processing/fourier_space.py b/qutil/signal_processing/fourier_space.py index 4b8b6eb0e5058ea34e0b1aab8f1949ec7de05ddf..ee69fa8d9d56ea8e949f78d925ba2d8afc1b6826 100644 --- a/qutil/signal_processing/fourier_space.py +++ b/qutil/signal_processing/fourier_space.py @@ -46,6 +46,7 @@ import numpy as np from qutil import math from qutil.caching import cache from qutil.functools import wraps +from qutil.misc import deprecate_kwarg from qutil.signal_processing._common import _parse_filter_edges from qutil.typecheck import check_literals from scipy import integrate @@ -113,7 +114,8 @@ def Id(x: _S, f: _T, *_, **__) -> Tuple[_S, _T]: return x, f -def derivative(x, f, deriv_order: int = 0, overwrite_x: bool = False, +@deprecate_kwarg('deriv_order', 'order') +def derivative(x, f, order: int = 0, overwrite_x: bool = False, **_) -> Tuple[np.ndarray, np.ndarray]: r"""Compute the (anti-)derivative. @@ -127,8 +129,8 @@ def derivative(x, f, deriv_order: int = 0, overwrite_x: bool = False, e^{i\omega t} \hat{f}(\omega) .. note:: - For negative ``deriv_order`` (antiderivatives), the - zero-frequency component is set to zero (due to zero-division). + For negative ``order`` (antiderivatives), the zero-frequency + component is set to zero (due to zero-division). Parameters ---------- @@ -136,7 +138,7 @@ def derivative(x, f, deriv_order: int = 0, overwrite_x: bool = False, Target data. f : array_like Frequencies corresponding to the last axis of `x`. - deriv_order : int + order : int The order of the derivative. If negative, the antiderivative is computed (indefinite integral). Default: 0. overwrite_x : bool, default False @@ -145,8 +147,8 @@ def derivative(x, f, deriv_order: int = 0, overwrite_x: bool = False, x = np.array(x, copy=not overwrite_x) f = np.asanyarray(f) with np.errstate(invalid='ignore', divide='ignore'): - x *= (2j*np.pi*f)**deriv_order - if deriv_order < 0: + x *= (2j*np.pi*f)**order + if order < 0: x[..., (f == 0).nonzero()] = 0 return x, f