Estimate cross power spectral density (CSD) using Welch’s method.
This is a JAX implementation of scipy.signal.csd()
. It is similar to jax.scipy.signal.welch()
, but it operates on two input signals and estimates their cross-spectral density instead of the power spectral density (PSD).
x (Array) – Array representing a time series of input values.
y (ArrayLike | None) – Array representing the second time series of input values, the same length as x
along the specified axis
. If not specified, then assume y = x
and compute the PSD Pxx
of x
via Welch’s method.
fs (ArrayLike) – Sampling frequency of the inputs (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 | None | None) – 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 is nperseg
.
detrend (str) – 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.
scaling (str) – Selects between computing the power spectral density ('density'
, default) or the power spectrum ('spectrum'
)
axis (int) – Axis along which the CSD is computed (default: -1).
average (str) – The type of averaging to use on the periodograms; one of 'mean'
(default) or 'median'
.
A length-2 tuple of arrays (f, Pxy)
. f
is the array of sample frequencies, and Pxy
is the cross spectral density of x and y
Notes
The original SciPy function exhibits slightly different behavior between csd(x, x)
and csd(x, x.copy())
. The LAX-backend version is designed to follow the latter behavior. To replicate the former, call this function function as csd(x, None)
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3