Repository navigation
irspec edit: peak add, remove, clear and auto - #2
Merged
Merged
Conversation
Second slice of roadmap 1a. `add` snaps each wavenumber to the nearest local band and `auto` picks again, both through session's own peak code (ir_organize._finish), so the label heights are session's and `peak auto` on a fresh session changes nothing. `remove` takes out the stored peak nearest X within 15 cm-1, `clear` leaves none. Atomic, idempotent, old -> new, --json, exit 2 (cannot be carried out, including no spectrum to read) and 1. "peaks": [] now means no peaks in resolve_peaks (it was picked again), so clear survives a session re-run. Tests in tests/test_edit_peaks.py, mutation-checked; README, CHANGELOG (Unreleased) and roadmap updated. No version change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GqBTMN8XHvB3aG8T6PmfYS
… .md found The session folder is copied from a template, so a stale ir_template.md sat beside the new ir_session.md and glob picked the stale one. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
aliperdehan
added a commit
that referenced
this pull request
Oct 23, 2026
… for the second), and that PR #2 needed a CI-found test fix. Documentation only: no version change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Second slice of roadmap 1a: peak editing in
irspec edit, onmanifest.jsononly.How it works
session's own code (ir_organize._finish/resolve_peaks, hencefind_peaks_manual,find_peaks_auto,assign_label_y), so snapping, label heights and rounding are exactly whatsessionproduces.peak autoon a fresh session changes nothing, byte for byte.add,removeandclearwrite an explicitpeakslist, whichsessionkeeps. They start from what the figure shows now, so an entry with nopeakskey starts from the automatic list.sessionreads it: an own.SPAfrom the file (this is what makesautomatchsession; the plain CSV's 3-decimal x flips a tie, 1446.3 against 1446.4). If the.SPAis gone, the copies inplain/orcsv/are used. A reference spectrum is read fromplain/NAME.csv. If none exists, exit 2 on stderr.set/unset: atomic write, entry and key order kept, idempotent, each change printed as old -> new,--jsonprints exactly one object. Exit 2 means the command cannot be carried out; exit 1 means the manifest is missing or broken.removefinds nothing within the tolerance: no change, a note on stderr, exit 0.peak autosays it replaces hand edits and lists what it dropped.One change outside
edit.pyir_organize.resolve_peakstreated"peaks": []like a missing key and picked again, sopeak clear(or removing the last peak) would have been undone by the nextirspec session. It now takes[]as "no peaks"; deleting the key still picks again. The README, CHANGELOG and roadmap say so. A legacy empty string forpeaksnow also means no peaks instead of picking.Tests
tests/test_edit_peaks.pyhas 31 tests on the sample.SPAand thephenacetin_T.jdxfixture. One runsirspec session --build noneafter edits and checks that they survive and reachfigures.jsonand the.md. Another does the same afterclear. Each test was mutation-checked: 17 mutants ofedit.pyandir_organize.py, all killed. One survived at first (adding a band that is already present), and a test was added for it.Full suite on Python 3.13 in a venv: 120 tests, OK, 19 skipped.
lualatexand R are not installed in this environment, so the TeX and R paths were not run. Please run the suite locally before merging.Not touched: version, tags,
session.py,irspec-ir.sty, rename/remove/move, per-figure limits,--no-build, preview. Not merged.🤖 Generated with Claude Code
https://claude.ai/code/session_01GqBTMN8XHvB3aG8T6PmfYS