GPU-accelerated proton radiography
Project description
GPU Proton Radiography Tracer
GPU-accelerated forward modelling of proton radiographs from magnetised plasma.
Runs the full relativistic Boris orbit through measured or simulated electromagnetic fields — not a paraxial approximation — and produces synthetic radiographs that can be directly compared to experimental RCF film data.
✓ 11/11 physics validation tests passing
✓ Reproducible, self-documenting run directories
✓ CLI + GUI workflows
✓ Re-render without re-tracing particles
Example radiographs
Three MHD instability geometries, computed in seconds on a laptop GPU:
| z-pinch | kink instability | sausage instability |
|---|---|---|
Each image is a synthetic proton radiograph — the spatial structure directly reflects the path-integrated field topology.
GUI
Deck parameters, run status, and the 3D radiograph — all in one view.
Why this tool
Proton radiography is sensitive to the path-integrated field, not just its peak value. The mapping from field structure to film pattern is nonlinear and depends on geometry — magnification, detector distance, source divergence. Paraxial approximations fail in the strong-field, large-deflection regimes common in modern pulsed-power experiments.
This tool runs the full relativistic Boris orbit, so you can:
- See where paraxial approximations break down and by how much
- Forward-model field topologies and compare directly to experimental films
- Design detector geometry before committing to a shot
Quick start
# Build (also compiles shaders via build.rs)
cd rust && cargo build --release && cd ..
# Scaffold a working deck from a preset
./rust/target/release/proton_tracer init zpinch -o my_run.toml
# Inspect resolved geometry before running
./rust/target/release/proton_tracer explain my_run.toml
# Schema check
./rust/target/release/proton_tracer validate my_run.toml
# Run — produces a self-contained output directory
./rust/target/release/proton_tracer run my_run.toml -o runs/zpinch_01
macOS / MoltenVK — set these before running:
export VK_ICD_FILENAMES=/opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
See docs/quickstart.md for the full install walkthrough.
Subcommands
| Command | Purpose |
|---|---|
run <deck> [-o dir] |
Batch run — GPU compute, full run directory output |
gui [deck] |
Interactive launcher with live progress |
explain <deck> |
Print resolved geometry and step budget — no GPU |
validate <deck> |
Schema check only — no GPU |
init [preset] [-o deck.toml] |
Emit a starter deck (blank / zpinch / kink-strong) |
demo [preset] |
Run a built-in preset without writing a deck |
render <run_dir> |
Re-render radiograph from saved counts — no GPU |
sweep <deck> --param k=v1,v2 |
Parameter sweep — one run directory per point |
inspect <run_dir|sweep_dir> |
Print run or sweep summary |
analyze <run_dir> |
Count statistics |
Run directory layout
Every run produces a self-contained directory. Share it with a colleague and they can
re-render or analyse without re-running anything.
runs/zpinch_01/
input_deck.toml ← exact copy of deck used
resolved_config.json ← fully resolved SI parameters
metadata.json ← hardware, git hash, field SHA-256, timing
log.txt ← full terminal output mirror
counts/
raw_counts.bin ← u32 [H×W] detector hit counts
processed_counts.bin ← f32 [H×W] after detector response
images/
radiograph.png
Parameter sweeps
# Energy scan — four runs, zipped
proton_tracer sweep zpinch.toml \
--param source.energy_MeV=5,10,15,20
# Range syntax
proton_tracer sweep zpinch.toml \
--param source.energy_MeV=5:20:5
# Paired sweep — same-length lists, zipped
proton_tracer sweep zpinch.toml \
--param source.energy_MeV=5,10,15 \
--param numerics.max_steps=10000,20000,30000
Output: runs/sweep_001/ with one run directory per point and a live sweep_manifest.json.
Validation
python3 validate.py # uses existing binary
python3 validate.py --build # build first, then validate
11 physics tests: B-only regression, zero-field straight-line projection, uniform E-field deflection (sign and magnitude), relativistic Boris energy conservation (14.7000 MeV recovered to sub-eV accuracy), pencil/point/disk source geometry, Gaussian energy spread, exponential/TNSA spectrum (mean KE ≈ T, hard cutoff enforced), Gaussian blur, Poisson noise reproducibility.
Documentation
| Doc | Contents |
|---|---|
| docs/quickstart.md | Full install → first run walkthrough |
| docs/geometry.md | Coordinate system, detector geometry, source types |
| docs/input_decks.md | TOML schema, all fields, --set overrides |
| docs/run_artifacts.md | Run directory anatomy and reproducibility |
| docs/file_formats.md | .bfld, binary count formats, metadata schema |
| docs/rendering.md | Counts → PNG pipeline, re-render without GPU |
| docs/sweeps.md | Parameter sweeps, syntax, sweep manifest |
| docs/validation.md | Physics test descriptions and tolerances |
| docs/gui.md | Deck launcher workflow |
| docs/limitations.md | Honest constraints and known gaps |
License
See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prad-0.2.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: prad-0.2.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.7 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2a9180d4c52a6963daac5ac3cb4c79c5943cc81041bc7a06049328f8cab1c60
|
|
| MD5 |
a2c93e3fa4164279fbabc011078f6a3d
|
|
| BLAKE2b-256 |
6af6e806c010bf8e1c0ed2fea9f495c493ba046a19900fdf165eb65c4b6e79a9
|
Provenance
The following attestation bundles were made for prad-0.2.0-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on JonasDolezal07/gpu-proton-radiography
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prad-0.2.0-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
a2a9180d4c52a6963daac5ac3cb4c79c5943cc81041bc7a06049328f8cab1c60 - Sigstore transparency entry: 1587301000
- Sigstore integration time:
-
Permalink:
JonasDolezal07/gpu-proton-radiography@174ebca4e95f6820ae19d5d5e551fb1927722599 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/JonasDolezal07
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@174ebca4e95f6820ae19d5d5e551fb1927722599 -
Trigger Event:
push
-
Statement type:
File details
Details for the file prad-0.2.0-py3-none-macosx_10_13_universal2.whl.
File metadata
- Download URL: prad-0.2.0-py3-none-macosx_10_13_universal2.whl
- Upload date:
- Size: 3.1 MB
- Tags: Python 3, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2963ca0bb6ae86aff5dcf7547c4ca0dffd9efe8dba7d24f426780eb7939a22d9
|
|
| MD5 |
4b82ffecb166441d641df9fead6a3e54
|
|
| BLAKE2b-256 |
5832cdf969c4a889f0ef6893a128e0df2139802b5e7c1376a516183c9ef252a0
|
Provenance
The following attestation bundles were made for prad-0.2.0-py3-none-macosx_10_13_universal2.whl:
Publisher:
release.yml on JonasDolezal07/gpu-proton-radiography
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prad-0.2.0-py3-none-macosx_10_13_universal2.whl -
Subject digest:
2963ca0bb6ae86aff5dcf7547c4ca0dffd9efe8dba7d24f426780eb7939a22d9 - Sigstore transparency entry: 1587300811
- Sigstore integration time:
-
Permalink:
JonasDolezal07/gpu-proton-radiography@174ebca4e95f6820ae19d5d5e551fb1927722599 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/JonasDolezal07
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@174ebca4e95f6820ae19d5d5e551fb1927722599 -
Trigger Event:
push
-
Statement type: