jax.scipy.signal.stft — JAX documentation (original) (raw)
jax.scipy.signal.stft#
jax.scipy.signal.stft(x, fs=1.0, window='hann', nperseg=256, noverlap=None, nfft=None, detrend=False, return_onesided=True, boundary='zeros', padded=True, axis=-1)[source]#
Compute the short-time Fourier transform (STFT).
JAX implementation of scipy.signal.stft().
Parameters:
- x (Array) – Array representing a time series of input values.
- fs (ArrayLike) – Sampling frequency of the time series (default: 1.0).
- window (str) – Data tapering window to apply to each segment. Can be a window function name, a tuple specifying a window length and function, or an array (default:
'hann'
). - nperseg (int) – Length of each segment (default: 256).
- noverlap (int | None | None) – Number of points to overlap between segments (default:
nperseg // 2
). - nfft (int | None | None) – Length of the FFT used, if a zero-padded FFT is desired. If
None
(default), the FFT length isnperseg
. - detrend (bool) – Specifies how to detrend each segment. Can be
False
(default: no detrending),'constant'
(remove mean),'linear'
(remove linear trend), or a callable accepting a segment and returning a detrended segment. - return_onesided (bool) – If True (default), return a one-sided spectrum for real inputs. If False, return a two-sided spectrum.
- boundary (str | None) – Specifies whether the input signal is extended at both ends, and how. Options are
None
(no extension),'zeros'
(default),'even'
,'odd'
, or'constant'
. - padded (bool) – Specifies whether the input signal is zero-padded at the end to make its length a multiple of nperseg. If True (default), the padded signal length is the next multiple of
nperseg
. - axis (int) – Axis along which the STFT is computed; the default is over the last axis (-1).
Returns:
A length-3 tuple of arrays (f, t, Zxx)
. f
is the Array of sample frequencies.t
is the Array of segment times, and Zxx
is the STFT of x
.
Return type: