Skip to content

Commit

Permalink
Fixed bug with data_path not properly being overwritten once h5py key…
Browse files Browse the repository at this point in the history
… is specified for ops
  • Loading branch information
chriski777 committed Sep 3, 2022
1 parent 6056df5 commit 04b09a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion suite2p/run_s2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'):
Expand Down

0 comments on commit 04b09a7

Please sign in to comment.