Repository navigation
feat(trend): normalize the trend to a fixed spectrum - #23
Merged
Merged
Conversation
The client asked for normalization of the intensity trend: fix the current window pixels on a press, then show every later value as the mean of each pixel divided by its own fixed pixel, times 100 or 1000, without touching the full spectrum, and drop it on a change of wavelength or window. A switch over the trend, Off | x100 | x1000, starts, switches and stops it. The cache fixes the newest live spectrum under its lock, normalizes the recent spectra, and re-reads the stored day normalized from the raw pixels, so raw and normalized points never share one axis. A key change ends it with an Info line, a dark reference is refused with a Warning, and a point of the other spectrometer is NaN, since both firmware tables cover 898-1028 nm. The factor segments need a fresh live spectrum; Off stays enabled so a stale link never locks normalization on. The switch replaces two toggle buttons after a designer review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mrcsin
marked this pull request as ready for review
November 16, 2026 14:54
This was referenced Nov 17, 2026
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.
Problem
The client asked to normalize the intensity trend: on a press, fix the current values in the measurement window, then show each later value as the mean of every pixel divided by its own fixed pixel, times 100 or 1000. Only the trend is normalized, and a change of wavelength or window resets it.
Change
ButtonRadioButtonlook, 22 px to fit the top margin. It replaces two toggle buttons after a designer review: Off is visible, and the checked state is quieter.IntensityCache.StartNormalizationandStopNormalizationfix and drop the reference under the cache lock, recompute the recent spectra, and raise a re-read that carries the reference. The stored day is re-read normalized from the raw pixels (SpectrumHistory.IntensityPointsAsync), and the stored data does not change.QueryWindows.NormalizedMeanOfis the one home of the formula: it divides each pixel by its own reference pixel and then averages. A zero reference pixel is skipped. A point of the other spectrometer is NaN, because both firmware tables cover 898-1028 nm.MirroredRadioButtonnever checks itself, so a refused press leaves the switch as it was. A transparent strip stops a press on a disabled segment from reaching the plot.overview.md(Normalization),docs/architecture/README.md(Trend row),readme.md, and the plan. This is PR 2 of 3; .NET 11 follows.Verification
dotnet build -c Release: 0 warnings.dotnet format --verify-no-changesandterseover everySemiSpec/*.cs: exit 0.dotnet test: 1133 passed. The new tests cover:[100, 200]and pixels of[100, 100]give 75, not 66.7; this is checked on the cache path and on the store pathAppLifecycleTrendTests.TheTrendShowsTheStoredPointsAfterARestartandCompositionRootTests.TheAppBuildsTheMainWindowFromTheProviderfail now and then on master and on the commit before feat(ui): add display toggles and trend dots #22.Per-task commits before collapse
🤖 Generated with Claude Code