allensdk.brain_observatory.behavior.criteria module

Functions for calculating mtrain state transitions. If criteria are met, return true. Otherwise, return false.

allensdk.brain_observatory.behavior.criteria.consistency_is_key(session_summary)[source]

need some way to judge consistency of various parameters

  • dprime
  • num trials
  • hit rate
  • fa rate
  • lick timing
allensdk.brain_observatory.behavior.criteria.consistent_behavior_within_session(session_summary)[source]

need some way to measure consistent performance within a session

  • compare peak to overall dprime?
  • variance in rolling window dprime?
allensdk.brain_observatory.behavior.criteria.meets_engagement_criteria(session_summary)[source]

Returns true if engagement criteria were met for the past 3 days, else false. Args:

session_summary (pd.DataFrame): Pandas dataframe with daily values for ‘dprime_peak’ and ‘num_engaged_trials’, ordered ascending by training day, for at least 3 days. If dataframe is not properly ordered, criterion may not be correctly calculated. This function does not sort the data to preserve prior behavior (sorting column was not required by mtrain function) The mtrain implementation created the required columns if they didn’t exist, so a more informative error is raised here to assist end-users in debugging.
Returns:
bool: True if criterion is met, False otherwise
allensdk.brain_observatory.behavior.criteria.mostly_useful(trials)[source]

Returns True if fewer than half the trial time on the last day were aborted trials.

Args: trials (pd.DataFrame): Pandas dataframe with columns ‘training_day’, ‘trial_type’, and ‘trial_length’.
Returns:
bool: True if criterion is met, False otherwise
allensdk.brain_observatory.behavior.criteria.n_complete(threshold, count)[source]

For compatibility with original API. If count >= threshold, return True. Otherwise return False. Args:

threshold (numeric): Threshold for the count to meet. count (numeric): The count to compare to the threshold.
Returns:
True if count >= threshold, otherwise False.
allensdk.brain_observatory.behavior.criteria.no_response_bias(session_summary)[source]

the mouse meets this criterion if their last session exhibited a response bias between 10% and 90%

Args: session_summary (pd.DataFrame): Pandas dataframe with daily values for ‘response_bias’, ordered ascending by training day, for at least 1 day. If dataframe is not properly ordered, criterion may not be correctly calculated. This function does not sort the data to preserve prior behavior (sorting column was not required by mtrain function). The mtrain implementation created the required columns if they didn’t exist, so a more informative error is raised here to assist end-users in debugging.
Returns:
bool: True if criterion is met, False otherwise
allensdk.brain_observatory.behavior.criteria.summer_over(trials)[source]

Returns true if the maximum value of ‘training_day’ in the trials dataframe is >= 40, else false.

allensdk.brain_observatory.behavior.criteria.two_out_of_three_aint_bad(session_summary)[source]

Returns true if 2 of the last 3 days showed a peak d-prime above 2.

Args:
session_summary (pd.DataFrame): Pandas dataframe with daily values for ‘dprime_peak’, ordered ascending by training day, for at least the past 3 days. If dataframe is not properly ordered, criterion may not be correctly calculated. This function does not sort the data to preserve prior behavior (sorting column was not required by mtrain function). The mtrain implementation created the required columns if they didn’t exist, so a more informative error is raised here to assist end-users in debugging.
Returns:
bool: True if criterion is met, False otherwise
allensdk.brain_observatory.behavior.criteria.whole_lotta_trials(session_summary)[source]

Mouse meets this criterion if the last session has more than 300 trials. Args:

session_summary (pd.DataFrame): Pandas dataframe with daily values for ‘num_contingent_trials’, ordered ascending by training day, for at least 1 day. If dataframe is not properly ordered, criterion may not be correctly calculated. This function does not sort the data to preserve prior behavior (sorting column was not required by mtrain function). The mtrain implementation created the required columns if they didn’t exist, so a more informative error is raised here to assist end-users in debugging.
Returns:
bool: True if criterion is met, False otherwise
allensdk.brain_observatory.behavior.criteria.yesterday_was_good(session_summary)[source]

Returns true if the last day showed a peak d-prime above 2 Args:

session_summary (pd.DataFrame): Pandas dataframe with daily values for ‘dprime_peak’, ordered ascending by training day, for at least 1 day. If dataframe is not properly ordered, criterion may not be correctly calculated. This function does not sort the data to preserve prior behavior (sorting column was not required by mtrain function). The mtrain implementation created the required columns if they didn’t exist, so a more informative error is raised here to assist end-users in debugging.
Returns:
bool: True if criterion is met, False otherwise