diff --git a/ibllib/io/extractors/ephys_fpga.py b/ibllib/io/extractors/ephys_fpga.py index da79c50da..bf957670a 100644 --- a/ibllib/io/extractors/ephys_fpga.py +++ b/ibllib/io/extractors/ephys_fpga.py @@ -658,7 +658,8 @@ def _update_var_names(self, bpod_fields=None, bpod_rsync_fields=None): self.settings = self.bpod_extractor.settings # This is used by the TaskQC self.bpod_rsync_fields = bpod_rsync_fields if self.bpod_rsync_fields is None: - self.bpod_rsync_fields = tuple(self._time_fields(self.bpod_extractor.var_names)) + self.bpod_rsync_fields = tuple([f for f in self._time_fields(self.bpod_extractor.var_names) + if 'wheel' not in f]) if 'table' in self.bpod_extractor.var_names: if not self.bpod_trials: self.bpod_trials = self.bpod_extractor.extract(save=False) @@ -666,7 +667,7 @@ def _update_var_names(self, bpod_fields=None, bpod_rsync_fields=None): self.bpod_rsync_fields += tuple(self._time_fields(table_keys)) elif bpod_rsync_fields: self.bpod_rsync_fields = bpod_rsync_fields - excluded = (*self.bpod_rsync_fields, 'table') + excluded = (*self.bpod_rsync_fields, 'table', *(f for f in self.bpod_extractor.var_names if 'wheel' in f)) if bpod_fields: assert not set(self.bpod_fields).intersection(excluded), 'bpod_fields must not also be bpod_rsync_fields' self.bpod_fields = bpod_fields diff --git a/ibllib/pipes/ephys_tasks.py b/ibllib/pipes/ephys_tasks.py index cb9a0099b..e9d152963 100644 --- a/ibllib/pipes/ephys_tasks.py +++ b/ibllib/pipes/ephys_tasks.py @@ -569,6 +569,8 @@ def _label_probe_qc(self, folder_probe, df_units, drift): qcdict['whitening_matrix_conditioning'] = np.linalg.cond(wm) # groom qc dict (this function will eventually go directly into the json field update) for k in qcdict: + if np.isnan(qcdict[k]): + qcdict[k] = None if isinstance(qcdict[k], np.int64): qcdict[k] = int(qcdict[k]) elif isinstance(qcdict[k], float): diff --git a/ibllib/pipes/training_status.py b/ibllib/pipes/training_status.py index 1356a08ba..ce4a61402 100644 --- a/ibllib/pipes/training_status.py +++ b/ibllib/pipes/training_status.py @@ -495,6 +495,8 @@ def get_data_collection(session_path): for i, (protocol, task_info) in enumerate(chain(*map(dict.items, task_protocols))): if 'passiveChoiceWorld' in protocol: continue + elif 'ChoiceWorld' not in protocol: + continue collection = task_info.get('collection', f'raw_task_data_{i:02}') if collection == 'raw_passive_data': continue diff --git a/ibllib/qc/alignment_qc.py b/ibllib/qc/alignment_qc.py index 71a4a76ad..b7b9beefa 100644 --- a/ibllib/qc/alignment_qc.py +++ b/ibllib/qc/alignment_qc.py @@ -383,7 +383,7 @@ def update_experimenter_evaluation(self, prev_alignments=None, override=False): self.alignments = prev_alignments outcomes = [align[2].split(':')[0] for key, align in self.alignments.items() - if len(align) == 3] + if len(align) >= 3] if len(outcomes) > 0: vals = list(map(QC.validate, outcomes)) max_qc = np.argmax(vals) diff --git a/ibllib/qc/task_qc_viewer/task_qc.py b/ibllib/qc/task_qc_viewer/task_qc.py index b26060cde..b227fb527 100644 --- a/ibllib/qc/task_qc_viewer/task_qc.py +++ b/ibllib/qc/task_qc_viewer/task_qc.py @@ -78,16 +78,17 @@ def __init__(self, qc): map = {k: [] for k in set(outcomes.values())} for k, v in outcomes.items(): map[v].append(k[6:]) + for k, v in map.items(): - if k == 'PASS': + if k.name == 'PASS': continue - print(f'The following checks were labelled {k}:') + print(f'The following checks were labelled {k.name}:') print('\n'.join(v), '\n') print('The following *critical* checks did not pass:') critical_checks = [f'_{x.replace("check", "task")}' for x in CRITICAL_CHECKS] for k, v in outcomes.items(): - if v != 'PASS' and k in critical_checks: + if v.name != 'PASS' and k in critical_checks: print(k[6:]) # Make DataFrame from the trail level metrics @@ -106,8 +107,8 @@ def n_trials(self): return self.qc.extractor.data['intervals'].shape[0] def get_wheel_data(self): - return {'re_pos': self.qc.extractor.data.get('wheel_position') or np.array([]), - 're_ts': self.qc.extractor.data.get('wheel_timestamps') or np.array([])} + return {'re_pos': self.qc.extractor.data.get('wheel_position', np.array([])), + 're_ts': self.qc.extractor.data.get('wheel_timestamps', np.array([]))} def create_plots(self, axes, wheel_axes=None, trial_events=None, color_map=None, linestyle=None): @@ -270,8 +271,10 @@ def show_session_task_qc(qc_or_session=None, bpod_only=False, local=False, one=N task.setUp() if local: # currently setUp does not raise on missing data task.assert_expected_inputs(raise_error=True) + trials, _ = task.extract_behaviour(save=False) + # Compute the QC and build the frame - task_qc = task.run_qc(update=False) + task_qc = task.run_qc(trials_data=trials, update=False) qc = QcFrame(task_qc) # Handle trial event names in habituationChoiceWorld