ezmsg.sigproc.util.segment#
Segment numbering and config_id for an output fed by more than one input, or reshaped by its stage.
Functions
- async next_pair(state)[source]#
The next
(a, b)for a two-input unit to combine, taken fromstate.queue_aandstate.queue_b.Messages pair in arrival order, except one with no samples (an end-of-stream message): that is paired with a zero-length copy of the other input’s previous message instead, so the unit emits one empty output in the new segment. Before the other input has sent anything there is nothing to base that output on, and the message only updates
state.segments.statealso needsheld_a,last_aandlast_b, all initially None.
Classes
- class ConfigChain(*own)[source]#
Bases:
objectDerives the
config_idof a single input’s output, for a stage whose contribution is fixed.The id is
chain_config_id(config_id, *own), recomputed only when the input’sconfig_idchanges, so a steady stream costs one comparison per message. An undeclared input (0) gives an undeclared output. Build a new one whereverownchanges (for a stateful stage: at reset).
- class ConfigJoin[source]#
Bases:
objectDerives the
config_idof an output that combines several inputs, or whose layout its stage changes.The id is
chain_config_id(*config_ids, *own), recomputed only when an input’sconfig_idorown(whatever the stage itself contributes to the output layout) changes. If any input does not declare one (0), neither does the output.
- class SegmentJoin[source]#
Bases:
objectNumbers the segments of an output that combines several inputs.
The output starts a new segment whenever any input’s
segmentchanges. Its number is this counter’s own, starting at 0, not any input’s: two inputs’ counters cannot be merged into one, only their changes can.
- class SettingsConfigChain[source]#
Bases:
objectMixin for a stateless transformer whose settings decide how it changes the output layout.
Stamp
self._chained_config_id(message)on the output, and return from_config_own()what determines that change. The derived id is cached on the input’sconfig_idand dropped on a settings change:update_settingscalls_request_reset, otherwise a no-op on a stateless processor.