-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BIDS channel type issue #1046
Comments
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴🏽♂️ |
Hi @arnodelorme Is this an error when you read the file? BIDSPath is just a class for creating file paths in bids datasets. I'm guessing maybe when you run read_raw_bids(?) is it possible for you to upload a code segment and also the MNE and related package versions? E.g. a Minimal working example for the error. output of 'mne sys_info' will show you the relevant versions. |
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
Of course import os
import os.path as op
import mne
from mne.datasets import sample
from mne_bids import BIDSPath, read_raw_bids, print_dir_tree, make_report, inspect_dataset, mark_channels
bids_path = BIDSPath(root='ds003061', datatype='eeg', suffix = 'eeg')
res = bids_path.match()
rawraw = read_raw_bids(bids_path=res[0], verbose=False) ds003061 is available from https://openneuro.org/datasets/ds003061 |
Sys info
|
@arnodelorme One could argue that MNE-BIDS should handle things more gracefully here (or raise an exception); but ultimately I'd say the dataset needs to be fixed.
But where? And which are the problematic channels, exactly? Here's a MWE: # %%
# Data downloaded via:
# openneuro-py download --dataset ds003061 --include sub-001
import mne_bids
bp = mne_bids.BIDSPath(
root='/tmp/ds003061',
subject='001',
task='P300',
run='1',
datatype='eeg',
suffix='eeg',
extension='.set',
)
raw = mne_bids.read_raw_bids(bp)
for ch_name in raw.ch_names:
ch_type = raw.get_channel_types(ch_name)[0]
ch_idx = raw.ch_names.index(ch_name)
print(f'{ch_idx:<5} {ch_name:<6} {ch_type}') yields:
|
Yes, but this is the actual file. You can see that GSR1 and 2 have the type GSR and that TEMP has the type TEMP which are regular BIDS types.
|
Oh, right. I only looked at the TSV in my web browser and didn't realize there was a scrollbar on the right, so I only saw the first few channels 🤦 |
We currently use the following channel type mapping from BIDS to MNE: Lines 77 to 83 in 16a7b0c
We need to add I don't believe MNE has "proper" support for these, so we should map them to @sappelhoff I don't think we should silently apply the BIDS datatype's channel type to channels for which we don't have a proper BIDS -> MNE mapping defined; instead, we should default to |
Either this is a bug, or we have incorrect documentation in MNE – We'd need to check the FIFF specs. |
… says "respiration monitoring" here: @larsoner What's correct now..? Is "resp" for "response" or for "respiration"? |
for some reason my answer from yesterday never appeared here. Let me paste it here: this data contains channels with type "temp" and "GSR" I don't think its part of the standard. Cf https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/03-electroencephalography.html#channels-description-_channelstsv Type of channel; MUST use the channel types listed below. Note that the type MUST be in upper-case. Must be one of: "MEGMAG", "MEGGRADAXIAL", "MEGGRADPLANAR", "MEGREFMAG", "MEGREFGRADAXIAL", "MEGREFGRADPLANAR", "MEGOTHER", "EEG", "ECOG", "SEEG", "DBS", "VEOG", "HEOG", "EOG", "ECG", "EMG", "TRIG", "AUDIO", "PD", "EYEGAZE", "PUPIL", "MISC", "SYSCLOCK", "ADC", "DAC", "HLU", "FITERR", "OTHER". mne_bids converts them to EEG when it does not understand the type. You should get warnings when attempting to read the files with: from mne_bids import BIDSPath, read_raw_bids
bp = BIDSPath(
root='./',
subject='001',
task='P300',
run='1',
datatype='eeg',
suffix='eeg',
extension='.set',
)
raw = read_raw_bids(bp) |
the So our docs are wrong, can you make a quick PR to fix them? |
Thanks @larsoner! I already fixed this a few days ago, I don't have the PR id at und right now though, as I'm on my phone |
Okay great! |
next channel type we should add is temp (temperature in celsius)
… Message ID: ***@***.***>
|
@arnodelorme This ensures that the temperature and GSR channels in your dataset will not show up as "eeg" channels anymore (but as "misc"). The next step for us is to amend the FIFF standard and add a proper EDA/GSR and temperature channel type. We're tracking this at mne-tools/mne-python#11055 |
Wonderful. Thanks
|
Also updates tiny_bids Will fail until mne-tools/mne-python#11108 has been merged Fixes mne-tools#1046
* Add support for GSR and temperature channels Also updates tiny_bids Will fail until mne-tools/mne-python#11108 has been merged Fixes #1046 * Indent * Preserve info * Require MNE devel to run tests * Fix unit writing * Write correct BIDS temperature unit (oC) * Better code * Add conditional * No warning * Skip test on MNE stable * Decorated the wrong test * Add channel statuses * Update doc/whats_new.rst Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org> * Fix channel description * Manually curate tiny_bids to keep the diff small * Revert changes related to _orig_units handling * Fix test Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org>
@arnodelorme Temperature and GSR channels should now work as expected when combining the development versions of MNE-Python and MNE-BIDS. Well, not quite, as we still have an issue with plotting: But loading and processing the data should all be good! Thank you for reporting this issue! |
You can scroll down this page to see the official BIDS channel types.
https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/03-electroencephalography.html#channels-description-_channelstsv
|
bids_path = BIDSPath(root='../ds003061')
Channels 65 to 79 are not EEG (and marked as such in the BIDS repo). Yet MNE thinks 2 of these channels are EEG.
https://openneuro.org/datasets/ds003061
The text was updated successfully, but these errors were encountered: