mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.72k stars 1.32k forks source link

split raw file error in examples/decoding/decoding_rsa_sgskip.py #10836

Closed CarinaFo closed 2 years ago

CarinaFo commented 2 years ago

while executing line 83 - 84: raws = [read_raw_fif(fname, verbose='error') for fname in fnames] this error pops up:


Traceback (most recent call last):
  File "C:\Users\Carina\Documents\expecon_EEG_analysis\venv\lib\site-packages\IPython\core\interactiveshell.py", line 3361, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-28-5f4d8359a1fd>", line 1, in <cell line: 1>
    raws = [read_raw_fif(fname, verbose='error')
  File "<ipython-input-28-5f4d8359a1fd>", line 1, in <listcomp>
    raws = [read_raw_fif(fname, verbose='error')
  File "C:\Users\Carina\Documents\expecon_EEG_analysis\venv\lib\site-packages\mne\io\fiff\raw.py", line 482, in read_raw_fif
    return Raw(fname=fname, allow_maxshield=allow_maxshield,
  File "<decorator-gen-240>", line 10, in __init__
  File "C:\Users\Carina\Documents\expecon_EEG_analysis\venv\lib\site-packages\mne\io\fiff\raw.py", line 94, in __init__
    _on_missing(on_split_missing, msg, name='on_split_missing')
  File "C:\Users\Carina\Documents\expecon_EEG_analysis\venv\lib\site-packages\mne\utils\check.py", line 872, in _on_missing
    raise error_klass(msg)
ValueError: Split raw file detected but next file C:\Users\Carina\mne_data\MNE-visual_92_categories-data\sample_subject_0_tsss_mc-1.fif does not exist. Ensure all files were transferred properly and that split and original files were not manually renamed on disk (split files should be renamed by loading and re-saving with MNE-Python to preserve proper filename linkage).
welcome[bot] commented 2 years ago

Hello! šŸ‘‹ Thanks for opening your first issue here! ā¤ļø We will try to get back to you soon. šŸš“šŸ½ā€ā™‚ļø

drammock commented 2 years ago

I've reproduced this locally on current main

drammock commented 2 years ago

it seems that the visual_92 data files have a FIFF_REF_FILE_NUM tag but don't actually have subsequent files (?). This dataset is only actually used in 2 places in our docs, and both are _sgskip files so they never actually get executed/tested. Here are the lines where the tag gets matched and triggers next_fname to not be None:

https://github.com/mne-tools/mne-python/blob/23a8da684a4debe87b8de99dda6fba399ac22063/mne/io/open.py#L73-L91

I'm not sure how to dig deeper; I don't know much about the origin of that dataset (or how things like split files are encoded in the FIFF standard)

agramfort commented 2 years ago

I can replicate the pb. Only one file was shared with me years ago. Just do:

raws = [read_raw_fif(fname % block, verbose='error', on_split_missing='ignore')
        for block in range(n_runs)]  # ignore filename warnings

in the script. Any volunteer to send the PR?

drammock commented 2 years ago

this wasn't actually fixed yet, as the linked PR wasn't merged. reopening.