bidsaid.events.EPrimeEventExtractor.extract_reaction_times
- EPrimeEventExtractor.extract_reaction_times(reaction_time_column_name)[source]
Extract the reaction time for each event.
Parameters
- reaction_time_column_name
str The name of the column containing reaction time values. Usually the column name ending in “.RT”.
Returns
- list[float]
A list of reaction times for each event. NaN for trials where the subject did not respond.
Notes
This function returns all reaction times as is, regardless of whether the trial was correct or incorrect, or whether the subject was expected to respond or not. Filter the resulting DataFrame based on trial type and response if needed.
Example
>>> rts = extractor.extract_reaction_times("Stimulus.RT") >>> responses = extractor.extract_accuracies( ... subject_response_column="Stimulus.RESP", ... correct_response_column="Stimulus.CRESP", ... ) >>> # Filter to only correct Go trials: >>> df = pd.DataFrame({"rt": rts, "trial_type": trial_types, "response": responses}) >>> correct_go_rts = df[(df["trial_type"] == "Go") & (df["response"] == 1)]["rt"]
- reaction_time_column_name