Skip to main content

Artificial Intelligence for Imaging Atmospheric Cherenkov Telescopes

Project description

aict-tools Build Status

Executables to perform machine learning tasks on FACT and CTA eventlist data. Possibly also able to handle input of other experiments if in the same file format.

All you ever wanted to do with your IACT data in one package. This project is mainly targeted at using machine-learning for the following tasks:

  • Energy Regression
  • Gamma/Hadron Separation
  • Reconstruction of origin (Mono for now)

Installation

Then you can install the aict-tools by:

pip install aict-tools

By default, this does not install optional dependencies for writing out models in onnx or pmml format. If you want to serialize models to these formats, install this using:

$ pip install aict-tools[pmml] # for pmml support
$ pip install aict-tools[onnx] # for onnx support
$ pip install aict-tools[all]  # for both

Alternatively you can clone the repo, cd into the folder and do the usual pip install . dance.

Usage

For each task, there are two executables, installed to your PATH. Each take yaml configuration files and h5py style hdf5 files as input. The models are saved as pickle using joblib and/or pmml using sklearn2pmml.

  • aict_train_<...>
    This script is used to train a model on events with known truth values for the target variable, usually monte carlo simulations.

  • aict_apply_<...> This script applies a given model, previously trained with aict_train_<...> and applies it to data, either a test data set or data with unknown truth values for the target variable.

The apply scripts can iterate through the data files in chunks using the --chunksize=<N> option, this can be handy for very large files (> 1 million events).

Energy Regression

Energy regression for gamma-rays require a yaml configuration file and simulated gamma-rays in the event list format.

The two scripts to perform energy regression are called

  • aict_train_energy_regressor
  • aict_apply_energy_regressor

An example configuration can be found in examples/config_energy.yaml.

To apply a model, use aict_apply_energy_regressor.

Separation

Binary classification or Separation requires a yaml configuration file, one data file for the signal class and one data file for the background class.

The two scripts to perform separation are called

  • aict_train_separation_model
  • aict_apply_separation_model.

An example configuration can be found in examples/config_separator.yaml.

Reconstruction of gamma-ray origin using the disp method

To estimate the origin of the gamma-rays in camera coordinates, the disp-method can be used.

Here it is implemented as a two step regression/classification task. One regression model is trained to estimate abs(disp) and a classification model is trained to estimate sgn(disp).

Training requires simulated diffuse gamma-ray events.

  • aict_train_disp_regressor
  • aict_apply_disp_regressor

An example configuration can be found in examples/config_source.yaml.

Note: By applying the disp regressor, Theta wil be deleted from the feature set. Theta has to be calculated from the source prediction e.g. by using fact_calculate_theta from pyfact.

Utility scripts

Applying straight cuts

For data selection, e.g. to get rid of not well reconstructable events, it is customary to apply so called pre- or quality cuts before applying machine learning models.

This can be done with aict_apply_cuts and a yaml configuration file of the cuts to apply. See examples/quality_cuts.yaml for an example configuration file.

Split data into training/test sets

Using aict_split_data, a dataset can be randomly split into sets, e.g. to split a monte carlo simulation dataset into train and test set.

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

aict_tools-0.17.0.tar.gz (25.6 kB view details)

Uploaded Source

File details

Details for the file aict_tools-0.17.0.tar.gz.

File metadata

  • Download URL: aict_tools-0.17.0.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for aict_tools-0.17.0.tar.gz
Algorithm Hash digest
SHA256 91d7a5cacfe3c390b34eb5450899bd608c6b6af138137dfa27b60c4c6b918431
MD5 252f78452ceb79816aee9eb1b1df75f6
BLAKE2b-256 31213c00a14e698c614ce856162ad93f44ed49aab09f6de9153293ccbaf14794

See more details on using hashes here.

Provenance

Supported by

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