A pipeline prototype for the Cherenkov Telescope Array.
These instructions are for users only, i.e. you want to use the latest version of the code but do not intend to make any change to it. If your wish is to develop the package then follow the instruction below entitled "Instructions for developpers".
Get the source code and create the required basic conda environment:
git clone https://github.com/cta-observatory/protopipe.git
cd protopipe
conda env create -f protopipe_environment.yml
conda activate protopipe
In case you have already an environment 'myenv' set up for that kind of development, use:
conda env update -n myenv -f protopipe_environment.yml
This environment contains the bare minimum in order to run the scripts and build the documentation.
It doesn't take into account any additional tool you could use later on (it is suggested to install ipython, jupyter and vitables, especially if you want to contribute to the code).
Next you need to install protopipe itself (protopipe is the folder where the code was expanded. The name differs if you downloaded a released tagged version, it can be protopipe-0.2 for instance) :
cd protopipe
python setup.py develop
This will let you make changes to your local git repository without the need to update your environment every time. In the abscence of a conda or pip installation made avalaible, to install a released version (no further development), use :
python setup.py install
Remember that the environment needs to be activated in order for protopipe to work. This procedure has been successfully tested on macOS (10.10.5 & 10.14.6) and on Scientific Linux 7.
From the main folder go down to the documentation repository and create the documentation :
cd docs
make html
You will probably get some harmless warnings. The initial page is stored in _ build/html/index.html, which you can open using your favorite internet browser.
Before starting to use protopipe, be sure to be inside the relevant environment (e.g. conda activate protopipe
).
Get a simtel Monte Carlo file obtained with prod3b with only LSTCam and NectarCam cameras.
Any other kind of cameras in the file would lead to a crash, see issues #23.
Note that some generic La Palma files can contain FlashCam cameras.
The write_dl1.py script will prodcue a DL1 output from the simtel data.
cd protopipe/scripts
python write_dl1.py -h
The following instructions refer to local use of protopipe, which doesn't involve the use of the DIRAC computing grid (you can ignore the grid.yaml configuration file). Typical analysis steps are the following :
- create an analysis parent folder with the auxiliary script create_dir_structure.py
- prepare the configuration files
- copy the example YAML configuration files in the relative subfolders
- edit them for the particular needs of your analysis
- build a model for energy estimation
- Create tables for gamma-rays using write_dl1.py and analysis.yaml
- Merge them with the auxiliary script merge.sh
- create the model with build_model.py and regressor.yaml
- check it's performance with model_diagnostic.py and regressor.yaml
- build a model for gamma/hadron separation
- set 'estimate_energy' to True when using write_dl1.py so the reconstructed energy can be estimated and further used as a discriminant parameter.
- same process as for the energy estimation but using classifier.yaml
- produce DL2-level data
- create tables for gamma-rays, protons and electrons using write_dl2.py and analysis.yaml
- merge them with the auxiliary script merge.sh
- Estimate the final performance (IRFs) with make_performance.py and performance.yaml
Note: DL1/DL2 scripts take as input only 1 file at the time.
- Fork the master protopipe remote repository as explained here
- Follow the installation instructions above, but using your remote repository (we'll call origin yours and upstream the official one)
- if you want to develop something new:
- update local master branch (
git pull upstream master
) - create a new branch from your local master branch
- develop inside it
- push it to origin
- continue to develop and push until you feel ready
- update local master branch (
- start a pull request from origin/your_branch to upstream/master
- wait for an outcome
- if necessary, you can update or fix things in your branch because now everything is traced (local/your_branch --> origin/your_branch --> pull request)
Note: if your developments take a relatively long time,
- update periodically your local master branch,
- if updates have been made, go to your local development branch (
git checkout your_branch
) - if there are no conflicts, move the beginning of your branch at the end of the updated master (
git rebase master
) - push your branch to your remote