Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: read_raw_bids and raw.save round-trip with splits #11900

Open
larsoner opened this issue Aug 18, 2023 · 1 comment
Open

BUG: read_raw_bids and raw.save round-trip with splits #11900

larsoner opened this issue Aug 18, 2023 · 1 comment

Comments

@larsoner
Copy link
Member

          ouch. it's really bad that `raw.save(my_bidspath)` generates filenames that can't be read by `read_raw_bids(my_bidspath)`.

Originally posted by @drammock in #11870 (comment)

@larsoner
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant