syncopy.specest.compRoutines.mtmconvol_cF#
- syncopy.specest.compRoutines.mtmconvol_cF(trl_dat, soi, postselect, equidistant=True, toi=None, foi=None, nTaper=1, tapsmofrq=None, timeAxis=0, keeptapers=True, polyremoval=0, output='pow', noCompute=False, chunkShape=None, method_kwargs=None)[source]#
Perform time-frequency analysis on multi-channel time series data using a sliding window FFT
- Parameters:
trl_dat (2D
numpy.ndarray) – Uniformly sampled multi-channel time-seriessoi (list of slices or slice) – Samples of interest; either a single slice encoding begin- to end-samples to perform analysis on (if sliding window centroids are equidistant) or list of slices with each slice corresponding to coverage of a single analysis window (if spacing between windows is not constant)
samplerate (float) – Samplerate of trl_dat in Hz
noverlap (int) – Number of samples covered by two adjacent analysis windows
nperseg (int) – Size of analysis windows (in samples)
equidistant (bool) – If True, spacing of window-centroids is equidistant.
toi (1D
numpy.ndarrayor float or str) – Either time-points to center windows on if toi is anumpy.ndarray, or percentage of overlap between windows if toi is a scalar or “all” to center windows on all samples in trl_dat. Please refer tofreqanalysis()for further details. Note: The value of toi has to agree with provided padding and window settings. See Notes for more information.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 tapers to use
timeAxis (int) – Index of running time axis in trl_dat (0 or 1)
taper (callable) – Taper function to use, one of
availableTaperstaper_opt (dict) – Additional keyword arguments passed to taper (see above). For further details, please refer to the SciPy docs
keeptapers (bool) – If True, results of Fourier transform are preserved for each taper, otherwise spectrum is averaged across tapers.
polyremoval (int) – 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 = 1removes linear trends (subtracting the least squares fit of a linear polynomial). Detrending is done on each segment! If polyremoval is None, no de-trending is performed.output (str) – Output of spectral estimation; one of
availableOutputsnoCompute (bool) – Preprocessing flag. If True, do not perform actual calculation but instead return expected shape and
numpy.dtypeof output array.chunkShape (None or tuple) – If not None, represents shape of output object spec (respecting provided values of nTaper, keeptapers etc.)
method_kwargs (dict) – Keyword arguments passed to
mtmconvol()controlling the spectral estimation method
- Returns:
spec – Complex or real time-frequency representation of (padded) input data.
- Return type:
Notes
This method is intended to be used as
computeFunction()inside aComputationalRoutine. 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 SciPy’s Short Time Fourier Transform (STFT) implementation
scipy.signal.stft().See also
syncopy.freqanalysisparent metafunction
MultiTaperFFTConvolComputationalRoutineinstance that calls this method ascomputeFunction()scipy.signal.stftSciPy’s STFT implementation