Commit d92c32be4ee4453868dacb737d57663066bd611c

Authored by Michael Mayer
1 parent 70e82b84

continue writing docs

doc/source/user_manual/iact_analysis/analysis.rst
@@ -109,8 +109,6 @@ model XML file will then contain both, the background model and the input sky mo @@ -109,8 +109,6 @@ model XML file will then contain both, the background model and the input sky mo
109 109
110 $ csiactobs inmodel="mymodel.xml" 110 $ csiactobs inmodel="mymodel.xml"
111 111
112 -A list of available sky models can be found here: `models <http://gammalib.sourceforge.net/user_manual/modules/model.html>`_  
113 -  
114 Alternatively, models can be merged at any times using the simple tool :ref:`csmodelmerge`: 112 Alternatively, models can be merged at any times using the simple tool :ref:`csmodelmerge`:
115 113
116 .. code-block:: bash 114 .. code-block:: bash
@@ -120,7 +118,100 @@ Alternatively, models can be merged at any times using the simple tool :ref:`csm @@ -120,7 +118,100 @@ Alternatively, models can be merged at any times using the simple tool :ref:`csm
120 Output model file [crab_models.xml] 118 Output model file [crab_models.xml]
121 119
122 Note that the number of files to merge is not limited to two. Detailled options how the input model XML file can 120 Note that the number of files to merge is not limited to two. Detailled options how the input model XML file can
123 -be passed is given on the reference page of :ref:`csmodelmerge`. 121 +be passed is given on the reference page of :ref:`csmodelmerge`. It is also important to know that each model in the container
  122 +must have a unique name. This implies, for instance, merging the same XML model twice will result in an exception.
  123 +
  124 +A list of available sky models can be found here: `models <http://gammalib.sourceforge.net/user_manual/modules/model.html>`_.
  125 +Of particular help to create sky models for your dataset is the section about :ref:`modelling CTA data <models>`.
  126 +
  127 +
  128 +Example XML files
  129 +-----------------
  130 +To get familiar with the XML syntax and format example files for an observation container and a model container
  131 +are shown in the following.
  132 +
  133 +Observation XML file
  134 +^^^^^^^^^^^^^^^^^^^^
  135 +
  136 +.. code-block:: xml
  137 +
  138 + <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  139 + <observation_list title="observation list">
  140 + <observation name="Crab Nebula" id="11111" instrument="HESS">
  141 + <parameter name="EventList" file="/path/to/fits/file/events_11111.fits.gz" />
  142 + <parameter name="EffectiveArea" file="/path/to/fits/file/aeff_11111.fits.gz" />
  143 + <parameter name="PointSpreadFunction" file="/path/to/fits/file/psf_11111.fits.gz" />
  144 + <parameter name="EnergyDispersion" file="/path/to/fits/file/edisp_11111.fits.gz" />
  145 + <parameter name="Background" file="/path/to/fits/file/bgmodel_11111.fits.gz" />
  146 + </observation>
  147 + <observation name="Crab Nebula" id="11112" instrument="HESS">
  148 + <parameter name="EventList" file="/path/to/fits/file/events_11112.fits.gz" />
  149 + <parameter name="EffectiveArea" file="/path/to/fits/file/aeff_11112.fits.gz" />
  150 + <parameter name="PointSpreadFunction" file="/path/to/fits/file/psf_11112.fits.gz" />
  151 + <parameter name="EnergyDispersion" file="/path/to/fits/file/edisp_11112.fits.gz" />
  152 + <parameter name="Background" file="/path/to/fits/file/bgmodel_11112.fits.gz" />
  153 + </observation>
  154 + <observation name="Crab Nebula" id="11113" instrument="HESS">
  155 + <parameter name="EventList" file="/path/to/fits/file/events_11113.fits.gz" />
  156 + <parameter name="EffectiveArea" file="/path/to/fits/file/aeff_11113.fits.gz" />
  157 + <parameter name="PointSpreadFunction" file="/path/to/fits/file/psf_11113.fits.gz" />
  158 + <parameter name="EnergyDispersion" file="/path/to/fits/file/edisp_11113.fits.gz" />
  159 + <parameter name="Background" file="/path/to/fits/file/bgmodel_11113.fits.gz" />
  160 + </observation>
  161 + <observation name="Crab Nebula" id="11114" instrument="HESS">
  162 + <parameter name="EventList" file="/path/to/fits/file/events_11114.fits.gz" />
  163 + <parameter name="EffectiveArea" file="/path/to/fits/file/aeff_11114.fits.gz" />
  164 + <parameter name="PointSpreadFunction" file="/path/to/fits/file/psf_11114.fits.gz" />
  165 + <parameter name="EnergyDispersion" file="/path/to/fits/file/edisp_11114.fits.gz" />
  166 + <parameter name="Background" file="/path/to/fits/file/bgmodel_11114.fits.gz" />
  167 + </observation>
  168 + </observation_list>
  169 +
  170 +Model XML file
  171 +^^^^^^^^^^^^^^
  172 +
  173 +.. code-block:: xml
  174 +
  175 + <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  176 + <source_library title="source library">
  177 + <source name="bkg_11111" type="CTAIrfBackground" instrument="HESS" id="11111">
  178 + <spectrum type="ConstantValue">
  179 + <parameter name="Value" value="1" error="0" scale="1" min="0.01" max="100" free="1" />
  180 + </spectrum>
  181 + </source>
  182 + <source name="bkg_11112" type="CTAIrfBackground" instrument="HESS" id="11112">
  183 + <spectrum type="ConstantValue">
  184 + <parameter name="Value" value="1" error="0" scale="1" min="0.01" max="100" free="1" />
  185 + </spectrum>
  186 + </source>
  187 + <source name="bkg_11113" type="CTAIrfBackground" instrument="HESS" id="11113">
  188 + <spectrum type="ConstantValue">
  189 + <parameter name="Value" value="1" error="0" scale="1" min="0.01" max="100" free="1" />
  190 + </spectrum>
  191 + </source>
  192 + <source name="bkg_11114" type="CTAIrfBackground" instrument="HESS" id="11114">
  193 + <spectrum type="ConstantValue">
  194 + <parameter name="Value" value="1" error="0" scale="1" min="0.01" max="100" free="1" />
  195 + </spectrum>
  196 + </source>
  197 + <source name="Crab" type="PointSource">
  198 + <spectrum type="PowerLaw">
  199 + <parameter name="Prefactor" scale="1e-17" value="3.0" min="1e-07" max="1000.0" free="1"/>
  200 + <parameter name="Index" scale="-1" value="2.5" min="0.0" max="+5.0" free="1"/>
  201 + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  202 + </spectrum>
  203 + <spatialModel type="SkyDirFunction">
  204 + <parameter name="RA" scale="1.0" value="83.6331" min="-360" max="360" free="1"/>
  205 + <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="1"/>
  206 + </spatialModel>
  207 + </source>
  208 + </source_library>
  209 +
  210 +.. note::
  211 +
  212 + It is important to ensure background models are properly linked to their respective observation.
  213 + Therefore it is required to keep the attributes ``instrument`` and ``id`` the same for the observation
  214 + and the corresponding background model. The tool :ref:`csiactobs` makes sure this is the case.
