Skip to content
index_generation.rst 2.42 KiB
Newer Older
Alice Donini's avatar
Alice Donini committed
.. _index_generation:

Index creation
==============

Gammapy needs an index file to read the generated DL3 fits file (:ref:`dl3`). This can be created using the `create_DL3_index.py` script.
The script makes use of the same configuration file of the script to generate DL3 files: `config_dl2_to_dl3.yaml`.

Usage:

.. code-block:: bash

    usage: create_DL3_index.py [-h] [--prod PROD] [--outdir OUTDIR] [--config CONFIG]
                           [--config-analysis CONFIG_ANALYSIS] [--verbose] [--source_name SOURCE_NAME]
                           [--tcuname TCUNAME] [--runlist RUNLIST [RUNLIST ...]] [--distance DISTANCE]
                           [--ra RA] [--dec DEC]

    DL3 index maker

    optional arguments:
      --config CONFIG, -c CONFIG
                            Specify a personal config file for the analysis
      --config-analysis CONFIG_ANALYSIS
                            Specify a config file which described analysis profile to use
      --dec DEC             Dec coordinate of the target. To add if you want to use custom position
      --distance DISTANCE, -dis DISTANCE
                            Max distance in degrees between the target position and the run pointing position
                            for the run selection, negative value means no selection using this parameter
                            (default: -1).
      --outdir OUTDIR, -o OUTDIR
                            Directory to store the output
      --prod PROD, -p PROD  Prod to use (default: v0.8.4)
      --ra RA               RA coordinate of the target. To add if you want to use custom position
      --runlist RUNLIST [RUNLIST ...], -rl RUNLIST [RUNLIST ...]
                            File with run list to be analysed
      --source_name SOURCE_NAME, -n SOURCE_NAME
                            Name of the source
      --tcuname TCUNAME     Apply run selection based on TCU source name
      --verbose, -v         Increase output verbosity
      -h, --help            show this help message and exit


The command is pretty similar to the one for the DL3 generation. The code is fast, so no submission process has been implemented.

.. code-block:: bash

    python create_DL3_index.py -c config_dl2_to_dl3_Crab2020.yaml --source_name Crab -v

After running the script, you should have two files in the DL3 data directory: `hdu-index.fits.gz` and `obs-index.fits.gz`.

.. note::

    The index files have to be in the same folder of the related DL3 file.