diff --git a/suite2p/run_s2p.py b/suite2p/run_s2p.py index ff22e7bd..be775caf 100644 --- a/suite2p/run_s2p.py +++ b/suite2p/run_s2p.py @@ -344,7 +344,7 @@ def run_s2p(ops={}, db={}, server={}): print(db) if 'save_path0' not in ops or len(ops['save_path0'])==0: if ops.get('h5py'): - ops['save_path0'] = os.path.split(ops['h5py'])[0] + ops['save_path0'] = os.path.split(ops['h5py'][0])[0] # Use first element in h5py key to find save_path elif ops.get('nwb_file'): ops['save_path0'] = os.path.split(ops['nwb_file'])[0] else: @@ -378,6 +378,9 @@ def run_s2p(ops={}, db={}, server={}): else: if len(ops['h5py']): ops['input_format'] = 'h5' + # Overwrite data_path with path provided by h5py. + # Use the directory containing the first h5 file + ops['data_path'] = [os.path.split(ops['h5py'][0])[0]] elif len(ops['nwb_file']): ops['input_format'] = 'nwb' elif ops.get('mesoscan'):