drift at stimulus onset shown on erp

  • 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!

I assume by “drift” you mean the spike at second 0. Can you rule out an effect from your stimulus? I’d plot the data without any lowpass filter to make sure your filters are not distorting the signal.

Yes I would like to remove the peak at t=0, where the signal should be flat. I assume it is my stimulation artifact, but I don’t know how to deal with it.
Removing lowpass filter has increased this phenomenon, and reducing it to 30Hz (initially 50) has reduced it, however it’s not a solution here, I don’t want to filter too much (and yet the spike was still here).

Filtering spike-like activity will create large distortions (depending on the filter properties). If this spike is legit, i.e. brain activity caused by your stimulus, I don’t understand why you say that the signal should be flat. In addition, even if this was an artifact, why do you want to remove it? Is it impacting any subsequent analyses?

It doesn’t look like a consistent spike (probably a stimulus artifact), it is not present on all conditions across subjects. I would say I find it in perhaps 25-30% of my datasets. When using source localization, it produces an unexpected occipital activation at 0 sec (eyes are closed), that’s why I’m looking for a way to remove it…