Importing events from an array in python

Hi,

I am trying to use an events stream from an xdf file in mne. I was able to import the xdf and create two arrays in python. One array includes lists of markup-language lines describing each event while the second array includes the corresponding timestamps.
I did edit the timestamps so that they match the timing of the EEG sampling rate already imported into mne. e.g. timestamp of first event is 5.34 seconds (with respect to time zero in mne) and so on.
I am wondering if there is a way to add these events to the raw file containing the EEG data.

Thank you

Hello @gkassis and welcome to the forum!

Can you please share a snippet of the array / data you have created? It’s not really clear to me what exactly you have and what needs to be done.

Best,
Richard

I assume you use pyxdf to load the file. You could try from mnelab.io.xdf import read_raw_xdf (using the mnelab package) to import your data including annotations. Normally, this should work out of the box, you just have to provide the stream ID (of the EEG data) you want to load.