Open larsoner opened 11 months ago
I started looking into this a bit. In principle I think we could fix this on the MNE-BIDS side for read_raw_bids
, but we'd be stuck with the same problem for read_epochs
in MNE-Python -- epochs.save(bids_path)
can write a path that has effectively been .update(split='01')
'ed so read_epochs(bids_path)
will fail.
I also thought about trying to fix the BIDSPath.fpath
to do some magic, but that was a non-starter because it doesn't know whether you intend to read or write, and that matters. If you want to write you want the nonexistent split=None
filename sent to the .save
method (otherwise you end up with split-01_split-01_
in your filenames if they get split!), and if you want to read you want the split='01'
version (because it actually exists).
So I think in the end one way around this problem is to put a fix in MNE in read_raw_fif
and read_epochs
directly. These could detect BIDSPath instances, and if present, check for bids_path
existence and if not found and split is None
in the BIDSPath, also check split='01'
. It's not perfect but it would at least allow the round-trip to succeed for both raw.save
+read_raw_fif
+read_raw_bids
and epochs.save
+read_epochs
.
Originally posted by @drammock in https://github.com/mne-tools/mne-python/issues/11870#issuecomment-1671754453