Commit 73f4c5f342e5b7bfe5f3e72c15b9c9711765c77c

Authored by Michael Mayer
1 parent d8fcfdf3

Added energy dispersion documentation

doc/source/users/user_manual/iact_analysis/analysis.rst
@@ -381,6 +381,33 @@ Depending on the required PSF precision, one could reduce the number of offset b @@ -381,6 +381,33 @@ Depending on the required PSF precision, one could reduce the number of offset b
381 381
382 $ ctpsfcube anumbins=100 382 $ ctpsfcube anumbins=100
383 383
  384 +Create energy dispersion cube (optional)
  385 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  386 +In case energy dispersion wants to be used in the analysis, the tool :ref:`ctedispcube` computes the energy
  387 +migration response for the given observations. Analogous to the PSF cube, the Edisp cube is stored in
  388 +a four-dimensional map. In each bin of the cube, the migration value ``E_reco/E_true`` is stored. The granularity
  389 +of the migration histogram can be steered via the hidden parameter ``migrabins`` (default: 100). In addition, the
  390 +maximum migration value can be set via the hidden parameter ``migramax`` (default: 2.0). Similar to the PSF cube,
  391 +the edispcube FITS file can become quite large. Therefore, since the energy dispersion shouldn't vary too much across
  392 +the sky region, one could reduce the spatial binning:
  393 +
  394 +.. code-block:: bash
  395 +
  396 + $ ctedispcube
  397 + Input event list or observation definition XML file [NONE] selected_obs.xml
  398 + Input counts cube file to extract energy dispersion cube definition [NONE]
  399 + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
  400 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
  401 + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR]
  402 + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
  403 + Image scale (in degrees/pixel) [1.0] 0.2
  404 + Size of the X axis in pixels [10] 20
  405 + Size of the Y axis in pixels [10] 20
  406 + Lower energy limit (TeV) [0.1] 0.5
  407 + Upper energy limit (TeV) [100.0] 50
  408 + Number of energy bins [20]
  409 + Output energy dispersion cube file [edispcube.fits]
  410 +
384 Create background cube 411 Create background cube
385 ^^^^^^^^^^^^^^^^^^^^^^ 412 ^^^^^^^^^^^^^^^^^^^^^^
386 Last but not least, for a binned IACT analysis a cube containing the background rate in sky coordinates and 413 Last but not least, for a binned IACT analysis a cube containing the background rate in sky coordinates and
@@ -451,6 +478,19 @@ Note that when passing an event cube to :ref:`ctlike`, the tool behaves differen @@ -451,6 +478,19 @@ Note that when passing an event cube to :ref:`ctlike`, the tool behaves differen
451 It queries directly for the additional ingredients for the binned analysis. It is important to pass the background model 478 It queries directly for the additional ingredients for the binned analysis. It is important to pass the background model
452 generated by :ref:`ctbkgcube` here to ensure the proper modelling of the background in the fit. 479 generated by :ref:`ctbkgcube` here to ensure the proper modelling of the background in the fit.
453 480
  481 +Running :ref:`ctlike` with energy dispersion, the hidden parameter ``edisp=yes`` needs to be specified. The tool
  482 +will then additionally query for the energy dispersion cube described above:
  483 +
  484 +.. code-block:: bash
  485 +
  486 + $ ctlike debug=yes
  487 + Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits
  488 + Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits
  489 + Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits
  490 + Input energy dispersion cube file (only needed for stacked analysis) [NONE] edispcube.fits
  491 + Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits
  492 + Input model XML file [binned_models.xml]
  493 + Output model XML file [binned_results.xml]
454 494
455 495
456 496
doc/source/users/user_manual/iact_analysis/high_level.rst
@@ -56,7 +56,8 @@ For a direct output on the screen, pass the hidden parameter ``debug=yes`` on th @@ -56,7 +56,8 @@ For a direct output on the screen, pass the hidden parameter ``debug=yes`` on th
56 2016-02-19T15:43:08: Total livetime ............: 6427.52 s = 107.13 min = 1.79 h 56 2016-02-19T15:43:08: Total livetime ............: 6427.52 s = 107.13 min = 1.79 h
57 ... 57 ...
58 58
59 -Further options are described on the reference page :ref:`csobsinfo`. 59 +Further options are described on the reference page :ref:`csobsinfo`. For instance, is possible to
  60 +generate a ds9 region file including all the pointing position by specifying the hidden parameter ``ds9file``.
60 61
61 Inspecting model XML files 62 Inspecting model XML files
62 -------------------------- 63 --------------------------
@@ -90,6 +91,8 @@ parameters that are at their limits might be of interest. @@ -90,6 +91,8 @@ parameters that are at their limits might be of interest.
90 2016-02-19T15:50:40: Free spectral parameters ..: 2 91 2016-02-19T15:50:40: Free spectral parameters ..: 2
91 2016-02-19T15:50:40: Parameters at limit .......: 0 92 2016-02-19T15:50:40: Parameters at limit .......: 0
92 93
  94 +Similar to :ref:`csobsinfo`, a ds9 region file including all the sky model components
  95 +can be generated by specifying the hidden parameter ``ds9file``.
