bidsaid.events.PresentationBlockExtractor.extract_mean_reaction_times

PresentationBlockExtractor.extract_mean_reaction_times(response_map=None, response_type='all', response_trial_names=None)[source]

Extract mean reaction times for each block.

Parameters

response_mapdict[str, int] or None, default=None

A dictionary mapping response codes, from “Stim Type” column (ie. “hit”, “miss”, “other”, “false alarm”, “incorrect”), to accuracy values (0 for incorrect, 1 for correct). Use float("NaN") to exclude a response code from the computation. Required when response_type is “correct” or “incorrect”. When provided with response_type="all", responses mapped to float("NaN") are excluded from the mean reaction time computation.

response_typeLiteral["correct", "incorrect", "all"], default=”all”

Whether to compute mean RT for correct, incorrect, or all trials. When “all”, response_map is not needed.

response_trial_namesIterable[str] or None, default=None

The stimulus trial names within each block to include for the reaction_time computation.

Important

If split_cue_from_block is True, trial types are excluded from this parameter.

Returns

list[float]

A list of mean reaction times for each block.

Note

The reaction time is computed for the first response only. Also, if cue is split from the block, NaN will be assigned for its reaction time.

Example

>>> # Mean RT for all trials with a response
>>> mean_reaction_times = extractor.extract_mean_reaction_times()
>>> # Mean RT for correct trials only
>>> response_map = {"hit": 1, "miss": 0}
>>> mean_reaction_times = extractor.extract_mean_reaction_times(
...     response_map=response_map,
...     response_type="correct",
... )