Selaa lähdekoodia

Make conversion script independent from the location it is ran from

Yaroslav Halchenko 1 vuosi sitten
vanhempi
commit
a0f2f89c8c
1 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 3 3
      ephys_neuropixel/rawdata/code/create_rawdata.py

+ 3 - 3
ephys_neuropixel/rawdata/code/create_rawdata.py

@@ -103,15 +103,15 @@ class BIDSGenerator(BEP032Data):
 
 
 if __name__ == '__main__':
-
-    for sub_path in pathlib.Path('.').glob('../sourcedata/sub-*'):
+    code_path = pathlib.Path(__file__).parent
+    for sub_path in codepath.glob('../sourcedata/sub-*'):
         sub_id = sub_path.name.split('sub-')[-1]
         for ses_path in sub_path.glob('ses-*'):
             ses_id = ses_path.name.split('ses-')[-1]
 
             gen = BIDSGenerator(sub_id, ses_id,
                                 custom_metadata_source={'source_data_folder': ses_path})
-            gen.basedir = pathlib.Path('../rawdata')
+            gen.basedir = code_path.parent
             gen.register_data_sources(ses_path)
             gen.generate_directory_structure()
             # gen.organize_data_files(mode='link', autoconvert='nwb')