Using MNE, is there a way to do full epoch length single-trial baseline correction for time-frequency data? I have data from a reading task that used a lot of different types of events and wanted to implement similar to what was used in the following paper: Single-trial normalization for event-related spectral decomposition reduces sensitivity to noisy trials. (Grandchamp & Delorme, 2011)
I tend to just make long epochs and then crop them down to around the event of interest. That is a really good reference for baseline correction that I use too. Does that work?
Thank you for the suggestion!
Would you then do this individually for each type of trigger/epoch (rather than using some average for all of the epochs)?
If so, would a code like this work? (Does not raise any errors, but just to be sure it does what is expected)
for i, epoch in enumerate(power.data):
# Select the time points within the baseline period for the current epoch
baseline_inds = (power.times >= baseline[0]) & (power.times <= baseline[1])
# Calculate the mean baseline power for the current epoch
baseline_mean = epoch[:, baseline_inds].mean(axis=1, keepdims=True)
# Subtract the mean baseline power from the current epoch
power.data[i] -= baseline_mean
In which baseline[0] is start point, baseline[1] is the end point of time range of interest.