syncopy.specest.compRoutines.mtmfft_cF#

syncopy.specest.compRoutines.mtmfft_cF(trl_dat, foi=None, timeAxis=0, keeptapers=True, polyremoval=None, output='pow', noCompute=False, chunkShape=None, method_kwargs=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

  • 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.

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

  • keeptapers (bool) – If True, return spectral estimates for each taper. Otherwise power spectrum is averaged across tapers, only valid spectral estimate if output is pow.

  • 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.

  • polyremoval (int or None) – 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). If polyremoval is None, no de-trending is performed.

  • output (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.)

  • method_kwargs (dict) – Keyword arguments passed to mtmfft() controlling the spectral estimation method

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.rfft

NumPy’s FFT implementation