Skip to content

Python Packages

Work in Progress

These packages are under active development as functionality is being moved in from external analysis packages. APIs may change and features may be incomplete or missing.

THOR ships a set of Python packages for post-processing simulation output, visualizing results, and accessing the C++ engine from Python.

Packages

Package Purpose
thor-rt Python tools: shared utilities, MCRT analysis, raytracer visualization, workflow helpers, and thor-tools CLI
thor-bindings C++ Python bindings via nanobind
thor-testkit Regression test tools (internal)

Installation

All packages live in the python/ directory and use standard pyproject.toml builds.

CLI tools

Install thor-tools so it is available everywhere on your system. From the repository root:

# With all plugins (MCRT + raytracer)
uv tool install 'python/thor-rt[all]'

# MCRT commands only
uv tool install 'python/thor-rt[mcrt]'

# Raytracer commands only
uv tool install 'python/thor-rt[raytracer]'

After installation, thor-tools is on your PATH. Verify with uv tool list.

To update after pulling new changes:

uv tool install 'python/thor-rt[all]' --reinstall

Development install

For editable installs when developing the Python packages:

uv pip install -e "python/thor-rt[all]"

You can also install subsets:

uv pip install -e "python/thor-rt[mcrt]"       # MCRT commands only
uv pip install -e "python/thor-rt[raytracer]"   # Raytracer commands only
uv pip install -e python/thor-rt                 # Base CLI only (no commands)

C++ Bindings (optional)

thor-bindings requires the same build environment as THOR itself (see Installation):

uv pip install -e python/thor-bindings

CLI

Installing thor-rt provides the thor-tools command. MCRT and raytracer sub-commands are registered as plugins:

thor-tools
├── mcrt
│   ├── projection create
│   └── traces {analyze, info, summary, compare}
└── raytracer
    ├── plot-frame
    ├── render-movie
    ├── batch-parallel-render
    ├── merge-parallel-render
    └── interpolate-movie

See CLI Reference for full usage.