Skip to content

ValueError: datatype (func) is not valid. Should be one of ['meg', 'eeg', 'ieeg', 'nirs', 'anat', 'beh'] #1385

@bathaeian

Description

@bathaeian

Description of the problem

Hi ,
I wrote this code to make needed folders. It generates that error:

import shutil
try:
    import mne
except ImportError:
    !pip install mne
try:
    import mne_bids 
except ImportError:
    !pip install mne_bids 
from mne_bids import BIDSPath
my_root = './sample_data/cobre' 
bids_path = BIDSPath(
    subject="0040000", datatype='func', suffix='bold', root=my_root
).mkdir()
947             if key == "datatype":
    948                 if val is not None and val not in ALLOWED_DATATYPES and self.check:
--> 949                     raise ValueError(
    950                         f"datatype ({val}) is not valid. "
    951                         f"Should be one of "

ValueError: datatype (func) is not valid. Should be one of ['meg', 'eeg', 'ieeg', 'nirs', 'anat', 'beh']

Steps to reproduce

#https://mne.tools/mne-bids/stable/auto_examples/create_bids_folder.html
import shutil
try:
    import mne
except ImportError:
    !pip install mne
try:
    import mne_bids 
except ImportError:
    !pip install mne_bids 
from mne_bids import BIDSPath
my_root = './sample_data/cobre' 
bids_path = BIDSPath(
    subject="0040000", datatype='func', suffix='bold', root=my_root
).mkdir()
print(bids_path.directory)

# clean up

Expected results

making two folders

Actual results

/usr/local/lib/python3.11/dist-packages/mne_bids/path.py in update(self, check, **kwargs)
947 if key == "datatype":
948 if val is not None and val not in ALLOWED_DATATYPES and self.check:
--> 949 raise ValueError(
950 f"datatype ({val}) is not valid. "
951 f"Should be one of "

ValueError: datatype (func) is not valid. Should be one of ['meg', 'eeg', 'ieeg', 'nirs', 'anat', 'beh']

Additional information

nothing

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions