Commit 1f3fcdb0 authored by Alice Donini's avatar Alice Donini
Browse files

update documentation

parent 34d01938
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
A "How to" Guide for LST analysis at IT
===============================================================================================

This document aims to describe how to perform an analysis at the IT cluster in La Palma using the scripts hosted on the `GitLab repository <https://www.ict.inaf.it/gitlab/alice.donini/lst-analysis>`_ .
This document aims to describe how to perform an analysis at the IT cluster in La Palma using the scripts hosted on the `GitLab repository <https://gitlab.com/davide.miceli1993/lst_scripts>`_ .


.. toctree::
+30 −31
Original line number Diff line number Diff line
@@ -4,30 +4,26 @@ DL2 files generation
====================

The script `DL1_to_DL2.py` allows to analyze DL1 data and produce DL2 files.
Mandatory arguments are the name of the source (option ``-n``) and a configuration file `config_dl1_to_dl2.yaml` (option ``--config``). The script will search for the configuration file in the ``$CONFIG`` folder specified in the initial settings.
Usage:

.. code-block::

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

    DL1 to DL2 converter

    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).
                            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).
      --dry                 Make a dry run, no true submission
      --globber, -g         If True, overwrites existing output file without asking
      --globber, -g         If True, overwrites existing output file without asking (default: False).
      --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, -rl RUNLIST
                            File with a list of run and the associated night to be analysed
@@ -38,11 +34,11 @@ Usage:
      --verbose, -v         Increase output verbosity
      -h, --help            show this help message and exit

It makes use of a configuration file `config_dl1_to_dl2.yaml` (option ``--config``):
Preview of the configuration file:

.. code-block:: yaml

    # Directory where job file are written
    # Directory where job files are written
    jobmanager: ../jobmanager

    # Database file name
@@ -53,42 +49,45 @@ It makes use of a configuration file `config_dl1_to_dl2.yaml` (option ``--config

    # path to main data folder of the user
    # change it accordingly to your working env
    base_dir: /fefs/aswg/alice.donini/Analysis/data
    base_dir: /fefs/aswg/workspace/alice.donini/Analysis/data

    # Path to personal directory where output data will be saved.
    # Uncomment and modify in case you want to use a non standard path
    #output_folder: ../DL2/Crab

    # Directory where config files are stored
    #config_folder: ./
    # Otherwise files will be saved to {base_dir}/DL2/{source_name}/{night}/{version}/{cleaning}
    #dl2_output_folder: ../DL2/Crab

    # Path to trained RF files
    path_models: ../models

    # Uncomment and modify in case you want to specify a custom configuration file for the lstchain script
    # lstchain_config: ../lstchain_84.json

    # Values for automatic selection of DL1 data
    dl1_data:
      DL1_dir: /fefs/aswg/data/real/DL1     # path to DL1 directory
      night: [20210911, 20210912]           # day(s) of observation (more than one is possible)
      version: v0.9.1                       # v0.7.3, v0.8.4, v0.9, v0.9.1
      version: v0.9                         # v0.7.3, v0.8.4, v0.9
      cleaning: tailcut84
      # uncomment the line below and specify the nights only if database search is used and not a custom runlist file
      #night: [20210911, 20210912]           # day(s) of observation (more than one is possible)

Edit the configuration file: change the paths based on your working directory and modify the DL1 data information used to search for the files at the IT.

The script uses the created database (:ref:`db_generation`) to find the runs to analyze, based on the nights specified in the configuration file `config_dl1_to_dl2.yaml`.
An extra selection can be done in coordinates (``--distance``, ``--ra`` and ``--dec`` are mandatory arguments) or by the name of the source as saved in TCU (argument ``--tcuname``).
There are two ways to select the data to analyze: through a search in the database (outdated for now) or through a run list given by the user.

If you want to use the created database (:ref:`db_generation`) to find the runs to analyze, then fill in the information about the wanted nights in the configuration file `config_dl1_to_dl2.yaml`.
An extra selection can be done in coordinates (in case ``--distance``, ``--ra`` and ``--dec`` are mandatory arguments) or by the name of the source as saved in TCU (argument ``--tcuname``).
If none of these selection methods is given, then all the runs available in the dates specified in the configuration file are considered for the analysis.

The search for DL1 files can be also done by giving a file list of runs and nights to be analyzed (option ``--runlist``).
No database file is needed in this case.

.. warning::

  The search of runs through the database has an issue on the dates at the moment. The database is generated from the drive log, so all the runs taken after the midnight are saved under the following day. This doesn't happen at the IT, where the runs are stored under the day of the starting night. So for some runs the search could fail, even if they are there.
  The search of runs through the database has a "feature". The database is generated from the drive log, so all the runs taken after the midnight are saved under the following day. This doesn't happen at the IT, where the runs are stored under the day of the starting night. So for some runs the search could fail, even if they are there.
  
  Thus if you use the database search always add in the config file also the date of the night after, so that you are sure all the runs take after the midnight are considered too.
  Thus if you use the database search always add in the configuration file also the date of the night after, so that you are sure all the runs take after the midnight are considered too.

Example of a file run list:
The search for DL1 files can be also done by giving a file list of runs and nights to be analyzed (option ``--runlist``).
No database file is needed in this case.
The runlist can be either manually created or produced using the `create_run_list.py` script (:ref:`runlist_generation`).

Example of a runlist file:

.. code-block::

@@ -96,9 +95,9 @@ Example of a file run list:
    2911 20201117
    3089 20201206

The argument ``--dry`` allows to perform a dry run.
No jobs are submitted and only the verbose output is printed.
Usefull to have a check of which runs are selected and the goodness of the sent command.

The argument ``--dry`` allows to perform a dry run. No jobs are submitted and only the verbose output is printed.
This option is usefull to have a check of which runs are selected and the goodness of the sent command.

Some examples of how to run the script:

+4 −15
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ There are two different scripts to generate the DL3 file:
  In the case the run of the job fails due to an astropy error about too old values of the IERS data:
  .. code-block::
    ValueError: interpolating from IERS_Auto using predictive values that are more than 30.0 days old.

  run before the script `IERS_download.py` to download offline the data and update the astropy tables.


@@ -28,37 +29,25 @@ Usage:

.. code-block::

    usage: DL2_to_DL3.py [-h] [--prod PROD] [--outdir OUTDIR] [--config CONFIG] [--config-analysis CONFIG_ANALYSIS]
                     [--verbose] [--source_name SOURCE_NAME] [--tcuname TCUNAME] [--runlist RUNLIST]
                     [--distance DISTANCE] [--ra RA] [--dec DEC] [--submit] [--dry] [--globber] [--cut_file CUT]
                     [--gh_cut GH_CUT] [--theta_cut THETA_CUT]
    usage: DL2_to_DL3.py [-h] [--verbose] [--outdir OUTDIR] --config CONFIG --source_name SOURCE_NAME [--ra RA] [--dec DEC] [--cut_file CUT_FILE] [--gh_cut GH_CUT] [--theta_cut THETA_CUT] [--submit] [--dry] [--globber]

    DL2 to DL3 converter

    optional arguments:
      --config CONFIG, -c CONFIG
                            Specify a personal config file for the analysis
      --config-analysis CONFIG_ANALYSIS
                            Specify a config file which describes analysis profile to use
      --cut_file CUT, -cut CUT
      --cut_file CUT_FILE, -cut CUT_FILE
                            Cut file
      --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).
      --dry                 Make a dry run, no true submission
      --gh_cut GH_CUT       Fixed selection cut for gh_score (gammaness)
      --globber, -g         If True, overwrites existing output file without asking
      --globber, -g         If True, overwrites existing output file without asking (default: False).
      --outdir OUTDIR, -o OUTDIR
                            Directory to store the output
      --prod PROD, -p PROD  Prod to use (default: v0.9.4)
      --ra RA               RA coordinate of the target. To add if you want to use custom position
      --runlist RUNLIST, -rl RUNLIST
                            File with a list of run and the associated night to be analysed
      --source_name SOURCE_NAME, -n SOURCE_NAME
                            Name of the source
      --submit              Submit the cmd to slurm on site
      --tcuname TCUNAME     Apply run selection based on TCU source name
      --theta_cut THETA_CUT
                            Fixed selection cut for theta
      --verbose, -v         Increase output verbosity
+7 −6
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ Analysis steps

There are many data levels and different scripts are used to call the corresponding ``lstchain`` one. The steps in order are:

* Database Generation (:ref:`db_generation`)
* Database Generation (:ref:`db_generation`) or Runlist generation (:ref: `runlist_generation`)
* DL1 generation (:ref:`dl1`)
* DL2 generation (:ref:`dl2`)
* DL3 generation (:ref:`dl3`)
@@ -64,13 +64,13 @@ Multiple nights can be specified.

    Create a directory structure

    optional arguments:
    options:
      -h, --help            show this help message and exit
      --main_dir MAIN_DIR   Path to parent folder
      --source SOURCE       Source name
      --night NIGHT [NIGHT ...]
                            Night date
      --version VERSION     lstchain version (default: v0.9.2)
      --version VERSION     lstchain version (default: v0.9)
      --cleaning CLEANING   Cleaning type (default: tailcut84)

Example of use:
@@ -88,12 +88,13 @@ Output:
    Directory  /fefs/aswg/workspace/alice.donini/Analysis/data/DL3/Crab/20220304/v0.9.2/tailcut84  created
    Directory structure for analysis on Crab was created.

Database generation
Database/Runlist generation
~~~~~~~~~~~~~~~~~~~~

Unless you specify a file with a list of runs and nights, there is the need of a database, through which the run selection is made.
Run selection can be done through two methods:

For the generation of the database file refer to :ref:`db_generation`.
* generation of a file with a list of runs and corresponding nights that is given as input to the analysis scripts, refer to :ref: `runlist_generation`.
* creation of a database through which the run selection is made, refer to :ref:`db_generation`.

DL1 generation
~~~~~~~~~~~~~~~~~~~~~
+2 −18
Original line number Diff line number Diff line
@@ -10,32 +10,16 @@ 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]
    usage: create_DL3_index.py [-h] [--verbose] --source_name SOURCE_NAME --config CONFIG [--dry]

    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
      --dry                 Make a dry run, no true submission
      --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

Loading