get_choices_by_difficulty_matrix#

get_choices_by_difficulty_matrix(df: DataFrame) → tuple[source]#

The proportion of left choices (first choice) by correct side and difficulty in each session: a psychometric curve per session, to show as colours (see MATRIX_ROWS).

Parameters:

df – prepared trials of one subject (preprocessing.prepare), with session, date, correct_side, difficulty and first_choice.

Returns:

  • p_left: one row per side and difficulty (“left easy” … “right easy”), one column per session (its date); NaN where the session had no such trials (or only trials without a choice),

  • n_trials: trials with a choice in each cell,

  • sessions: one row per session (same order as the columns), with date, day (YYYY-MM-DD), session, current_training_stage, stimulus_modality (several joined by “+”), n_trials and performance (% correct, timeouts count as errors).

Trials without a known side or difficulty (e.g. habituation) count in n_trials and performance of their session but not in the matrix.

Return type:

(p_left, n_trials, sessions)