brain_pipe.preprocessing.resample.ResamplePoly

class ResamplePoly(target_frequency: int | float, data_key: str | Sequence[str] = 'data', sampling_frequency_key: str | Sequence[str] = 'data_fs', copy_data_dict: bool = False, *resample_args: Any, **resample_kwargs: Any)

Bases: PipelineStep

Resample data to a target frequency with polyphase filtering.

Notes

Uses scipy.signal.resample_poly.

__init__(target_frequency: int | float, data_key: str | Sequence[str] = 'data', sampling_frequency_key: str | Sequence[str] = 'data_fs', copy_data_dict: bool = False, *resample_args: Any, **resample_kwargs: Any)

Create a new ResamplePoly instance.

Parameters:
  • data_key (Union[str, Sequence[str]]) – Keys in the data dict containing the data to resample.

  • sampling_frequency_key (Union[str, Sequence[str]]) – Keys in the data dict containing the sampling frequency of the data.

  • target_frequency

  • resample_args

  • resample_kwargs

Methods

__init__(target_frequency[, data_key, ...])

Create a new ResamplePoly 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:
  • key (Union[str, Sequence[str], Mapping[str,str]]) – A key or a sequence of keys.

  • name (str) – The name of the key. Used for error messages.

  • require_ordered_dict (bool) – If True, the key must be an OrderedDict. If False, the key can also be an ordinary dict.

Returns:

A mapping of input keys to output keys.

Return type:

OrderedDict[str, str]

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.