I’m struggling with understanding when baseline correction is applied (to Epochs or Evokeds). As @agramfort points out in this related question, baseline correction is performed when accessing the data (and only if baseline is set appropriately when constructing the Epochs object).
How do I know when this actually happens? For example, let’s assume I have an Epochs object named epochs and I want to average them, I do:
epochs.average()
This creates an Evoked object, and its repr states for my example data:
<Evoked | '2' (average, N=158), -0.25 – 0.75 sec, baseline off, 9 ch, ~50 kB>
Notice the “baseline off” part, which indicates to me that no baseline correction was performed. So I tried this:
epochs.average().apply_baseline()
Now the object is represented as:
<Evoked | '2' (average, N=158), -0.25 – 0.75 sec, baseline -0.25 – 0 sec, 9 ch, ~50 kB>
This time, it shows the baseline that I have provided when creating epochs.
However, both Evoked objects contain identical data, so the baseline has been applied even in the first example, despite the repr stating that baseline is off. Am I misunderstanding something?
Here’s a reprex:
import mne
import numpy as np
n_epochs, n_chans, n_samples = 100, 32, 1001
rng = np.random.default_rng()
epochs = mne.EpochsArray(
data=rng.standard_normal(size=(n_epochs, n_chans, n_samples)),
info=mne.create_info(n_chans, 500, "eeg"),
tmin=-1
)
print(epochs)
e1 = epochs.average()
print(e1)
e2 = epochs.average().apply_baseline()
print(e2)