Skip to content

Commit

Permalink
Merge pull request #683 from int-brain-lab/behavior_qc
Browse files Browse the repository at this point in the history
Behavior qc
  • Loading branch information
juhuntenburg authored Jan 3, 2024
2 parents b2618a6 + 79141a5 commit 98043b9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ibllib/pipes/behavior_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,26 @@ def signature(self):
}
return signature

def _behaviour_criterion(self, update=True):
def _behaviour_criterion(self, update=True, truncate_to_pass=True):
"""
Computes and update the behaviour criterion on Alyx
"""
from brainbox.behavior import training

trials = alfio.load_object(self.session_path.joinpath(self.output_collection), 'trials')
trials = alfio.load_object(self.session_path.joinpath(self.output_collection), 'trials').to_df()
good_enough = training.criterion_delay(
n_trials=trials["intervals"].shape[0],
n_trials=trials.shape[0],
perf_easy=training.compute_performance_easy(trials),
)
if truncate_to_pass and not good_enough:
n_trials = trials.shape[0]
while not good_enough and n_trials > 400:
n_trials -= 1
good_enough = training.criterion_delay(
n_trials=n_trials,
perf_easy=training.compute_performance_easy(trials[:n_trials]),
)

if update:
eid = self.one.path2eid(self.session_path, query_type='remote')
self.one.alyx.json_field_update(
Expand Down

0 comments on commit 98043b9

Please sign in to comment.