Commit 5a7f34d583cdb6aefa09ba5bf61dd0de19bc1386

Authored by Jürgen Knödlseder
1 parent 73f4c5f3

Update IACT documentation

doc/source/users/reference_manual/csmodelmerge.rst
... ... @@ -13,10 +13,10 @@ This script merges several model XML file into a single model XML file. The
13 13 files are passed via the ``inmodels`` parameter. There are 4 options to specify
14 14 a list of files that should be merged:
15 15  
16   -* a space-separated list of file names (e.g. model1.xml model2.xml)
17   -* a comma-separated list of file names (e.g. model1.xml,model2.xml)
18   -* a wildcard string (e.g. mymodel*.xml)
19   -* an ASCII file containing the file names, one file per line (e.g. @mymodels.txt)
  16 +* a space-separated list of file names (e.g. ``model1.xml model2.xml``)
  17 +* a semi-colon separated list of file names (e.g. ``model1.xml;model2.xml``)
  18 +* a wildcard string (e.g. ``mymodel*.xml``)
  19 +* an ASCII file containing the file names, one file per line (e.g. ``@mymodels.txt``)
20 20  
21 21 Note that the "@" needs to be specified in case of an ASCII file name. It is
22 22 also important to note that models with the same name cannot be appended. The
... ...
doc/source/users/user_manual/iact_analysis/analysis.rst
... ... @@ -3,83 +3,97 @@
3 3 Analysing IACT data
4 4 ===================
5 5  
6   -In order to analyse data from current IACTs, the data have to be retrieved. Information how
7   -to copy IACT data to a local machine can be found here: :ref:`sec_copy`
  6 +In order to analyse data from current IACTs, you first have to retrieve the
  7 +data. Information on how to do that can be found in the section :ref:`sec_copy`.
8 8  
9 9 Check available FITS production
10 10 -------------------------------
11   -Before starting an analysis, it is important to know what kind of data need to be analysed.
12   -In the current scheme of `storing IACT data <http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/index.html>`_,
13   -every FITS data set is represented with a unique name, e.g. ``"hess-fits-pa-release-1.0-Prod26-MppStd"``. This string
14   -has to be passed to some set of ctools to find and use the data for analysis.
  11 +Before you start an analysis, it is important that you know what kind of data
  12 +need to be analysed. In the current scheme of
  13 +`storing IACT data <http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/index.html>`_,
  14 +every FITS data set is represented by a unique name, e.g.
  15 +``"hess-fits-pa-release-1.0-Prod26-MppStd"``.
  16 +You have to pass this string to some set of scripts to find and use the data
  17 +for analysis.
15 18  
16   -To check the available names of FITS data sets, it is recommended to run :ref:`csiactdata`.
  19 +To check the available names of FITS data sets, you should run the
  20 +:ref:`csiactdata` script:
17 21  
18 22 .. code-block:: bash
19 23  
20 24 $ csiactdata
21 25 Path were data is located [] /path/to/fits/data/
22 26  
23   -This will list names of available FITS data sets on the screen. In the
24   -following it is assumed the user has selected a data set called ``fits-data-name``.
25   -The query for the path where the data is located can be
26   -omitted by setting the environment variable ``VHEFITS`` to this locations. This might be convenient
27   -since some other tools also query for the same parameter and can use ``VHEFITS`` instead.
  27 +This script will list the names of available FITS data sets into the console.
  28 +In the following it is assumed that you have selected a data set named
  29 +``fits-data-name``.
  30 +You can omit the query for the path where the data is located by setting the
  31 +environment variable ``VHEFITS`` to this location. Also other scripts will
  32 +benefit from having this environment variable set, and this avoids that you
  33 +have to type in the path name every time you use one of these scripts.
  34 +
28 35  
29 36 Find observations
30 37 -----------------
31   -To start an analysis, it is required to assemble a list of observations that should be used. For this purpose,
32   -:ref:`csfindobs` searches for observations according to user criteria.
33 38  
34   -Search for sky pointings
35   -^^^^^^^^^^^^^^^^^^^^^^^^
36   -The most common search for observations is by pointing position in the sky.
  39 +Now that you know which data are available you have to assemble a list of
  40 +observations (a.k.a. runs) that you want to use in an analysis. You will
  41 +use the :ref:`csfindobs` for that task, which allows you to select the
  42 +observations according to a number of user criteria.
  43 +
  44 +
  45 +Select observations according to pointing direction
  46 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  47 +
  48 +The most common search for observations is by pointing direction on the sky,
  49 +and you do this by simply invoking the :ref:`csfindobs` script:
