Make waveform beat detection and motion QC robust#30
Draft
sslnevefocusrite wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QualityControl/Beatoutputs, configurable thresholds, documentation, and a generic local benchmark commandWhy
A missed systolic boundary currently merges two cycles into one long beat. Motion spikes or dips can also become the apparent maximum, minimum, or derivative extremum. Both errors propagate beyond heart rate into RI, PI, timing, width, slope, cumulative, spectral, and whole-shape endpoints.
The recovery pass is deliberately local: it does not lower the detector threshold over the whole trace. A candidate must be close to the expected midpoint and pass independent height and prominence gates. Recovered boundaries remain explicitly flagged.
Beat QC produces one shared mask for artery and vein. Rejected intervals are then extracted again rather than sliced from an already-interpolated tensor; this prevents an unresolved double beat from setting
n_fftfor all accepted beats. Theanalysisnamespace retains candidate segmentation for diagnosis, while finalArtery/VelocityPerBeat,Vein/VelocityPerBeat, and beat-period datasets contain accepted beats only.Validation
python -m unittest discover -s test -v: 74 tests passn_fftregressionLocal regression data and case-specific identifiers are not included in this branch. The tracked benchmark tool accepts an external fixture directory and optional external expectation manifest.
Run locally
Deliberate limits
Closes #28