Edge effects in TFR Mortlet

Code:

import mne
import numpy as np
Input_data = [epochs * chans * time] # Size = 150 * 95 * 7000 # Confidential data
Out = mne.time_frequency.tfr_array_morlet(Input_data, 1000, np.arange(1, 30, 0.5), n_cycles=7.0, output='avg_power')

Obviously, there will be edge artifacts. Can we predict the approximate temporal range of it? So that I can simply crop out the boundaries from both the start and end.

System specs:

  • MNE version: e.g. 1.3
  • operating system: Windows 11

Hello RainyMeadows,

I suggest this part of the methods from a publication by Iemi et al., 2017 (Journal of Neuroscience):

Time-frequency analysis

Time-frequency analysis was performed using a wavelet transform (Morlet wavelets, frequency range: 1–30 Hz, number of cycles increasing linearly from 1 to 12). Thus, a wavelet at 10 Hz was 4.4 cycles long and had a temporal resolution σt of 0.14 s and a spectral resolution σf of 4.53 Hz. Frequencies and time points were sampled every 2 Hz and 40 ms, respectively. Because we were primarily interested in the prestimulus time range, no baseline correction was applied.

Because wavelet analysis is computed by convolution of the data with a function that is extended in time, it is conceivable that prestimulus effects close to stimulus onset are actually affected by poststimulus data. To determine the extent of this contamination, we applied a time-frequency transform using the same settings as in the main analysis to synthetic data (i.e., a sinusoidal oscillation of exactly 10 Hz) (Fig. 3). The extent of temporal contamination caused by a wavelet is determined by the wavelet’s temporal resolution σt, which is defined as twice the SD of the Gaussian envelope (Tallon-Baudry et al., 1996). This simulation illustrates that prestimulus time points are indeed contaminated by poststimulus data points. However, the magnitude of this contamination is virtually null at time points earlier than onset: σt. Thus, we consider effects as truly “prestimulus” only if they occur before this limit, which is indicated by a red line in Figures 47. The MATLAB code used for this simulation can be downloaded from GitHub - LucaIemi/Iemi2017_JNeurosci: Matlab script for simulating the temporal contamination of a wavelet-transformed 10~Hz signal into pre-signal period.

Hope this helps,

Best,

Carina

1 Like