syncopy.specest.mtmfft.mtmfft#
- syncopy.specest.mtmfft.mtmfft(data_arr, samplerate, nSamples=None, taper='hann', taper_opt=None, demean_taper=False, ft_compat=False)[source]#
(Multi-)tapered fast Fourier transform. Returns full complex Fourier transform for each taper. Multi-tapering only supported with Slepian windwows (taper=”dpss”).
- Parameters:
data_arr ((N,)
numpy.ndarray
) – Uniformly sampled multi-channel time-series data The 1st dimension is interpreted as the time axissamplerate (float) – Samplerate in Hz
nSamples (int or None) – Absolute length of the (potentially to be padded) signals or None for no padding.
taper (str or None) – Taper function to use, one of scipy.signal.windows Set to None for no tapering.
taper_opt (dict or None) – Additional keyword arguments passed to the taper function. For multi-tapering with
taper='dpss'
set the keys ‘Kmax’ and ‘NW’. For further details, please refer to the SciPy docsdemean_taper (bool) – Set to True to perform de-meaning after tapering
ft_compat (bool) – Set to True to use Field Trip’s normalization, which is NOT independent of the padding size
- Returns:
ftr (3D
numpy.ndarray
) – Complex output has shape(nTapers x nFreq x nChannels)
.freqs (1D
numpy.ndarray
) – Array of Fourier frequencies
Notes
For a (MTM) power spectral estimate average the absolute squared transforms across tapers:
Sxx = np.real(ftr * ftr.conj()).mean(axis=0)
The FFT result is normalized such that this yields the spectral power. For a clean harmonic this will give a peak power of A**2 / 2, with A as harmonic amplitude.