feat(dashboard): time-varying threshold specs in FastSenseWidget#204
Merged
Conversation
FastSense core has long supported dynamic limits —
addThreshold(thX, thY, ...) draws step-function thresholds with full
violation detection (compute_violations_dynamic + violation_cull MEX).
But FastSenseWidget's 'Thresholds' option only understood scalar
struct('Value',..) entries, so dashboards could never reach that
capability: state-dependent limits (e.g. a tighter band only while a
machine is MEASURING) had to be drawn as constant lines.
Spec entries may now carry X/Y vectors instead of Value:
{struct('X', thX, 'Y', thY, 'Direction', 'upper', 'Label', 'UWL')}
applyThresholds_ forwards them to the core's time-varying form; NaN Y
samples mean "no limit here" and break the drawn line. Scalar and
time-varying entries mix freely in one spec. autoscaleY_ now folds the
finite part of Y series into the auto Y-range (omitnan), matching the
scalar-Value behavior.
Two new suite tests cover the X/Y pass-through (fields preserved,
Value stays empty) and scalar/time-varying coexistence.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Threshold spec entries can now carry optional Color and LineStyle, forwarded to FastSense.addThreshold so dashboards can severity-style limit lines (e.g. warn yellow solid, alarm red solid) per entry instead of inheriting the theme default for every line. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
Reviewed: diff is backward-compatible (scalar specs unchanged, X/Y + Color/LineStyle additive), autoscale correctly folds finite Y with omitnan and skips all-NaN series. Local 🤖 Generated with Claude Code |
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.
Motivation
FastSensecore already supports dynamic (time-varying) thresholds —addThreshold(thX, thY, ...)draws step-function limits with full violation detection (compute_violations_dynamic+violation_cullMEX), label tracking on zoom, and clone support. But the Dashboard layer couldn't reach it:FastSenseWidget's'Thresholds'option only understood scalarstruct('Value',..)entries.This matters for state-dependent limits (the classic case: a band that only applies while a machine is MEASURING). Discovered converting a legacy Zeiss monitoring system whose plots drew exactly such per-sample threshold series — dashboards built on FastSenseWidget had no way to reproduce them.
Change
Spec entries may now carry
X/Yvectors instead ofValue:applyThresholds_forwards X/Y entries to the core's existing time-varying form;NaNY samples mean no limit here and break the drawn lineautoscaleY_folds the finite part of Y series into the auto Y-range (omitnan), matching scalar-Value handlingNo core (
FastSense.m) changes — pure pass-through plumbing.Testing
testTimeVaryingThresholdSpecReachesFastSense— X/Y entry creates exactly one core threshold, keeps its per-sample series, carries no scalar Value, preserves Direction/LabeltestMixedScalarAndTimeVaryingThresholds— both forms coexist in one specmh_style/mh_lintclean; MATLAB Code Analyzer clean on the touched regions (remaining findings pre-exist onmain)🤖 Generated with Claude Code