Decimator

class gpype.backend.timing.decimator.Decimator[source]

Bases: IONode

Decimator node for downsampling data streams.

Reduces data rate by outputting only every Nth sample based on decimation factor. Adjusts sampling rate and frame size in output context accordingly.

class Configuration[source]

Bases: Configuration

class Keys[source]

Bases: Keys

__init__(decimation_factor=1, **kwargs)[source]

Initialize decimator with decimation factor.

Parameters:
  • decimation_factor (int) – Factor by which to reduce data rate. Must be positive integer. Value of 1 means no decimation.

  • **kwargs – Additional arguments for parent IONode.

setup(data, port_context_in)[source]

Setup output context with adjusted sampling rate and frame size.

Parameters:
  • data (dict[str, ndarray]) – Input data arrays.

  • port_context_in (dict[str, dict]) – Input port contexts containing frame size and sampling rate information.

Return type:

dict[str, dict]

Returns:

Output port contexts with decimated sampling rate.

Raises:

ValueError – If frame_size is not provided or doesn’t match decimation_factor.

step(data)[source]

Process one step of decimation.

Parameters:

data (dict) – Input data dictionary containing data to be decimated.

Returns:

Dictionary with last sample of input data if decimation step, None otherwise.