Skip to content

irspec session DIR --preview: every spectrum drawn as text before anything is filed - #4

Merged
aliperdehan merged 1 commit into
mainfrom
claude/session-preview
Oct 24, 2026
Merged

aliperdehan merged 1 commit into
mainfrom
claude/session-preview

Conversation

@aliperdehan

Copy link
Copy Markdown
Owner

Roadmap 1c, second part: irspec session DIR --preview [--width N] [--height N] [--ascii] [--json].

What it does

  • Prints the planned file moves exactly as --dry-run does, then, for every spectrum in DIR (loose, or already in SPA/ and jdx/), the same text irspec preview prints, headed by the title and the csv/ and plain/ names the file will get.
  • Writes nothing: no folder, manifest, figure list, report, and no moved file. A loose file is read from where it lies.
  • img/ pictures are listed with their planned names and a note that session digitizes them; they are not drawn.
  • An existing manifest.json (peaks, titles) and --title STEM=TITLE are honoured. --preview with --dry-run means the same as --preview; plain --dry-run output is unchanged.
  • --json prints exactly one object {"moves", "spectra", "images"}. Each spectrum is the irspec preview --json object plus will_be_filed_as (and title, csv, plain).
  • Exit 2: DIR is not a folder, has no spectra, its manifest cannot be used, or --width/--height is too small. Exit 1: some spectrum could not be read; it is listed with its error and the others are still shown.

How

  • Reuse, no copied code: organize(dry_run=True) for the moves, build_manifest (new optional planned argument: files not yet filed count as on disk and are read from where they lie; default_title gets a matching path argument), and preview.work_out_entry / render (work_out split in two; public() split out of main). No second picking or limit computation.
  • tests/test_session_preview.py (19 tests): unchanged tree listing with sizes and mtimes (loose and filed folders, text, --json, --dry-run, --build/--formats), golden text for the sample .SPA, headers for the .jdx fixtures, manifest and --title honoured, pictures, --json shape, peaks and ymin equal to what a real session --build none then writes to manifest.json and figures.json, an unreadable file, QUANT-IR without peak_a, exit 2 cases, --dry-run unchanged.
  • Mutation-checked: 22 mutations of session.py (writing a folder, dropping planned files, moves not printed, swapped csv/plain names, manifest ignored, exit code, absolute paths in errors, images drawn, unchecked width, extra stdout in --json, ...); all killed except one equivalent (text rendered but not printed under --json). One surviving title path got its own test, which then killed it.
  • README (options table and a new section), CHANGELOG (## Unreleased) and roadmap 1c updated. __version__ not bumped, nothing tagged.

Test result

Whole suite in a throwaway venv: Ran 176 tests, OK (skipped=18). The skips are the tests that need lualatex, R, poppler or MuPDF, or the author's LR6 folders; this change does not touch those paths.

Do not merge: for the author's review.


Generated by Claude Code

…awn as text, nothing written

Dry run that shows more than --dry-run: prints the moves as --dry-run does, then the
`irspec preview` text of each spectrum (loose or filed), headed by the title and the
csv/ and plain/ names it will get; img/ pictures are listed, not drawn. --json prints
{"moves","spectra","images"}. Reuses organize(dry_run=True), build_manifest (now takes
files not yet filed) and preview.work_out_entry/render. Roadmap 1c, second part.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UFRe77TjiXkrJrN11L1uwj
@aliperdehan
aliperdehan merged commit 5844d91 into main Oct 24, 2026
4 checks passed
@aliperdehan
aliperdehan deleted the claude/session-preview branch October 24, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants