Skip to content

Command line spectral doc - #911

Open
cyrilmory wants to merge 1 commit into
RTKConsortium:mainfrom
cyrilmory:command_line_spectral_doc
Open

cyrilmory wants to merge 1 commit into
RTKConsortium:mainfrom
cyrilmory:command_line_spectral_doc

Conversation

@cyrilmory

@cyrilmory cyrilmory commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Adds Simon Rit's python spectral examples from PR#635, and uses the data it generates (tweaked a bit and uploaded to Girder) to document the spectral tools' command line applications.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were established.

Summary

Adds Python examples and command-line guides for spectral CT simulation and reconstruction.

  • Spectral command guides show how to run each reconstruction stage.
  • A Python example builds spectral data and runs one-step reconstruction.
  • A Python example decomposes spectral measurements and reconstructs each material.
  • Python test installs include the tools used by spectral examples.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Phantom and scan geometry] --> B[Material projections]
  C[Spectrum and detector response] --> D[Simulated photon counts]
  B --> D
  D --> E[One-step reconstruction]
  D --> F[Material decomposition]
  F --> G[Two-step reconstruction]
Loading

Reviews (10) · Last reviewed commit: "ENH: Add Python examples and associated ..." · Reviewed by Greptile

@SimonRit SimonRit self-assigned this Apr 16, 2026
@SimonRit SimonRit added this to the RTK 3.0 milestone Apr 16, 2026
@SimonRit SimonRit mentioned this pull request Jun 8, 2026
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch 9 times, most recently from e959451 to 9db7cdd Compare June 9, 2026 09:41
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch from 9db7cdd to 2389b6d Compare June 24, 2026 10:46
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch from 2389b6d to 81de0f4 Compare September 16, 2026 05:26
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch from 81de0f4 to eeb5981 Compare September 23, 2026 11:22
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch from eeb5981 to c8e2ff5 Compare October 15, 2026 07:00
Comment thread examples/SpectralOneStep/SpectralOneStep.py Outdated
Comment thread examples/SpectralTwoStep/SpectralTwoStep.py Outdated
Comment thread applications/rtkspectralrooster/README.md Outdated
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch from c8e2ff5 to db35549 Compare October 15, 2026 22:38
Comment thread examples/SpectralTwoStep/SpectralTwoStep.py Outdated
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch from db35549 to 853247f Compare October 16, 2026 14:11
Comment thread test/rtk_examples_test.py Outdated
Comment on lines +5 to +7
import spekpy as sp
import numpy as np
import xraylib as xrl

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Required test packages are missing

Both new examples import spekpy and xraylib, but neither package is installed by the wheel-test workflows or listed in the test dependencies. Once the directory argument is fixed, both new tests fail at import spekpy. Add both packages to the test setup used by the CPU and CUDA workflows.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are now listed in pyproject.toml in the test group so the tests will execute fine. The user will have to install those dependencies manually if they want to run the examples which is not unreasonable.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — adding spekpy and xraylib to the test dependency group covers installations that explicitly run pip install --group test, and it’s reasonable for users running the examples to install those separately.

However, the wheel-test jobs do not install that group: they install the wheel followed by only pytest matplotlib. Since test_SpectralOneStep and test_SpectralTwoStep import those modules, those CI jobs will still fail with ModuleNotFoundError. The workflow setup needs to install the test group or add spekpy xraylib to its existing install command.

@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch 7 times, most recently from b8a3f1c to 1c95c3c Compare October 16, 2026 15:17
Comment thread .github/workflows/build-test-package.yml Outdated
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch from 1c95c3c to 23d6c70 Compare October 16, 2026 15:26
Co-authored-by: Cyril Mory <cyril.mory@gmail.com>
@SimonRit
SimonRit force-pushed the command_line_spectral_doc branch from 23d6c70 to a899cb4 Compare October 16, 2026 15:28
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