37 50  
38 51 .. code-block:: bash
39 52  
40 53 $ csfindobs
41 54 Name of FITS production (Run csiactdata to view your options) [fits-data-name]
42   - Right ascension [83.6331]
43   - Declination [22.01]
44   - Search radius [2.5]
45   - Runlist outfile [runlist.lis]
46   -
47   -
48   -Specifying additional search criteria
49   -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50   -The search for observations can be further constrained arbitrarily. For this purpose,
51   -:ref:`csfindobs` contains a hidden parameter ``expression``. It is possible to use any
52   -FITS selection expression that is `supported by cfitsio <http://www.isdc.unige.ch/integral/download/osa/doc/10.1/osa_um_intro/node38.html>`_.
53   -Available properties (i.e. column names) for selection, can be found
54   -`here <http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/obs_index/index.html>`_
55   -or by simply browsing the observation index file with a FITS viewer.
  55 + Right ascension of selection region centre (deg) [83.63]
  56 + Declination of selection region centre (deg) [22.01]
  57 + Search radius of selection region (deg) [2.5]
  58 + Output runlist file [runlist.lis]
56 59  
57   -Example:
  60 +The script will create an ASCII file named ``runlist.lis`` that contains the
  61 +identifiers for all observations with pointing directions located within 2.5°
  62 +around the position of the Crab nebula.
  63 +
  64 +
  65 +Select observations using additional criteria
  66 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  67 +
  68 +You may add further selection criteria using the hidden ``expression`` parameter.
  69 +You may use any FITS selection expression that is
  70 +`supported by the cfitsio row filtering specification <https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node97.html>`_.
  71 +Column names that can be used in the expression can be found
  72 +`here <http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/obs_index/index.html>`_
  73 +or by simply browsing the observation index file with a FITS viewer. For example
58 74  
59 75 .. code-block:: bash
60 76  
61 77 $ csfindobs expression="ZEN_PNT<30&&LIVETIME>1800"
62   - ...
63   -
64   -This command selects all observations that have a zenith angle less than
65   -30 degrees and a livetime larger than 1800 seconds (i.e. 30 minutes).
  78 +
  79 +will select all observations that have a zenith angle less than 30° and a
  80 +livetime larger than 1800 seconds.
66 81  
67 82  
68   -Omitting the pointing selection
69   -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70   -You can also omit the pointing selection, for example in case where you
71   -don't know the sky coordinates of your object of interest. In that case, you
72   -may directly use the object name in the expression and pass ``NONE`` as
73   -coordinate to :ref:`csfindobs`:
  83 +Select observations independent of pointing direction
  84 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  85 +
  86 +You can also omit the pointing selection, for example in case that you do not
  87 +know the sky coordinates of your object of interest. In that case, you may
  88 +directly use the object name in the expression and pass ``NONE`` as coordinate
  89 +to :ref:`csfindobs`:
74 90  
75 91 .. code-block:: bash
76 92  
77 93 $ csfindobs expression="OBJECT=='Crab Nebula'"
78 94 Name of FITS production (Run csiactdata to view your options) [fits-data-name]
79   - Right ascension [NONE]
80   - Runlist outfile [runlist.lis]
81   -
82   -This will omit the selection of pointing positions.
  95 + Right ascension of selection region centre [NONE]
  96 + Output runlist file [runlist.lis]
83 97  
84 98 .. note::
85 99  
... ... @@ -88,50 +102,79 @@ This will omit the selection of pointing positions.
88 102 ``min_qual``. For example, ``min_qual=1`` selects all data with a
89 103 looser quality criteria.
90 104  
  105 +
91 106 Create an observation list
92 107 --------------------------
93   -The runlist ASCII file containing a list of selected observation IDs must now be converted to an
94   -observation definition XML file. This file contains information about the location of the files that are required
95   -for the analysis. The purpose of the tool :ref:`csiactobs` is to do this conversion.
  108 +
  109 +As next step, you must convert the runlist ASCII file into an observation
  110 +definition XML file. The observation definition XML file will contain the
  111 +file names of all files that are needed for the analysis. You do this
  112 +conversion with the :ref:`csiactobs` script:
96 113  
97 114 .. code-block:: bash
98 115  
99 116 $ csiactobs
100   - Data storage name (Run csiactdata to view your options) [] fits-data-name
101   - Runlist file [runlist.lis]
  117 + Data storage name [] fits-data-name
  118 + Input runlist file [runlist.lis]
