Unexpected event_id's in my epochs

  • MNE version: 1.5
  • operating system: Windows 10

This is my first time posting, so I hope I gave you all the relevant information. I have some unexpected event_id’s in my epochs.

I have an event array (events: 2960, 3); colums: latency, x, trigger respectively). I am selecting epochs based on trigger 999 and 998: tmin, tmax = -0.95,0.05.

Importantly, trigger 999/8 should not be preceded within 1000ms by any trigger.

But when I use:

tmin, tmax = -0.95,0.05
decim=4
SS_TFEpochs = mne.Epochs(raw_MT_ref, events=events, event_id = dict(SS=999), tmin=tmin, tmax=tmax, baseline=None, preload=True, picks='eeg',decim=decim)
SS_TFEpochs.plot(events=events)

I get:

If I remove decim I get even more 103 events preceding trigger 999.

From the event list I confirmed (I believe) that there shouldn’t be any triggers (103) in the 1 second time-window before trigger 999/8:

for idx, event in enumerate(events):
    trigger = event[2]
    
    # Check for the specific situation where 998/999 (go-signal) is preceded by 103 (stop-signal) within 1 second
    if trigger in  [998, 999]:
        if idx > 0 and events[idx - 1][2] == 103:
            latency_diff = event[0] - events[idx - 1][0]
            if latency_diff < 1000:
                print(f"Error: {trigger} at latency {event[0]} is preceded by 103 within {latency_diff} ms. This isn't supposed to happen.")

I am probably missing something obvious, but I can’t seem to find the issue.

Cheers,
Sam