brain_pipe.preprocessing.filter.SosFiltFilt¶
- class SosFiltFilt(filter_, data_key='data', emulate_matlab=True, *sosfiltfilt_args, copy_data_dict=False, **sosfiltfilt_kwargs)¶
Bases:
PipelineStep
Filter data with a second-order section filter.
Notes
Wrapper for
scipy.signal.sosfiltfilt()
.- __init__(filter_, data_key='data', emulate_matlab=True, *sosfiltfilt_args, copy_data_dict=False, **sosfiltfilt_kwargs)¶
Create a SosFiltFilt instance.
- Parameters:
filter (np.ndarray or Callable) – Array of second-order filter coefficients, must have shape (n_sections, 6). Each row corresponds to a second-order section, with the first three columns providing the numerator coefficients and the last three providing the denominator coefficients. See also the documentation on
data_key
emulate_matlab
sosfiltfilt_args
copy_data_dict
sosfiltfilt_kwargs
Methods
__init__
(filter_[, data_key, ...])Create a SosFiltFilt instance.
get_matlab_arguments
(filter_, ...)Mimick MATLAB's sosfiltfilt arguments.
parse_dict_keys
(key[, name, ...])Parse a key or a sequence of keys.
- get_matlab_arguments(filter_, sosfiltfilt_args, sosfiltfilt_kwargs)¶
Mimick MATLAB’s sosfiltfilt arguments.
- Parameters:
filter (np.ndarray) – Array of second-order filter coefficients, must have shape (n_sections, 6).
sosfiltfilt_args (Sequence[Any]) – Arguments passed to sosfiltfilt.
sosfiltfilt_kwargs (Dict[str, Any]) – Keyword arguments passed to sosfiltfilt.
- Returns:
The arguments and keyword arguments to pass to sosfiltfilt to mimick MATLAB’s sosfiltfilt.
- Return type:
Tuple[Sequence[Any], Dict[str, Any]]
- 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.