Quellcode durchsuchen

Make conversion script independent from the location it is ran from

Yaroslav Halchenko vor 1 Jahr
Ursprung
Commit
a0f2f89c8c
1 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  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')