v2dl3

VERITAS (VEGAS and Eventdisplay) to DL3 Converter

https://github.com/veritas-observatory/v2dl3

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
    Organization veritas-observatory has institutional domain (veritas.sao.arizona.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.9%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

VERITAS (VEGAS and Eventdisplay) to DL3 Converter

Basic Info
  • Host: GitHub
  • Owner: VERITAS-Observatory
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 116 MB
Statistics
  • Stars: 9
  • Watchers: 34
  • Forks: 1
  • Open Issues: 12
  • Releases: 7
Created over 7 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

V2DL3 - VERITAS (VEGAS and Eventdisplay) to DL3 Converter

License DOI

V2DL3 is a tool to convert VERITAS data products to DL3 FITS format, allowing to use e.g. the gammapy science tools for the high-level analysis.

DL3 files include event lists, instrument response functions (IRFs) and observation index tables. The V2DL3 converter can be used to convert point-like and full-enclosure IRFs. The FITS output follows the data formats for gamma-ray astronomy as defined in open gamma-astro-data-formats (GADF) repository.

The V2DL3 project tries to share as many tools as possible between VEGAS and Eventdisplay, especially those used for writing the FITS files.

Two steps are required to convert VERITAS data products to DL3 FITS format and use them with gammapy. Each of these steps are covered by one of the following tools:

  • converter of event lists and instrument response functions to DL3 (v2dl3-vegas for VEGAS, v2dl3-eventdisplay for Eventdisplay)
  • v2dl3-generate-index-file tool to generate observation index tables

User installation

Users of V2DL3 can install the package with the following steps:

bash git clone https://github.com/VERITAS-Observatory/V2DL3 cd V2DL3 pip install .

[!NOTE] This will replaced in near future by a pip install from PyPI.

All scripts (v2dl3-vegas, v2dl3-eventdisplay, v2dl3-generate-index-file) are now available as callable command line tools.

V2DL3 for VEGAS

  • VEGAS version >= 2.5.7
  • Requirements are listed in the environment-vegas.yml file.
  • Alternatively, a script which builds a Docker image with the latest V2DL3 and the prerequisite software for v2dl3-vegas is available. See utils/v2dl3-vegas-docker/README.md

Developer Installation (VEGAS)

Use the conda package manager to install the dependencies:

bash conda env create -f environment-vegas.yml

The environment v2dl3-vegas will be created and can be activated with:

bash conda activate v2dl3-vegas

Install now pyV2DL3:

bash pip install .

Docker recipe

To use a Docker image with v2dl3-vegas pre-installed, see utils/v2dl3-vegas-docker/README.md

The command line tool v2dl3 with VEGAS

Run v2dl3-vegas --help to see all options.

See README_vegas.md for more information on newer v2dl3-vegas features such as ITM reconstruction, full-enclosure, and event classes.

Make sure you have ROOT with pyROOT enabled and VEGAS(>=v2.5.7) installed to proceed. Now, lets create the DL3 fits files from the stage 5 files in the ./VEGAS/ folder.

One file at a time

To convert a single stage 5 file to DL3 fits you need to provide the path to the stage 5 file as well as the corresponding effective area file using the flag -f. The last argument is the name of the output directory .Beware that the file names for the outputs are inferred from the root file name (xxx.root -> xxx.fits)

bash v2dl3-vegas -f ./VEGAS/54809.med.ED.050.St5_Stereo.root ./VEGAS/EA_na21stan_medPoint_050_ED_GRISU.root ./test

Generate from a VEGAS stage6 run list

You can also provide a stage6 run list to the command line tool. In this case the last argument is the folder where all the output DL3 files will be saved. Beware that the file names for the outputs are inferred from the root file name (xxx.root -> xxx.fits)

bash v2dl3-vegas -l ./runlist.txt ./test

Run lists may be generated via a utility script.

bash python utils/vegas_runlister.py --help

V2DL3 for EventDisplay

The pip installation as discussed above is recommended for all users.

Developer Installation (Eventdisplay)

Install dependencies and activate the environment using the conda package manager:

bash conda env create -f environment-eventdisplay.yml conda activate v2dl3Eventdisplay pip install -e .

Converting Eventdisplay data products to DL3

Run v2dl3-eventdisplay --help to see all options.

Convert an anasum output file to DL3. The following input is required:

  • anasum file for a given run
  • effective area file for the corresponding cut applied during the preparation of the anasum file (DL3 version)

Example for point-like analysis:

bash v2dl3-eventdisplay \ -f 54809.anasum.root [Effective Area File] \ ./output_dir/54809.anasum.fits

Example for full-enclosure analysis:

bash v2dl3-eventdisplay \ --full-enclosure \ -f 64080.anasum.root [Effective Area File] \ ./output_dir/64080.anasum.fits

Runs with observational parameters (i.e., zenith, night sky background) outside but close to corresponding IRF axes range can be converted with the one of the following two command line parameters:

  • --fuzzy_boundary tolerance: This option interpolates the IRF at the boundary value if the run parameter value is within the given tolerance. The tolerance is define as the ratio of absolute difference between boundary and run parameter value to boundary. This option is preferable over --force_extrapolation.
  • --force_extrapolation: This option extrapolates linearly the IRF at the run parameter value. Use this option with a caution since the extrapolation is applied even for run parameter values very far from the corresponding IRF axes range.

Recommended options is: --fuzzy_boundary zenith 0.05 --fuzzy_boundary pedvar 0.5. This takes into account that extrapolation of the IRF zenith axis is applied to very large zenith angles only, where shower properties changes significantly with small changes in zenith angle.

Further options are:

  • --save_multiplicity: write telescope multiplicity as EVENTTYPE keyword.
  • --instrument_epoch [epoch]: write instrument epoch as INSTRUME keyword.
  • --db_fits_file [db_fits_file]: copy run information (e.g., weather, L3 rates) from DB fits file into header information. Requires access to DB fits files.
  • --evt_filter [filter_file]: apply an event filter defined in a yaml or json file (examples below).

Event filter examples

Selects all events with IsGamma == 1 (relevant only for anasum files produced with the WRITE_ALL_EVENTS set to 1).

yaml IsGamma: 1

Select all events with energies between 1 and 10 TeV:

yaml ENERGY: [1, 10]

Data storage and generating index files

Generate observation index and HDU tables for DL3 data storage are required to use with gammapy in for reading and analysis of the generated DL3 data. This steps is independent of VEGAS or Eventdisplay. The two index files are generated with the tool v2dl3-generate-index-file (check all options with v2dl3-generate-index-file --help).

The tables are described on the GADF website:

Contributing to V2DL3 and Developing Code

Your contribution is welcome!

A few remarks when contributing code:

  • goal is to keep as much common code for converting from VEGAS or Eventdisplay data products
  • put package specific code into the pyV2DL3/vegas and pyV2DL3/eventdisplay directories. As different environments are used for both packages, do not put any imports to vegas/eventdisplay in modules in pyV2DL3

To ensure readability, we try follow the Python PEP8 style guide. Best to install the precommit tool to check the code style before committing.

Functions and classes should contain a docstring with a short description.

Unit tests are encouraged and are available for few cases at this point. Unit tests are in the tests directory and can be called using pytest.

Use the python logging system instead of the ‘print()’ function to output text. This allows to pipe all output into a log file and for different logging levels (INFO, DEBUG, …).

Owner

  • Name: VERITAS Observatory
  • Login: VERITAS-Observatory
  • Kind: organization

Citation (CITATION.cff)

# YAML 1.2
# Metadata for citation of this software according to the CFF format (https://citation-file-format.github.io/)
cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
title: "V2DL3 - VERITAS (VEGAS and Eventdisplay) to DL3 Converter."
doi: 10.5281/zenodo.8306205
version: 0.5.0
date-released: 2023-09-08
keywords:
- "gamma-ray astronomy"
- "astronomy software"
- "Imaging Atmospheric Cherenkov Telescope"
- VERITAS
- Eventdisplay
- VEGAS
repository-code: "https://github.com/VERITAS-Observatory/V2DL3"
license: BSD-3-Clause
# authors appear in reverse appearance in time of contribution
# (earliest first)
authors:
- given-names: Ralph
  family-names: Bird
  affiliation: UCLA
- given-names: Tony
  family-names: Lin
- given-names: Tarek
  family-names: Hassan
  affiliation: DESY
- given-names: Josh
  family-names: Cardenzana
- given-names: Mireia
  family-names: Nievas
  affiliation: DESY
- given-names: Tobias
  family-names: Kleiner
  affiliation: DESY
- given-names: Gernot
  family-names: Maier
  affiliation: DESY
  orcid: https://orcid.org/0000-0001-9868-4700
- given-names: Sonal
  family-names: Patel
  affiliation: DESY
- given-names: Konstantin
  family-names: Pfrang
  affiliation: DESY
- given-names: Donggeun
  family-names: Tak
  affiliation: DESY
- given-names: Greg
  family-names: Foote
  affiliation: "Department of Physics and Astronomy and the Bartol Research Institute, University of Delaware, Newark, DE 19716, USA"
- given-names: Alisha
  family-names: Chromey
  affiliation: "Smithsonian Astrophysics Observatory"
- given-names: Amanda
  family-names: Weinstein
  affiliation: "Iowa State University"
- given-names: Tyler
  family-names: Cahill
  affiliation: "Iowa State University"
- given-names: Matthew
  family-names: Lundy
  affiliation: "McGill University"
- given-names: Deivid
  family-names: Ribeiro
  affiliation: "University of Minnesota"
- given-names: Nicki
  family-names: Bond
  affiliation: "University College Dublin"

GitHub Events

Total
  • Create event: 19
  • Issues event: 8
  • Watch event: 1
  • Delete event: 17
  • Member event: 1
  • Issue comment event: 18
  • Push event: 79
  • Pull request review comment event: 9
  • Pull request review event: 21
  • Pull request event: 33
Last Year
  • Create event: 19
  • Issues event: 8
  • Watch event: 1
  • Delete event: 17
  • Member event: 1
  • Issue comment event: 18
  • Push event: 79
  • Pull request review comment event: 9
  • Pull request review event: 21
  • Pull request event: 33

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 56
  • Total pull requests: 64
  • Average time to close issues: 8 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 12
  • Total pull request authors: 14
  • Average comments per issue: 2.93
  • Average comments per pull request: 0.47
  • Merged pull requests: 45
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 2
  • Pull requests: 5
  • Average time to close issues: about 2 months
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 4
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • GernotMaier (18)
  • TarekHC (10)
  • tony32lin (8)
  • steob92 (5)
  • ralphbird (5)
  • Jvinniec (3)
  • tobiaskleiner (3)
  • epuesche (1)
  • matthew-w-lundy (1)
  • kpfrang (1)
  • leandrorizk (1)
  • deividribeiro (1)
  • cedrickperron (1)
Pull Request Authors
  • GernotMaier (22)
  • sona-patel (11)
  • tobiaskleiner (10)
  • dependabot[bot] (6)
  • TarekHC (5)
  • tony32lin (4)
  • deividribeiro (4)
  • Jvinniec (4)
  • tmcahill (3)
  • matthew-w-lundy (3)
  • kpfrang (3)
  • ralphbird (2)
  • steob92 (1)
  • achrmy (1)
  • NickiBond (1)
Top Labels
Issue Labels
bug (9) eventDisplay (9) VEGAS (6) enhancement (5) help wanted (3) good first issue (2) question (1)
Pull Request Labels
dependencies (6) github_actions (2) eventDisplay (1) bug (1) VEGAS (1)

Dependencies

.github/workflows/v2dl3-codeChecking.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/v2dl3-eventdisplay-packaging.yml actions
  • actions/checkout v3 composite
  • docker/build-push-action v3 composite
  • docker/login-action v2 composite
  • docker/metadata-action v4 composite
.github/workflows/v2dl3-eventdisplay.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/v2dl3-vegas.yml actions
  • actions/checkout v3 composite
utils/v2dl3-eventdisplay-docker/Dockerfile docker
  • python 3.10-slim build
setup.py pypi
  • astropy *
  • click *
  • numpy *
  • pkgconfig *
  • pyyaml *
  • root_numpy *
  • scipy *
  • tqdm *
  • uproot *