syncopy.specest.mtmfft.mtmfft

syncopy.specest.mtmfft.mtmfft(trl_dat, samplerate=None, foi=None, nTaper=1, timeAxis=0, taper=<function hann>, taperopt={}, pad='nextpow2', padtype='zero', padlength=None, keeptapers=True, polyremoval=None, output_fmt='pow', noCompute=False, chunkShape=None)[source]

Compute (multi-)tapered Fourier transform of multi-channel time series data

Parameters
  • trl_dat (2D numpy.ndarray) – Uniformly sampled multi-channel time-series

  • samplerate (float) – Samplerate of trl_dat in Hz

  • foi (1D numpy.ndarray) – Frequencies of interest (Hz) for output. If desired frequencies cannot be matched exactly the closest possible frequencies (respecting data length and padding) are used.

  • nTaper (int) – Number of filter windows to use

  • timeAxis (int) – Index of running time axis in trl_dat (0 or 1)

  • taper (callable) – Taper function to use, one of availableTapers

  • taperopt (dict) – Additional keyword arguments passed to the taper function. For further details, please refer to the SciPy docs

  • pad (str) – Padding mode; one of ‘absolute’, ‘relative’, ‘maxlen’, or ‘nextpow2’. See syncopy.padding() for more information.

  • padtype (str) – Values to be used for padding. Can be ‘zero’, ‘nan’, ‘mean’, ‘localmean’, ‘edge’ or ‘mirror’. See syncopy.padding() for more information.

  • padlength (None, bool or positive scalar) – Number of samples to pad to data (if pad is ‘absolute’ or ‘relative’). See syncopy.padding() for more information.

  • keeptapers (bool) – If True, results of Fourier transform are preserved for each taper, otherwise spectrum is averaged across tapers.

  • polyremoval (int or None) – FIXME: Not implemented yet Order of polynomial used for de-trending data in the time domain prior to spectral analysis. A value of 0 corresponds to subtracting the mean (“de-meaning”), polyremoval = 1 removes linear trends (subtracting the least squares fit of a linear polynomial), polyremoval = N for N > 1 subtracts a polynomial of order N (N = 2 quadratic, N = 3 cubic etc.). If polyremoval is None, no de-trending is performed.

  • output_fmt (str) – Output of spectral estimation; one of availableOutputs

  • noCompute (bool) – Preprocessing flag. If True, do not perform actual calculation but instead return expected shape and numpy.dtype of output array.

  • chunkShape (None or tuple) – If not None, represents shape of output spec (respecting provided values of nTaper, keeptapers etc.)

Returns

spec – Complex or real spectrum of (padded) input data.

Return type

numpy.ndarray

Notes

This method is intended to be used as computeFunction() inside a ComputationalRoutine. Thus, input parameters are presumed to be forwarded from a parent metafunction. Consequently, this function does not perform any error checking and operates under the assumption that all inputs have been externally validated and cross-checked.

The computational heavy lifting in this code is performed by NumPy’s reference implementation of the Fast Fourier Transform numpy.fft.fft().

See also

syncopy.freqanalysis()

parent metafunction

MultiTaperFFT()

ComputationalRoutine instance that calls this method as computeFunction()

numpy.fft.fft()

NumPy’s FFT implementation