I tested the code below , when changing the path just trying to download the dataset without sample is not working ?
import os
import os.path as op
from pathlib import Path
import openneuro
from mne.datasets import sample
from mne_bids import (
BIDSPath,
find_matching_paths,
get_entity_vals,
make_report,
print_dir_tree,
read_raw_bids,
)
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)
bids_root = ‘C:/Use/Desktop/EEGML’
openneuro.download(dataset=dataset, target_dir=bids_root, include=[f"sub-{subject}"])
###############################################################################
print_dir_tree(bids_root, max_depth=4)
sessions = get_entity_vals(bids_root, “session”, ignore_sessions=“on”)
datatype = “eeg”
extensions = [“.bdf”, “.tsv”] # ignore .json files
bids_paths = find_matching_paths(
bids_root, datatypes=datatype, sessions=sessions, extensions=extensions
)
print(bids_paths)
session = “off”
bids_path = BIDSPath(root=bids_root, session=session, datatype=datatype)
print(bids_path.match(ignore_json=True))
task = “rest”
suffix = “eeg”
bids_path = bids_path.update(subject=subject, task=task, suffix=suffix)
print(bids_path)
raw = read_raw_bids(bids_path=bids_path, verbose=False)