How is the baseline correction calculated?

Hi,

I am comparing the evoke data of one subject between my script in Python
with mne package and the script in IGOR pro that my lab used so far.

I gave the following time interval for baseline correction to both:
baseline = (-0.060, 0.040). I noticed that the values of the average
change: for each electrode there is always the same difference (between
Python and IGOR) across data points.

How come? Can I have a more detailed explanation of how the baseline
correction is applied?

Many thanks,
Emanuela Liaci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160905/19965511/attachment.html

Hi Emanuela,

I assume you do the baselining when constructing the epochs
(mne.Epochs(..., baseline=baseline))? It simply subtracts the mean over the
baseline period. So the effective lines of code boil down to:

mean = np.mean(data[..., imin:imax], axis=-1)[..., None]
data -= mean

, where the baseline runs from imin to imax. And yes this should be
documented better. I'll make the issue to github.

-Jaakko

Hi Jaakko,

thanks for the enlightenment. Yes of course, now I understand the problem.
But then since I have to apply the correction after the emerging, how can I
do it?

Here my code:

epochs_noRef = mne.EpochsArray(ElectrodeArray, info=info,tmin=-0.06)
    # baseline = (-0.06, 0.04)
epochs_Ref,_= mne.io.set_eeg_reference(epochs_noRef, ['TP9', 'TP10'])
evoked=epochs_Ref.average()

thanks a lot for your help,
Emanuela

Hi Jaakko,

thanks for the enlightenment. Yes of course, now I understand the problem.
But then since I have to apply the correction after the averaging, how can
I do it?

Here my code:

epochs_noRef = mne.EpochsArray(ElectrodeArray, info=info,tmin=-0.06)
    # baseline = (-0.06, 0.04)
epochs_Ref,_= mne.io.set_eeg_reference(epochs_noRef, ['TP9', 'TP10'])
evoked=epochs_Ref.average()

thanks a lot for your help,
Emanuela

In the development version there is a new method just for that
http://mne-tools.github.io/dev/generated/mne.Evoked.html?highlight=apply_baseline#mne.Evoked.apply_baseline
.
You can also access the evoked data directly (evoked.data) and manipulate
it to your liking,

-Jaakko