feat(cq): per-channel pulse-validity criterion (beat coverage >75%) - #127
Draft
boringethan wants to merge 7 commits into
Draft
feat(cq): per-channel pulse-validity criterion (beat coverage >75%)#127boringethan wants to merge 7 commits into
boringethan wants to merge 7 commits into
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.
Refs #126.
Adds a per-camera pulse-validity criterion to
ContactQualityWorkflow: a channel that passes the existing signal-level checks is markedno_pulseunless a valid cardiac pulse train covers >75% of the CQ scan.What's in it
PulseWaveformAnalyzer.beat_coverage(total_duration_s, *, min_coverage=0.75) -> PulseCoverage— additive; reuses the Pulse-waveform analysis pipeline extension (BFI cardiac pulse: ensemble template, envelope, morphology) #124 band-limit + autocorrelation + foot segmentation, skips per-beat morphology QC (that QC is right for the live view but wrongly rejects beats on noisier channels for a presence gate). Noise rejection is delegated to the autocorrelationperiodicitygate.(side,cam)bfi_liveand runs one analyzer per channel atresult(). Coverage denominator = global light-frame span (so a channel that drops out mid-scan scores low, not spuriously high).CamCQResultgainspulse_valid / pulse_coverage / pulse_hr_bpm / pulse_periodicity;reasongainsno_pulse. Precedence: no_signal → ambient_light → poor_contact → no_pulse → ok.check(evaluate_pulse=False, pulse_min_coverage=0.75)— default off = fully backward-compatible (existing 1 s quick-check + all prior tests unchanged).Criterion
pulse_valid = coverage > min_coverage AND periodicity >= 0.45Validation
Bench capture
scan_owC27EHALL(16 ch, ~85 bpm), vendored astests/data/cq_pulse_reference_bfi.csv:Tests: 55 pass in the touched suite (pulse-coverage + live-pulse regression + CQ); 251 pass / 29 skipped in the pipeline suite. No hardware required.
Base
Targets
feature/124because it reuses the #124PulseWaveformAnalyzer. Retarget tonextif #124 merges first.Scope / follow-up
SDK only. Bloodflow-app wiring (config keys, longer CQ capture, surface
no_pulsein the CQ modal) is a separate follow-up ticket/PR.Design:
docs/superpowers/specs/2026-07-04-cq-pulse-validity-design.md🤖 Generated with Claude Code