ezmsg.sigproc.bandpower#

Spectral band power estimation via windowed FFT and aggregation.

Functions

bandpower(spectrogram_settings, bands=[(17, 30), (70, 170)], aggregation=AggregationFunction.MEAN, materialize=MaterializeMode.ASYNC)[source]#

Calculate the average spectral power in each band.

Returns:

BandPowerTransformer

Parameters:
Return type:

BandPowerTransformer

Classes

class BandPower(*args, settings=None, **kwargs)[source]#

Bases: BaseTransformerUnit[BandPowerSettings, AxisArray, AxisArray, BandPowerTransformer]

Parameters:

settings (Settings | None)

SETTINGS#

alias of BandPowerSettings

class BandPowerSettings(spectrogram_settings=<factory>, bands=<factory>, aggregation=AggregationFunction.MEAN, materialize=MaterializeMode.ASYNC)[source]#

Bases: Settings

Settings for BandPower.

Parameters:
spectrogram_settings: SpectrogramSettings#

Settings for spectrogram calculation.

bands: list[tuple[float, float]] | None#

(min, max) tuples of band limits in Hz.

aggregation: AggregationFunction = 'mean'#

AggregationFunction to apply to each band.

materialize: MaterializeMode = 'async'#

How to evaluate the output on a lazy backend (MLX); see MaterializeMode. No-op elsewhere.

Defaults to ASYNC: this node’s output is the end of a spectrogram chain, so evaluating it here keeps a lazy graph from accumulating even if nothing downstream forces it – but the caller has no need of the values on the host, so there is nothing to block for. Set OFF if a downstream node already materializes every cycle, or SYNC to time this stage’s work as its own.

__init__(spectrogram_settings=<factory>, bands=<factory>, aggregation=AggregationFunction.MEAN, materialize=MaterializeMode.ASYNC)#
Parameters:
Return type:

None

class BandPowerTransformer(*args, **kwargs)[source]#

Bases: CompositeProcessor[BandPowerSettings, AxisArray, AxisArray]