ezmsg.event.binned#
Bin an event stream into a lower-rate count (or rate) signal.
The binning is delegated to
ezmsg.sigproc.binned_aggregate.BinnedAggregate so this shares one
bin-boundary implementation with every other consumer of that binner. With
fractional=True (the default) bins span a fractional bin_duration * fs
samples with a carry accumulator and are labelled with the nominal
bin_duration gain; with fractional=False they span a fixed
int(bin_duration * fs) samples (sample-locked, matching
ezmsg.sigproc.window.Window). Because the grid comes from the shared
binner, two streams binned this way at the same bin_duration land on the
same grid for any input rate and can be aligned downstream (e.g. with
ezmsg.sigproc.merge.Merge).
Sparse sparse.COO inputs (e.g. the default
ezmsg.event.peak.ThresholdCrossing output) are densified to per-sample
contributions before binning; dense inputs are used as is. Set
scale_by_value=True to weight each event by its stored value instead of
counting occurrences, and scale_output=True to divide the per-bin count by
bin_duration (events/second).
Classes
- class BinnedEventAggregator(*args, **kwargs)[source]#
Bases:
BaseTransformer[BinnedEventAggregatorSettings,AxisArray,AxisArray]Count events per fixed-duration bin, delegating binning to sigproc.
The per-bin reduction, carry across message boundaries, and output time axis all come from
BinnedAggregateTransformer; this wrapper only converts events to per-sample contributions and optionally rate-normalizes.
- class BinnedEventAggregatorSettings(bin_duration: float = 0.05, scale_output: bool = True, axis: str = 'time', fractional: bool = True, scale_by_value: bool = False)[source]#
Bases:
Settings- Parameters:
- fractional: bool = True#
If True (default), bins span a fractional
bin_duration * fssamples viaBinnedAggregateand are labelled with the nominalbin_durationgain. If False, bins span a fixedint(bin_duration * fs)samples (sample-locked). SeeBinnedAggregate.
- class BinnedEventAggregatorUnit(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[BinnedEventAggregatorSettings,AxisArray,AxisArray,BinnedEventAggregator]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
BinnedEventAggregatorSettings