Skip to content

fix(peaks): peak marks follow chemical-shift reference edits - #6

Closed
Limdongcheng wants to merge 1 commit into
fix/peak-snapfrom
fix/peaks-follow-reference
Closed

fix(peaks): peak marks follow chemical-shift reference edits#6
Limdongcheng wants to merge 1 commit into
fix/peak-snapfrom
fix/peaks-follow-reference

Conversation

@Limdongcheng

Copy link
Copy Markdown
Owner

Root cause

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.

Fix

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.

Tests

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. cargo pr-check passes.


Part 5 of the stack, based on fix/peak-snap (#5). The final part, the Reference on-plot pick (#1), is based on this branch.

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.
@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant