Skip to content

NaN-aware causal filtering

What it does

This utility applies an ordinary causal digital filter while interpolating short internal NaN gaps and preserving long missing spans.

When to use it

Use it when filtering must remain causal and short missing gaps may be bridged without joining independent signal segments across longer gaps.

Canonical ID: tools.nan_filter

Inputs

Name Meaning Type Unit Requirements
numerator_coefficients Numerator coefficients of the causal digital filter. real vector 1 minimum length: 1; no NaN; finite
denominator_coefficients Denominator coefficients of the causal digital filter. real vector 1 minimum length: 1; no NaN; finite
signal Signal to filter, optionally containing missing-value gaps. real vector a.u. NaN allowed; finite

Parameters

Name Meaning Type Unit Default Requirements
max_gap Largest internal NaN gap that will be interpolated before filtering. integer scalar sample 0 minimum: 0

Outputs

Name Meaning Type Unit
filtered_signal Causally filtered signal with long missing spans preserved. real vector a.u.

How it works

Short internal gaps are interpolated before filtering. Long gaps split the signal into independent finite segments, and missing boundary samples remain missing.

Interpretation and limitations

Interpolated samples are estimates. max_gap should reflect the sampling frequency and the longest absence that can reasonably be bridged for the intended analysis.

Implementations and technical resources

Python source | MATLAB source

Normative JSON | Validation cases