Stereograph
Stereoscopic event reconstruction using graph neural networks applied to CTAO
This project applies Graph Neural Networks (GNNs) to the stereoscopic event reconstruction for the Cherenkov Telescope Array Observatory (CTAO). We use GNNs to combine data from multiple telescopes. This project provides a framework to easily apply models, train, perform inference, and plot IRFs from a configuration file.
Usage
Stereograph's CI/CD pipelines generate containers that provide a ready-to-use environment for development and production. These containers are uploaded to Stereograph's container registry. A set of containers is available for each branch in the repository, and the containers are re-built for any commit that involves modifications made to the environment or dockerfiles files (anything in the docker directory). The containers include PyTorch and CUDA dependencies to do computation on NVIDIA GPUs, in addition to a big stack of scientific computing software. They typically require several GBs of storage.
For Users
The use of apptainer is recommended. To obtain the production image use the following command:
apptainer pull docker://gitlab-registry.in2p3.fr/gammalearn/stereograph/stereograph:main
This command will create a .sif file, which provides a ready-to-use Stereograph environment.
Note: apptainer can use several GB of disk storage as cache when building the .sif file. The default cache is usually located in ~/.apptainer/cache. The location can be changed by setting the APPTAINER_CACHEDIR environment variable. The apptainer cache can be cleaned using:
apptainer cache clean
Docker Image Build and Versioning
In our CI/CD pipeline, Docker image builds are executed in parallel within the same stage, rather than sequentially. This approach optimizes build times and resource utilization.
We currently support the generation of two distinct Docker images, each for a specific version of ctapipe and associated production environment:
- ctapipe v0.19.3: used for Production 5 data analysis
- ctapipe v0.24.0: used for Production 6 data analysis
Due to differences in data loading and handling between these ctapipe versions, we maintain compatibility with both. Therefore, we support both environments in parallel.
To facilitate this, ctapipe has been removed from the list of mandatory dependencies. It is now treated as an optional dependency, conditionally included based on the specific Docker image being built. This ensures that each image includes only the appropriate version of ctapipe without introducing conflicts or unnecessary dependencies.
Run an Experiment
To run an experiment, you need to set your configuration file. See the example here:
The configuration file is a YAML file that defines all the necessary parameters to train the model using Stereograph.
You can specify:
- The network parameters
- The input (node features) you want to use
- The number of telescopes (from 1 to 11, plus 19 and 35)
- The number of events (since the dataset is large, you can select a specific number of events, or set the variable to
nullto use the entire dataset if you have sufficient resources)
Note: The configuration file used to produce the graphs must be the same as the one used to train the model, especially with regard to the data.
You can now run your experiment using apptainer run. Since apptainer containers are read-only by default, you will need to mount the paths to your input and output files. To use NVIDIA GPUs, you will need to specify the --nv option as well. A typical command example:
# Run the experiment in the container
# Parameters:
# --nv to use nvidia gpus from inside the container
# CUDA_VISIBLE_DEVICES env variable used by pytorch to discover the gpus
# NUMBA_CACHE_DIR a writable directory where numba can store its compiled functions
# (needs to be outside of the container, which is read-only)
# CTAPIPE_CACHE ctapipe needs a writable place, to store its downloaded files.
# Mounts: input (data and settings file) and output directories
#
# We call the stereograph entrypoint directly in /opt/conda/bin, because micromamba is not initialized
# inside the container for a new user (and every user is new, since with apptainer the user remains the same
# as the user on the host system by default (only users defined in the containers are known))
apptainer run \
--nv \
--env "CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES" \
--env "NUMBA_CACHE_DIR=/tmp/NUMBA" \
--env "CTAPIPE_CACHE=/tmp/CTAPIPE" \
--mount type=bind,source=/path/to/input/data_dir/,destination=/corresponding/path/in/container/ \
$CONTAINER \
bash -c "\
$PYTHON $TRAIN_FILE --config_file $CONFIG_FILE_ENERGY --gamma_file gamma.graphs --overwrite"
Installation (Local Development)
If you prefer to install locally without containers:
# Clone repository
git clone https://gitlab.in2p3.fr/gammalearn/stereograph/stereograph.git
cd stereograph
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install with all dependencies
pip install -e ".[all]"
# (Optional) For specific ctapipe version
pip install -e ".[ctapipe_v24]" # For ctapipe v0.24.0
pip install -e ".[ctapipe_v19]" # For ctapipe v0.19.3
Installation (via PyPI)
For users who just want to use the package:
pip install stereograph
When installing locally, specify which ctapipe version you need:
pip install "stereograph[ctapipe_v24]" # For Production 6
pip install "stereograph[ctapipe_v19]" # For Production 5
For Developers
See CONTRIBUTING.md for detailed guidelines including:
- Code style requirements (Ruff)
- Testing and validation
- Documentation standards
- Pull request workflow
Quick setup:
pip install -e ".[dev,tests,docs]"
# Run tests
pytest
# Check code style
ruff check .
# Build documentation
mkdocs serve
Documentation
- Installation Guide - Detailed setup instructions
- Configuration Guide - YAML configuration reference
- Usage Guide - Workflow examples and best practices
- API Reference - Complete API documentation
Build documentation locally:
pip install -e ".[docs]"
mkdocs serve # Visit http://localhost:8000
Citation
If you use Stereograph in your research, please cite:
@software{alimessaoud2025stereograph,
author = {ALI MESSAOUD, Hana and Vuillaume, Thomas and Francois, Tom and Pollet, Vincent},
title = {Stereograph: Graph Neural Networks for Stereoscopic Event Reconstruction in CTAO},
year = {2026},
doi = {10.5281/zenodo.14857530},
url = {https://zenodo.org/records/14857530},
version = {4.1.0}
}
Or in plain text:
ALI MESSAOUD, H., Vuillaume, T., Francois, T., & Pollet, V. (2026). Stereograph: Graph Neural Networks for Stereoscopic Event Reconstruction in CTAO (v4.1.0). Zenodo. https://doi.org/10.5281/zenodo.14857530
License
This project is licensed under the MIT License - see LICENSE for details.
Acknowledgments
- Funding: European Union's Horizon 2020 research and innovation programme under grant 824064 (ESCAPE)
- Infrastructure: CTAO Consortium and MUST Computing Center
- Contributors: See CITATION.cff
This work has been done thanks to the facilities offered by the Univ. Savoie Mont Blanc - CNRS/IN2P3 MUST computing center
Related Resources
Questions? Open an issue or check the documentation.
Want to contribute? See CONTRIBUTING.md and read our code of conduct.
Metadata
Release files for stereograph 4.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stereograph-4.1.0.tar.gz | 91.6 kB | Without provenance | Details for stereograph-4.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stereograph-4.1.0-py3-none-any.whl | Python 3 | none | any | Details for stereograph-4.1.0-py3-none-any.whl |
Total release size: 183.3 kB
Release files / stereograph-4.1.0.tar.gz
| Download URL | stereograph-4.1.0.tar.gz |
|---|---|
| Size | 91.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28ae43f9970d56fdc5b4c60e473f61fff4d57311a86b0465a9ec40397721c896
|
|
BLAKE2b-256 checksum How to use checksums |
43e1e23dd5709d8fde0354430903e750a1c0ce05dd47932c01c1911d6d947598
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.22
|
Release files / stereograph-4.1.0-py3-none-any.whl
| Download URL | stereograph-4.1.0-py3-none-any.whl |
|---|---|
| Size | 91.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e36ca4a9f40cad0ac1663b4fd2f3532ee0f6c9bc10cfdd4e3cb2668287713d87
|
|
BLAKE2b-256 checksum How to use checksums |
79a02b44b2fc10d42455c53a267e26cb028940b2fcda5e7ca626852c34b7ecf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.22
|
Security for stereograph 4.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.