I am facing a weird issue. For a few runs, I am unable to load the raw fif file. It returns the following error message. Any idea on how to resolve this is highly appreciated.
raw = mne.io.read_raw_fif(os.path.join(fpath, fname), allow_maxshield = True)
Traceback (most recent call last):
File "C:\Users\Aakash\AppData\Local\Temp\ipykernel_6452\68822043.py", line 2, in <cell line: 2>
raw = mne.io.read_raw_fif(os.path.join(fpath, fname), allow_maxshield = True)
File "C:\Users\Aakash\AppData\Roaming\Python\Python39\site-packages\mne\io\fiff\raw.py", line 540, in read_raw_fif
return Raw(
File "<decorator-gen-271>", line 12, in __init__
File "C:\Users\Aakash\AppData\Roaming\Python\Python39\site-packages\mne\io\fiff\raw.py", line 93, in __init__
raw, next_fname, buffer_size_sec = self._read_raw_file(
File "<decorator-gen-272>", line 12, in _read_raw_file
File "C:\Users\Aakash\AppData\Roaming\Python\Python39\site-packages\mne\io\fiff\raw.py", line 185, in _read_raw_file
ff, tree, _ = fiff_open(fname, preload=whole_file)
File "<decorator-gen-10>", line 12, in fiff_open
File "C:\Users\Aakash\AppData\Roaming\Python\Python39\site-packages\mne\io\open.py", line 126, in fiff_open
return _fiff_open(fname, fid, preload)
File "C:\Users\Aakash\AppData\Roaming\Python\Python39\site-packages\mne\io\open.py", line 185, in _fiff_open
tree, _ = make_dir_tree(fid, directory)
File "<decorator-gen-9>", line 12, in make_dir_tree
File "C:\Users\Aakash\AppData\Roaming\Python\Python39\site-packages\mne\io\tree.py", line 55, in make_dir_tree
if directory[start].kind == FIFF_BLOCK_START:
TypeError: 'NoneType' object is not subscriptable
OK, I can reproduce the error. It seems like the cause is that the FIFF tag directory is not what we expect:
ipdb> p dir_tag
<Tag | kind 0 - type 0 - size 0 - next 0 - pos 0 - data None>
@agramfort or @larsoner I wasnβt able to determine if this is a case of βvalid file we canβt handleβ or βcorrupted file we donβt catch and give informative error aboutβ. Can one of you take a look? Link to the file is in the prior post.
Ah, I see. Thanks a lot for checking this out. I will ask my friends to send the data again and confirm. In any case, is it possible to extract the partial data that is present in this file?