Skip to content

Operations

Each call uploads its input, runs, and returns NumPy.

import dspk
y = dspk.ops.filter.iir(x, 30_000.0, "bandpass", (300.0, 6000.0))
y = dspk.ops.spatial.cmr(y)

Two separate calls move the data to the device and back twice. A Pipeline does one upload, every stage, one download.

from dspk.ops import Pipeline, stage
chain = Pipeline([stage.iir("bandpass", (300.0, 6000.0)), stage.cmr()], 30_000.0)
y = chain.process(x)

stream=True treats chunks as consecutive pieces of one signal. Filter state carries over, so the output equals processing the whole signal at once. It needs causal filters:

chain = Pipeline([stage.iir("highpass", 300.0, mode="forward"), stage.cmr()], 30_000.0, stream=True)
for chunk in chunks:
y = chain.process(chunk)

Without stream, each chunk stands alone, and settling says how much context it needs to match the whole signal.

Every call takes runtime="cuda" and so on, or set one for everything with dspk.runtime.set.

See Operations for what’s available.