prepare#
- prepare(df_in: DataFrame, include_early_pokeouts: bool = True) DataFrame[source]#
Prepares the trials of one or several subjects for any analysis or figure.
Every analysis and figure of the package reads the columns added here, so they do not depend on what the caller ran before. It can be called on data that was prepared already (only the missing columns are added), and on a subset of prepared data (e.g. one day), keeping the values computed on the whole history (such as total_trial).
It:
fills missing task information and converts old names to the current ones (fill_missing_data, see data_format_changes.py),
reads the event columns (Port1In, STATE_*_START…) once,
adds: year_month_day, total_trial (per subject), trial_of_day, miss_trial, first_choice, last_choice, last_choice_before_stimulus, previous_port_before_stimulus, roa_choice, roa_choice_numeric, early_pokeout (None if it cannot be computed), reaction_time, time_between_trials, trial_duration and port2_holds.
Event columns are left as they are (text in the .csv).