124 215
125 Run ctselect 216 Run ctselect
126 ------------ 217 ------------
@@ -173,9 +264,11 @@ On default, energy dispersion is not considered in the fit. To switch on the usa @@ -173,9 +264,11 @@ On default, energy dispersion is not considered in the fit. To switch on the usa
173 the hidden parameter ``edisp=yes`` can be provided. Note that this will cause a significant reduction of the computing 264 the hidden parameter ``edisp=yes`` can be provided. Note that this will cause a significant reduction of the computing
174 speed. 265 speed.
175 266
176 -Binned analysis  
177 ----------------  
178 -For binned analysis, some intermediated data products have to be produced. The products are a binned data cube, 267 +Stacked (binned) analysis
  268 +-------------------------
  269 +The stacked analysis mode is using a binned analysis where all observations are included and stacked into one event cube.
  270 +This analysis mode is much faster than unbinned analysis when having a large dataset (e.g. > 100 hours).
  271 +For this type of binned analysis, some intermediate data products have to be produced. The products are a binned data cube,
179 an exposure cube, a psf cube, and a background cube. 272 an exposure cube, a psf cube, and a background cube.
180 273
181 Bin events 274 Bin events
doc/source/user_manual/iact_analysis/high_level.rst
@@ -10,15 +10,108 @@ High level analysis tools for IACT data @@ -10,15 +10,108 @@ High level analysis tools for IACT data
10 10
11 Inspecting observation definition files 11 Inspecting observation definition files
12 --------------------------------------- 12 ---------------------------------------
  13 +After having created an observation definition file, the user might want to know a summary of its content.
  14 +Important quantities usually are the number of observations, the total livetime, or the mean zenith angle.
  15 +For this purpose, :ref:`csobsinfo` inspects an observation XML container for its content.
  16 +
  17 +.. code-block:: bash
  18 +
  19 + $ csobsinfo
  20 + Event list, counts cube, or observation definition file [obs.xml] selected_obs.xml
  21 +
  22 +This dumps general information of the observation container in a logfile ``csobsinfo.log``.
  23 +For a direct output on the screen, pass the hidden parameter ``debug=yes`` on the command line:
  24 +
  25 +.. code-block:: bash
  26 +
  27 + $ csobsinfo debug=yes
  28 + Event list, counts cube, or observation definition file [obs.xml] selected_obs.xml
  29 + ...
  30 + 2016-02-19T15:43:08: +=========+
  31 + 2016-02-19T15:43:08: | Summary |
  32 + 2016-02-19T15:43:08: +=========+
  33 + 2016-02-19T15:43:08: Unbinned observations .....: 4
  34 + 2016-02-19T15:43:08: Number of events ..........: 6085
  35 + 2016-02-19T15:43:08: Binned observations .......: 0
  36 + 2016-02-19T15:43:08: Number of bins ............: 0
  37 + 2016-02-19T15:43:08:
  38 + 2016-02-19T15:43:08: === Pointings ===
  39 + 2016-02-19T15:43:08: Mean zenith angle .........: 46.89
  40 + 2016-02-19T15:43:08: Mean azimuth angle ........: 13.63
  41 + 2016-02-19T15:43:08:
  42 + 2016-02-19T15:43:08: === Energy range ===
  43 + 2016-02-19T15:43:08: Emin ......................: 461.48 GeV
  44 + 2016-02-19T15:43:08: Emax ......................: 37.8832 TeV
  45 + 2016-02-19T15:43:08:
  46 + 2016-02-19T15:43:08: === Time range ===
  47 + 2016-02-19T15:43:08: Start [MJD] ...............: 53343.9212153
  48 + 2016-02-19T15:43:08: Stop [MJD] ................: 53347.9321065
  49 + 2016-02-19T15:43:08: Total ontime ..............: 6877.00 s = 114.62 min = 1.91 h
  50 + 2016-02-19T15:43:08: Total livetime ............: 6427.52 s = 107.13 min = 1.79 h
  51 + ...
  52 +
  53 +Further options are described on the reference page :ref:`csobsinfo`.
