Skip to content

radiens_core.models.dsp

Digital Signal Processing (DSP) domain models and enums.

CLASS DESCRIPTION
DSPGroup

Group of DSP filter stages, organized by hardware/software layers.

DSPParams

Configuration parameters for a single DSP filter stage.

DSPParamsDict

Typed dict shorthand for DSPParams.

DSPType

Digital Signal Processing filter type.

FilterFamily

IIR filter design family.

FilterStage

Digital Signal Processing filter stage.

FreqSpecBand

Frequency band specification for filters.

ATTRIBUTE DESCRIPTION
FlexDSPParams

DSPParams that also accepts a DSPParamsDict typed-dict shorthand.

FlexDSPType

DSPType that also accepts a string name (case-insensitive) or int value.

FlexFilterFamily

FilterFamily that also accepts a string name (case-insensitive) or int index.

FlexFilterStage

FilterStage that also accepts a string name (case-insensitive) or int index.

Attributes

FlexDSPParams module-attribute

FlexDSPParams = DSPParams | DSPParamsDict

DSPParams that also accepts a DSPParamsDict typed-dict shorthand.

In set_dsp_group, the dict may leave out stage.

Example
allego.set_dsp_group(stage="stage1", params=[{"type": "highpass", "freq": 300.0, "port": "A"}])

FlexDSPType module-attribute

FlexDSPType = DSPType | DSPTypeStr | int

DSPType that also accepts a string name (case-insensitive) or int value.

FlexFilterFamily module-attribute

FlexFilterFamily = FilterFamily | FilterFamilyStr | int | None

FilterFamily that also accepts a string name (case-insensitive) or int index.

FlexFilterStage module-attribute

FlexFilterStage = FilterStage | FilterStageStr | int

FilterStage that also accepts a string name (case-insensitive) or int index.

Classes

DSPGroup

Bases: BaseModel

Group of DSP filter stages, organized by hardware/software layers.

ATTRIBUTE DESCRIPTION
hardware

List of hardware filter stages.

TYPE: list[DSPParams]

software_stage1

List of software stage 1 filters.

TYPE: list[DSPParams]

software_stage2

List of software stage 2 filters.

TYPE: list[DSPParams]

DSPParams

Bases: BaseModel

Configuration parameters for a single DSP filter stage.

Set at most one of freq, freq_spec_band and ref_ntv_chan_idx: the one the filter type uses.

ATTRIBUTE DESCRIPTION
type

DSP filter type. Also accepts string names (e.g. "highpass").

TYPE: DSPType | DSPTypeStr

stage

DSP filter stage. Also accepts string names or int index. set_dsp_group() puts every filter in its own stage= argument and ignores this.

TYPE: FilterStage | FilterStageStr | int

freq

Cutoff frequency in Hz, for lowpass and highpass; center frequency for notch.

TYPE: float | None

freq_spec_band

Passband or stopband, for bandpass and bandstop.

TYPE: FreqSpecBand | None

ref_ntv_chan_idx

Native index of the reference channel, for virtual and paired references.

TYPE: int | None

notch_bandwidth

Notch width in Hz. Required, and positive, for a notch.

TYPE: float | None

user_label

User-defined label for the filter. Defaults to "".

TYPE: str

port

Amplifier port the filter applies to. Ignored when is_aux is set. Also accepts string name or int index.

TYPE: Port | PortStr | int

target_ntv_chan_idx

Native index of the channel a paired reference is applied to. Required for a paired reference.

TYPE: int | None

is_aux

Whether the filter applies to an analog input (AIN) channel rather than an amplifier port. Defaults to False.

TYPE: bool

aux_chan_idx

Native index of the AIN channel. Required when is_aux is set.

TYPE: int | None

filter_order

Filter order.

TYPE: int | None

zero_phase

Not supported; set_dsp_group() raises ValueError for True. Defaults to False.

TYPE: bool

force_sos

Whether to force second-order sections. Ignored for notch filters. Defaults to False.

TYPE: bool

family

IIR design family. Defaults to None, which designs a Butterworth. Ignored for notch and referencing filters.

TYPE: FilterFamily | FilterFamilyStr | int | None

ripple_db

Chebyshev-I passband ripple in dB. None uses 0.05 dB for Chebyshev-I; unused for Butterworth.

TYPE: float | None

DSPParamsDict

Bases: TypedDict

Typed dict shorthand for DSPParams.

The type and port keys are required; all other keys are optional, stage included.

Example
{"type": "highpass", "freq": 300.0, "port": "A"}
{"type": "bandpass", "freq_spec_band": {"low_freq": 300.0, "high_freq": 5000.0}, "port": "B"}

DSPType

Bases: IntEnum

Digital Signal Processing filter type.

FilterFamily

Bases: IntEnum

IIR filter design family.

FilterStage

Bases: IntEnum

Digital Signal Processing filter stage.

ATTRIBUTE DESCRIPTION
STAGE_HARDWARE

Filters on the acquisition hardware. Recorded samples include them.

STAGE1

Software filters applied before recording. Recorded samples include them.

STAGE2

Software filters applied when data is read, never stored. KPI metrics, spike detection, and get_signals(apply_dsp=True) all use this stage.

FreqSpecBand

Bases: BaseModel

Frequency band specification for filters.

ATTRIBUTE DESCRIPTION
low_freq

Low frequency in Hertz.

TYPE: float

high_freq

High frequency in Hertz.

TYPE: float