Skip to content
5 changes: 3 additions & 2 deletions ibllib/io/extractors/ephys_fpga.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,15 +658,16 @@ 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)
table_keys = alfio.AlfBunch.from_df(self.bpod_trials['table']).keys()
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
Expand Down
2 changes: 2 additions & 0 deletions ibllib/pipes/ephys_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions ibllib/pipes/training_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ibllib/qc/alignment_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 9 additions & 6 deletions ibllib/qc/task_qc_viewer/task_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand Down
Loading