Creating events in stim channel


I noted interesting point: when I try to add events in adjacent time indexes, one of them is not recorded.
For instance:

My first ‘stim 10’:

stim = np.zeros((1, 3))
stim [0,0]=5
stim[0,1] =0
raw.add_events (stim, ‘STI’,replace=False)

After that I added second “stim 15” in the next time step:

stim2 = np.zeros((1, 3))
stim2 [0,0]=6
stim2[0,1] =0
raw.add_events(stim2, ‘STI’, replace=False)

And “stim 15” is not recorded. But if I used farther time step (not 6, but 20) - it works.
stim2 = np.zeros((1, 3))
stim2 [0,0]=20
stim2[0,1] =0
raw.add_events (stim2, ‘STI’, replace=False)

I don’t understand why. Is it a physical limitation of the impossibility of two close stimuli? Or is it a bug?

what mne version are you using?

do you have the problem with some public data so we can replicate the error?


I cannot replicate this problem:

import os
import numpy as np
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
raw =, verbose=False, preload=False)

ev1 = np.array([[raw.first_samp + 10, 0, 10]])
ev2 = np.array([[raw.first_samp + 11, 0, 50]])

raw.add_events(ev1, 'STI 014', replace=True)
raw.add_events(ev2, 'STI 014', replace=False)
fig = raw.pick('STI 014').plot(duration=0.1)

You can clearly see an event at 2 different samples with 2 different values: