add_win_stay_lose_switch_columns#
- add_win_stay_lose_switch_columns(df: DataFrame) DataFrame[source]#
Adds, to each trial, what happened in the trial before (of the same subject and session) and whether the mouse chose the same side again:
previous_outcome: “win” if the previous trial was correct, “loss” if it was an error with a choice, None otherwise (first trial of the session, or no choice: miss or timeout).
stay: 1 if the first choice is the same side as the first choice of the previous trial, 0 if it is the other side, NaN if one of them made no choice.
Needs: subject, session, first_choice, correct (prepared data, see preprocessing.prepare).