Closed aplzr closed 4 months ago
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴🏽♂️
Thanks for the report!
Just to clarify: My understanding of the filename template table for EEG in the BIDS specification is, that the task entity is NOT optional, see screenshot:
What makes you think that not having a task entity is a legitimate formatting according to the spec? :-)
I thought I had read somewhere in the BIDS docs that only subject and session are mandatory, but it seems I was wrong and it's actually subject and task. Also I might have inadvertently put some (apparently undeserved) trust into the source of my data, since I was told that adherence to the BIDS spec is important to them.
Thanks for pointing me in the right direction. I will update my recordings with a (dummy) task.
@sappelhoff I think we should fail earlier or provide a better error message either way...
I agree that mne-bids should provide a more helpful error message for this
Description of the problem
Using the latest
mne_bids
version (v.0.14) I'm trying to load an EEG recording usingmne_bids.read_raw_bids()
. I'm passing the followingBIDSPath
to the function:As you can see there is no task entity in the basename, which as I understand is legal according to the BIDS spec.
Calling
read_raw_bids
with thisBIDSPath
results in an error with the following stack trace:In line 841 a string operation is applied to
bids_path.task
, but because it is not actually astr
butNone
, the attribute error is raised.I can't open a pull request at the moment and I'm also not sure if I'm overlooking anything as this is the first time working with BIDS, but I have a suggestion for a fix:
Changing line 841 from
) or bids_path.task.startswith("rest"):
to
) or (bids_path.task and bids_path.task.startswith("rest")):
resolves the problem and I can load the data.
Steps to reproduce
Use
mne_bids.read_raw_bids()
to load a BIDS dataset that does not contain task information (i.e. whose filenames do not contain a task entity).Expected results
The dataset is loaded from disk.
Actual results
An attribute error is raised.
Additional information