brain_pipe.preprocessing.brain.link.LinkStimulusToBrainResponse¶
- class LinkStimulusToBrainResponse(stimulus_data: ~typing.Sequence[~typing.Dict[str, ~typing.Any]] | ~brain_pipe.pipeline.base.PipelineStep, extract_stimuli_information_fn=<brain_pipe.preprocessing.brain.link.BIDSStimulusInfoExtractor object>, comparison_fn=<brain_pipe.preprocessing.brain.link.BasenameComparisonFn object>, stimulus_path_key='stimulus_path', stimuli_key='stimuli', grouper: ~brain_pipe.utils.path.BIDSStimulusGrouper | None = None, key_fn_for_multiprocessing=<function default_multiprocessing_key_fn>, *args, **kwargs)¶
Bases:
PipelineStep
Link stimulus to Brain data.
Attributes
multiprocessing_condition
multiprocessing_dict
- __init__(stimulus_data: ~typing.Sequence[~typing.Dict[str, ~typing.Any]] | ~brain_pipe.pipeline.base.PipelineStep, extract_stimuli_information_fn=<brain_pipe.preprocessing.brain.link.BIDSStimulusInfoExtractor object>, comparison_fn=<brain_pipe.preprocessing.brain.link.BasenameComparisonFn object>, stimulus_path_key='stimulus_path', stimuli_key='stimuli', grouper: ~brain_pipe.utils.path.BIDSStimulusGrouper | None = None, key_fn_for_multiprocessing=<function default_multiprocessing_key_fn>, *args, **kwargs)¶
Create a new LinkStimulusToEEG instance.
- Parameters:
stimulus_data_dicts (Sequence[Dict[str, Any]]) – A sequence of data dicts containing the stimulus data.
find_stimulus_fn (Callable[[str], Sequence[str]]) – A function that takes the path to the EEG recording and returns a sequence of corresponding stimulus paths.
comparison_fn (Callable[[Dict[str, Any], str], bool]) – A function that takes a data dict and a stimulus path and returns True if the data dict corresponds to the stimulus path.
stimulus_path_key (str) – The key in the data dict that contains the path to the stimulus.
stimuli_key (str) – The key in the data dict that contains the stimulus data.
pipeline_cache (Optional[PipelineCache]) – The pipeline cache to use to load the stimulus data dict if necessary. This is only necessary if the stimulus data dicts are cached.
Methods
__init__
(stimulus_data[, ...])Create a new LinkStimulusToEEG instance.
parse_dict_keys
(key[, name, ...])Parse a key or a sequence of keys.
- parse_dict_keys(key: str | Sequence[str] | Mapping[str, str], name='key', require_ordered_dict=False) OrderedDict[str, str] ¶
Parse a key or a sequence of keys.
- Parameters:
- Returns:
A mapping of input keys to output keys.
- Return type:
- Raises:
TypeError – If the key is not a string, a sequence of strings or a mapping of strings. If the key is a mapping but require_ordered_dict is True and the mapping is not an OrderedDict.