How to extract information about onset of raw fif file?

  • MNE version: 1.1.1
  • operating system: Windows 10

Dear all,

I am a complete newbie at MNE and need your advice.

I am loading raw .fif files with events and it works well, but there’s a starting time problem. When MEG data is recorded, the starting point is non-zero and unique for each file. But when I load events they are displayed relative to zero.

Here’s how I read the file:
raw_file =

Here I see information about onset and offset times:

Opening raw data file …/data\subjects\sub2\raw\Encoding1_tsss_mc_trans.fif…
Range : 75000 … 1016999 = 75.000 … 1016.999 secs

How can I extract information about the starting point of the file and shift events relative to it?
I have searched on the forum, but failed to find an answer.

Thanks in advance!


So your events are stored in a separate file? (they’re not being read off of a STIM or TRIGGER channel in the raw file?) Generally speaking you can add an offset to the sample numbers of all the events, and the offset can be found by raw.first_samp. So if I’m understanding you correctly, this would be something like

events[:, 0] += raw.first_samp

…But I’m not certain I’m understanding your situation correctly. Could you share a more complete code sample showing how the data and events are being loaded, and how you’re checking / knowing that they aren’t properly aligned?