# .. note: If the keyword argument include is left out of # ``openneuro.download``, the whole dataset will be downloaded. # We're just using data from one subject to reduce the time # it takes to run the example. dataset = 'ds002778' subject = 'pd6' # Download one subject's data from each dataset bids_root = op.join(op.dirname(sample.data_path()), dataset) if not op.isdir(bids_root): os.makedirs(bids_root) openneuro.download(dataset=dataset, target_dir=bids_root, include=[f'sub-{subject}']) # %% # Explore the dataset contents # ---------------------------- # # We can use MNE-BIDS to print a tree of all # included files and folders. We pass the ``max_depth`` parameter to # `mne_bids.print_dir_tree` to the output to four levels of folders, for # better readability in this example. print_dir_tree(bids_root, max_depth=4) # %% # We can even ask MNE-BIDS to produce a human-readbale summary report
# We will do this using ``openneuro-py`` which can be installed using pip # (``pip install openneuro-py``). import os import openneuro import autoreject dataset = 'ds000117' # The id code on OpenNeuro for this example dataset subject_id = 16 # OpenfMRI format of subject numbering target_dir = os.path.join( os.path.dirname(autoreject.__file__), '..', 'examples', dataset) if not os.path.isdir(target_dir): os.makedirs(target_dir) openneuro.download(dataset=dataset, target_dir=target_dir, include=[f'sub-{subject_id}/ses-meg/']) # %% # We will create epochs with data starting 200 ms before trigger onset # and continuing up to 800 ms after that. The data contains visual stimuli for # famous faces, unfamiliar faces, as well as scrambled faces. tmin, tmax = -0.2, 0.8 events_id = {'famous/first': 5, 'famous/immediate': 6, 'famous/long': 7} # %% # Let us now load all the epochs into memory and concatenate them import mne # noqa epochs = list()
def _download_via_openneuro(*, ds_name: str, ds_path: Path): openneuro.download(dataset=DATASET_OPTIONS[ds_name]['openneuro'], target_dir=ds_path, include=DATASET_OPTIONS[ds_name]['include'], exclude=DATASET_OPTIONS[ds_name]['exclude'])