93 96
94 Compute upper limit 97 Compute upper limit
95 ------------------- 98 -------------------
@@ -120,13 +123,18 @@ source of interest. For this purpose, the tool :ref:`cterror` can be used: @@ -120,13 +123,18 @@ source of interest. For this purpose, the tool :ref:`cterror` can be used:
120 Output model XML file [cterror_results.xml] 123 Output model XML file [cterror_results.xml]
121 124
122 The output model does not contain asymmetric errors yet. The positive and negative uncertainties can be read from the 125 The output model does not contain asymmetric errors yet. The positive and negative uncertainties can be read from the
123 -logfile (or from screen) if ``debug=yes`` was specified. 126 +logfile (or from screen if ``debug=yes`` was specified).
124 127
125 Compute spectral points 128 Compute spectral points
126 ----------------------- 129 -----------------------
127 A very common task in astronomy is to compute spectral data points. To determine a spectral data point, a small energy 130 A very common task in astronomy is to compute spectral data points. To determine a spectral data point, a small energy
128 range is considered and the model prefactor and its uncertainty is evaluated. The tool :ref:`csspec` works on both, binned 131 range is considered and the model prefactor and its uncertainty is evaluated. The tool :ref:`csspec` works on both, binned
129 -and unbinned data. 132 +and unbinned data. The hidden parameter ``edisp=yes`` can be specified in both cases to consider the energy migration
  133 +matrix in the fit.
  134 +
  135 +.. note::
  136 +
  137 + The resulting spectral points are provided as a function of reconstructed energy.
130 138
131 Unbinned 139 Unbinned
132 ^^^^^^^^ 140 ^^^^^^^^
@@ -158,8 +166,7 @@ Binned @@ -158,8 +166,7 @@ Binned
158 Number of spectral points (1-10000) [10] 166 Number of spectral points (1-10000) [10]
159 Lower energy limit for spectral points (TeV) [0.5] 167 Lower energy limit for spectral points (TeV) [0.5]
160 Upper energy limit for spectral points (TeV) [50.0] 168 Upper energy limit for spectral points (TeV) [50.0]
161 - Output spectrum file [spectrum.fits]  
162 - 169 + Output spectrum file [spectrum.fits]
163 170
164 Plot spectral points 171 Plot spectral points
165 ^^^^^^^^^^^^^^^^^^^^ 172 ^^^^^^^^^^^^^^^^^^^^
doc/source/users/user_manual/iact_analysis/tips.rst
@@ -13,7 +13,7 @@ Create a skymap of counts @@ -13,7 +13,7 @@ Create a skymap of counts
13 The tool :ref:`ctskymap` allows to create a single map of counts contained inside an observation container. 13 The tool :ref:`ctskymap` allows to create a single map of counts contained inside an observation container.
14 In contrast to :ref:`ctbin`, ctskymap takes into account all events that fall into the skymap energy range and spatial range. 14 In contrast to :ref:`ctbin`, ctskymap takes into account all events that fall into the skymap energy range and spatial range.
15 Since :ref:`ctbin` is intended for binned/stacked analysis, it respects energy thresholds, RoI selections etc. 15 Since :ref:`ctbin` is intended for binned/stacked analysis, it respects energy thresholds, RoI selections etc.
16 -Accordingly, :ref:`ctskymap` should be used for a simple visualisation of the counts. 16 +Accordingly, :ref:`ctskymap` could be used for a simple visualisation of the counts.
17 17
18 18
19 .. code-block:: bash 19 .. code-block:: bash
@@ -31,6 +31,15 @@ Accordingly, :ref:`ctskymap` should be used for a simple visualisation of the co @@ -31,6 +31,15 @@ Accordingly, :ref:`ctskymap` should be used for a simple visualisation of the co
31 Size of the Y axis in pixels [200] 31 Size of the Y axis in pixels [200]
32 Output skymap file [skymap.fits] 32 Output skymap file [skymap.fits]
33 33
  34 +Alternatively, one could use count cube and collapse the maps into one single image via Python:
  35 +
  36 +.. code-block:: python
  37 +
  38 + import gammalib
  39 + map = gammalib.GSkyMap("myCountCube.fits") # Loads the count cube
  40 + map.stack_maps() # Stack energy slices
  41 + map.save("myCountMap.fits") # Save to file
  42 +
34 Create region file of pointings 43 Create region file of pointings
35 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 44 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36 In particular, one might want to know how the pointings of the observation container distribute across the sky. 45 In particular, one might want to know how the pointings of the observation container distribute across the sky.
@@ -77,6 +86,12 @@ to access information in python: @@ -77,6 +86,12 @@ to access information in python:
77 info.ebounds() # gammalib.GEbounds object of energy ranges 86 info.ebounds() # gammalib.GEbounds object of energy ranges
78 info.gti() # gammalib.GGti object containing good time intervals 87 info.gti() # gammalib.GGti object containing good time intervals
79 88
  89 +There is also an example script to plot several information about an observation container which might be useful
  90 +for a quick visualisation of the observations inside a container:
  91 +
  92 +.. code-block:: bash
  93 +
  94 + $ python $CTOOLS/examples/show_obs.py selected_obs.xml
80 95
81 Visualise models 96 Visualise models
82 ---------------- 97 ----------------
@@ -185,7 +200,7 @@ Not all issues can be tackled. Nevertheless, here is a list of actions that have @@ -185,7 +200,7 @@ Not all issues can be tackled. Nevertheless, here is a list of actions that have
185 200
186 * Consider switching to binned analysis if the observation time exceeds 50-100 hours. 201 * Consider switching to binned analysis if the observation time exceeds 50-100 hours.
187 * Diffuse and extended sources in the RoI are computational expensive. However, in unbinned analysis they impact the speed much more. 202 * Diffuse and extended sources in the RoI are computational expensive. However, in unbinned analysis they impact the speed much more.
188 -* Usage of energy dispersion in unbinned analysis could also cause a long fit. Try switching it off if speed is important. 203 +* Usage of energy dispersion could also cause a long fit. Try switching it off if speed is important. Keep in mind this will have an effect on the results.
189 * Switch to a machine that supports OpenMP. This allows to parallelise the fit onto several cores. 204 * Switch to a machine that supports OpenMP. This allows to parallelise the fit onto several cores.
190 205
191 Compute excess maps 206 Compute excess maps