nih-megcore / nih_to_mne

General functions for NIH data to work with MNE python
Other
2 stars 3 forks source link

multi-session recording anatomy (make_meg_bids.py) #35

Open LinaTeichmann1 opened 1 year ago

LinaTeichmann1 commented 1 year ago

Hi @jstout211,

I was trying to run make_meg_bids.py for data acquired in multiple sessions. Everything works fine for the MEG data, however, it is also trying to make an "anat" folder in every session folder. This part fails as soon as you get to session 2 because the files for that same participant exist already in the bids_prep_temp folder. I wonder whether it would make sense to either copy over the "anat" folder to all sessions or have anat outside of each session folder? Or is there a way to add a flag so it ignores that there is a duplicate file?

ERROR: You are trying to re-run an existing subject with (possibly)
 new input data (-i). If this is truly new input data, you should delete
 the subject folder and re-run, or specify a different subject name.
 If you are just continuing an analysis of an existing subject, then 
 omit all -i flags.
Traceback (most recent call last):
  File "/Users/teichmanna2/anaconda3/envs/mne13/bin/make_meg_bids.py", line 441, in <module>
    trans_fname = make_trans_mat(mri=nii_mri, subjid=subjid, 
  File "/Users/teichmanna2/anaconda3/envs/mne13/bin/make_meg_bids.py", line 193, in make_trans_mat
    trans_dir.mkdir()
  File "/Users/teichmanna2/anaconda3/envs/mne13/lib/python3.10/pathlib.py", line 1175, in mkdir
    self._accessor.mkdir(self, mode)
FileExistsError: [Errno 17] File exists: '~data/bids_prep_temp/trans_mats/S02'

Thanks, Lina :)

EDIT: actually now that I'm thinking about it, copying wouldn't make sense because the electrode files are different right? So maybe we'll just need to delete the bids_prep_temp folder after every session?

jstout211 commented 1 year ago

Yeah - I have run into this already. Like you mentioned the trans_mats folder can be deleted to have the process continue on. Alternatively - I can build out that folder to be more "bids" like and have a subj/session folder structure.

I can look into it.