brain_pipe.preprocessing.brain.trigger.AlignPeriodicBlockTriggers¶
- class AlignPeriodicBlockTriggers(brain_trigger_processing_fn=<function AlignPeriodicBlockTriggers.<lambda>>, postprocessing_fn=<function default_drift_correction>, data_key='data', data_trigger_key='trigger_data', data_sampling_rate_key='eeg_sfreq', stimulus_trigger_data_key='trigger_data', stimulus_trigger_sampling_rate_key='trigger_sr')¶
Bases:
PipelineStep
Align the trigger pulses in the form of periodic blocks.
- __init__(brain_trigger_processing_fn=<function AlignPeriodicBlockTriggers.<lambda>>, postprocessing_fn=<function default_drift_correction>, data_key='data', data_trigger_key='trigger_data', data_sampling_rate_key='eeg_sfreq', stimulus_trigger_data_key='trigger_data', stimulus_trigger_sampling_rate_key='trigger_sr')¶
Create a new MatchTriggersToStimulus instance.
Methods
__init__
([brain_trigger_processing_fn, ...])Create a new MatchTriggersToStimulus instance.
get_trigger_indices
(triggers)Get the indices of the triggers.
parse_dict_keys
(key[, name, ...])Parse a key or a sequence of keys.
split_epochs
(brain_trigger_indices, ...)Split the EEG data into epochs.
- get_trigger_indices(triggers: ndarray) ndarray ¶
Get the indices of the triggers.
- Parameters:
triggers (np.ndarray) – Raw trigger data. Should be a 1D array of 0s and 1s.
- Returns:
Indices of the triggers.
- Return type:
np.ndarray
- 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.
- split_epochs(brain_trigger_indices, brain_fs, nb_epochs)¶
Split the EEG data into epochs.
- Parameters:
brain_trigger_indices (np.ndarray) – Indices of the triggers in the EEG data.
nb_epochs (int) – Number of epochs to split the EEG data into.
- Returns:
EEG data split into epochs.
- Return type:
Sequence[np.ndarray]