problems cloning git repository

Hello everyone,

I have cloned this git repository: GitHub - OpenNeuroDatasets/ds004837: OpenNeuro dataset - Magnetoencephalographic (MEG) Pitch and Duration Mismatch Negativity (MMN) in First-Episode Psychosis
in cloab.
In principle, it is cloned, git remote is correct, but when trying to read the fiff file
code:
fname = “/content/drive/MyDrive/…/ds004837/sub-2218A/ses-0001/meg/sub-2218A_ses-0001_task-attnmod_run-01_meg.fif”
raw = mne.io.read_raw_fif(fname)

I’ve also tried just: raw = mne.io.read_raw(fname)
but I get the same result.

it gives me this error:
Opening raw data file /content/drive/MyDrive/…sub-2218A_ses-0001_task-attnmod_run-01_meg.fif…

FileNotFoundError Traceback (most recent call last)
in <cell line: 1>()
----> 1 raw = mne.io.read_raw_fif(fname)

3 frames
in init(self, fname, allow_maxshield, preload, on_split_missing, verbose)

in _read_raw_file(self, fname, allow_maxshield, preload, do_check_ext, verbose)

in _check_fname(fname, overwrite, must_exist, name, need_dir, verbose)

/usr/local/lib/python3.10/dist-packages/mne/utils/check.py in _check_fname(fname, overwrite, must_exist, name, need_dir, verbose)
261 raise PermissionError(f"{name} does not have read permissions: {fname}")
262 elif must_exist:
→ 263 raise FileNotFoundError(f’{name} does not exist: “{fname}”')
264
265 return fname

FileNotFoundError: fname does not exist: “/content/drive/MyDrive/…sub-2218A/ses-0001/meg/sub-2218A_ses-0001_task-attnmod_run-01_meg.fif”

For more information, if I bring the file from local and try to read it, it still gives me this other error: ValueError: file ‘/content/drive/MyDrive/…/sub-01_task-abseq_run-01_meg.fif’ does not start with a file id tag

Any help is appreciated, I am new to cloning from git and handling these types of files, sincere thanks!

Xavier,

  • MNE version: e.g. 1.6.0
  • operating system: Windows 10

Hello @Xavis and welcome to the forum!

You cannot simply clone OpenNeuro datasets from GitHub. That is, you can do it, but they’re special – you’d need datalad or another tool to actually use the data.

What you should do instead is follow the instructions on the OpenNeuro website:

https://openneuro.org/datasets/ds004837/versions/1.0.0/download

You can also use openneuro-py to fetch the data.

Please also note that for reading, you should use MNE-BIDS and not “pure” MNE-Python functions.

Best wishes,
Richard

2 Likes

Thanks for the welcome!
Very kind of your response, I’m going to try doing it.

Grateful Richard!

Xavier,

1 Like

Hello again,
I have been able to clone the files successfully from git-hub with ssh. But when trying to read a fiff file with mne-bids I get this error:

ValueError Traceback (most recent call last) [c:\Users.…\ds004837_datalab.ipynb](file:///C:/Users/…/ds004837_datalab.ipynb) Cell 19 line 1 ----> 1 raw = mne.io.read_raw(fname) File [c:\Users.…\lib\site-packages\mne\io_read_raw.py:157](file:///C:/Users/…/lib/site-packages/mne/io/_read_raw.py:157), in read_raw(fname, preload, verbose, **kwargs) [155](file:///C:/Users/…/lib/site-packages/mne/io/_read_raw.py:155) for reader in these_readers: [156](file:///C:/Users/…/lib/site-packages/mne/io/_read_raw.py:156) try: → [157](file:///C:/Users/…/lib/site-packages/mne/io/_read_raw.py:157) return reader(fname, **kwargs) [158](file:///C:/Users/…/lib/site-packages/mne/io/_read_raw.py:158) except Exception: [159](file:///C:/Users/…/lib/site-packages/mne/io/_read_raw.py:159) if len(these_readers) == 1: File [c:\Users.…\lib\site-packages\mne\io\fiff\raw.py:543](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:543), in read_raw_fif(fname, allow_maxshield, preload, on_split_missing, verbose) [502](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:502) @fill_doc [503](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:503) def read_raw( [504](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:504) fname, allow_maxshield=False, preload=False, on_split_missing=“raise”, verbose=None [505](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:505) ): [506](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:506) “”“Reader function for Raw FIF data. [507](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:507) [508](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:508) Parameters (…) [541](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:541) are updated accordingly. [542](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:542) “”” → [543](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:543) return Raw( [544](file:///C:/Users/…/lib/site-packages/mne/io/fiff/raw.py:544) fname=fname,

→ [147](file:///C:/Users/…/lib/site-packages/mne/_fiff/open.py:147) raise ValueError(f"{prefix} start with a file id tag") [149](file:///C:/Users/…/lib/site-packages/mne/_fiff/open.py:149) if tag.type != FIFF.FIFFT_ID_STRUCT: [150](file:///C:/Users/…/lib/site-packages/mne/_fiff/open.py:150) raise ValueError(f"{prefix} start with a file id tag") ValueError: file ‘C:\Users\…\ds004837\sub-2387A\ses-0001\meg\sub-2387A_ses-0001_task-attnmod_run-01_meg.fif’ does not start with a file id tag

I have used this code:
fname = “path to file”
raw = mne.io.read_raw(fname)

Does anyone know why? Where this error?

I work locally from VSCode with Anaconda3

Thank you!

Hello, like I said, simply cloning the repository with git is not enough! This will not copy the data files properly, only references to the files. Hence you cannot load them. This is because they are stored in a special way using git-annex. You cannot treat the OpenNeuro repositories like ordinary git repositories.

Please follow the instructions from the OpenNeuro website I linked to above.

Richard

Thanks again Richard, you have put me on the right path, downloading and reading files is correct now. In case it helps someone in the future: to read the data without a file start error, in my case I had to configure (preload=True) as the raw reading parameter.
The only problem is that the MEG frequency graph is not interactive for me, I guess it depends on the colab configuration.

All the best!

Xavier,

1 Like