diff --git a/doc/source/help/issues.rst b/doc/source/help/issues.rst index ac3f41f..745975c 100644 --- a/doc/source/help/issues.rst +++ b/doc/source/help/issues.rst @@ -20,8 +20,9 @@ list of **Model fitting issues** -- :ref:`Broken power law has unreliable errors ` +- :ref:`Pivot energy should be comprised in energy range of fitted data ` - :ref:`Errors become unreliable when fitting the pivot energy ` +- :ref:`Broken power law has unreliable errors ` - :ref:`Shell model is biased when width is comparable to angular resolution ` - :ref:`Elliptical Gaussian model fit converges slowly ` @@ -34,14 +35,14 @@ Installation issues .. topic:: Certificate problem when cloning from Git - When cloning ctools from git you may encounter an SSL certificate - problem. This is related to the usage of the https protocol and can - be resolved by setting the ``GIT_SSL_NO_VERIFY`` environment variable - to true: + When cloning ctools from git you may encounter an SSL certificate + problem. This is related to the usage of the https protocol and can + be resolved by setting the ``GIT_SSL_NO_VERIFY`` environment variable + to true: - .. code-block:: bash + .. code-block:: bash - export GIT_SSL_NO_VERIFY=true + export GIT_SSL_NO_VERIFY=true .. _issue_python: @@ -71,15 +72,15 @@ Installation issues .. topic:: Installing on Solaris - Although ctools build on Solaris using the Sun compiler, there are - problems with global symbols in shared libraries and exception catching, - which prevents the FITS interface to work correctly. ctools have however - been built and tested successfully using the GNU compiler, and this is - the only build method that is currently supported. Problems have also - been encountered when compiling cfitsio versions more recent than 3.250. - The problems have been reported to the cfitsio developer team, and are - likely to be solved in the future. For the time being, it is recommended - to use cfitsio version 3.250 on Solaris. + Although ctools build on Solaris using the Sun compiler, there are + problems with global symbols in shared libraries and exception catching, + which prevents the FITS interface to work correctly. ctools have however + been built and tested successfully using the GNU compiler, and this is + the only build method that is currently supported. Problems have also + been encountered when compiling cfitsio versions more recent than 3.250. + The problems have been reported to the cfitsio developer team, and are + likely to be solved in the future. For the time being, it is recommended + to use cfitsio version 3.250 on Solaris. .. _issue_opensolaris: @@ -119,15 +120,13 @@ Analysis issues Model fitting issues ^^^^^^^^^^^^^^^^^^^^ -.. _issue_bplaw: +.. _issue_interval: -.. topic:: Broken power law has unreliable errors +.. topic:: Pivot energy should be comprised in energy range of fitted data - The broken power law spectral model has unreliable errors, specifically - for the prefactor and the break value. Errors are in general too large, - and this is related to the fact that the law's gradient is discontinuous - in energy. There is not very much we can do about it, it's inherent in - the law. + The pivot energy of a spectral model, such as for example a power law model, + should be comprised within the energy range of the fitted data, + otherwise some fit instabilities may occur. .. _issue_pivot: @@ -143,6 +142,16 @@ Model fitting issues parameters of the model to assure non-degeneracy of the free parameters. +.. _issue_bplaw: + +.. topic:: Broken power law has unreliable errors + + The broken power law spectral model has unreliable errors, specifically + for the prefactor and the break value. Errors are in general too large, + and this is related to the fact that the law's gradient is discontinuous + in energy. There is not very much we can do about it, it's inherent in + the law. + .. _issue_shell: .. topic:: Shell model is biased when width is comparable to angular resolution diff --git a/doc/source/users/tutorials/howto/howto_connect_models.ipynb b/doc/source/users/tutorials/howto/howto_connect_models.ipynb index bcf0627..8acd9a6 100644 --- a/doc/source/users/tutorials/howto/howto_connect_models.ipynb +++ b/doc/source/users/tutorials/howto/howto_connect_models.ipynb @@ -11,7 +11,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "
\"Download
" + "
\"Download
" ] }, { diff --git a/doc/source/users/tutorials/howto/howto_edisp.rst b/doc/source/users/tutorials/howto/howto_edisp.rst deleted file mode 100644 index ec2791f..0000000 --- a/doc/source/users/tutorials/howto/howto_edisp.rst +++ /dev/null @@ -1,92 +0,0 @@ -.. _howto_edisp: - -How to take the energy dispersion into account? ------------------------------------------------ - - .. admonition:: What you will learn - - You will learn how to **take the energy dispersion into account** when - fitting a model to the data using a maximum likelihood analysis. - - Although the effect of the energy dispersion is often neglegible there - may be cases where you want to consider energy dispersion in an analysis, - for example if you are analysing the data down to very low energies. - - .. warning:: - Energy dispersion is fully implemented in ctools but is computationally - intensive. So be aware that the **tools and scripts will take a substantial - amount of computing time**. - -If you are doing a stacked analysis the first thing you need is an energy -dispersion cube. You generate this cube using the :ref:`ctedispcube` tool: - -.. code-block:: bash - - $ ctedispcube - Input event list or observation definition XML file [NONE] obs_selected.xml - Input counts cube file to extract energy dispersion cube definition [NONE] - First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 - Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 - Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] - Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL - Image scale (in degrees/pixel) [1.0] - Size of the X axis in pixels [10] - Size of the Y axis in pixels [10] - Lower energy limit (TeV) [0.1] - Upper energy limit (TeV) [100.0] - Number of energy bins [20] 30 - Output energy dispersion cube file [edispcube.fits] - -This produces an -:ref:`energy dispersion cube ` -FITS file that contains the weighted energy dispersion as function of -sky position and energy. -Since the energy dispersion varies only slowly over the field of view it is -sufficient to sample that variation at a large spatial scale of typically one -degree. - -Now you can run the :ref:`ctlike` tool by adding the attribute ``edisp=yes`` -to the command line. As you see below, this instructs :ref:`ctlike` to query -for the energy dispersion cube and to take the energy dispersion into account -during the fit: - -.. code-block:: bash - - $ ctlike edisp=yes - Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits - Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits - Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits - Input energy dispersion cube file (only needed for stacked analysis) [NONE] edispcube.fits - Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits - Input model definition XML file [$CTOOLS/share/models/crab.xml] stacked_models.xml - Output model definition XML file [crab_results.xml] stacked_results_edisp.xml - -If you are doing an unbinned analysis you do not need to generate an energy -dispersion cube and you can directly run :ref:`ctlike` with the ``edisp=yes`` -attribute: - -.. code-block:: bash - - $ ctlike edisp=yes - Input event list, counts cube or observation definition XML file [events.fits] obs_selected.xml - Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml - Output model definition XML file [crab_results.xml] unbinned_models_edisp.xml - -The following tools and scripts do accept the optional ``edisp=yes`` attribute: - -* :ref:`ctbutterfly` -* :ref:`cterror` -* :ref:`ctlike` -* :ref:`ctmodel` -* :ref:`ctprob` -* :ref:`cttsmap` -* :ref:`ctulimit` -* :ref:`cslightcrv` -* :ref:`csphasecrv` -* :ref:`cspull` -* :ref:`csresmap` -* :ref:`cssens` -* :ref:`csspec` -* :ref:`cstsdist` -* :ref:`cstsmapsplit` - diff --git a/doc/source/users/tutorials/howto/howto_exclude.rst b/doc/source/users/tutorials/howto/howto_exclude.rst index 6d165e6..e894c0f 100644 --- a/doc/source/users/tutorials/howto/howto_exclude.rst +++ b/doc/source/users/tutorials/howto/howto_exclude.rst @@ -28,9 +28,9 @@ radius of 1 degree around the location of ``Src001``. Input counts cube or observation definition XML file [cntcube.fits] Input exclusion region file in ds9 format [NONE] RA for ROI centre (degrees) (0-360) [83.63] 266.42 - Dec for ROI centre (degrees) (-90-90) [22.01] -29.01 + Dec for ROI centre (degrees) (-90-90) [22.51] -29.01 Radius of ROI (degrees) (0-180) [3.0] 1.0 - Lower energy limit (TeV) [0.1] + Lower energy limit (TeV) [0.1] 1.0 Upper energy limit (TeV) [100.0] Output counts cube or observation definition XML file [cntcube_filtered.fits] @@ -62,10 +62,10 @@ the :ref:`ctcubemask` run: $ ctcubemask Input counts cube or observation definition XML file [cntcube.fits] Input exclusion region file in ds9 format [NONE] exclude.reg - RA for ROI centre (degrees) (0-360) [83.63] 266.42 - Dec for ROI centre (degrees) (-90-90) [22.01] -29.01 - Radius of ROI (degrees) (0-180) [3.0] 1.0 - Lower energy limit (TeV) [0.1] + RA for ROI centre (degrees) (0-360) [266.42] + Dec for ROI centre (degrees) (-90-90) [-29.01] + Radius of ROI (degrees) (0-180) [1.0] + Lower energy limit (TeV) [1.0] Upper energy limit (TeV) [100.0] Output counts cube or observation definition XML file [cntcube_filtered.fits] cntcube_filtered_exclude.fits diff --git a/doc/source/users/tutorials/howto/howto_extent.png b/doc/source/users/tutorials/howto/howto_extent.png new file mode 100644 index 0000000..75dad66 --- /dev/null +++ b/doc/source/users/tutorials/howto/howto_extent.png diff --git a/doc/source/users/tutorials/howto/howto_extent.rst b/doc/source/users/tutorials/howto/howto_extent.rst index 0ec8db2..a1577e1 100644 --- a/doc/source/users/tutorials/howto/howto_extent.rst +++ b/doc/source/users/tutorials/howto/howto_extent.rst @@ -27,9 +27,13 @@ As noted during the there is a bright extended source south-west of the Galactic Centre, and we add now an additional ``Src003`` component with a ``RadialDisk`` model to describe the spatial morphology of the source. -The -:ref:`model definition ` -for ``Src003`` is shown below: +To do this, copy the 1DC :ref:`model definition ` file + +.. code-block:: bash + + $ cp $CTOOLS/share/models/1dc_howto.xml extended_model.xml + +and add the following source to it .. code-block:: xml @@ -46,36 +50,46 @@ for ``Src003`` is shown below: -Running :ref:`ctlike` using the -:ref:`model definition file ` -will then fit the disk radius of ``Src003``. The results can be seen in the -log file and will also be written into the output -:ref:`model definition file `. +Then run :ref:`ctlike` to fit the parameters of ``Src003`` together with the +other source parameters + +.. code-block:: bash + + $ ctlike + Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits + Input exposure cube file [NONE] expcube.fits + Input PSF cube file [NONE] psfcube.fits + Input background cube file [NONE] bkgcube.fits + Input model definition XML file [$CTOOLS/share/models/crab.xml] extended_model.xml + Output model definition XML file [crab_results.xml] result.xml + +The results can be seen in the log file and will also be written into the +output :ref:`model definition file `. For illustration, an excerpt of the :ref:`ctlike` log file is shown below. -The disk with of ``Src003`` has been fitted to 0.335 +/- 0.003 degrees. -The source is detected with a TS value of 5393.8. +The disk with of ``Src003`` has been fitted to 0.326 +/- 0.005 degrees. +The source is detected with a TS value of 960.6. .. code-block:: none - 2017-08-25T19:37:47: === GModelSky === - 2017-08-25T19:37:47: Name ......................: Src003 - 2017-08-25T19:37:47: Instruments ...............: all - 2017-08-25T19:37:47: Test Statistic ............: 5393.78645148844 - 2017-08-25T19:37:47: Instrument scale factors ..: unity - 2017-08-25T19:37:47: Observation identifiers ...: all - 2017-08-25T19:37:47: Model type ................: ExtendedSource - 2017-08-25T19:37:47: Model components ..........: "RadialDisk" * "PowerLaw" * "Constant" - 2017-08-25T19:37:47: Number of parameters ......: 7 - 2017-08-25T19:37:47: Number of spatial par's ...: 3 - 2017-08-25T19:37:47: RA .......................: 266.306975228126 +/- 0.00363322258453142 [-360,360] deg (free,scale=1) - 2017-08-25T19:37:47: DEC ......................: -30.1946569442618 +/- 0.0031545381615373 [-90,90] deg (free,scale=1) - 2017-08-25T19:37:47: Radius ...................: 0.335173109280516 +/- 0.00257226134023012 [0.001,10] deg (free,scale=1) - 2017-08-25T19:37:47: Number of spectral par's ..: 3 - 2017-08-25T19:37:47: Prefactor ................: 6.23930379041412e-17 +/- 1.06204679984262e-18 [0,5.7e-15] ph/cm2/s/MeV (free,scale=5.7e-18,gradient) - 2017-08-25T19:37:47: Index ....................: -2.73810250489576 +/- 0.0151068737641297 [9.92,-9.92] (free,scale=-2.48,gradient) - 2017-08-25T19:37:47: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) - 2017-08-25T19:37:47: Number of temporal par's ..: 1 - 2017-08-25T19:37:47: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2018-01-25T13:18:26: === GModelSky === + 2018-01-25T13:18:26: Name ......................: Src003 + 2018-01-25T13:18:26: Instruments ...............: all + 2018-01-25T13:18:26: Test Statistic ............: 960.648581179907 + 2018-01-25T13:18:26: Instrument scale factors ..: unity + 2018-01-25T13:18:26: Observation identifiers ...: all + 2018-01-25T13:18:26: Model type ................: ExtendedSource + 2018-01-25T13:18:26: Model components ..........: "RadialDisk" * "PowerLaw" * "Constant" + 2018-01-25T13:18:26: Number of parameters ......: 7 + 2018-01-25T13:18:26: Number of spatial par's ...: 3 + 2018-01-25T13:18:26: RA .......................: 266.317413730996 +/- 0.00715229434136355 [-360,360] deg (free,scale=1) + 2018-01-25T13:18:26: DEC ......................: -30.1850885371228 +/- 0.00616374863033401 [-90,90] deg (free,scale=1) + 2018-01-25T13:18:26: Radius ...................: 0.325758937003301 +/- 0.00480357697494016 [0.001,10] deg (free,scale=1) + 2018-01-25T13:18:26: Number of spectral par's ..: 3 + 2018-01-25T13:18:26: Prefactor ................: 5.64206343830812e-17 +/- 6.90009393020621e-18 [0,5.7e-15] ph/cm2/s/MeV (free,scale=5.7e-18,gradient) + 2018-01-25T13:18:26: Index ....................: -2.70498667660106 +/- 0.0560039729118815 [9.92,-9.92] (free,scale=-2.48,gradient) + 2018-01-25T13:18:26: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) + 2018-01-25T13:18:26: Number of temporal par's ..: 1 + 2018-01-25T13:18:26: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) .. warning:: The parameter errors returned by :ref:`ctlike` are purely statistical. In @@ -83,87 +97,37 @@ The source is detected with a TS value of 5393.8. as for example the limits on the knowledge of the point spread function. These systematic uncertainties are **not** determined by ctools. -The figure below shows the residual map, generated using the ``SIGNIFICANCE`` -method, after subtracting the three fitted -sources and the diffuse emission model from the data. There is a ring-like -residual at the position of ``Src003`` which suggests that an axisymmetric -disk is not an accurate description of the data. - -.. figure:: howto_extent_disk.png - :width: 400px - :align: center - - *Residual sky map for a radial disk spatial shape for Src003* - -There are other spatial models in ctools, and we try in a second step an -axisymmetric Gaussian spatial shape. The corresponding -:ref:`model definition file ` -looks as follows: - -.. code-block:: xml +Now generate a residual map using :ref:`csresmap` to check the fit quality - - - - - - - - - - - - +.. code-block:: bash -Running :ref:`ctlike` again with that model results in a Gaussian sigma of -0.198 +/- 0.003 degrees for ``Src003``. The source is detected with a TS value -of 5665.7 which is considerably larger than the TS value of 5393.8 that is found -above for the radial disk model. -Below an excerpt of the :ref:`ctlike` log file: + $ csresmap + Input event list, counts cube, or observation definition XML file [cntmap.fits] cntcube.fits + Input model cube file (generated with ctmodel) [NONE] + Input exposure cube file [NONE] expcube.fits + Input PSF cube file [NONE] psfcube.fits + Input background cube file [NONE] bkgcube.fits + Input model definition XML file [$CTOOLS/share/models/crab.xml] result.xml + Residual map computation algorithm (SUB|SUBDIV|SUBDIVSQRT|SIGNIFICANCE) [SIGNIFICANCE] + Output residual map file [resmap.fits] -.. code-block:: none +The resulting residual map is shown below. The map looks rather clean. - 2017-08-25T20:32:55: === GModelSky === - 2017-08-25T20:32:55: Name ......................: Src003 - 2017-08-25T20:32:55: Instruments ...............: all - 2017-08-25T20:32:55: Test Statistic ............: 5665.73173788155 - 2017-08-25T20:32:55: Instrument scale factors ..: unity - 2017-08-25T20:32:55: Observation identifiers ...: all - 2017-08-25T20:32:55: Model type ................: ExtendedSource - 2017-08-25T20:32:55: Model components ..........: "RadialGaussian" * "PowerLaw" * "Constant" - 2017-08-25T20:32:55: Number of parameters ......: 7 - 2017-08-25T20:32:55: Number of spatial par's ...: 3 - 2017-08-25T20:32:55: RA .......................: 266.30022317901 +/- 0.00475655134090925 [-360,360] deg (free,scale=1) - 2017-08-25T20:32:55: DEC ......................: -30.1993627725406 +/- 0.0041251924859714 [-90,90] deg (free,scale=1) - 2017-08-25T20:32:55: Sigma ....................: 0.198343910095786 +/- 0.00298438230006778 [0.001,10] deg (free,scale=1) - 2017-08-25T20:32:55: Number of spectral par's ..: 3 - 2017-08-25T20:32:55: Prefactor ................: 7.15427332759485e-17 +/- 1.40842792023593e-18 [0,5.7e-15] ph/cm2/s/MeV (free,scale=5.7e-18,gradient) - 2017-08-25T20:32:55: Index ....................: -2.71899753120954 +/- 0.0146676775081257 [9.92,-9.92] (free,scale=-2.48,gradient) - 2017-08-25T20:32:55: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) - 2017-08-25T20:32:55: Number of temporal par's ..: 1 - 2017-08-25T20:32:55: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) - -.. note:: - While the TS values can formally not be convert into a statistical - significance between different spatial model hypotheses, a TS improvement - of 271.9 indicates a considerably better fit of the axisymmetric Gaussian - model with respect to the radial disk model to the data. - -The figure below shows the residual map for the fit of ``Src003`` with an -axisymmetric Gaussian model. -The map now looks pretty flat around ``Src003``, suggesting that an axisymmetric -Gaussian model is an appropriate description for the morphology of the gamma-ray -source. - -.. figure:: howto_extent_gauss.png +.. figure:: howto_extent.png :width: 400px :align: center - *Residual sky map for an axisymmetric Gaussian spatial shape for Src003* + *Residual sky map for a radial disk spatial shape for Src003* .. tip:: The region overlays for the residual sky maps were generated using the - :ref:`csmodelinfo` script. + :ref:`csmodelinfo` script + + .. code-block:: bash + + $ csmodelinfo + Input model definition XML file [model.xml] result.xml + Output DS9 region file [ds9.reg] result.reg .. warning:: The fitting of extended spatial models takes more computing time @@ -174,10 +138,3 @@ source. to use by default radial disk models for the extension fitting**, and only switch to a Gaussian disk models when really needed, or for the determination of final values for a publication. - - For reference, here the computing times on Mac OS X for the example using - different spatial morphology hypotheses for ``Src003``: - - * Point source: 12 min - * Radial disk source: 15 min - * Axisymmetric Gaussian source: 40 min diff --git a/doc/source/users/tutorials/howto/howto_extent_disk.png b/doc/source/users/tutorials/howto/howto_extent_disk.png deleted file mode 100644 index 3615dff..0000000 --- a/doc/source/users/tutorials/howto/howto_extent_disk.png +++ /dev/null diff --git a/doc/source/users/tutorials/howto/howto_extent_gauss.png b/doc/source/users/tutorials/howto/howto_extent_gauss.png deleted file mode 100644 index 699537c..0000000 --- a/doc/source/users/tutorials/howto/howto_extent_gauss.png +++ /dev/null diff --git a/doc/source/users/tutorials/howto/howto_filtered.png b/doc/source/users/tutorials/howto/howto_filtered.png index 6964d9c..55506a9 100644 --- a/doc/source/users/tutorials/howto/howto_filtered.png +++ b/doc/source/users/tutorials/howto/howto_filtered.png diff --git a/doc/source/users/tutorials/howto/howto_filtered_exclude.png b/doc/source/users/tutorials/howto/howto_filtered_exclude.png index 37205a2..e57595d 100644 --- a/doc/source/users/tutorials/howto/howto_filtered_exclude.png +++ b/doc/source/users/tutorials/howto/howto_filtered_exclude.png diff --git a/doc/source/users/tutorials/howto/howto_lightcurve.png b/doc/source/users/tutorials/howto/howto_lightcurve.png index 4766a35..69a0e94 100644 --- a/doc/source/users/tutorials/howto/howto_lightcurve.png +++ b/doc/source/users/tutorials/howto/howto_lightcurve.png diff --git a/doc/source/users/tutorials/howto/howto_lightcurve.rst b/doc/source/users/tutorials/howto/howto_lightcurve.rst index 3252555..106835e 100644 --- a/doc/source/users/tutorials/howto/howto_lightcurve.rst +++ b/doc/source/users/tutorials/howto/howto_lightcurve.rst @@ -21,26 +21,26 @@ performs a maximum likelihood analyse for each of the intervals. The analysis results are writted into a light curve FITS file. The following example illustrates how you can generate a light curve for -``Src001`` for the time interval from 59235.5 to 59236.0 (MJD), +``Src002`` for the time interval from 59235.5 to 59236.0 (MJD), corresponding to the dates from 2021-01-21 (12:00:00) to 2021-01-22 (00:00:00) (to convert dates to MJD and vice versa we suggest to use the `xTime Date and Time Conversion Utility `_). -The time interval is linearly divided into 20 time bins. +The time interval is linearly divided into 5 time bins. .. code-block:: bash $ cslightcrv Input event list or observation definition XML file [events.fits] obs_selected.xml - Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml - Source name [Crab] Src001 + Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_unbinned.xml + Source name [Crab] Src002 Algorithm for defining time bins (FILE|LIN|GTI) [GTI] LIN Lightcurve start time (UTC string, JD, MJD or MET in seconds) [MJD 51544.5] MJD 59235.5 Lightcurve stop time (UTC string, JD, MJD or MET in seconds) [MJD 51544.6] MJD 59236.0 - Number of time bins (1-10000) [5] 20 + Number of time bins (1-10000) [5] Analysis method (3D|ONOFF) [3D] - Lower energy limit of events (TeV) [0.1] - Upper energy limit of events (TeV) [100.0] - Number of energy bins for binned (0=unbinned for Cube analysis only) (0-100) [0] + Lower energy limit of events (TeV) [0.1] 1.0 + Upper energy limit of events (TeV) [100.0] 100.0 + Number of energy bins for binned (0=unbinned for 3D analysis only) (0-100) [0] Output light curve file [lightcurve.fits] The resulting light curve is shown in the figure below. @@ -49,7 +49,7 @@ The resulting light curve is shown in the figure below. :width: 600px :align: center - *Light curve from 59235.5 to 59236.0 (MJD) for Src001* + *Light curve from 59235.5 to 59236.0 (MJD) for Src002* .. note:: The plot was created using the ``show_lightcurve.py`` script that is diff --git a/doc/source/users/tutorials/howto/howto_phasecurve.rst b/doc/source/users/tutorials/howto/howto_phasecurve.rst index 29e3208..b83fb8d 100644 --- a/doc/source/users/tutorials/howto/howto_phasecurve.rst +++ b/doc/source/users/tutorials/howto/howto_phasecurve.rst @@ -57,9 +57,10 @@ Vela pulsar are selected: Input event list or observation definition XML file [obs.xml] $CTADATA/obs/obs_gps_baseline.xml Pointing selection region shape (CIRCLE|BOX) [CIRCLE] Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] - Galactic longitude of selection centre (deg) (0-360) [184.56] 128.838 - Galactic latitude of selection centre (deg) (-90-90) [-5.79] -45.178 + Right Ascension of selection centre (deg) (0-360) [83.63] 128.838 + Declination of selection centre (deg) (-90-90) [22.01] -45.178 Radius of selection circle (deg) (0-180) [5.0] + Start time (UTC string, JD, MJD or MET in seconds) [NONE] NONE Output observation definition XML file [outobs.xml] obs_vela.xml This results in a selection of 45 observations from the Galactic Plane Survey @@ -73,14 +74,14 @@ as follows: $ ctphase Input event list or observation definition XML file [events.fits] obs_vela.xml - Model definition XML file [$CTOOLS/share/models/crab.xml] models.xml + Model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_velapsr.xml Source in model definition XML file to use for phase computation [Crab] VelaPulsar Output event list or observation definition XML file [phased_events.fits] obs_vela_phased.xml This produces a new :ref:`observation definition file ` ``obs_vela_phased.xml`` that points to event files to which a ``PHASE`` -column was added. The format of the file is dislayed below. Each event +column was added. The format of the event files is dislayed below. Each event has now an associated phase value that was computed from the trigger time of the event. @@ -100,10 +101,9 @@ the following: $ ctselect Input event list or observation definition XML file [events.fits] obs_vela_phased.xml RA for ROI centre (degrees) (0-360) [83.63] 128.838 - Dec for ROI centre (degrees) (-90-90) [22.01] -45.178 + Dec for ROI centre (degrees) (-90-90) [22.51] -45.178 Radius of ROI (degrees) (0-180) [3.0] 0.2 - Start time (CTA MET in seconds) [0.0] - End time (CTA MET in seconds) [0.0] + Start time (UTC string, JD, MJD or MET in seconds) [NONE] Lower energy limit (TeV) [0.1] 0.03 Upper energy limit (TeV) [100.0] 160.0 Output event list or observation definition XML file [selected_events.fits] obs_vela_phased_selected.xml @@ -145,11 +145,11 @@ should look as follows: - + - - - + + + @@ -161,7 +161,7 @@ event arises either from the source or from the background component: $ ctprob Input event list or observation definition XML file [events.fits] obs_vela_phased.xml - Input model definition XML file [$CTOOLS/share/models/crab.xml] models_prob.xml + Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_vela.xml Output event list or observation definition XML file [prob_events.fits] obs_vela_phased_prob.xml This produces a new @@ -188,9 +188,8 @@ probability threshold to >10% by adding the attribute Input event list or observation definition XML file [obs_vela_phased.xml] obs_vela_phased_prob.xml RA for ROI centre (degrees) (0-360) [128.838] Dec for ROI centre (degrees) (-90-90) [-45.178] - Radius of ROI (degrees) (0-180) [0.5] 5.0 - Start time (CTA MET in seconds) [0.0] - End time (CTA MET in seconds) [0.0] + Radius of ROI (degrees) (0-180) [0.2] 5.0 + Start time (UTC string, JD, MJD or MET in seconds) [NONE] Lower energy limit (TeV) [0.03] Upper energy limit (TeV) [160.0] Output event list or observation definition XML file [obs_vela_phased_selected.xml] obs_vela_phased_prob_selected.xml @@ -222,8 +221,7 @@ after the :ref:`ctselect` command: RA for ROI centre (degrees) (0-360) [128.838] Dec for ROI centre (degrees) (-90-90) [-45.178] Radius of ROI (degrees) (0-180) [5.0] - Start time (CTA MET in seconds) [0.0] - End time (CTA MET in seconds) [0.0] + Start time (UTC string, JD, MJD or MET in seconds) [NONE] Lower energy limit (TeV) [0.03] Upper energy limit (TeV) [160.0] Output event list or observation definition XML file [obs_vela_phased_prob_selected.xml] obs_vela_phased_mcid.xml diff --git a/doc/source/users/tutorials/howto/howto_phasecurve_mcid.png b/doc/source/users/tutorials/howto/howto_phasecurve_mcid.png index 46392e1..fd8e064 100644 --- a/doc/source/users/tutorials/howto/howto_phasecurve_mcid.png +++ b/doc/source/users/tutorials/howto/howto_phasecurve_mcid.png diff --git a/doc/source/users/tutorials/howto/howto_phasecurve_phases.png b/doc/source/users/tutorials/howto/howto_phasecurve_phases.png index 3676e6e..8547ba6 100644 --- a/doc/source/users/tutorials/howto/howto_phasecurve_phases.png +++ b/doc/source/users/tutorials/howto/howto_phasecurve_phases.png diff --git a/doc/source/users/tutorials/howto/howto_phasecurve_probphases.png b/doc/source/users/tutorials/howto/howto_phasecurve_probphases.png index 91c6bf0..bde1c9e 100644 --- a/doc/source/users/tutorials/howto/howto_phasecurve_probphases.png +++ b/doc/source/users/tutorials/howto/howto_phasecurve_probphases.png diff --git a/doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb b/doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb new file mode 100644 index 0000000..7f5027f --- /dev/null +++ b/doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb @@ -0,0 +1,233 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Data preparation for 1DC How-tos" + ] + }, + { + "cell_type": "raw", + "metadata": {}, + "source": [ + "
\"Download
" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This tutorial assumes that you have downloaded the data for the first CTA Data Challenge. If this is not the case, please read first [how to get the 1DC data](../1dc/getting_data.rst).\n", + "\n", + "Start by importing the relevant Python modules." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import gammalib\n", + "import ctools\n", + "import cscripts" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now set the `CTADATA` and `CALDB` environment variables. Please adjust the path below so that it points to the relevant location." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "env: CTADATA=/Users/jurgen/1dc\n", + "env: CALDB=/Users/jurgen/1dc/caldb\n" + ] + } + ], + "source": [ + "%env CTADATA=/Users/jurgen/1dc\n", + "%env CALDB=/Users/jurgen/1dc/caldb" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now prepare a dataset that comprises the Galactic Centre observations that have been performed during the Galactic Plane Scan. Start with selecting the observations." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "obsselect = cscripts.csobsselect()\n", + "obsselect['inobs'] = '$CTADATA/obs/obs_gps_baseline.xml'\n", + "obsselect['pntselect'] = 'CIRCLE'\n", + "obsselect['coordsys'] = 'GAL'\n", + "obsselect['glon'] = 0.0\n", + "obsselect['glat'] = 0.0\n", + "obsselect['rad'] = 3.0\n", + "obsselect['tmin'] = 'NONE'\n", + "obsselect['tmax'] = 'NONE'\n", + "obsselect['outobs'] = 'obs.xml'\n", + "obsselect.execute()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now select the events with energies comprised between 1 and 100 TeV from the observations. " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "select = ctools.ctselect()\n", + "select['inobs'] = 'obs.xml'\n", + "select['ra'] = 'NONE'\n", + "select['dec'] = 'NONE'\n", + "select['rad'] = 'NONE'\n", + "select['tmin'] = 'NONE'\n", + "select['tmax'] = 'NONE'\n", + "select['emin'] = 1.0\n", + "select['emax'] = 100.0\n", + "select['outobs'] = 'obs_selected.xml'\n", + "select.execute()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The next step is to stack the selected events into a counts cube." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "binning = ctools.ctbin()\n", + "binning['inobs'] = 'obs_selected.xml'\n", + "binning['xref'] = 0.0\n", + "binning['yref'] = 0.0\n", + "binning['coordsys'] = 'GAL'\n", + "binning['proj'] = 'CAR'\n", + "binning['binsz'] = 0.02\n", + "binning['nxpix'] = 300\n", + "binning['nypix'] = 300\n", + "binning['ebinalg'] = 'LOG'\n", + "binning['emin'] = 1.0\n", + "binning['emax'] = 100.0\n", + "binning['enumbins'] = 20\n", + "binning['outcube'] = 'cntcube.fits'\n", + "binning.execute()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now compute the corresponding stacked exposure cube, point spread function cube and background cube." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "expcube = ctools.ctexpcube()\n", + "expcube['inobs'] = 'obs_selected.xml'\n", + "expcube['incube'] = 'cntcube.fits'\n", + "expcube['outcube'] = 'expcube.fits'\n", + "expcube.execute()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "psfcube = ctools.ctpsfcube()\n", + "psfcube['inobs'] = 'obs_selected.xml'\n", + "psfcube['incube'] = 'NONE'\n", + "psfcube['ebinalg'] = 'LOG'\n", + "psfcube['emin'] = 1.0\n", + "psfcube['emax'] = 100.0\n", + "psfcube['enumbins'] = 20\n", + "psfcube['nxpix'] = 10\n", + "psfcube['nypix'] = 10\n", + "psfcube['binsz'] = 1.0\n", + "psfcube['coordsys'] = 'GAL'\n", + "psfcube['proj'] = 'CAR'\n", + "psfcube['xref'] = 0.0\n", + "psfcube['yref'] = 0.0\n", + "psfcube['outcube'] = 'psfcube.fits'\n", + "psfcube.execute()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "bkgcube = ctools.ctbkgcube()\n", + "bkgcube['inobs'] = 'obs_selected.xml'\n", + "bkgcube['inmodel'] = '$CTOOLS/share/models/bkg_irf.xml'\n", + "bkgcube['incube'] = 'cntcube.fits'\n", + "bkgcube['outcube'] = 'bkgcube.fits'\n", + "bkgcube['outmodel'] = 'bkgcube.xml' \n", + "bkgcube.execute()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now you are done. All data structures are prepared for the following tutorials." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/doc/source/users/tutorials/howto/howto_ts.rst b/doc/source/users/tutorials/howto/howto_ts.rst index d228470..b3d545d 100644 --- a/doc/source/users/tutorials/howto/howto_ts.rst +++ b/doc/source/users/tutorials/howto/howto_ts.rst @@ -12,8 +12,16 @@ To compute the detection significance of a given source you need to add the attribute ``tscalc="1"`` to the ```` tag in the :ref:`model definition file ` and execute :ref:`ctlike` using the modified file. -The structure of the XML file with significance computation requested for -``Src001`` is shown below. +Copy the 1DC :ref:`model definition ` file + +.. code-block:: bash + + $ cp $CTOOLS/share/models/1dc_howto.xml ts_model.xml + +and modify the file by adding ``tscalc="1"`` to the ```` tag for +source ``Src1``. Your +:ref:`model definition XML file ` +should then look like this: .. code-block:: xml @@ -27,36 +35,39 @@ The structure of the XML file with significance computation requested for - - + + ... -:ref:`ctlike` will compute the so-called Test Statistic, which is twice the -difference between the log-likelihood value obtained for a fit that includes +Then run :ref:`ctlike` to compute the so-called Test Statistic, which is twice +the difference between the log-likelihood value obtained for a fit that includes ``Src001`` and a fit that excludes ``Src001``. The Test Statistic value will follow a :math:`\chi^2_p` distribution with :math:`p` degrees of freedom, where :math:`p` is the number of free parameters of ``Src001``. For :math:`p=1`, the source significance is the square root of the Test Statistic. -An excerpt of the :ref:`ctlike` log file is shown below where significance -computation was requested for ``Src001`` and ``Src002``. The computation was -done using a stacked analysis. - .. code-block:: bash - 2017-07-28T01:26:56: === GModelSky === - 2017-07-28T01:26:56: Name ......................: Src001 - 2017-07-28T01:26:56: Instruments ...............: all - 2017-07-28T01:26:56: Test Statistic ............: 15404.1562257314 - ... - 2017-07-28T01:26:56: === GModelSky === - 2017-07-28T01:26:56: Name ......................: Src002 - 2017-07-28T01:26:56: Instruments ...............: all - 2017-07-28T01:26:56: Test Statistic ............: 3419.3020299729 + $ ctlike + Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits + Input exposure cube file [NONE] expcube.fits + Input PSF cube file [NONE] psfcube.fits + Input background cube file [NONE] bkgcube.fits + Input model definition XML file [$CTOOLS/share/models/crab.xml] ts_model.xml + Output model definition XML file [crab_results.xml] result.xml + +An excerpt of the :ref:`ctlike` log file is shown below + +.. code-block:: none + + 2018-01-25T12:46:12: === GModelSky === + 2018-01-25T12:46:12: Name ......................: Src001 + 2018-01-25T12:46:12: Instruments ...............: all + 2018-01-25T12:46:12: Test Statistic ............: 7659.64342272468 The Test Statistic values are also written into the :ref:`model definition file ` @@ -66,12 +77,8 @@ created by :ref:`ctlike`: - - ... - - + ... ... - diff --git a/doc/source/users/tutorials/howto/howto_tsmap.png b/doc/source/users/tutorials/howto/howto_tsmap.png index f8813f0..2b8fc30 100644 --- a/doc/source/users/tutorials/howto/howto_tsmap.png +++ b/doc/source/users/tutorials/howto/howto_tsmap.png diff --git a/doc/source/users/tutorials/howto/howto_tsmap.rst b/doc/source/users/tutorials/howto/howto_tsmap.rst index 5dff9a3..1f8dc5c 100644 --- a/doc/source/users/tutorials/howto/howto_tsmap.rst +++ b/doc/source/users/tutorials/howto/howto_tsmap.rst @@ -21,11 +21,11 @@ map of size 0.5 x 0.5 degrees, centred on the Galactic Centre. $ cttsmap Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits - Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits - Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits - Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits - Test source name [Crab] Src001 - Input model definition XML file [$CTOOLS/share/models/crab.xml] stacked_models.xml + Input exposure cube file [NONE] expcube.fits + Input PSF cube file [NONE] psfcube.fits + Input background cube file [NONE] bkgcube.fits + Test source name [Crab] Test + Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] @@ -69,18 +69,18 @@ The figure below shows the resulting Test Statistic map. $ cstsmapsplit Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits - Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits - Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits - Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits - Input model definition XML file [$CTOOLS/share/models/crab.xml] stacked_models.xml + Input exposure cube file [NONE] expcube.fits + Input PSF cube file [NONE] psfcube.fits + Input background cube file [NONE] bkgcube.fits + Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 - Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL Image scale (in degrees/pixel) [0.02] 0.05 Size of the X axis in pixels [200] 10 Size of the Y axis in pixels [200] 10 - Test source name [Crab] Src001 + Test source name [Crab] Test Output Test Statistic map file [tsmap.fits] tsmap_split.fits Number of TS map bins per task [5] 10 Compute null hypothesis first? [yes] @@ -90,16 +90,16 @@ The figure below shows the resulting Test Statistic map. .. code-block:: bash - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=0 binmax=10 outmap=tsmap_split_0.fits logfile=tsmap_split_0.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=10 binmax=20 outmap=tsmap_split_1.fits logfile=tsmap_split_1.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=20 binmax=30 outmap=tsmap_split_2.fits logfile=tsmap_split_2.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=30 binmax=40 outmap=tsmap_split_3.fits logfile=tsmap_split_3.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=40 binmax=50 outmap=tsmap_split_4.fits logfile=tsmap_split_4.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=50 binmax=60 outmap=tsmap_split_5.fits logfile=tsmap_split_5.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=60 binmax=70 outmap=tsmap_split_6.fits logfile=tsmap_split_6.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=70 binmax=80 outmap=tsmap_split_7.fits logfile=tsmap_split_7.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=80 binmax=90 outmap=tsmap_split_8.fits logfile=tsmap_split_8.log & - cttsmap inobs=cntcube.fits inmodel=stacked_models.xml srcname=Src001 expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-274462.5864105515 binmin=90 binmax=100 outmap=tsmap_split_9.fits logfile=tsmap_split_9.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=0 binmax=10 outmap=tsmap_split_0.fits logfile=tsmap_split_0.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=10 binmax=20 outmap=tsmap_split_1.fits logfile=tsmap_split_1.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=20 binmax=30 outmap=tsmap_split_2.fits logfile=tsmap_split_2.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=30 binmax=40 outmap=tsmap_split_3.fits logfile=tsmap_split_3.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=40 binmax=50 outmap=tsmap_split_4.fits logfile=tsmap_split_4.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=50 binmax=60 outmap=tsmap_split_5.fits logfile=tsmap_split_5.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=60 binmax=70 outmap=tsmap_split_6.fits logfile=tsmap_split_6.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=70 binmax=80 outmap=tsmap_split_7.fits logfile=tsmap_split_7.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=80 binmax=90 outmap=tsmap_split_8.fits logfile=tsmap_split_8.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=90 binmax=100 outmap=tsmap_split_9.fits logfile=tsmap_split_9.log & Now run the ASCII file by typing diff --git a/doc/source/users/tutorials/howto/howto_ulimit.rst b/doc/source/users/tutorials/howto/howto_ulimit.rst index bfe7762..6e26c3f 100644 --- a/doc/source/users/tutorials/howto/howto_ulimit.rst +++ b/doc/source/users/tutorials/howto/howto_ulimit.rst @@ -12,51 +12,55 @@ You determine upper limits for gamma-ray sources using the :ref:`ctulimit` tool. Suppose you want to know the upper limit on the gamma-ray flux for -a putative source at position :math:`l=0.1^\circ` and :math:`b=0.4^\circ` -(corresponding to :math:`\alpha=266.0753^\circ` and -:math:`\delta=-28.6420^\circ`). +a putative source at position :math:`l=0.1^\circ` and :math:`b=0.4^\circ`. For this you have to add a test source with the respective coordinates to the -:ref:`model definition file `, -for example +:ref:`model definition file `. +To do this, copy the 1DC :ref:`model definition ` file + +.. code-block:: bash + + $ cp $CTOOLS/share/models/1dc_howto.xml ulimit_model.xml + +and add the following source to it .. code-block:: xml - - - + + + - - + + -and then run the :ref:`ctulimit` tool as follows: +Now run the :ref:`ctulimit` tool as follows: .. code-block:: bash $ ctulimit Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits - Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits - Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits - Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits + Input exposure cube file [NONE] expcube.fits + Input PSF cube file [NONE] psfcube.fits + Input background cube file [NONE] bkgcube.fits Source of interest [Crab] Test - Input model definition XML file [$CTOOLS/share/models/crab.xml] stacked_models_cutoff_iem_up.xml + Input model definition XML file [$CTOOLS/share/models/crab.xml] ulimit_model.xml After the run, the upper gamma-ray flux limit for this test source can be extracted from the :ref:`ctulimit` log file: .. code-block:: bash - 2017-07-28T07:03:03: +=====================+ - 2017-07-28T07:03:03: | Upper limit results | - 2017-07-28T07:03:03: +=====================+ - 2017-07-28T07:03:03: Differential flux limit ...: 6.39388221102118e-21 ph/cm2/s/MeV at 1 TeV - 2017-07-28T07:03:03: Integral flux limit .......: 4.31545368823519e-15 ph/cm2/s within [1-100] TeV - 2017-07-28T07:03:03: Energy flux limit .........: 1.90018365473006e-14 erg/cm2/s within [1-100] TeV + 2018-01-25T13:57:23: +=====================+ + 2018-01-25T13:57:23: | Upper limit results | + 2018-01-25T13:57:23: +=====================+ + 2018-01-25T13:57:23: Differential flux limit ...: 1.39791304697722e-20 ph/cm2/s/MeV at 1 TeV + 2018-01-25T13:57:23: Integral flux limit .......: 9.43500179595339e-15 ph/cm2/s within [1-100] TeV + 2018-01-25T13:57:23: Energy flux limit .........: 4.1544267393937e-14 erg/cm2/s within [1-100] TeV .. warning:: It is important to fix the spectral index of the test source in the diff --git a/doc/source/users/tutorials/howto/index.rst b/doc/source/users/tutorials/howto/index.rst index 41fbbc5..cbf32f7 100644 --- a/doc/source/users/tutorials/howto/index.rst +++ b/doc/source/users/tutorials/howto/index.rst @@ -17,11 +17,19 @@ CTA data analysis howto_advanced_python_fitting howto_connect_irfs howto_connect_models + + +CTA first Data Challenge data analysis +-------------------------------------- + +.. toctree:: + :maxdepth: 1 + + howto_prepare_1dc howto_ts howto_tsmap howto_extent howto_ulimit - howto_edisp howto_lightcurve howto_phasecurve howto_exclude diff --git a/doc/source/users/tutorials/notebooks.rst b/doc/source/users/tutorials/notebooks.rst index 5bc79aa..9b49a00 100644 --- a/doc/source/users/tutorials/notebooks.rst +++ b/doc/source/users/tutorials/notebooks.rst @@ -19,3 +19,4 @@ this page. * :download:`How to connect observations to specific models? ` * :download:`How to perform a stacked analysis? ` * :download:`How to do advanced model manipulation and fitting in Python? ` +* :download:`Data preparation for 1DC How-tos ` diff --git a/models/1dc_howto.xml b/models/1dc_howto.xml new file mode 100644 index 0000000..fd21966 --- /dev/null +++ b/models/1dc_howto.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/models/1dc_howto_unbinned.xml b/models/1dc_howto_unbinned.xml new file mode 100644 index 0000000..0046c4c --- /dev/null +++ b/models/1dc_howto_unbinned.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/models/1dc_howto_vela.xml b/models/1dc_howto_vela.xml new file mode 100644 index 0000000..140b68a --- /dev/null +++ b/models/1dc_howto_vela.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/models/1dc_howto_velapsr.xml b/models/1dc_howto_velapsr.xml new file mode 100644 index 0000000..e16ad3a --- /dev/null +++ b/models/1dc_howto_velapsr.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/models/Makefile.am b/models/Makefile.am index 666090b..f6d5206 100644 --- a/models/Makefile.am +++ b/models/Makefile.am @@ -20,7 +20,14 @@ ############################################################################# # Models to install -models = bkg_irf.xml \ +models = 1dc_howto.xml \ + 1dc_howto_unbinned.xml \ + 1dc_howto_vela.xml \ + 1dc_howto_velapsr.xml \ + bkg_irf.xml \ + bkg_cube.xml \ + test_irf.xml \ + test_cube.xml \ crab.xml \ crab_beyond.xml \ crab_2bkg.xml \ diff --git a/models/bkg_cube.xml b/models/bkg_cube.xml new file mode 100644 index 0000000..dd481d6 --- /dev/null +++ b/models/bkg_cube.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/models/test_cube.xml b/models/test_cube.xml new file mode 100644 index 0000000..b5b92f8 --- /dev/null +++ b/models/test_cube.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/models/test_irf.xml b/models/test_irf.xml new file mode 100644 index 0000000..d1bc947 --- /dev/null +++ b/models/test_irf.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + +