allensdk.brain_observatory.behavior.session_metrics module

allensdk.brain_observatory.behavior.session_metrics.num_contingent_trials(session_trials)[source]

Returns the number of “go” and “catch” trials in a training session dataframe. Args:

session_trials (pandas.DataFrame): a pandas.DataFrame describing behavior training trials, with the string column “trial_type” describing the type of trial.

Returns (int): Number of “go” and “catch” trials

allensdk.brain_observatory.behavior.session_metrics.response_bias(trials, detect_col, trial_types=('go', 'catch'))[source]

Calculate the response bias for a subset of trial types from a behavioral training dataframe. Args:

trials (pandas.DataFrame): Dataframe containing trial-level information
from a behavioral training session. Required columns: “trial_type”, detect_col.
detect_col (str): Name of column containing boolean
or numeric codings (0/1) for whether or not the mouse had a response.
trial_types (iterable<str>): Iterable containing string trial types
to check for the response bias. Trials of types not included in this iterable will be ignored. Default=(“go”, “catch”)
Return:
The response bias (or average value of the detect_col) for trials in trial_types.