Hold

class gpype.backend.timing.hold.Hold[source]

Bases: IONode

Classical sample-and-hold node for arbitrary resampling.

Implements sample-and-hold behavior where input is forwarded to output and remains asynchronously available for retrieval at any rate.

__init__(**kwargs)[source]

Initialize sample-and-hold node with asynchronous output.

Parameters:

**kwargs – Additional arguments for parent IONode.

setup(data, port_context_in)[source]

Setup asynchronous output context for sample-and-hold operation.

Removes sampling rate constraints from output context, enabling downstream nodes to access held values at any desired rate.

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

  • port_context_in (dict[str, dict]) – Input port contexts containing channel count and frame size.

Return type:

dict[str, dict]

Returns:

Output port contexts with asynchronous timing and no sampling rate.

Raises:

ValueError – If channel count or frame size not provided, or if frame size is not 1.

step(data)[source]

Forward input sample and hold for asynchronous retrieval.

Implements the hold operation by making input data available on output where it remains accessible until the next update.

Parameters:

data (dict[str, ndarray]) – Input data dictionary containing sample to hold.

Return type:

dict[str, ndarray]

Returns:

Dictionary with held sample on output port.