Commit 6540305d6502cc5c8b582dff57018e56c0fe59b6

Authored by Jürgen Knödlseder
1 parent b37325c4

Include information about energy dispersion in H.E.S.S. tutorial

doc/source/users/tutorials/hess_dr1/fitting.rst
@@ -118,6 +118,10 @@ The fit has converged and the source was fitted at a position of @@ -118,6 +118,10 @@ The fit has converged and the source was fitted at a position of
118 :math:`22.025 \pm 0.002` degrees in Declination. 118 :math:`22.025 \pm 0.002` degrees in Declination.
119 The statistical :math:`1\sigma` positional uncertainty corresponds to 0.12 arcmin. 119 The statistical :math:`1\sigma` positional uncertainty corresponds to 0.12 arcmin.
120 Systematic uncertainties are not computed. 120 Systematic uncertainties are not computed.
  121 +This can be compared to the values of
  122 +:math:`83.629 \pm 0.005` degrees in Right Ascension and
  123 +:math:`22.012 \pm 0.001` degrees in Declination reported in
  124 +`Holler et al. (2017) <https://arxiv.org/pdf/1707.04196.pdf>`_.
121 125
122 According to 126 According to
123 `SIMBAD <http://cdsportal.u-strasbg.fr/?target=Crab%20nebula>`_, 127 `SIMBAD <http://cdsportal.u-strasbg.fr/?target=Crab%20nebula>`_,
@@ -128,13 +132,37 @@ from the fitted position. @@ -128,13 +132,37 @@ from the fitted position.
128 The intensity at 1 TeV of the Crab was fitted to 132 The intensity at 1 TeV of the Crab was fitted to
129 :math:`(4.81 \pm 0.26) \times 10^{-11}\,{\rm photons}\,{\rm cm}^{-2}\,{\rm s}^{-1}\,{\rm TeV}^{-1}` 133 :math:`(4.81 \pm 0.26) \times 10^{-11}\,{\rm photons}\,{\rm cm}^{-2}\,{\rm s}^{-1}\,{\rm TeV}^{-1}`
130 the spectral index of the power law is 134 the spectral index of the power law is
131 -:math:`-2.58 \pm 0.01`. 135 +:math:`-2.71 \pm 0.07`.
132 This can be compared to the values of 136 This can be compared to the values of
133 :math:`(3.45 \pm 0.05) \times 10^{-11}\,{\rm photons}\,{\rm cm}^{-2}\,{\rm s}^{-1}\,{\rm TeV}^{-1}` 137 :math:`(3.45 \pm 0.05) \times 10^{-11}\,{\rm photons}\,{\rm cm}^{-2}\,{\rm s}^{-1}\,{\rm TeV}^{-1}`
134 and 138 and
135 :math:`-2.63 \pm 0.01` 139 :math:`-2.63 \pm 0.01`
136 reported in 140 reported in
137 -`Aharonian et al. (2016), A&A, 457, 899 <https://www.aanda.org/articles/aa/abs/2006/39/aa5351-06/aa5351-06.html>`_. 141 +`Aharonian et al. (2006), A&A, 457, 899 <https://www.aanda.org/articles/aa/abs/2006/39/aa5351-06/aa5351-06.html>`_.
  142 +
  143 +.. note::
  144 + In the :ref:`ctlike` run above the energy dispersion, which relates the
  145 + true photon energies to the energies of the reconstructed events, was
  146 + not taken into account.
  147 + **By default energy dispersion usage is disabled** since it involves an
  148 + extra dimension in the data analysis which slows down the computations.
  149 + To enable energy dispersion you have to run :ref:`ctlike` with the
  150 + ``edisp=yes`` argument:
  151 +
  152 + .. code-block:: bash
  153 +
  154 + $ ctlike debug=yes edisp=yes
  155 + Input event list, counts cube or observation definition XML file [events.fits] obs_crab_selected.xml
  156 + Input model definition XML file [$CTOOLS/share/models/crab.xml] crab_models.xml
  157 + Output model definition XML file [crab_results.xml]
  158 +
  159 + Taking into account the energy dispersion, the fitted source position is
  160 + :math:`83.621 \pm 0.003` degrees in Right Ascension and
  161 + :math:`22.024 \pm 0.002` degrees in Declination,
  162 + the fitted source intensity at 1 TeV is
  163 + :math:`(4.64 \pm 0.26) \times 10^{-11}\,{\rm photons}\,{\rm cm}^{-2}\,{\rm s}^{-1}\,{\rm TeV}^{-1}`
  164 + and the fitted spectral index is
  165 + :math:`-2.61 \pm 0.07`.
138 166
139 Following a model fit, **you should always inspect the fit residuals.** 167 Following a model fit, **you should always inspect the fit residuals.**
140 First let's inspect the spectral residuals. 168 First let's inspect the spectral residuals.
@@ -164,20 +192,23 @@ You can do this using the :ref:`csresspec` script as follows: @@ -164,20 +192,23 @@ You can do this using the :ref:`csresspec` script as follows:
164 The script will produce the FITS file ``resspec.fits`` that contains the 192 The script will produce the FITS file ``resspec.fits`` that contains the
165 spectral residuals for each of the model components. 193 spectral residuals for each of the model components.
166 To display the residuals you can use the ``show_residuals.py`` script in the 194 To display the residuals you can use the ``show_residuals.py`` script in the
167 -example folder.  
168 -Apparently there as still significant spectral residuals that cannot be  
169 -explained by the model, yet overall, the model provides a reasonable first order  
170 -approximation of the data. 195 +example folder as follows:
171 196
172 .. code-block:: bash 197 .. code-block:: bash
173 198
174 $CTOOLS/share/examples/python/show_residuals.py resspec.fits 199 $CTOOLS/share/examples/python/show_residuals.py resspec.fits
175 200
  201 +The figure below shows the resulting residual spectrum.
  202 +Although the model provides a reasonable first order approximation of the
  203 +spectral distribution of the data, there are still significant spectral
  204 +residuals that cannot be explained by the model.
  205 +
176 .. figure:: fitting_resspec.png 206 .. figure:: fitting_resspec.png
177 :width: 600px 207 :width: 600px
178 :align: center 208 :align: center
179 209
180 - *Residual spectrum* 210 + *Residual counts spectrum after model fitting*
  211 +
181 212
182 Finally you should also inspect the spatial residuals. 213 Finally you should also inspect the spatial residuals.
183 You do this using the :ref:`csresmap` script as follows: 214 You do this using the :ref:`csresmap` script as follows:
@@ -213,3 +244,12 @@ south-east of the fitted Crab nebula position. @@ -213,3 +244,12 @@ south-east of the fitted Crab nebula position.
213 :align: center 244 :align: center
214 245
215 *Residual map with a slight Gaussian smoothing applied* 246 *Residual map with a slight Gaussian smoothing applied*
  247 +
  248 +.. note::
  249 + If the energy dispersion should be taken into account you also have to
  250 + specify the ``edisp=yes`` argument in the residual computations:
  251 +
  252 + .. code-block:: bash
  253 +
  254 + $ csresspec components=yes edisp=yes
  255 + $ csresmap edisp=yes