Event-cone imaging (neutron & gamma ray) with fastmode and list-mode pipelines.
Project description
ng-imager
ng-imager is a modular Python toolkit for imaging neutrons and gamma rays in the NOVO detector system.
It turns detector-level hit data into images via a clean, restartable pipeline:
hits → events → cones → images
and is designed to replace a monolithic legacy script with:
- Explicit separation of physics, geometry, imaging, configuration, and I/O
- Flexible energy strategies (ELUT, ToF, fixed–energy, direct Edep)
- Unified neutron and gamma imaging, including proton vs carbon recoil handling
- Structured hit / event / cone filters with detailed counters
- Self-describing HDF5 output suitable for long-term analysis and archiving
Repository vs Python Package Name
- Repository name:
ng-imager - Python package (import name):
ngimager - PyPI package:
ngimager
After installing from source, you import the package as:
import ngimager
and use the CLI entry points:
ng-run– main imaging pipelineng-viz– visualization / re-rendering of summed imagesng-inspect– inspect a single cone and its pixel footprint (optional tool)
Install
From PyPI (recommended)
pip install ngimager
Check that the package and CLI are available:
python -c "import ngimager; print(ngimager.__file__)"
ng-run --help
ng-viz --help
From Source (development install)
git clone https://github.com/Lindt8/ng-imager.git
cd ng-imager
python -m venv .venv
source .venv/bin/activate # on Windows: .venv\Scripts\activate
pip install -e ".[dev]"
This installs ngimager in editable mode along with development dependencies (tests, docs, etc.). For a minimal runtime install, you can also use:
pip install -e .
First Run: Example PHITS Config
The repository includes a simple PHITS usrdef example:
- Config:
examples/configs/phits_usrdef_simple.toml - Input:
examples/imaging_datasets/PHITS_simple_ng_source/usrdef.out
Run the unified pipeline with:
ng-run examples/configs/phits_usrdef_simple.toml
or equivalently:
python -m ngimager.pipelines.core examples/configs/phits_usrdef_simple.toml
This will:
-
Read PHITS usrdef events via the adapter.
-
Construct hits and apply hit-level filters.
-
Shape and type events (neutron 2-hit, gamma 3-hit).
-
Apply event- and cone-level filters (ToF windows, light thresholds, Δθ, incident energy).
-
Build neutron and gamma cones (with proton vs carbon recoil handling for neutrons).
-
Reconstruct a simple back-projection (SBP) image on the configured plane.
-
Write an HDF5 file containing:
/images/summed/n,/images/summed/g, and/images/summed/all(where available)/cones/...with per-cone geometry, species, recoil code, and incident energy/lm/...with per-event and per-hit physics and optional list-mode cone pixel indices/meta/counters/...summarizing all filters and pipeline stages- A snapshot of the TOML config used for the run
You can then use ng-viz to re-render images from that HDF5 file:
ng-viz summed results/example.h5
Documentation
Full documentation is hosted at:
Key sections:
- Quickstart – run the example config and inspect the results.
- Configuration – complete TOML reference (
docs/config.md). - HDF5 Layout – how to interpret the output file (
docs/hdf5.md). - Architecture – design overview and long-term roadmap (
docs/architecture.md). - API Reference – auto-generated documentation from Python docstrings (
docs/api/index.md).
Status
- Neutron imaging: functional and validated against the legacy NOVO imaging code.
- Gamma imaging: functional and validated on legacy-formatted model data.
- Proton vs carbon recoil hypotheses: implemented, selected via priors, and stored in HDF5.
- Hit / event / cone filters: implemented with counters and HDF5 export.
- Fast and list modes: wired through configuration and I/O.
The codebase is under active development, but the core architecture and HDF5 layout are intended to be stable enough for experimental usage and future extension.
Contributing
Contributions are very welcome. Useful areas include:
- New I/O adapters (additional simulation formats, experimental data).
- Alternative imaging algorithms / uncertainty models.
- Improved tests, examples, and documentation.
If you’d like to help:
- File an issue describing your idea or bug.
- Open a pull request from a feature branch.
- Use the existing example config and tests to validate your changes.
Repository:
https://github.com/Lindt8/ng-imager
The aim is to keep ng-imager physically transparent, modular, and pleasant to work with for both simulation and experimental campaigns.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 ngimager-1.2.0.tar.gz.
File metadata
- Download URL: ngimager-1.2.0.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00dbaf9c236af714dcda785d4720dc9af91c658d8b189864440eb4b1102435bd
|
|
| MD5 |
2238688e09ad79a78edd4c9bbb6ddf35
|
|
| BLAKE2b-256 |
076f757d4d5391b7eb7205c59206b99e7d80a7d7b71bb0006ec3c24dd0bf6aed
|
File details
Details for the file ngimager-1.2.0-py3-none-any.whl.
File metadata
- Download URL: ngimager-1.2.0-py3-none-any.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a45c9f4c4832e5c717baa1b9dc9a59a5bdc874f88a59252ff18d7108742e436e
|
|
| MD5 |
865d721e646d04bda05aa4afb410f4f8
|
|
| BLAKE2b-256 |
acf962d5e19e82a46062347f2d14997a2d306680d868416f494d4ddc91a98bd9
|