Difference between TFRs

After computing TFRs separately for two conditions, I usually rescale (baseline-correct) the average plots using mode="percent", which gives values ranging from -100% to x%.

Now I would like to plot a difference TFR using the same baseline correction. I tried subtracting the AverageTFR objects of the two conditions, but the resulting plot looks weird when plotting with mode="percent". I think the order of operations is not what I want, because MNE first subtracts the (uncorrected) average TFRs and then applies baseline correction to the difference. However, I would like to subtract one baseline-corrected average TFR from the other, so I literally want to get the difference between the two plots.

Is this possible somehow? Is this a good idea in the first place, because maybe there is a reason why this is not implemented?

I have now rescaled the average TFR data using mne.baseline.rescale; this seems to work as expected. If people think this functionality would be useful I’m happy to make a PR, for example this could be implemented as a new AverageTFR.rescale method.

This does sound useful! I’d like to see this implemented if you feel like working on this :slight_smile:

1 Like

You should be able to perform .apply_baseline() to each of the TFR objects and then perform the subtraction.

1 Like

Thanks @mmagnuski, that’s exactly what I was looking for!

1 Like