13 54
14 Inspecting model XML files 55 Inspecting model XML files
15 -------------------------- 56 --------------------------
  57 +Similar to the observation containers, model XML file can be inspected, too.
  58 +The tool :ref:`csmodelinfo` gives a summary of the model container. In particular,
  59 +the number of free parameters, number of sky and background models and also number of
  60 +parameters that are at their limits might be of interest.
  61 +
  62 +.. code-block:: bash
  63 +
  64 + $ csmodelinfo debug=yes
  65 + Input model XML file [$CTOOLS/share/models/crab.xml]
  66 + 2016-02-19T15:50:40: +=========+
  67 + 2016-02-19T15:50:40: | Summary |
  68 + 2016-02-19T15:50:40: +=========+
  69 + 2016-02-19T15:50:40: === Instrument specific models ===
  70 + 2016-02-19T15:50:40: All .......................: 1
  71 + 2016-02-19T15:50:40: CTA .......................: 1
  72 + 2016-02-19T15:50:40: === Model types ===
  73 + 2016-02-19T15:50:40: PointSource ...............: 1
  74 + 2016-02-19T15:50:40: CTAIrfBackground ..........: 1
  75 + 2016-02-19T15:50:40:
  76 + 2016-02-19T15:50:40: +=======================+
  77 + 2016-02-19T15:50:40: | Parameter information |
  78 + 2016-02-19T15:50:40: +=======================+
  79 + 2016-02-19T15:50:40: All parameters ............: 10
  80 + 2016-02-19T15:50:40: Fixed parameters ..........: 6
  81 + 2016-02-19T15:50:40: Free parameters (total) ...: 4
  82 + 2016-02-19T15:50:40: Free background parameters : 2
  83 + 2016-02-19T15:50:40: Free source parameters ....: 2
  84 + 2016-02-19T15:50:40: Free spectral parameters ..: 2
  85 + 2016-02-19T15:50:40: Parameters at limit .......: 0
  86 +
16 87
17 Compute upper limit 88 Compute upper limit
18 ------------------- 89 -------------------
  90 +Very often in gamma-ray astronomy sources are at the verge of detection or even not detectable.
  91 +In such cases, it is useful to derive an upper limit using :ref:`ctulimit`.
  92 +
  93 +.. code-block:: bash
  94 +
  95 + $ ctulimit
  96 + Input event list, counts cube or observation definition XML file [selected_obs.xml]
  97 + Input model XML file [crab_models.xml]
  98 + Source of interest [Crab]
  99 +
  100 +The upper limit will be stored in the log file. To get the limit printed on screen, use the hidden parameter
  101 +``debug=yes``.
19 102
20 Compute asymmetric errors 103 Compute asymmetric errors
21 ------------------------- 104 -------------------------
  105 +When an analysis approaches its final state, it makes sense to have asymmetric errors on the parameters of the
  106 +source of interest. For this purpose, the tool :ref:`cterror` can be used:
  107 +
  108 +.. code-block:: bash
  109 +
  110 + $ cterror debug=yes
  111 + Input event list, counts cube or observation definition XML file [selected_obs.xml]
  112 + Input model XML file [crab_models.xml]
  113 + Source of interest [Crab]
  114 +
22 115
23 Compute spectral points 116 Compute spectral points
24 ----------------------- 117 -----------------------
doc/source/user_manual/iact_analysis/tipps.rst
@@ -21,6 +21,9 @@ Split TS map computation @@ -21,6 +21,9 @@ Split TS map computation
21 Accessing fit parameters in python 21 Accessing fit parameters in python
22 ---------------------------------- 22 ----------------------------------
23 23
  24 +Accessing upper limits in python
  25 +--------------------------------
  26 +
24 Manipulate models in python 27 Manipulate models in python
25 --------------------------- 28 ---------------------------
26 29