Integration baseline separation#303
Draft
Nicolass67 wants to merge 4 commits into
Draft
Conversation
- Implemented `splitIntegration` action in integration actions. - Added tests for the new split integration functionality in `integration.test.tsx`. - Enhanced integration helper functions to support split integration logic. - Updated UI components to handle split integration state and actions. - Introduced new constants for integration split in action types and UI sweep types.
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.
PR description
Context
Before this branch, an integration could only be added by sweeping over a range (click-and-drag), removed, referenced or cleared. There was no way to subdivide an existing integration: if a peak ended up containing two signals, users had to delete the integration and redraw both halves by hand. That was tedious, lost the reference factor, and made the raw integration values flicker between two states with no way to relate them to each other.
This PR reworks the way integrations are created and introduces two complementary split tools so users can subdivide an integration depending on what they want to express.
What's in this PR
1. Two-click integration creation
Adding an integration is no longer done with a sweep. The user now clicks a first point to anchor the start of the integration (a live preview follows the cursor), then clicks a second point to commit it. The previous click-and-drag sweep is removed for integrations.
This makes the boundaries easier to place precisely on noisy or dense spectra and matches the interaction model used by the new split tools below.
2. Regular split
A new Split Integration toolbar button. Clicking on an integration drops a vertical cut at the cursor position and replaces it with two independent integrations. Each new integration recomputes its area from the raw data, so the values reflect the true area under the curve of each half. Use this when the two halves are genuinely separate signals whose areas should stand on their own.
3. Visual split
A new Visual Split toolbar button. Clicking on an integration drops a red dashed line and splits it into two visually linked children that share a
visualSplitGroupId. Use this when both halves still belong to the same chemical group but you want to see their individual contributions without losing the total.Key properties:
splitAreaProportionally).4. JCAMP persistence
$OBSERVEDINTEGRALSGROUPSrecords read/write thevisualSplitGroupIdof each integration, so visual splits survive save/reload through ChemSpectra. The parser is robust against the optional leading newline emitted byjcampconverter.