102 119 Number of free parameters per background model [1]
103   - Output model XML file [bgmodels.xml]
104   - Observation XML outfile [obs.xml]
105   -
106   -This tools has now performed various tasks:
107   -
108   -* Use the IACT data storage to convert the observation list ``runlist.lis`` into an observation definition XML file ``obs.xml``.
109   -* Create a model XML file that contains the background models. In ctools, each observation has its own independent background model. The number of free parameters per model was set to 1, i.e. the normalisation of the background is left free for each observation. The models were saved in ``bgmodels.xml``.
110   -* The tool uses an internal hierarchy for assigning the background models. The hidden parameter ``bkg_mod_hiera`` (default=irf|aeff|gauss) steers the order how background models should be created. In case the IRF background model is not available, the script automatically falls back to the background model from effective area (GCTAModelAeffBackground).
111   -* There are some further hidden parameters to steer the start parameters for the Aeff and Gaussian background model. Have a look at :ref:`csiactobs` to view a full list of parameters.
112   -* In ``csiactobs.log`` (or on screen if ``debug=yes``), the script logs the complete energy range of the observation container. These values might be important for later usage (e.g. in binned analysis).
113   -
114   -In case a sky model is already prepared, it is possible to also provide the hidden parameter ``inmodel``. The output
115   -model XML file will then contain both, the background model and the input sky model:
  120 + Output model definition XML file [bgmodels.xml]
  121 + Output observation definition XML file [obs.xml]
  122 +
  123 +The :ref:`csiactobs` script will create two output files: the observations
  124 +definition XML file ``obs.xml`` and an output model definition XML file
  125 +``bgmodels.xml``. To generate ``obs.xml``, :ref:`csiactobs` has used the
  126 +IACT data storage and extracted the relevant file names. ``bgmodels.xml`` is
  127 +a file that is used for background modeling, where each observation will have
  128 +its own independent background model. In the example above, you have set the
  129 +number of free parameters per background model to one, hence the normalisation
  130 +of the background model for each observation will be a free parameter that is
  131 +later adjusted by the maximum likelihood fit.
  132 +
  133 +There are some further hidden parameters to steer the start parameters for the
  134 +effective area and the Gaussian background models. You may have a look at
  135 +:ref:`csiactobs` to see the full list of available parameters.
  136 +
  137 +You may also note that the :ref:`csiactobs` script has created a ``csiactobs.log``
  138 +file that logs the complete energy range of the observations that have been
  139 +selected. These values may be important for later, in particular if you
  140 +intend to do a binned or stacked analysis.
  141 +
  142 +In case that you have already a model definition XML file that describes a model
  143 +of the celestial source distribution (a.k.a. a sky model), you may provide this
  144 +sky model to :ref:`csiactobs` using the hidden ``inmodel`` parameter. The
  145 +output model definition XML file will then contain the sky model and the
  146 +background model, and you can use the model directly in a maximum likelihood
  147 +fit.
116 148  
117 149 .. code-block:: bash
118 150  
119 151 $ csiactobs inmodel="mymodel.xml"
120 152  
121   -Alternatively, models can be merged at any times using the simple tool :ref:`csmodelmerge`:
  153 +Alternatively, you can merged models using the :ref:`csmodelmerge` script:
122 154  
123 155 .. code-block:: bash
124 156  
125 157 $ csmodelmerge
126   - Input model XML files [bgmodels.xml crab.xml]
127   - Output model file [crab_models.xml]
128   -
129   -Note that the number of files to merge is not limited to two. Detailled options how the input model XML file can
130   -be passed is given on the reference page of :ref:`csmodelmerge`. It is also important to know that each model in the container
131   -must have a unique name. This implies, for instance, merging the same XML model twice will result in an exception.
  158 + Input model definition XML files [mymodel.xml bgmodels.xml]
  159 + Output model definition XML file [combined_model.xml]
  160 +
  161 +.. note::
  162 +
  163 + The number of files that can be merged with :ref:`csmodelmerge` is not
  164 + limited to two. The list of input file names may be either separated by
  165 + whitespace or semi-colons, can be specified using wildcards, or can be given
  166 + in an ASCII file (see :ref:`csmodelmerge`).
  167 +
  168 +.. warning::
  169 +
  170 + Each model component in the input model definition XML files that are provided
  171 + to :ref:`csmodelmerge` must have a different and unique name. Merging for
  172 + example the same XML model twice will raise an exception.
132 173  
133   -A list of available sky models can be found `here <http://gammalib.sourceforge.net/user_manual/modules/model.html>`_.
134   -Of particular help to create sky models for your dataset is the section about :ref:`modelling CTA data <models>`.
  174 +A list of available sky models can be found
  175 +`here <http://gammalib.sourceforge.net/user_manual/modules/model.html>`_.
  176 +If you are not familiar with creating sky models you should read the section
  177 +about :ref:`modelling CTA data <models>`.
135 178  
136 179  
137 180 Example XML files
... ...