Skip to content

Median-filter adaptive threshold

What it does

This utility produces a sample-aligned adaptive threshold from a one-dimensional signal using a local median baseline, a multiplier, and an upper cap.

When to use it

Use it when a detector needs a robust local threshold that follows slow baseline changes without being dominated by isolated large samples.

Canonical ID: tools.medfilt_threshold

Inputs

Name Meaning Type Unit Requirements
x One-dimensional signal for which an adaptive threshold is required. real vector a.u. minimum length: 2; NaN allowed; finite

Parameters

Name Meaning Type Unit Default Requirements
window Local median-filter window setting. integer scalar sample not applicable minimum: 2
factor Multiplier applied to the local median baseline. real scalar 1 not applicable greater than: 0
max_threshold Upper cap applied to the adaptive threshold. real scalar a.u. not applicable greater than: 0

Outputs

Name Meaning Type Unit
threshold Sample-aligned capped adaptive threshold. real vector a.u.

Interpretation and limitations

The result depends on window length and boundary handling. The factor and cap are algorithm settings rather than universal physiological thresholds.

Implementations and technical resources

Python source | MATLAB source

Normative JSON | Validation cases