Filter Sandbox
Flagship: live filter design on real 10-s traces, with the trace, spectrum, impulse and step response updating as you drag cutoffs and order.
3 claims on this page are unverified. TODO(confirm) marks a specific statement the author has not yet checked against a
primary source. Everything else on this page has been reviewed. Treat a marked claim as
provisional and go to the cited source rather than quoting the sentence.
Modes: basic · notch · pipeline · causal — the widget below runs in basic. Use Share state to put the exact view in the URL.
What it does
Drag cutoffs, order and transition bandwidth on a real 10-second EEG trace and watch four views update live: the filtered trace over the original, the spectrum before and after, the filter’s impulse response and its step response. Switch between FIR and IIR designs and between causal and zero-phase application. A canned electrode pop shows ringing; a blink shows what a high-pass does to a slow transient; a line-noise trace with harmonics shows what a notch does and does not remove. All filtering runs in the browser using the site’s own DSP library (src/lib/dsp/), which is tested against SciPy reference outputs.
Controls
| Control | What it sets |
|---|---|
| Trace | Which recording to filter: clean eyes-closed (occipital), electrode pop, blink, line noise with harmonics, or an 8-channel segment |
| Filter type | Low-pass, high-pass, band-pass, band-stop (notch in notch mode) |
| Cutoff(s) | Low and/or high cutoff in Hz |
| Order / transition band | IIR order, or FIR transition bandwidth (which sets filter length) |
| FIR / IIR | Windowed-sinc FIR (MNE-style firwin) or Butterworth IIR (second-order sections) |
| Causal / zero-phase | Single forward pass, or forward–backward (filtfilt) application |
| Notch width, harmonics | (notch mode) width of the notch and how many harmonics to remove |
| Pipeline stage | (pipeline mode) where the filter sits relative to epoching and the ICA fit |
What to look for
basic
- A sharper cutoff (higher order or narrower transition band) produces a longer, more oscillatory impulse response.
- Zero-phase filtering spreads the ringing around the electrode pop to both sides; causal filtering puts it only after, and delays the whole trace.
- Raising a high-pass from 0.1 Hz toward 1 Hz and above visibly reshapes the blink and adds opposite-polarity deflections around it.
- The spectrum shows what the filter removed; the trace shows what it did to the timing.
notch
- A narrow notch removes the 60 Hz line and leaves the flanks intact; a wide or high-order notch carves a hole and rings around the pop.
- Harmonics below the Nyquist frequency need their own notches; those above it cannot be addressed at their true frequency.
pipeline
- The same high-pass applied to a short epoch shows edge artifacts that the continuously filtered version does not.
- The 1 Hz “ICA-fit” copy and the 0.1 Hz “analysis” copy are different data; the unmixing matrix travels between them, the filtered signal does not.
causal
- Causal group delay is visible as a lag between original and filtered traces; it grows with FIR length and with IIR order at low frequencies.
Used in
- L1.5 Filters: FIR, IIR, and what they do to your data (
basic) - L1.6 Line noise (
notch) - L2.4 Filtering in practice (
pipeline) - L7.3 Real-time processing and neurofeedback (
causal)
Data provenance
All traces are derivatives (cropped, single-channel or channel-subset, unfiltered unless stated) of public datasets; the exact subject, run, start time and license of each trace are read from the asset sidecar and shown in the frame’s provenance line.
- Clean eyes-closed (occipital), electrode pop, blink, and the 8-channel segment:
ds-eegbci(EEG Motor Movement/Imagery Dataset; 160 Hz; recorded with no hardware filters; ODC-By 1.0 on PhysioNet, CC0 on the OpenNeuro mirror). Subject and run: TODO(confirm) fromdata/manifest.json. - Line noise with harmonics:
ds-iowapd(Iowa Parkinson’s resting EEG; 500 Hz; 60 Hz mains; CC0). Subject: TODO(confirm) fromdata/manifest.json. - If no real electrode pop could be found, the pop trace is a labelled synthetic derivative (
synthetic: truein its sidecar, withderived_fromandmodifications), and the frame says so.
Every asset is listed in data/manifest.json with its SHA-256 and generating script.
Open the code
site/src/components/widgets/w-filter-sandbox/ — Widget.svelte, index.ts, README.md. Repository link: TODO(confirm) (GitHub org/repo, §13 item 3).