dpss
Utility functions for calculating multitaper measurements (MTM). Mainly contains functions for calculating Discrete Prolate Spheroidal Sequences (DPSS)
- copyright
adjTomo Dev Team (adjtomo@gmail.com), 2022 Lion Krischer (krischer@geophysik.uni-muenchen.de), 2016 Martin Luessi (mluessi@nmr.mgh.harvard.edu), 2012
License : BSD 3-clause
Module Contents
Functions
|
Symmetric tridiagonal system solver, from Golub and Van Loan pg 157 |
|
Perform an inverse iteration to find the eigenvector corresponding |
|
Compute norm of an array |
|
Returns the Discrete Prolate Spheroidal Sequences of orders [0,Kmax-1] |
- dpss.tridisolve(d, e, b, overwrite_b=True)[source]
Symmetric tridiagonal system solver, from Golub and Van Loan pg 157
Note
Copied from the mne-python package so credit goes to them. https://github.com/mne-tools/mne-python/blob/master/mne/time_frequency/ multitaper.py
- Parameters
d (ndarray) – main diagonal stored in d[:]
e (ndarray) – superdiagonal stored in e[:-1]
b (ndarray) – RHS vector
:rtype x : ndarray :return: Solution to Ax = b (if overwrite_b is False). Otherwise solution is
stored in previous RHS vector b
- dpss.tridi_inverse_iteration(d, e, w, x0=None, rtol=1e-08)[source]
Perform an inverse iteration to find the eigenvector corresponding to the given eigenvalue in a symmetric tridiagonal system.
Note
Copied from the mne-python package so credit goes to them. https://github.com/mne-tools/mne-python/blob/master/mne/time_frequency/ multitaper.py
- Parameters
d (ndarray) – main diagonal stored in d[:]
e (ndarray) – off diagonal stored in e[:-1]
w (float) – eigenvalue of the eigenvector
x0 (ndarray) – initial point to start the iteration
:type rtol : float :param rtol: tolerance for the norm of the difference of iterates :rtype: ndarray :return: The converged eigenvector
- dpss.sum_squared(x)[source]
Compute norm of an array
- Parameters
x (array) – Data whose norm must be found
- Return type
- Returns
Sum of squares of the input array X
- dpss.dpss_windows(n, half_nbw, k_max, low_bias=True, interp_from=None, interp_kind='linear')[source]
Returns the Discrete Prolate Spheroidal Sequences of orders [0,Kmax-1] for a given frequency-spacing multiple NW and sequence length N. Rayleigh bin parameter typical values of half_nbw/nw are 2.5,3,3.5,4.
Note
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
Note
This function was copied from NiTime
- Parameters
n (int) – Sequence length
half_nbw (float) – unitless standardized half bandwidth corresponding to 2 * half_bw = BW*f0 = BW*N/dt but with dt taken as 1
k_max (int) – Number of DPSS windows to return is Kmax (orders 0 through Kmax-1)
low_bias (Bool) – Keep only tapers with eigenvalues > 0.9
interp_from (int (optional)) – The dpss can be calculated using interpolation from a set of dpss with the same NW and Kmax, but shorter N. This is the length of this shorter set of dpss windows.
interp_kind (str (optional)) – This input variable is passed to scipy.interpolate.interp1d and specifies the kind of interpolation as a string (‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic, ‘cubic’) or as an integer specifying the order of the spline interpolator to use.
- Return type
- Returns
(v, e), v is an array of DPSS windows shaped (Kmax, N), e are the eigenvalues