[Mne_analysis] Error with load epochs after cropping after baseline correction

S.P.H. Speer speer at rsm.nl
Sat Apr 18 11:06:49 EDT 2020
Search archives:

        External Email - Use Caution        

Dear MNE team,

I've recently started preprocessing some EEG data with the MNE toolbox and it has been a great experience so far.

I did my baseline correction on a period of 1s which is 6s prior to the onset of the event of interest (due to unfortunate experimental design), so I initially epoched my data to -7 to 3s . After epoching the data I then cropped the data to -0.3 to 3s, as I no longer needed the 7 seconds prior to the data after the baseline correction was done. When I then save the epoched data and load it again somewhere else and error occurs because the baseline parameters are outside the epoched data.
To my understanding the baseline correction is already applied during epoching so I the decided to just set the baseline parameters to (0,0) after baseline correction has been done and data has been cropped. If I do that I can load the epoched data without no problem. My question is now: Will I run into problem later in my analysis pipeline because I set the baseline parameters to (0,0) even though baseline correction was done on another time window?
Is there a better way to solve this issue?

See below the code:

    decision_epochs = mne.Epochs(eeg_data_interp_ref_ica, events, tmin=-7, tmax=3,baseline=(-7,-6),
                        #reject=reject_criteria,  flat=flat_criteria, # commented beause we're using autoreject here
                        event_id = decision_events_of_interest,
                        reject_by_annotation=False, preload=True)

    decision_epochs_cropped = decision_epochs.copy().crop(tmin=-0.3, tmax=3, include_tmax=True)


    # drop epochs after cropping

    ar = AutoReject(verbose='tqdm_notebook', n_jobs=n_jobs, consensus=np.linspace(0, 1, 20), n_interpolate = np.array([1,4,8,16,32]) )
    decision_epochs_cropped_clean_ar = ar.fit_transform(decision_epochs_cropped)

    out_dir='/data/sebastian/EEG/neural_analysis/'

    # This version can't be loaded after
    decision_epochs_cropped_clean_ar.save(opj(out_dir,task,sub+'-TEST_'+str(cutoff_l)+'_HP_'+str(cutoff_h)+'_'+reference+'.fif'), overwrite=True)

    # This version can't be loaded after
    decision_epochs_cropped_clean_ar.baseline=(0,0)
    decision_epochs_cropped_clean_ar.save(opj(out_dir,task,sub+'-TEST2_'+str(cutoff_l)+'_HP_'+str(cutoff_h)+'_'+reference+'.fif'), overwrite=True)


Thank you very much for your help,

Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200418/8739f301/attachment.html 


More information about the Mne_analysis mailing list