spectral_connectivity.transforms.Multitaper#
- class Multitaper(time_series, sampling_frequency=1000, time_halfbandwidth_product=3, detrend_type='constant', time_window_duration=None, time_window_step=None, n_tapers=None, tapers=None, start_time=0, n_fft_samples=None, n_time_samples_per_window=None, n_time_samples_per_step=None, is_low_bias=True)[source]#
Bases:
objectTransform time-domain signal(s) to the frequency domain by using multiple tapering windows.
- Parameters:
time_series (array, shape (n_time_samples, n_trials, n_signals) or (n_time_samples, n_signals))
sampling_frequency (float, optional) – Number of samples per time unit the signal(s) are recorded at.
time_halfbandwidth_product (float, optional) – Specifies the time-frequency tradeoff of the tapers and also the number of tapers if n_tapers is not set.
detrend_type (string or None, optional) – Subtracting a constant or a linear trend from each time window. If None then no detrending is done.
start_time (float, optional) – Start time of time series.
time_window_duration (float, optional) – Duration of sliding window in which to compute the fft. Defaults to the entire time if not set.
time_window_step (float, optional) – Duration of time to skip when moving the window forward. By default, this equals the duration of the time window.
tapers (array, optional, shape (n_time_samples_per_window, n_tapers)) – Pass in a pre-computed set of tapers. If None, then the tapers are automically calculated based on the time_halfbandwidth_product, n_tapers, and n_time_samples_per_window.
n_tapers (int, optional) – Set the number of tapers. If None, the number of tapers is computed by 2 * time_halfbandwidth_product - 1.
n_time_samples_per_window (int, optional) – Number of samples in each sliding window. If time_window_duration is set, then this is calculated automically.
n_time_samples_per_step (int, optional) – Number of samples to skip when moving the window forward. If time_window_step is set, then this is calculated automically.
is_low_bias (bool, optional) – If True, excludes tapers with eigenvalues < 0.9
- Attributes:
frequenciesFrequency of each frequency bin.
frequency_resolutionRange of frequencies the transform is able to resolve given the time-frequency tradeoff.
n_fft_samplesNumber of frequency bins.
n_signalsNumber of signals computed.
n_tapersNumber of desired tapers.
n_time_samples_per_stepIf time_window_step is set, then calculate the n_time_samples_per_step based on the time window duration.
n_time_samples_per_windowNumber of samples per time bin.
n_trialsNumber of trials computed.
nyquist_frequencyMaximum resolvable frequency.
tapersReturns the tapers used for the multitpaer function.
timeTime of each time bin.
time_window_durationDuration of each time bin.
time_window_stepHow much to each time window slides.
Methods
fft()Compute the fast Fourier transform using the multitaper method.
Methods
Compute the fast Fourier transform using the multitaper method.
Attributes
Frequency of each frequency bin.
Range of frequencies the transform is able to resolve given the time-frequency tradeoff.
Number of frequency bins.
Number of signals computed.
Number of desired tapers.
If time_window_step is set, then calculate the n_time_samples_per_step based on the time window duration.
Number of samples per time bin.
Number of trials computed.
Maximum resolvable frequency.
Returns the tapers used for the multitpaer function.
Time of each time bin.
Duration of each time bin.
How much to each time window slides.
- fft()[source]#
Compute the fast Fourier transform using the multitaper method.
- Returns:
fourier_coefficients
- Return type:
array, shape (n_time_windows, n_trials, n_tapers, n_fft_samples, n_signals)
- property frequencies#
Frequency of each frequency bin.
- property frequency_resolution#
Range of frequencies the transform is able to resolve given the time-frequency tradeoff.
- property n_fft_samples#
Number of frequency bins.
- property n_signals#
Number of signals computed.
- property n_tapers#
Number of desired tapers.
Note that the number of tapers may be less than this number if the bias of the tapers is too high (eigenvalues > 0.9)
- property n_time_samples_per_step#
If time_window_step is set, then calculate the n_time_samples_per_step based on the time window duration. If time_window_step and n_time_samples_per_step are both not set, default the window step size to the same size as the window.
- property n_time_samples_per_window#
Number of samples per time bin.
- property n_trials#
Number of trials computed.
- property nyquist_frequency#
Maximum resolvable frequency.
- property tapers#
Returns the tapers used for the multitpaer function. Tapers are the windowing function.
- Returns:
tapers
- Return type:
array_like, shape (n_time_samples_per_window, n_tapers)
- property time#
Time of each time bin.
- property time_window_duration#
Duration of each time bin.
- property time_window_step#
How much to each time window slides.