I’m working with NIRS data in BIDS format and want to create an analysis pipeline for my dataset.
Therefore, I am using the read_raw_bids command to read in my RawSNIRF object. I can set the datatype to ‘nirs’ without problems. Then I perform some magic (extract bad channels) which I want to save for each subject again (temporarily stored in raw.info['bads']). So analogously, I want to use write_raw_bids now to store the list of bad channels in the given subject file.
When executing write_raw_bids(raw, bids_path=bids_path, overwrite=True), it overwrites 5 out of 6 files, namely the ones ending on tsv and json, but deletes my snirf file and in return complains about this now nonexistent file:
Input In  in <cell line: 1>
write_raw_bids(raw, bids_path=bids_path, overwrite=True)
File <decorator-gen-585>:12 in write_raw_bids
File ~/anaconda3/lib/python3.9/site-packages/mne_bids/write.py:1779 in write_raw_bids
File ~/anaconda3/lib/python3.9/shutil.py:265 in copyfile
with open(src, ‘rb’) as fsrc, open(dst, ‘wb’) as fdst:
FileNotFoundError: [Errno 2] No such file or directory: ‘/pathtodata/bids_nBack_2022-06-09/sub-17/ses-01/nirs/sub-17_ses-01_task-nBack_nirs.snirf’
What’s a bit odd to me is that nirs doesn’t seem to be a valid format in the write_raw_bids, but it is valid in read_raw_bids. Is it not supported at all? Is there some other easy way to save my data that I overlooked? (And why is my - backupped! - snirf file deleted in the first place?)
To clarify, I am working on the raw but not the sourcedata, the latter remains untouched. And now that I think about it, shouldn’t I rather store my “processed” data in the derivatives folder instead of modifying the raw bids data? (And how?)
I don’t know if it’s just me, but I found it quite confusing that in all those truly good and thorough tutorials no one really speaks of saving their data. There should be an intuitive way to save intermediate results, similar to what I know from I think nipype for MRI, where each preprocessing step like realign or smooth was saved to a different folder. Maybe take that as a kind suggestion to improve the docs.