mne-bids icon indicating copy to clipboard operation
mne-bids copied to clipboard

Write EEG/iEEG reference to JSON sidecar

Open hoechenberger opened this issue 3 years ago • 5 comments

See https://github.com/mne-tools/mne-bids/pull/695#issuecomment-786165997

hoechenberger avatar Feb 25 '21 20:02 hoechenberger

amend our documentation, suggesting users do the following before calling write_raw_bids:

  • if the reference channels are present in the data, call raw.set_eeg_reference() to make the reference explicitly known
  • if the reference channels are not present in the data:
    • add them via raw.add_reference_channels()
    • call raw.set_eeg_reference() to make the reference explicit The cool thing would be that if the reference electrode is part of the montage, we'd get the reference electrode location for free :) Then call write_raw_bids(), which should extract the reference channel info from raw.info['chs'] -> this will need a PR Easiest is to start with the assertion that all channels have the same reference, so we can write it to [i]EEGReference in the sidecar JSON.

and if users don't do it we keep writing n/a?

sappelhoff avatar Feb 25 '21 21:02 sappelhoff

and if users don't do it we keep writing n/a?

Yeah… I mean, if you will, this follows the principle we're applying to events already: if they are not specified, we don't write any (well… we do warn, though…)

hoechenberger avatar Feb 25 '21 21:02 hoechenberger

I'll make a PR and we can then discuss & iterate from there

hoechenberger avatar Feb 25 '21 22:02 hoechenberger

Oh well it wouldn't be fun if it were easy, right?

  • https://github.com/mne-tools/mne-python/issues/8962

hoechenberger avatar Feb 25 '21 23:02 hoechenberger

We still don't have a solution for this, do we? :( I want to store some BV data in BIDS format. The data doesn't contain the reference channel. Now I'm not sure which approach to take to make BIDS aware of this reference.

Shall I just add it via raw.add_reference_channels() and leave it as all-zeros before calling write_raw_bids()?

hoechenberger avatar Sep 14 '23 13:09 hoechenberger