overview#

Tables and figures of the overview page of the daily report (village-report-generator), one function per report cell.

They take the trials of all the subjects of a project, prepared with preprocessing.prepare (or analyze_df). None of them raises: if something fails, they return a figure that says what failed (and log the error), so that one broken cell does not stop the report.

Performance counts timeouts (correct = None) as errors, as in the figures (see data_format_changes.py).

Functions

box_occupancy_figure

Percentage of each day the box was used, the hours of the day it was used, and which mouse used it after which (an arrow from A to B: B started a session right after A).

cohort_trials_and_performance_figure

Number of trials and performance per day of the whole cohort, by training stage.

daily_trials_and_performance

Trials, performance and misses of each subject per day and training stage.

failed_cells

The report cells that failed (and showed a message instead) so far.

group_trials

At most max_points points per subject: consecutive trials are grouped (as few per group as needed) and each group is one point, at the last trial of the group (total_trial) with the mean of column.

last_days

Trials and performance of each subject in the last n_days days with data, one column per day ("trials_<day>", "performance_<day>").

last_days_table

last_hours

The trials that started in the last hours before the last trial of df (of any subject).

never_raises

Decorator: if the function raises, log the error and return a figure (kind "plotly" or "matplotlib") with the message instead.

performance_over_trials_figure

Performance through the trials of every subject (interactive), with at most max_points points per subject (see group_trials), so that the size of the report does not grow with the number of trials.

problems_table

The figure panels that failed, e.g. {"NUO003": fig.panel_problems, ...}.

reset_failed_cells

stage_performance_figure

Performance against the number of trials done in each training stage (bins of bin_size trials), a plot per stage (Habituation left out): the mean of the mice (with its 95% confidence interval) in the colour of the stage, and each mouse as a thin line (not in the "publication" style).

strategies_figure

Win-stay / lose-switch and side / alternation bias of each mouse in the last hours (before the last trial of df), a point per mouse with its colour of the overview.

subject_colors

A colour per subject (in alphabetical order), the same in every figure of the overview.

trials_by_stage

Number of trials of each subject in each training stage (stages in order of appearance).

trials_by_stage_table

tv_report_table

Detections, sessions, water and weight of each subject in the last hours.