Spectral transforms are used in order to estimate the frequency-domain representation of time-series. Several methods can be used and this module contains implementations of several algorithms for the calculation of spectral transforms.
Returns the Discrete Prolate Spheroidal Sequences of orders [0,Kmax-1] for a given frequency-spacing multiple NW and sequence length N.
Parameters : | N : int
NW : float, unitless
Kmax : int
interp_from : int (optional)
interp_kind : str (optional)
|
---|---|
Returns : | v, e : tuple,
|
Notes
Tridiagonal form of DPSS calculation from:
Slepian, D. Prolate spheroidal wave functions, Fourier analysis, and uncertainty V: The discrete case. Bell System Technical Journal, Volume 57 (1978), 1371430
Returns the frequency response of the IIR or FIR filter described by beta and alpha coefficients.
Parameters : | b : beta sequence (moving average component) a : alpha sequence (autoregressive component) n_freqs : size of frequency grid sides : {‘onesided’, ‘twosided’}
|
---|---|
Returns : | fgrid, H(e^jw) : |
Notes
For a description of the linear constant-coefficient difference equation, see http://en.wikipedia.org/wiki/Z-transform
Compute the spectra of an n-tuple of time series and all of the pairwise cross-spectra.
Parameters : | time_series : float array
method : dict, optional
|
---|---|
Returns : | f : float array
fxy : float array
|
Computes the spectra of two timeseries and the cross-spectrum between them
Parameters : | x,y : float arrays
method : dict, optional
|
---|---|
Returns : | f : float array
fxx : float array
fyy : float array
fxy : float array
|
The cross-spectrum between two tapered time-series, derived from a multi-taper spectral estimation.
Parameters : | tx, ty : ndarray (K, ..., N)
weights : ndarray, or 2-tuple or list
sides : str in {‘onesided’, ‘twosided’}
|
---|
Notes
spectral densities are always computed as
S_{xy}^{mt}(f) = \frac{\sum_k [d_k^x(f)s_k^x(f)][d_k^y(f)(s_k^y(f))^{*}]}{[\sum_k d_k^x(f)^2]^{\frac{1}{2}}[\sum_k d_k^y(f)^2]^{\frac{1}{2}}}
Returns an estimate of the Cross Spectral Density (CSD) function between all (N choose 2) pairs of timeseries in s, using the multitaper method. If the NW product, or the BW and Fs in Hz are not specified by the user, a bandwidth of 4 times the fundamental frequency, corresponding to NW = 4 will be used.
Parameters : | s : ndarray
Fs : float, Sampling rate of the signal NW : float
BW : float
adaptive : {True, False}
low_bias : {True, False}
sides : str (optional) [ ‘default’ | ‘onesided’ | ‘twosided’ ]
|
---|---|
Returns : | (freqs, csd_est) : ndarrays
|
Notes
The bandwidth of the windowing function will determine the number tapers to use. This parameters represents trade-off between frequency resolution (lower main lobe BW for the taper) and variance reduction (higher BW and number of averaged estimates). Typically, the number of tapers is calculated as 2x the bandwidth-to-fundamental-frequency ratio, as these eigenfunctions have the best energy concentration.
Returns an estimate of the PSD function of s using the multitaper method. If the NW product, or the BW and Fs in Hz are not specified by the user, a bandwidth of 4 times the fundamental frequency, corresponding to NW = 4 will be used.
Parameters : | s : ndarray
Fs : float
NW : float
BW : float
adaptive : {True/False}
jackknife : {True/False}
low_bias : {True/False}
sides : str (optional) [ ‘default’ | ‘onesided’ | ‘twosided’ ]
|
---|---|
Returns : | (freqs, psd_est, var_or_nu) : ndarrays
|
Notes
The bandwidth of the windowing function will determine the number tapers to use. This parameters represents trade-off between frequency resolution (lower main lobe BW for the taper) and variance reduction (higher BW and number of averaged estimates). Typically, the number of tapers is calculated as 2x the bandwidth-to-fundamental-frequency ratio, as these eigenfunctions have the best energy concentration.
Takes an N-point periodogram estimate of the PSD function. The number of points N, or a precomputed FFT Sk may be provided. By default, the PSD function returned is normalized so that the integral of the PSD is equal to the mean squared amplitude (mean energy) of s (see Notes).
Parameters : | s : ndarray
Fs : float (optional)
Sk : ndarray (optional)
N : int (optional)
sides : str (optional) [ ‘default’ | ‘onesided’ | ‘twosided’ ]
PSD normalize : boolean (optional, default=True) Normalizes the PSD |
---|---|
Returns : | (f, psd) : tuple
|
Takes an N-point periodogram estimate of all the cross spectral density functions between rows of s.
The number of points N, or a precomputed FFT Sk may be provided. By default, the CSD function returned is normalized so that the integral of the PSD is equal to the mean squared amplitude (mean energy) of s (see Notes).
Returns : | freqs, csd_est : ndarrays
|
---|
Compute the tapered spectra of the rows of s.
Parameters : | s : ndarray, (n_arr, n_pts)
tapers : ndarray or container
NFFT : int
low_bias : Boolean
|
---|---|
Returns : | t_spectra : ndarray, shaped (n_arr, K, NFFT)
eigvals : ndarray
|