- MNE version: e.g. 1.2.2
- operating system: e.g. macOS 10.15.7
Hello,
I wonder if anyone has any idea on why I get this large drift at stimulus onset at 0ms on condition D1_inv (see figure attached) ? And how to remove it?
Here’s a snippet of my code:
ref_raw = raw.copy().set_eeg_reference(ref_channels=['EXG7', 'EXG8']) # reference to the mastoids
filtered_raw = ref_raw.copy().filter(l_freq=0.1, h_freq=50)
reref_raw = filtered_raw.copy().set_eeg_reference(ref_channels='average', projection=True).apply_proj()
unfiltered_raw = reref_raw.copy().filter(l_freq=1, h_freq=50)
montage = mne.channels.make_standard_montage(kind='biosemi64')
unfiltered_raw.set_montage(montage)
ica = mne.preprocessing.ICA(n_components=0.95, noise_cov=None, method='fastica', max_iter='auto')
ica_raw = ica.fit(unfiltered_raw)
ica.exclude = []
reref_raw.load_data()
excomp_raw = ica.apply(reref_raw)
inter_raw = excomp_raw.copy().interpolate_bads(reset_bads=True)
mne.pick_events(events=events, exclude=[131070, 131071])
event_dict = {'D1_down': 1, 'D1_up': 11, 'D1_inv': 21}
reject_criteria = dict(eeg=150e-6) # 150 µV
raw_epoch = mne.Epochs(inter_raw, events, event_id=event_dict, tmin=-0.1, tmax=0.3, preload=True, reject=None, reject_by_annotation=None, baseline=(-0.1, 0))
_ = raw_epoch.drop_bad(reject='existing', flat='existing', verbose=None)
conds_we_care_about = ['D1_down','D1_up','D1_inv]
raw_epoch.equalize_event_counts(conds_we_care_about)
d1down_epochs = raw_epoch['D1_down']
d1up_epochs = raw_epoch['D1_up']
d1inv_epochs = raw_epoch['D1_inv']
d1down_evoked = d1down_epochs.average()
d1up_evoked = d1up_epochs.average()
d1inv_evoked = d1inv_epochs.average()
Thanks!