Skip to content

Commit

Permalink
Ensure paths are str in GlobusPatcher; ignore tmin, tmax if no trials…
Browse files Browse the repository at this point in the history
… start pulses detected
  • Loading branch information
k1o0 committed Oct 23, 2023
1 parent 7277c78 commit 148c4c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions ibllib/io/extractors/ephys_fpga.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,12 @@ def _extract(self, sync=None, chmap=None, sync_collection='raw_ephys_data',
# in ephysChoiceWorld that tend to ruin the final trial extraction).
t_trial_start, *_ = _assign_events_bpod(bpod['times'], bpod['polarities'])
bpod_start = self.bpod_trials['intervals_bpod'][:, 0]
fcn, *_ = neurodsp.utils.sync_timestamps(bpod_start, t_trial_start)
tmin = fcn(trials_table['intervals'][0, 0]) - 1
tmax = fcn(trials_table['intervals'][-1, 1]) + 1
if len(t_trial_start) > len(bpod_start) / 2:
fcn, *_ = neurodsp.utils.sync_timestamps(bpod_start, t_trial_start)
tmin = fcn(trials_table['intervals'][0, 0]) - 1
tmax = fcn(trials_table['intervals'][-1, 1]) + 1
else: # This type of alignment fails for some sessions, e.g. mesoscope
tmin = tmax = None

# Store the cleaned frame2ttl, audio, and bpod pulses as this will be used for QC
fpga_trials, self.frame2ttl, self.audio, self.bpod = extract_behaviour_sync(
Expand Down
5 changes: 3 additions & 2 deletions ibllib/oneibl/patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def _scp(self, local_path, remote_path, dry=True):
remote_path.relative_to(PurePosixPath(FLATIRON_MOUNT))
)
_logger.info(f"Globus copy {local_path} to {remote_path}")
local_path = globus.as_globus_path(local_path)
if not dry:
if isinstance(self.globus_transfer, globus_sdk.TransferData):
self.globus_transfer.add_item(local_path, remote_path.as_posix())
Expand All @@ -263,9 +264,9 @@ def _rm(self, flatiron_path, dry=True):
_logger.info(f'Globus del {flatiron_path}')
if not dry:
if isinstance(self.globus_delete, globus_sdk.DeleteData):
self.globus_delete.add_item(flatiron_path)
self.globus_delete.add_item(flatiron_path.as_posix())
else:
self.globus_delete.path.append(flatiron_path)
self.globus_delete.path.append(flatiron_path.as_posix())
return 0, ''

def patch_datasets(self, file_list, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion ibllib/tests/qc/test_critical_reasons.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def mock_input(prompt):
if "Select from this list the reason(s)" in prompt:
return "1,3"
return "1," + prompt[prompt.index(') Other') - 1] # always choose last option, 'Other'
elif "Explain why you selected" in prompt:
return "estoy un poco preocupada"
elif "You are about to delete" in prompt:
Expand Down

0 comments on commit 148c4c2

Please sign in to comment.