A first filter
The same 300 Hz high-pass, four ways. Data is always (channels, samples).
import numpy as npimport dspk
x = np.random.default_rng(0).standard_normal((4, 30_000)).astype(np.float32)spikes = dspk.ops.filter.iir(x, 30_000.0, "highpass", 300.0)spikes.shape # (4, 30000)use dspk::core::compute::ComputeTarget;use dspk::ops::core::buffer;use dspk::ops::{Pipeline, PipelineStage};
let client = ComputeTarget::from_env()?.client()?;let (channels, samples, fs) = (4, 30_000, 30_000.0);let x = vec![0.0_f32; channels * samples];
let mut pipeline = Pipeline::new();pipeline.add(PipelineStage::highpass(300.0));pipeline.validate(fs)?;
let input = buffer::upload(&client, &x);let output = pipeline.execute::<f32>(&client, &input, channels, samples, fs)?;let y: Vec<f32> = buffer::download(&client, output);A spec works on files. Save it as highpass.toml and run dspk run highpass.toml.
dspk_pipeline = 1edges = [["raw", "hp"], ["hp", "out"]]
[nodes.raw]op = "read"path = "recording.bin"
[nodes.hp]op = "iir"band = "highpass"cutoff = [300.0]
[nodes.out]op = "write"path = "filtered.zarr"format = "zarr"- Open a recording with File → Open.
- In the Inspector on the right, under processing, use Add op → Filter → IIR and pick the preset Spikes · high-pass 300 Hz.
- The view previews the result on the device, and updates as you change the values.
That’s the shape of every operation: data in, the same shape out, on the device.
Where next:
- Concepts explains what happens underneath.
- Operations lists everything you can run.