fix(peaks): peak marks follow chemical-shift reference edits - #76
Merged
Merged
Conversation
PeakMark stored its x as a finished-spectrum snapshot, so editing a Reference step shifted the whole ppm axis while every existing mark stayed at the old coordinate — visibly detached from its peak. Marks now store the *uncalibrated* position (finished x minus the pipeline's reference offset at pick time) and every reader adds the current offset back through `PeakSet::resolve(offset)`, fed by the new `Dataset::peak_reference_offset_ppm()` (the pipeline's single semantic outlet `chemical_shift_reference_offset_ppm`, previously used only by CRAFT; tables calibrate by zero). This is the lifecycle-copy option: the calibration lives once, in the pipeline, and marks follow any Reference edit — including undo/redo of the processing step — without being rewritten, so no mark-translation action or migration exists. Both write paths (manual picks and detection on the finished trace) subtract the current offset symmetrically; de-duplication compares in uncalibrated space. Persisted mark coordinates change meaning; the format stays v1 with no compatibility reader, per repository policy. `y` deliberately remains a pick-time intensity snapshot: reference edits never change intensities, and refreshing y after re-phasing or normalization is an orthogonal concern. Regression tests: mark → reference edit → resolved ppm follows the shifted trace and its default label; picks on an already-referenced spectrum round-trip through the uncalibrated store.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
PeakMarkstored its x as a finished-spectrum snapshot, so editing a Reference step shifted the whole ppm axis while every existing mark stayed at the old coordinate — visibly detached from its peak.Marks now store the uncalibrated position (finished x minus the pipeline's reference offset at pick time) and every reader adds the current offset back through
PeakSet::resolve(offset), fed by the newDataset::peak_reference_offset_ppm()— the pipeline's single semantic outletchemical_shift_reference_offset_ppm, previously used only by CRAFT. The calibration lives once, in the pipeline, so marks follow any Reference edit — including undo/redo — without being rewritten. Both write paths (manual picks and detection) subtract the current offset symmetrically; de-duplication compares in uncalibrated space. Persisted mark coordinates change meaning; the format stays v1 with no compatibility reader, per repository policy.ydeliberately remains a pick-time intensity snapshot: reference edits never change intensities.Validation
cargo pr-checkpasses on currentmain(fmt, source sizes, dependency policy, default-frontends build, clippy-D warnings, reference-backend test suite).