NeuroReach: causal preprocessing and artifact-gate order

artifact gates need the raw branch, before filtering/CAR can hide the thing being rejected. Also keep SOS state across chunks — check resets + chunk-size changes

specified real-time chain: latched DC-offset subtraction → causal filter chain with persistent SOS state → common-average reference → filtered ring buffer. Preserve a raw branch for artifact gates before filtering/CAR.

why the split matters in these notes: filtering and common-average subtraction can attenuate common-mode disturbances, so applying the artifact gate only after that processing can hide events the gate was meant to reject. DCOffsetRemover subtracts one latched per-channel offset rather than recalculating a separate mean for every chunk, avoiding artificial chunk-boundary steps.

Sample report: artifacts, uptime and compensation flags.
Sample report: artifacts, uptime and compensation flags.

Eight-channel EEG display with electrode labels and auto-gain.
Eight-channel EEG display with electrode labels and auto-gain.

  • recorded configuration: fourth-order Butterworth 1–40 Hz bandpass; 60/50 Hz notch selected for environment; persistent causal IIR state for streaming. Offline/buffered paths may use zero-phase filtfilt, which must not be confused with the causal online path. AmplitudeGate uses a draft >100 µV peak-to-peak threshold over C3/Cz/C4; MovementGate examines IMU variation; Fz is used as an artifact proxy.
  • code pointers: signal-engine/preprocessing/, DCOffsetRemover, CausalFilterChain, CommonAverageReference, AmplitudeGate, MovementGate.
  • review questions: confirm raw units before applying thresholds; validate threshold choices on hardware rather than treating spec values as calibrated constants. Test chunk-size invariance, restart transients and state reset. The spec's reference to real signal validation is a planned gate, not a supplied test report.