Skip to content

Align tools with Biosiglib v0.5.5 specs - #43

Merged
dcajal merged 4 commits into
mainfrom
agent/align-tools-v051
Jul 8, 2026
Merged

Align tools with Biosiglib v0.5.5 specs#43
dcajal merged 4 commits into
mainfrom
agent/align-tools-v051

Conversation

@dcajal

@dcajal dcajal commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Pins conformance to Biosiglib v0.5.5 (9844bd742d6c375f472dceb16adaae97e700509b). As of this update, origin/main still points to Biosiglib v0.5.4, so the postrelease propagation has not landed on main yet.
  • Implements the NaN-aware snaptopeak behavior: NaN ECG gaps are hard finite-segment boundaries, NaN detections keep output alignment as NaN, detections on NaN ECG samples return NaN, and Inf/-Inf remain invalid.
  • Simplifies pantompkins back to delegating segment refinement to snaptopeak.
  • Updates snaptopeak conformance coverage for the new Biosiglib cases.

Conformance Cases

  • tools.snap_to_peak.ecg_nan_segment_boundary
  • tools.snap_to_peak.detection_nan_returns_nan
  • tools.snap_to_peak.detection_on_nan_ecg_returns_nan

Validation

  • matlab -batch "addpath('scripts/local'); runTests('tools/snaptopeak'); runTests('ecg/pantompkins')"
  • matlab -batch "addpath('scripts/local'); runTests('tools/medfiltThreshold'); runTests('tools/nanfilter'); runTests('tools/nanfiltfilt'); runTests('tools/lpdfilter'); runTests('tools/snaptopeak')"
  • matlab -batch "addpath('scripts/local'); runTests" (188/188 passed)
  • .venv\Scripts\python.exe tools\validate_specs.py --manifest C:\Users\cajal\dev\biosig\biosigmat\conformance.json
  • git diff --check

Copilot AI review requested due to automatic review settings July 8, 2026 10:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns Biosigmat’s MATLAB tool implementations and test coverage with Biosiglib v0.5.4 conformance cases, including updated NaN-segmentation behavior for nanfilter/nanfiltfilt, stricter finiteness requirements for snaptopeak, and segment-wise peak refinement in pantompkins. Also marks the corresponding tool specs as conformant in conformance.json.

Changes:

  • Adds Biosiglib conformance-case driven tests for medfiltThreshold, nanfilter, nanfiltfilt, lpdfilter, and snaptopeak (including expected-error case coverage where applicable).
  • Refines NaN-handling by preserving boundary/long NaN gaps, interpolating only short internal gaps, and leaving too-short candidate segments as NaN for filtering operations.
  • Updates pantompkins to refine peaks only within finite ECG segments and updates the conformance manifest to declare the five tool specs conformant.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/tools/snaptopeakTest.m Adds Biosiglib conformance and expected-error parameterized coverage; improves path setup to use repo root.
test/tools/nanfiltfiltTest.m Adds parameterized Biosiglib conformance-case coverage via shared base helper.
test/tools/nanfilterTest.m Adds parameterized Biosiglib conformance-case coverage via shared base helper.
test/tools/medfiltThresholdTest.m Adds Biosiglib conformance + expected-error coverage and makes fixtures/path handling repo-root based.
test/tools/lpdfilterTest.m Adds Biosiglib conformance + expected-error coverage and makes fixtures/path handling repo-root based.
test/common/verifyBiosiglibExpectedOutputs.m Makes expected-outputs verification robust to expected_outputs being a cell array vs struct array.
test/common/NanFilterTestBase.m Adds a shared helper to run Biosiglib NaN-filtering conformance cases; updates path handling.
src/tools/snaptopeak.m Tightens input validation to require finite ECG/detections and vector-shaped detections.
src/tools/private/processNanSignal.m Updates core NaN-segmentation/interpolation logic and adds minimum-segment-length gating for filtering.
src/tools/nanfiltfilt.m Uses the updated NaN processing with a filtfilt-specific minimum segment length.
src/tools/nanfilter.m Uses the updated NaN processing with a filter-specific minimum segment length.
src/tools/medfiltThreshold.m Tightens input validation (window >= 2, finite scalar params; reject Inf in x while allowing NaN).
src/ecg/pantompkins.m Refines peaks only within finite ECG segments to avoid snapping across NaN/Inf gaps.
conformance.json Declares the five tool specs conformant and maps them to MATLAB entry points.

caseDefinition, 'sampling_frequency');
stopFrequency = loadBiosiglibConformanceInput( ...
caseDefinition, 'stop_frequency');
parameters = caseDefinition.parameters;
function testBiosiglibConformanceCase(tc, validConformanceCaseId)
caseDefinition = loadBiosiglibConformanceCase(validConformanceCaseId);
x = loadBiosiglibConformanceInput(caseDefinition, 'x');
parameters = caseDefinition.parameters;
@dcajal
dcajal force-pushed the agent/align-tools-v051 branch from 8fe5bc0 to a78af6b Compare July 8, 2026 13:20
@dcajal dcajal changed the title Align tools with Biosiglib v0.5.4 specs Align tools with Biosiglib v0.5.5 specs Jul 8, 2026
@dcajal
dcajal merged commit e917827 into main Jul 8, 2026
3 checks passed
@dcajal
dcajal deleted the agent/align-tools-v051 branch August 3, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants