Skip to main content

Package to train GNNs for stereoscopic reconstruction of gamma events for CTAO

Project description

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-build 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  

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 null to 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 ince 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 && \  #example of a command to run a training 

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

stereograph-0.0.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stereograph-0.0.0-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

Details for the file stereograph-0.0.0.tar.gz.

File metadata

  • Download URL: stereograph-0.0.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for stereograph-0.0.0.tar.gz
Algorithm Hash digest
SHA256 c7f0ea35fe030f36701422efe7c372ed2376bee78eeb94419abba302cfb2f782
MD5 9a1af10ee15913a13b31f26fb2a73b41
BLAKE2b-256 c999b3ad450f0808fd010c75ce2c0c1d9f399a23d93bd88e80c9cafbaaef97b5

See more details on using hashes here.

File details

Details for the file stereograph-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: stereograph-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 42.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for stereograph-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0df38621a4b2084332a70eb5d62c6e41e803232ff97c651d7cf1e915c8cdb1c4
MD5 e73335f66fe9c85b13e50c13751716dd
BLAKE2b-256 e600f14c2b7209ecbd9b22dd144ae8ab7e98ed53c6d364bec060715f2aee809f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page