trial_events#

Reading the events of one trial (a row): first and last choice, reaction time, center port holds, misses. Event columns (Port1In, STATE_*_START…) can be lists or text such as “[1.2, 3.4]”.

Functions

add_time_from_session_start

early_pokeout_from_events

True if the first center poke was shorter than holding_time (None if unknown).

first_choice_from_events

Side of the first side poke after the stimulus started (None if no poke).

first_poke_after_stimulus_state

get_dictionary_event_as_list

get_last_poke_before_stimulus_state

Sometimes the animal can poke in the center port and not wait long enough to get the stimulus state.

get_last_poke_of_trial

get_previous_row_index

get_repeat_or_alternate_to_numeric

get_start_and_end_times

Get the start and end times of the session.

get_trial_port_hold

This calculates everything, including those occurring in the ITIs for example.

initiation_time_from_events

Time from the start of the trial to the first center poke (NaN if none).

is_this_a_miss_trial

checks if STATE_stimulus_state_END is the last state

is_this_an_early_pokeout_trial

checks if there was an early pokeout in the center port before holding the required time

last_choice_before_stimulus_from_events

Side of the last side poke before the stimulus started (None if no poke).

miss_from_events

True if the trial ended when the stimulus state ended (no choice).

parse_event_column

parse_events for every trial of a column ([] for every trial if the column is missing).

parse_events

Times of one event in one trial, as a list of floats ([] if none).

port_holds_from_events

Duration of every poke in a port during the trial (including the ITI).

reaction_time_from_events

Time from the last center poke out to the next side poke (NaN if none).

side_and_difficulty_to_numeric

transform_side_choice_to_numeric

trial_initiation_time

This method calculates the initiation time of a trial.

trial_reaction_time

This method calculates the reaction time of a trial.

Classes

EventColumns(df)

Event columns of a dataframe, read with parse_events.