find_events report a wrong time

My data is only about 500s(551000 samples), but it seems that the last event (748072.00 samples)is longer than the length of my data.
This code seems to find the event(32) appearing at a different time than the actual mark time I hit, I should have hit the mark around 20 seconds.

I have a lot of files that present this error.

My code is :

data = mne.io.read_raw_fif(path, preload=False)
events = mne.find_events(data, stim_channel='STI101',shortest_event=1)
event = mne.pick_events(events, include=32)

The event I found is
|229629.00 |0.00 |32.00 |
|721529.00 |0.00 |128.00 |
|731592.00 |0.00 |64.00 |
|748072.00 |0.00 |128.00 |

  • MNE version: 1.0
  • operating system: Ubuntu 20.04

what is raw.first_samp for you?

index in data is given by: events[:, 0] - raw.first_samp

see https://mne.tools/stable/glossary.html#term-first_samp

Alex

2 Likes

data.first_samp is 208000

So the actual time should be events[:, 0] - raw.first_samp/ sample rate?
(229629.00 - 208000 )/1000 = 21.629

if you sfreq is 1000 yes this is the latency after the event from the start of the available data

Alex

1 Like