Help check for possible issues with pre-processing

Hi,everyone
I`m SongLin, As a graduate student in psychology, I have invested a lot of time in EEG preprocessing, but my results are very poor. Could you please help me find the reason?
I used pyprep and ICLABEL to help me.

1.First,using pyprep to interpolation bad line

raw = mne.io.read_raw_eeglab(data_path, preload=True)
montage = mne.channels.make_standard_montage("standard_1020")
raw.set_montage(montage)
raw = raw.resample(250)
report.add_raw(raw, title='Raw Data with Montage', psd=True)

prep_params = {
   "ref_chs": "eeg",
    "reref_chs": "eeg",
    "line_freqs": np.arange(50, 250 / 2, 50),
}
prep = PrepPipeline(raw, prep_params, montage)
prep.fit()
raw = prep.raw_eeg

2.Second, ICA with ICLABEL
In this part, I generated epochs of 1-100Hz according to ICLABEL standards to train ICA,And marked eye movements, muscle noise, and heartbeat

    raw_filter = raw.copy().filter(l_freq=1.0, h_freq=100.0)
    events, event_id = mne.events_from_annotations(raw_filter)
    print(event_id)
    event_ids = {"self": 1, "luxun": 2, "baoyi": 3}
    epochs = mne.Epochs(raw_filter, events, event_id=event_ids, tmin=-0.2, tmax=1, baseline=None, detrend=1,
                        preload=True)

    epochs_clean = epochs.copy()

    #############  ICA  ################
    ica = ICA(n_components=0.999, max_iter="auto", method="picard", random_state=42,
              fit_params=dict(ortho=False, extended=True))
    ica.fit(epochs_clean)
    epochs_clean.load_data()
    ic_labels = label_components(epochs_clean, ica, method="iclabel")
    labels = ic_labels["labels"]
    y_pred_proba = ic_labels["y_pred_proba"]

    ica_labels_probs = [{"component": idx, "label": label, "probability": proba} for idx, (label, proba) in
                        enumerate(zip(labels, y_pred_proba))]

    exclude_idx = [idx for idx, (label, proba) in enumerate(zip(labels, y_pred_proba)) if
                   label in ["eye blink", 'heart beat', 'muscle artifact'] and proba > 0.8]
    excluded_components = len(exclude_idx)

3.Third, exclude artificial by ICA on 0.1-30hz epochs,and delete epochs by reject_criteria(50uV)

    raw = raw.filter(l_freq=0.1, h_freq=30.0)
    raw.plot()
    raw.plot_psd()

    epochs_to_ICA = mne.Epochs(raw, events, event_id=event_ids, tmin=-0.2, tmax=1, baseline=None, preload=True,
                               detrend=1)
    epochs_to_ICA.load_data()

    ica.apply(epochs_to_ICA, exclude=exclude_idx)
    epochs_to_ICA.apply_baseline(baseline=(-0.2, 0))
    epochs_to_ICA.plot()
    report.add_epochs(epochs_to_ICA, title='ICA Data', psd=True)

    epochs_finall = epochs_to_ICA.copy()
    bad_epochs_idx = find_bad_epochs(epochs_finall)
    epochs_finall = epochs_finall.drop(bad_epochs_idx)

    reject_criteria = dict(eeg=50e-6)  # 50 µV
    epochs_finall.drop_bad(reject=reject_criteria)

My results recorded some issues,
1.Pyprep detected multiple bad channels, and some channels remained bad even after interpolation
2. Some ERP channels look strange, such as C4 and T3
3.My results are contrary to classical papers, and I suspect it may be caused by noise
My ERP results are shown in the figure


My happy life has been stuck by this project, which is my first psychology project. The poor data has made me lose confidence in continuing to apply for a PhD
If you need more data, please contact me

1 Like

how many epochs are you averaging?

Hi,Tomas
60 /condition for one subject
60*30(subjects) for grandaverage

Sounds like you are at the old “I’m a complete idiot” phase of doing research. That’s a rough phase, one that everyone I know goes through, but that doesn’t make it less rough. Perhaps we can help you out.

What effect would you expect to see, given the literature? Any refs to papers you want us to take a look at? If you are reproducing a study that someone else has done before: what happens if you use their exact preprocessing setup (hopefully described in some detail in their methods section).

1 Like

I’ve recently also found it challenging to replicate some simple ERP effects (I’m working on object recognition in natural images), but permutation clustering and MVPA (decoding) helped me detect differences. Perhaps you could try these methods too, if you’re looking at differences between conditions

1 Like