bids-standard / pybv

A lightweight I/O utility for the BrainVision data format, written in Python.

Home Page:https://pybv.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Negative Event Onsets

behinger opened this issue · comments

Hi!
According to BIDS standard, we can have negative onsets of events - but this runs into an assert here:

pybv/pybv/io.py

Line 471 in cb79575

if not (0 <= event["onset"] < n_times):

is this a fundamental issue to be compatible with the BrainVision format, or is this something we could fix with a PR?

BIDS-Specificatoins:
grafik

Cheers and thanks for the hard work!

Best, Benedikt & Manpa (@ReboreExplore)

According to the file format specs, marker onsets must be >= 0.

Hello 👋

is this a fundamental issue to be compatible with the BrainVision format

Yes, I think it's a format issue 🤔

But I also don't understand the use case --> in the BrainVision files, you'd store ephys data, and the VHDR file contains event markers into that data (the stored data). Do you want to store event markers in the VHDR that do not correspond to the stored data (EEG file) in any way?

I see. We will switch to EDF then.

We use read_raw_xdf in mnelab to get a raws with negative annotations (lsl stimulus/marker stream might be opened before the EEG data is available). We then use mne-bids to save that raw file. where exactly in mne-bids pybv comes into play I'd have to look into.

Edit: Thanks for the fast and nice answers :)

Okay thanks, that makes sense to me -- and switching to EDF sounds like a reasonable alternative then! Good luck!

thanks!

We use read_raw_xdf in mnelab to get a raws with negative annotations (lsl stimulus/marker stream might be opened before the EEG data is available).

Just out of curiosity, shouldn't the streams be synced once you load it with read_raw_xdf()?

I thought so too, but for some reason we provide only the EEG stream, somehow it has to get the Marker streams without providing explicitly - not 100% sure yet.

so we call mnelab with: https://github.com/s-ccs/LSLAutoBIDS/blob/b055f107355fffdc94447f9b5524573cb50409b4/lsl_autobids/convert_to_bids_and_upload.py#L135

Which should be one stream - but now looking at this code a second time, I'm not so sure anymore. @ReboreExplore could you put a breakpoint there and check what exactly is inputted to read_raw_xdf?

But, because this is off-topic, we can take the discussion offline and we'll provide a summary of our findings later :-)

Yes, I could see into this matter.