SpectralEntropy
Spectral entropy: how flat the power spectrum is, tone to noise.
data
entropy
- Type name
signal:SpectralEntropy- Plane
signal- Tags
analysis- Language
python- Tier
in-process- Bundle
complexity- Source
node-bundles/complexity/spectral_entropy.py- Availability
- available
Slots
| Slot | Direction | Type | |
|---|---|---|---|
data | input | ARRAY | |
entropy | output | ARRAY |
Parameters
spectral
| Name | Type | Default | Range | Doc |
|---|---|---|---|---|
method | string | welch | welch | fft | Welch averages sub-windows; fft takes the whole frame at once. |
normalize | bool | true | Scale to 0..1 against a flat spectrum. |
common
| Name | Type | Default | Range | Doc |
|---|---|---|---|---|
autotrigger | bool | false | Run on the node's own schedule, instead of waiting for an input frame. Turn this on for sources; leave it off for transforms driven by their input. | |
max_frequency | float | 0 | 0 … 100 | Rate cap for this node, read through `frequency_mode`. 0 means uncapped — the node runs as often as the scheduler and its inputs allow. |
frequency_mode | string | updates_per_second | updates_per_second | seconds_per_update | How to read `max_frequency`: as a rate in Hz (updates per second), or as a period in seconds between updates — convenient for very slow nodes. |
Source
The current source of this node, as it stands in the goofi repository at node-bundles/complexity/spectral_entropy.py.
"""SpectralEntropy — how flat the power spectrum is, from antropy.
A pure tone is near 0 and white noise near 1, so this reads as "how noise-like". The last axis is
time and is consumed; every axis before it survives. antropy vectorizes this one itself.
"""
import antropy
import numpy as np
import goofi
class SpectralEntropy(goofi.Node):
"""Spectral entropy: how flat the power spectrum is, tone to noise."""
TAGS = ["analysis"]
INPUTS = {"data": goofi.InputSlot(goofi.DataType.ARRAY, required=True)}
OUTPUTS = {"entropy": goofi.DataType.ARRAY}
PARAMS = {
"spectral": {
"method": goofi.StringParam(
"welch", ["welch", "fft"], doc="Welch averages sub-windows; fft takes the whole frame at once."
),
"normalize": goofi.BoolParam(True, doc="Scale to 0..1 against a flat spectrum."),
}
}
def process(self, data):
p = self.params.spectral
# Without a stamped rate the bins are cycles per sample. That shifts every frequency by the
# same factor, and the measure only reads the SHAPE of the spectrum, so it is unharmed.
sfreq = data.meta.get("sfreq") or 1.0
return antropy.spectral_entropy(
np.asarray(data.data, dtype=np.float64),
sf=sfreq,
method=p.method,
normalize=p.normalize,
axis=-1,
).astype(np.float32)This reference describes goofi 3.1.0(537cd394), generated from a running instance on 2026-09-06.