Commit 2e97e659a91502d4ffbc3ebe5fc42bab4075b10c
1 parent
63a4fd11
Update 1DC How-tos
Showing
31 changed files
with
632 additions
and
323 deletions
doc/source/help/issues.rst
| ... | ... | @@ -20,8 +20,9 @@ list of |
| 20 | 20 | |
| 21 | 21 | **Model fitting issues** |
| 22 | 22 | |
| 23 | -- :ref:`Broken power law has unreliable errors <issue_bplaw>` | |
| 23 | +- :ref:`Pivot energy should be comprised in energy range of fitted data <issue_interval>` | |
| 24 | 24 | - :ref:`Errors become unreliable when fitting the pivot energy <issue_pivot>` |
| 25 | +- :ref:`Broken power law has unreliable errors <issue_bplaw>` | |
| 25 | 26 | - :ref:`Shell model is biased when width is comparable to angular resolution <issue_shell>` |
| 26 | 27 | - :ref:`Elliptical Gaussian model fit converges slowly <issue_egauss>` |
| 27 | 28 | |
| ... | ... | @@ -34,14 +35,14 @@ Installation issues |
| 34 | 35 | |
| 35 | 36 | .. topic:: Certificate problem when cloning from Git |
| 36 | 37 | |
| 37 | - When cloning ctools from git you may encounter an SSL certificate | |
| 38 | - problem. This is related to the usage of the https protocol and can | |
| 39 | - be resolved by setting the ``GIT_SSL_NO_VERIFY`` environment variable | |
| 40 | - to true: | |
| 38 | + When cloning ctools from git you may encounter an SSL certificate | |
| 39 | + problem. This is related to the usage of the https protocol and can | |
| 40 | + be resolved by setting the ``GIT_SSL_NO_VERIFY`` environment variable | |
| 41 | + to true: | |
| 41 | 42 | |
| 42 | - .. code-block:: bash | |
| 43 | + .. code-block:: bash | |
| 43 | 44 | |
| 44 | - export GIT_SSL_NO_VERIFY=true | |
| 45 | + export GIT_SSL_NO_VERIFY=true | |
| 45 | 46 | |
| 46 | 47 | .. _issue_python: |
| 47 | 48 | |
| ... | ... | @@ -71,15 +72,15 @@ Installation issues |
| 71 | 72 | |
| 72 | 73 | .. topic:: Installing on Solaris |
| 73 | 74 | |
| 74 | - Although ctools build on Solaris using the Sun compiler, there are | |
| 75 | - problems with global symbols in shared libraries and exception catching, | |
| 76 | - which prevents the FITS interface to work correctly. ctools have however | |
| 77 | - been built and tested successfully using the GNU compiler, and this is | |
| 78 | - the only build method that is currently supported. Problems have also | |
| 79 | - been encountered when compiling cfitsio versions more recent than 3.250. | |
| 80 | - The problems have been reported to the cfitsio developer team, and are | |
| 81 | - likely to be solved in the future. For the time being, it is recommended | |
| 82 | - to use cfitsio version 3.250 on Solaris. | |
| 75 | + Although ctools build on Solaris using the Sun compiler, there are | |
| 76 | + problems with global symbols in shared libraries and exception catching, | |
| 77 | + which prevents the FITS interface to work correctly. ctools have however | |
| 78 | + been built and tested successfully using the GNU compiler, and this is | |
| 79 | + the only build method that is currently supported. Problems have also | |
| 80 | + been encountered when compiling cfitsio versions more recent than 3.250. | |
| 81 | + The problems have been reported to the cfitsio developer team, and are | |
| 82 | + likely to be solved in the future. For the time being, it is recommended | |
| 83 | + to use cfitsio version 3.250 on Solaris. | |
| 83 | 84 | |
| 84 | 85 | .. _issue_opensolaris: |
| 85 | 86 | |
| ... | ... | @@ -119,15 +120,13 @@ Analysis issues |
| 119 | 120 | Model fitting issues |
| 120 | 121 | ^^^^^^^^^^^^^^^^^^^^ |
| 121 | 122 | |
| 122 | -.. _issue_bplaw: | |
| 123 | +.. _issue_interval: | |
| 123 | 124 | |
| 124 | -.. topic:: Broken power law has unreliable errors | |
| 125 | +.. topic:: Pivot energy should be comprised in energy range of fitted data | |
| 125 | 126 | |
| 126 | - The broken power law spectral model has unreliable errors, specifically | |
| 127 | - for the prefactor and the break value. Errors are in general too large, | |
| 128 | - and this is related to the fact that the law's gradient is discontinuous | |
| 129 | - in energy. There is not very much we can do about it, it's inherent in | |
| 130 | - the law. | |
| 127 | + The pivot energy of a spectral model, such as for example a power law model, | |
| 128 | + should be comprised within the energy range of the fitted data, | |
| 129 | + otherwise some fit instabilities may occur. | |
| 131 | 130 | |
| 132 | 131 | .. _issue_pivot: |
| 133 | 132 | |
| ... | ... | @@ -143,6 +142,16 @@ Model fitting issues |
| 143 | 142 | parameters of the model to assure non-degeneracy of the free |
| 144 | 143 | parameters. |
| 145 | 144 | |
| 145 | +.. _issue_bplaw: | |
| 146 | + | |
| 147 | +.. topic:: Broken power law has unreliable errors | |
| 148 | + | |
| 149 | + The broken power law spectral model has unreliable errors, specifically | |
| 150 | + for the prefactor and the break value. Errors are in general too large, | |
| 151 | + and this is related to the fact that the law's gradient is discontinuous | |
| 152 | + in energy. There is not very much we can do about it, it's inherent in | |
| 153 | + the law. | |
| 154 | + | |
| 146 | 155 | .. _issue_shell: |
| 147 | 156 | |
| 148 | 157 | .. topic:: Shell model is biased when width is comparable to angular resolution | ... | ... |
doc/source/users/tutorials/howto/howto_connect_models.ipynb
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | "cell_type": "raw", |
| 12 | 12 | "metadata": {}, |
| 13 | 13 | "source": [ |
| 14 | - "<div align=\"right\"><a href=\"../../../_downloads/howto_connect_models.ipynb\" download=\"combining-observations.ipynb\"><img src=\"../../../_static/download-notebook.jpg\" alt=\"Download Notebook\" height=\"40\"></a></div>" | |
| 14 | + "<div align=\"right\"><a href=\"../../../_downloads/howto_connect_models.ipynb\" download=\"howto_connect_models.ipynb\"><img src=\"../../../_static/download-notebook.jpg\" alt=\"Download Notebook\" height=\"40\"></a></div>" | |
| 15 | 15 | ] |
| 16 | 16 | }, |
| 17 | 17 | { | ... | ... |
doc/source/users/tutorials/howto/howto_edisp.rst deleted
| 1 | -.. _howto_edisp: | |
| 2 | - | |
| 3 | -How to take the energy dispersion into account? | |
| 4 | ------------------------------------------------ | |
| 5 | - | |
| 6 | - .. admonition:: What you will learn | |
| 7 | - | |
| 8 | - You will learn how to **take the energy dispersion into account** when | |
| 9 | - fitting a model to the data using a maximum likelihood analysis. | |
| 10 | - | |
| 11 | - Although the effect of the energy dispersion is often neglegible there | |
| 12 | - may be cases where you want to consider energy dispersion in an analysis, | |
| 13 | - for example if you are analysing the data down to very low energies. | |
| 14 | - | |
| 15 | - .. warning:: | |
| 16 | - Energy dispersion is fully implemented in ctools but is computationally | |
| 17 | - intensive. So be aware that the **tools and scripts will take a substantial | |
| 18 | - amount of computing time**. | |
| 19 | - | |
| 20 | -If you are doing a stacked analysis the first thing you need is an energy | |
| 21 | -dispersion cube. You generate this cube using the :ref:`ctedispcube` tool: | |
| 22 | - | |
| 23 | -.. code-block:: bash | |
| 24 | - | |
| 25 | - $ ctedispcube | |
| 26 | - Input event list or observation definition XML file [NONE] obs_selected.xml | |
| 27 | - Input counts cube file to extract energy dispersion cube definition [NONE] | |
| 28 | - First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 | |
| 29 | - Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 | |
| 30 | - Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] | |
| 31 | - Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL | |
| 32 | - Image scale (in degrees/pixel) [1.0] | |
| 33 | - Size of the X axis in pixels [10] | |
| 34 | - Size of the Y axis in pixels [10] | |
| 35 | - Lower energy limit (TeV) [0.1] | |
| 36 | - Upper energy limit (TeV) [100.0] | |
| 37 | - Number of energy bins [20] 30 | |
| 38 | - Output energy dispersion cube file [edispcube.fits] | |
| 39 | - | |
| 40 | -This produces an | |
| 41 | -:ref:`energy dispersion cube <glossary_edispcube>` | |
| 42 | -FITS file that contains the weighted energy dispersion as function of | |
| 43 | -sky position and energy. | |
| 44 | -Since the energy dispersion varies only slowly over the field of view it is | |
| 45 | -sufficient to sample that variation at a large spatial scale of typically one | |
| 46 | -degree. | |
| 47 | - | |
| 48 | -Now you can run the :ref:`ctlike` tool by adding the attribute ``edisp=yes`` | |
| 49 | -to the command line. As you see below, this instructs :ref:`ctlike` to query | |
| 50 | -for the energy dispersion cube and to take the energy dispersion into account | |
| 51 | -during the fit: | |
| 52 | - | |
| 53 | -.. code-block:: bash | |
| 54 | - | |
| 55 | - $ ctlike edisp=yes | |
| 56 | - Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits | |
| 57 | - Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits | |
| 58 | - Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits | |
| 59 | - Input energy dispersion cube file (only needed for stacked analysis) [NONE] edispcube.fits | |
| 60 | - Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits | |
| 61 | - Input model definition XML file [$CTOOLS/share/models/crab.xml] stacked_models.xml | |
| 62 | - Output model definition XML file [crab_results.xml] stacked_results_edisp.xml | |
| 63 | - | |
| 64 | -If you are doing an unbinned analysis you do not need to generate an energy | |
| 65 | -dispersion cube and you can directly run :ref:`ctlike` with the ``edisp=yes`` | |
| 66 | -attribute: | |
| 67 | - | |
| 68 | -.. code-block:: bash | |
| 69 | - | |
| 70 | - $ ctlike edisp=yes | |
| 71 | - Input event list, counts cube or observation definition XML file [events.fits] obs_selected.xml | |
| 72 | - Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml | |
| 73 | - Output model definition XML file [crab_results.xml] unbinned_models_edisp.xml | |
| 74 | - | |
| 75 | -The following tools and scripts do accept the optional ``edisp=yes`` attribute: | |
| 76 | - | |
| 77 | -* :ref:`ctbutterfly` | |
| 78 | -* :ref:`cterror` | |
| 79 | -* :ref:`ctlike` | |
| 80 | -* :ref:`ctmodel` | |
| 81 | -* :ref:`ctprob` | |
| 82 | -* :ref:`cttsmap` | |
| 83 | -* :ref:`ctulimit` | |
| 84 | -* :ref:`cslightcrv` | |
| 85 | -* :ref:`csphasecrv` | |
| 86 | -* :ref:`cspull` | |
| 87 | -* :ref:`csresmap` | |
| 88 | -* :ref:`cssens` | |
| 89 | -* :ref:`csspec` | |
| 90 | -* :ref:`cstsdist` | |
| 91 | -* :ref:`cstsmapsplit` | |
| 92 | - |
doc/source/users/tutorials/howto/howto_exclude.rst
| ... | ... | @@ -28,9 +28,9 @@ radius of 1 degree around the location of ``Src001``. |
| 28 | 28 | Input counts cube or observation definition XML file [cntcube.fits] |
| 29 | 29 | Input exclusion region file in ds9 format [NONE] |
| 30 | 30 | RA for ROI centre (degrees) (0-360) [83.63] 266.42 |
| 31 | - Dec for ROI centre (degrees) (-90-90) [22.01] -29.01 | |
| 31 | + Dec for ROI centre (degrees) (-90-90) [22.51] -29.01 | |
| 32 | 32 | Radius of ROI (degrees) (0-180) [3.0] 1.0 |
| 33 | - Lower energy limit (TeV) [0.1] | |
| 33 | + Lower energy limit (TeV) [0.1] 1.0 | |
| 34 | 34 | Upper energy limit (TeV) [100.0] |
| 35 | 35 | Output counts cube or observation definition XML file [cntcube_filtered.fits] |
| 36 | 36 | |
| ... | ... | @@ -62,10 +62,10 @@ the :ref:`ctcubemask` run: |
| 62 | 62 | $ ctcubemask |
| 63 | 63 | Input counts cube or observation definition XML file [cntcube.fits] |
| 64 | 64 | Input exclusion region file in ds9 format [NONE] exclude.reg |
| 65 | - RA for ROI centre (degrees) (0-360) [83.63] 266.42 | |
| 66 | - Dec for ROI centre (degrees) (-90-90) [22.01] -29.01 | |
| 67 | - Radius of ROI (degrees) (0-180) [3.0] 1.0 | |
| 68 | - Lower energy limit (TeV) [0.1] | |
| 65 | + RA for ROI centre (degrees) (0-360) [266.42] | |
| 66 | + Dec for ROI centre (degrees) (-90-90) [-29.01] | |
| 67 | + Radius of ROI (degrees) (0-180) [1.0] | |
| 68 | + Lower energy limit (TeV) [1.0] | |
| 69 | 69 | Upper energy limit (TeV) [100.0] |
| 70 | 70 | Output counts cube or observation definition XML file [cntcube_filtered.fits] cntcube_filtered_exclude.fits |
| 71 | 71 | ... | ... |
doc/source/users/tutorials/howto/howto_extent.png
0 → 100644
308 KB
doc/source/users/tutorials/howto/howto_extent.rst
| ... | ... | @@ -27,9 +27,13 @@ As noted during the |
| 27 | 27 | there is a bright extended source south-west of the Galactic Centre, and |
| 28 | 28 | we add now an additional ``Src003`` component with a ``RadialDisk`` model to |
| 29 | 29 | describe the spatial morphology of the source. |
| 30 | -The | |
| 31 | -:ref:`model definition <glossary_moddef>` | |
| 32 | -for ``Src003`` is shown below: | |
| 30 | +To do this, copy the 1DC :ref:`model definition <glossary_moddef>` file | |
| 31 | + | |
| 32 | +.. code-block:: bash | |
| 33 | + | |
| 34 | + $ cp $CTOOLS/share/models/1dc_howto.xml extended_model.xml | |
| 35 | + | |
| 36 | +and add the following source to it | |
| 33 | 37 | |
| 34 | 38 | .. code-block:: xml |
| 35 | 39 | |
| ... | ... | @@ -46,36 +50,46 @@ for ``Src003`` is shown below: |
| 46 | 50 | </spatialModel> |
| 47 | 51 | </source> |
| 48 | 52 | |
| 49 | -Running :ref:`ctlike` using the | |
| 50 | -:ref:`model definition file <glossary_moddef>` | |
| 51 | -will then fit the disk radius of ``Src003``. The results can be seen in the | |
| 52 | -log file and will also be written into the output | |
| 53 | -:ref:`model definition file <glossary_moddef>`. | |
| 53 | +Then run :ref:`ctlike` to fit the parameters of ``Src003`` together with the | |
| 54 | +other source parameters | |
| 55 | + | |
| 56 | +.. code-block:: bash | |
| 57 | + | |
| 58 | + $ ctlike | |
| 59 | + Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits | |
| 60 | + Input exposure cube file [NONE] expcube.fits | |
| 61 | + Input PSF cube file [NONE] psfcube.fits | |
| 62 | + Input background cube file [NONE] bkgcube.fits | |
| 63 | + Input model definition XML file [$CTOOLS/share/models/crab.xml] extended_model.xml | |
| 64 | + Output model definition XML file [crab_results.xml] result.xml | |
| 65 | + | |
| 66 | +The results can be seen in the log file and will also be written into the | |
| 67 | +output :ref:`model definition file <glossary_moddef>`. | |
| 54 | 68 | For illustration, an excerpt of the :ref:`ctlike` log file is shown below. |
| 55 | -The disk with of ``Src003`` has been fitted to 0.335 +/- 0.003 degrees. | |
| 56 | -The source is detected with a TS value of 5393.8. | |
| 69 | +The disk with of ``Src003`` has been fitted to 0.326 +/- 0.005 degrees. | |
| 70 | +The source is detected with a TS value of 960.6. | |
| 57 | 71 | |
| 58 | 72 | .. code-block:: none |
| 59 | 73 | |
| 60 | - 2017-08-25T19:37:47: === GModelSky === | |
| 61 | - 2017-08-25T19:37:47: Name ......................: Src003 | |
| 62 | - 2017-08-25T19:37:47: Instruments ...............: all | |
| 63 | - 2017-08-25T19:37:47: Test Statistic ............: 5393.78645148844 | |
| 64 | - 2017-08-25T19:37:47: Instrument scale factors ..: unity | |
| 65 | - 2017-08-25T19:37:47: Observation identifiers ...: all | |
| 66 | - 2017-08-25T19:37:47: Model type ................: ExtendedSource | |
| 67 | - 2017-08-25T19:37:47: Model components ..........: "RadialDisk" * "PowerLaw" * "Constant" | |
| 68 | - 2017-08-25T19:37:47: Number of parameters ......: 7 | |
| 69 | - 2017-08-25T19:37:47: Number of spatial par's ...: 3 | |
| 70 | - 2017-08-25T19:37:47: RA .......................: 266.306975228126 +/- 0.00363322258453142 [-360,360] deg (free,scale=1) | |
| 71 | - 2017-08-25T19:37:47: DEC ......................: -30.1946569442618 +/- 0.0031545381615373 [-90,90] deg (free,scale=1) | |
| 72 | - 2017-08-25T19:37:47: Radius ...................: 0.335173109280516 +/- 0.00257226134023012 [0.001,10] deg (free,scale=1) | |
| 73 | - 2017-08-25T19:37:47: Number of spectral par's ..: 3 | |
| 74 | - 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) | |
| 75 | - 2017-08-25T19:37:47: Index ....................: -2.73810250489576 +/- 0.0151068737641297 [9.92,-9.92] (free,scale=-2.48,gradient) | |
| 76 | - 2017-08-25T19:37:47: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) | |
| 77 | - 2017-08-25T19:37:47: Number of temporal par's ..: 1 | |
| 78 | - 2017-08-25T19:37:47: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 74 | + 2018-01-25T13:18:26: === GModelSky === | |
| 75 | + 2018-01-25T13:18:26: Name ......................: Src003 | |
| 76 | + 2018-01-25T13:18:26: Instruments ...............: all | |
| 77 | + 2018-01-25T13:18:26: Test Statistic ............: 960.648581179907 | |
| 78 | + 2018-01-25T13:18:26: Instrument scale factors ..: unity | |
| 79 | + 2018-01-25T13:18:26: Observation identifiers ...: all | |
| 80 | + 2018-01-25T13:18:26: Model type ................: ExtendedSource | |
| 81 | + 2018-01-25T13:18:26: Model components ..........: "RadialDisk" * "PowerLaw" * "Constant" | |
| 82 | + 2018-01-25T13:18:26: Number of parameters ......: 7 | |
| 83 | + 2018-01-25T13:18:26: Number of spatial par's ...: 3 | |
| 84 | + 2018-01-25T13:18:26: RA .......................: 266.317413730996 +/- 0.00715229434136355 [-360,360] deg (free,scale=1) | |
| 85 | + 2018-01-25T13:18:26: DEC ......................: -30.1850885371228 +/- 0.00616374863033401 [-90,90] deg (free,scale=1) | |
| 86 | + 2018-01-25T13:18:26: Radius ...................: 0.325758937003301 +/- 0.00480357697494016 [0.001,10] deg (free,scale=1) | |
| 87 | + 2018-01-25T13:18:26: Number of spectral par's ..: 3 | |
| 88 | + 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) | |
| 89 | + 2018-01-25T13:18:26: Index ....................: -2.70498667660106 +/- 0.0560039729118815 [9.92,-9.92] (free,scale=-2.48,gradient) | |
| 90 | + 2018-01-25T13:18:26: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) | |
| 91 | + 2018-01-25T13:18:26: Number of temporal par's ..: 1 | |
| 92 | + 2018-01-25T13:18:26: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 79 | 93 | |
| 80 | 94 | .. warning:: |
| 81 | 95 | 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. |
| 83 | 97 | as for example the limits on the knowledge of the point spread function. |
| 84 | 98 | These systematic uncertainties are **not** determined by ctools. |
| 85 | 99 | |
| 86 | -The figure below shows the residual map, generated using the ``SIGNIFICANCE`` | |
| 87 | -method, after subtracting the three fitted | |
| 88 | -sources and the diffuse emission model from the data. There is a ring-like | |
| 89 | -residual at the position of ``Src003`` which suggests that an axisymmetric | |
| 90 | -disk is not an accurate description of the data. | |
| 91 | - | |
| 92 | -.. figure:: howto_extent_disk.png | |
| 93 | - :width: 400px | |
| 94 | - :align: center | |
| 95 | - | |
| 96 | - *Residual sky map for a radial disk spatial shape for Src003* | |
| 97 | - | |
| 98 | -There are other spatial models in ctools, and we try in a second step an | |
| 99 | -axisymmetric Gaussian spatial shape. The corresponding | |
| 100 | -:ref:`model definition file <glossary_moddef>` | |
| 101 | -looks as follows: | |
| 102 | - | |
| 103 | -.. code-block:: xml | |
| 100 | +Now generate a residual map using :ref:`csresmap` to check the fit quality | |
| 104 | 101 | |
| 105 | - <source name="Src003" type="ExtendedSource" tscalc="1"> | |
| 106 | - <spectrum type="PowerLaw"> | |
| 107 | - <parameter name="Prefactor" scale="5.7e-18" value="1.0" min="0" max="1000.0" free="1"/> | |
| 108 | - <parameter name="Index" scale="-2.48" value="1.0" min="-4.0" max="4.0" free="1"/> | |
| 109 | - <parameter name="PivotEnergy" scale="300000" value="1.0" free="0" /> | |
| 110 | - </spectrum> | |
| 111 | - <spatialModel type="RadialGaussian"> | |
| 112 | - <parameter name="RA" scale="1.0" value="266.3070" min="-360" max="360" free="1"/> | |
| 113 | - <parameter name="DEC" scale="1.0" value="-30.1876" min="-90" max="90" free="1"/> | |
| 114 | - <parameter name="Sigma" scale="1.0" value="0.2" min="0.001" max="10" free="1"/> | |
| 115 | - </spatialModel> | |
| 116 | - </source> | |
| 102 | +.. code-block:: bash | |
| 117 | 103 | |
| 118 | -Running :ref:`ctlike` again with that model results in a Gaussian sigma of | |
| 119 | -0.198 +/- 0.003 degrees for ``Src003``. The source is detected with a TS value | |
| 120 | -of 5665.7 which is considerably larger than the TS value of 5393.8 that is found | |
| 121 | -above for the radial disk model. | |
| 122 | -Below an excerpt of the :ref:`ctlike` log file: | |
| 104 | + $ csresmap | |
| 105 | + Input event list, counts cube, or observation definition XML file [cntmap.fits] cntcube.fits | |
| 106 | + Input model cube file (generated with ctmodel) [NONE] | |
| 107 | + Input exposure cube file [NONE] expcube.fits | |
| 108 | + Input PSF cube file [NONE] psfcube.fits | |
| 109 | + Input background cube file [NONE] bkgcube.fits | |
| 110 | + Input model definition XML file [$CTOOLS/share/models/crab.xml] result.xml | |
| 111 | + Residual map computation algorithm (SUB|SUBDIV|SUBDIVSQRT|SIGNIFICANCE) [SIGNIFICANCE] | |
| 112 | + Output residual map file [resmap.fits] | |
| 123 | 113 | |
| 124 | -.. code-block:: none | |
| 114 | +The resulting residual map is shown below. The map looks rather clean. | |
| 125 | 115 | |
| 126 | - 2017-08-25T20:32:55: === GModelSky === | |
| 127 | - 2017-08-25T20:32:55: Name ......................: Src003 | |
| 128 | - 2017-08-25T20:32:55: Instruments ...............: all | |
| 129 | - 2017-08-25T20:32:55: Test Statistic ............: 5665.73173788155 | |
| 130 | - 2017-08-25T20:32:55: Instrument scale factors ..: unity | |
| 131 | - 2017-08-25T20:32:55: Observation identifiers ...: all | |
| 132 | - 2017-08-25T20:32:55: Model type ................: ExtendedSource | |
| 133 | - 2017-08-25T20:32:55: Model components ..........: "RadialGaussian" * "PowerLaw" * "Constant" | |
| 134 | - 2017-08-25T20:32:55: Number of parameters ......: 7 | |
| 135 | - 2017-08-25T20:32:55: Number of spatial par's ...: 3 | |
| 136 | - 2017-08-25T20:32:55: RA .......................: 266.30022317901 +/- 0.00475655134090925 [-360,360] deg (free,scale=1) | |
| 137 | - 2017-08-25T20:32:55: DEC ......................: -30.1993627725406 +/- 0.0041251924859714 [-90,90] deg (free,scale=1) | |
| 138 | - 2017-08-25T20:32:55: Sigma ....................: 0.198343910095786 +/- 0.00298438230006778 [0.001,10] deg (free,scale=1) | |
| 139 | - 2017-08-25T20:32:55: Number of spectral par's ..: 3 | |
| 140 | - 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) | |
| 141 | - 2017-08-25T20:32:55: Index ....................: -2.71899753120954 +/- 0.0146676775081257 [9.92,-9.92] (free,scale=-2.48,gradient) | |
| 142 | - 2017-08-25T20:32:55: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) | |
| 143 | - 2017-08-25T20:32:55: Number of temporal par's ..: 1 | |
| 144 | - 2017-08-25T20:32:55: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 145 | - | |
| 146 | -.. note:: | |
| 147 | - While the TS values can formally not be convert into a statistical | |
| 148 | - significance between different spatial model hypotheses, a TS improvement | |
| 149 | - of 271.9 indicates a considerably better fit of the axisymmetric Gaussian | |
| 150 | - model with respect to the radial disk model to the data. | |
| 151 | - | |
| 152 | -The figure below shows the residual map for the fit of ``Src003`` with an | |
| 153 | -axisymmetric Gaussian model. | |
| 154 | -The map now looks pretty flat around ``Src003``, suggesting that an axisymmetric | |
| 155 | -Gaussian model is an appropriate description for the morphology of the gamma-ray | |
| 156 | -source. | |
| 157 | - | |
| 158 | -.. figure:: howto_extent_gauss.png | |
| 116 | +.. figure:: howto_extent.png | |
| 159 | 117 | :width: 400px |
| 160 | 118 | :align: center |
| 161 | 119 | |
| 162 | - *Residual sky map for an axisymmetric Gaussian spatial shape for Src003* | |
| 120 | + *Residual sky map for a radial disk spatial shape for Src003* | |
| 163 | 121 | |
| 164 | 122 | .. tip:: |
| 165 | 123 | The region overlays for the residual sky maps were generated using the |
| 166 | - :ref:`csmodelinfo` script. | |
| 124 | + :ref:`csmodelinfo` script | |
| 125 | + | |
| 126 | + .. code-block:: bash | |
| 127 | + | |
| 128 | + $ csmodelinfo | |
| 129 | + Input model definition XML file [model.xml] result.xml | |
| 130 | + Output DS9 region file [ds9.reg] result.reg | |
| 167 | 131 | |
| 168 | 132 | .. warning:: |
| 169 | 133 | The fitting of extended spatial models takes more computing time |
| ... | ... | @@ -174,10 +138,3 @@ source. |
| 174 | 138 | to use by default radial disk models for the extension fitting**, and only |
| 175 | 139 | switch to a Gaussian disk models when really needed, or for the determination |
| 176 | 140 | of final values for a publication. |
| 177 | - | |
| 178 | - For reference, here the computing times on Mac OS X for the example using | |
| 179 | - different spatial morphology hypotheses for ``Src003``: | |
| 180 | - | |
| 181 | - * Point source: 12 min | |
| 182 | - * Radial disk source: 15 min | |
| 183 | - * Axisymmetric Gaussian source: 40 min | ... | ... |
doc/source/users/tutorials/howto/howto_extent_disk.png deleted
289 KB
doc/source/users/tutorials/howto/howto_extent_gauss.png deleted
287 KB
doc/source/users/tutorials/howto/howto_filtered.png
doc/source/users/tutorials/howto/howto_filtered_exclude.png
doc/source/users/tutorials/howto/howto_lightcurve.png
doc/source/users/tutorials/howto/howto_lightcurve.rst
| ... | ... | @@ -21,26 +21,26 @@ performs a maximum likelihood analyse for each of the intervals. |
| 21 | 21 | The analysis results are writted into a light curve FITS file. |
| 22 | 22 | |
| 23 | 23 | The following example illustrates how you can generate a light curve for |
| 24 | -``Src001`` for the time interval from 59235.5 to 59236.0 (MJD), | |
| 24 | +``Src002`` for the time interval from 59235.5 to 59236.0 (MJD), | |
| 25 | 25 | corresponding to the dates from 2021-01-21 (12:00:00) to 2021-01-22 (00:00:00) |
| 26 | 26 | (to convert dates to MJD and vice versa we suggest to use the |
| 27 | 27 | `xTime Date and Time Conversion Utility <https://heasarc.gsfc.nasa.gov/cgi-bin/Tools/xTime/xTime.pl>`_). |
| 28 | -The time interval is linearly divided into 20 time bins. | |
| 28 | +The time interval is linearly divided into 5 time bins. | |
| 29 | 29 | |
| 30 | 30 | .. code-block:: bash |
| 31 | 31 | |
| 32 | 32 | $ cslightcrv |
| 33 | 33 | Input event list or observation definition XML file [events.fits] obs_selected.xml |
| 34 | - Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml | |
| 35 | - Source name [Crab] Src001 | |
| 34 | + Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_unbinned.xml | |
| 35 | + Source name [Crab] Src002 | |
| 36 | 36 | Algorithm for defining time bins (FILE|LIN|GTI) [GTI] LIN |
| 37 | 37 | Lightcurve start time (UTC string, JD, MJD or MET in seconds) [MJD 51544.5] MJD 59235.5 |
| 38 | 38 | Lightcurve stop time (UTC string, JD, MJD or MET in seconds) [MJD 51544.6] MJD 59236.0 |
| 39 | - Number of time bins (1-10000) [5] 20 | |
| 39 | + Number of time bins (1-10000) [5] | |
| 40 | 40 | Analysis method (3D|ONOFF) [3D] |
| 41 | - Lower energy limit of events (TeV) [0.1] | |
| 42 | - Upper energy limit of events (TeV) [100.0] | |
| 43 | - Number of energy bins for binned (0=unbinned for Cube analysis only) (0-100) [0] | |
| 41 | + Lower energy limit of events (TeV) [0.1] 1.0 | |
| 42 | + Upper energy limit of events (TeV) [100.0] 100.0 | |
| 43 | + Number of energy bins for binned (0=unbinned for 3D analysis only) (0-100) [0] | |
| 44 | 44 | Output light curve file [lightcurve.fits] |
| 45 | 45 | |
| 46 | 46 | The resulting light curve is shown in the figure below. |
| ... | ... | @@ -49,7 +49,7 @@ The resulting light curve is shown in the figure below. |
| 49 | 49 | :width: 600px |
| 50 | 50 | :align: center |
| 51 | 51 | |
| 52 | - *Light curve from 59235.5 to 59236.0 (MJD) for Src001* | |
| 52 | + *Light curve from 59235.5 to 59236.0 (MJD) for Src002* | |
| 53 | 53 | |
| 54 | 54 | .. note:: |
| 55 | 55 | The plot was created using the ``show_lightcurve.py`` script that is | ... | ... |
doc/source/users/tutorials/howto/howto_phasecurve.rst
| ... | ... | @@ -57,9 +57,10 @@ Vela pulsar are selected: |
| 57 | 57 | Input event list or observation definition XML file [obs.xml] $CTADATA/obs/obs_gps_baseline.xml |
| 58 | 58 | Pointing selection region shape (CIRCLE|BOX) [CIRCLE] |
| 59 | 59 | Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] |
| 60 | - Galactic longitude of selection centre (deg) (0-360) [184.56] 128.838 | |
| 61 | - Galactic latitude of selection centre (deg) (-90-90) [-5.79] -45.178 | |
| 60 | + Right Ascension of selection centre (deg) (0-360) [83.63] 128.838 | |
| 61 | + Declination of selection centre (deg) (-90-90) [22.01] -45.178 | |
| 62 | 62 | Radius of selection circle (deg) (0-180) [5.0] |
| 63 | + Start time (UTC string, JD, MJD or MET in seconds) [NONE] NONE | |
| 63 | 64 | Output observation definition XML file [outobs.xml] obs_vela.xml |
| 64 | 65 | |
| 65 | 66 | This results in a selection of 45 observations from the Galactic Plane Survey |
| ... | ... | @@ -73,14 +74,14 @@ as follows: |
| 73 | 74 | |
| 74 | 75 | $ ctphase |
| 75 | 76 | Input event list or observation definition XML file [events.fits] obs_vela.xml |
| 76 | - Model definition XML file [$CTOOLS/share/models/crab.xml] models.xml | |
| 77 | + Model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_velapsr.xml | |
| 77 | 78 | Source in model definition XML file to use for phase computation [Crab] VelaPulsar |
| 78 | 79 | Output event list or observation definition XML file [phased_events.fits] obs_vela_phased.xml |
| 79 | 80 | |
| 80 | 81 | This produces a new |
| 81 | 82 | :ref:`observation definition file <glossary_obsdef>` |
| 82 | 83 | ``obs_vela_phased.xml`` that points to event files to which a ``PHASE`` |
| 83 | -column was added. The format of the file is dislayed below. Each event | |
| 84 | +column was added. The format of the event files is dislayed below. Each event | |
| 84 | 85 | has now an associated phase value that was computed from the trigger time of |
| 85 | 86 | the event. |
| 86 | 87 | |
| ... | ... | @@ -100,10 +101,9 @@ the following: |
| 100 | 101 | $ ctselect |
| 101 | 102 | Input event list or observation definition XML file [events.fits] obs_vela_phased.xml |
| 102 | 103 | RA for ROI centre (degrees) (0-360) [83.63] 128.838 |
| 103 | - Dec for ROI centre (degrees) (-90-90) [22.01] -45.178 | |
| 104 | + Dec for ROI centre (degrees) (-90-90) [22.51] -45.178 | |
| 104 | 105 | Radius of ROI (degrees) (0-180) [3.0] 0.2 |
| 105 | - Start time (CTA MET in seconds) [0.0] | |
| 106 | - End time (CTA MET in seconds) [0.0] | |
| 106 | + Start time (UTC string, JD, MJD or MET in seconds) [NONE] | |
| 107 | 107 | Lower energy limit (TeV) [0.1] 0.03 |
| 108 | 108 | Upper energy limit (TeV) [100.0] 160.0 |
| 109 | 109 | Output event list or observation definition XML file [selected_events.fits] obs_vela_phased_selected.xml |
| ... | ... | @@ -145,11 +145,11 @@ should look as follows: |
| 145 | 145 | <parameter name="DEC" scale="1" value="-45.178" min="-90" max="90" free="0"/> |
| 146 | 146 | </spatialModel> |
| 147 | 147 | </source> |
| 148 | - <source name="Background" type="CTAIrfBackground"> | |
| 148 | + <source name="Background" type="CTAIrfBackground" instrument="CTA"> | |
| 149 | 149 | <spectrum type="PowerLaw"> |
| 150 | - <parameter name="Prefactor" value="1" error="0" scale="1" min="0" free="1" /> | |
| 151 | - <parameter name="Index" value="0" error="0" scale="1" min="-10" max="10" free="1" /> | |
| 152 | - <parameter name="PivotEnergy" value="1" scale="1000000" free="0" /> | |
| 150 | + <parameter name="Prefactor" value="1" scale="1" min="0" free="1"/> | |
| 151 | + <parameter name="Index" value="0" scale="1" min="-10" max="10" free="1"/> | |
| 152 | + <parameter name="PivotEnergy" value="1" scale="1000000" free="0"/> | |
| 153 | 153 | </spectrum> |
| 154 | 154 | </source> |
| 155 | 155 | </source_library> |
| ... | ... | @@ -161,7 +161,7 @@ event arises either from the source or from the background component: |
| 161 | 161 | |
| 162 | 162 | $ ctprob |
| 163 | 163 | Input event list or observation definition XML file [events.fits] obs_vela_phased.xml |
| 164 | - Input model definition XML file [$CTOOLS/share/models/crab.xml] models_prob.xml | |
| 164 | + Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_vela.xml | |
| 165 | 165 | Output event list or observation definition XML file [prob_events.fits] obs_vela_phased_prob.xml |
| 166 | 166 | |
| 167 | 167 | This produces a new |
| ... | ... | @@ -188,9 +188,8 @@ probability threshold to >10% by adding the attribute |
| 188 | 188 | Input event list or observation definition XML file [obs_vela_phased.xml] obs_vela_phased_prob.xml |
| 189 | 189 | RA for ROI centre (degrees) (0-360) [128.838] |
| 190 | 190 | Dec for ROI centre (degrees) (-90-90) [-45.178] |
| 191 | - Radius of ROI (degrees) (0-180) [0.5] 5.0 | |
| 192 | - Start time (CTA MET in seconds) [0.0] | |
| 193 | - End time (CTA MET in seconds) [0.0] | |
| 191 | + Radius of ROI (degrees) (0-180) [0.2] 5.0 | |
| 192 | + Start time (UTC string, JD, MJD or MET in seconds) [NONE] | |
| 194 | 193 | Lower energy limit (TeV) [0.03] |
| 195 | 194 | Upper energy limit (TeV) [160.0] |
| 196 | 195 | 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: |
| 222 | 221 | RA for ROI centre (degrees) (0-360) [128.838] |
| 223 | 222 | Dec for ROI centre (degrees) (-90-90) [-45.178] |
| 224 | 223 | Radius of ROI (degrees) (0-180) [5.0] |
| 225 | - Start time (CTA MET in seconds) [0.0] | |
| 226 | - End time (CTA MET in seconds) [0.0] | |
| 224 | + Start time (UTC string, JD, MJD or MET in seconds) [NONE] | |
| 227 | 225 | Lower energy limit (TeV) [0.03] |
| 228 | 226 | Upper energy limit (TeV) [160.0] |
| 229 | 227 | Output event list or observation definition XML file [obs_vela_phased_prob_selected.xml] obs_vela_phased_mcid.xml | ... | ... |
doc/source/users/tutorials/howto/howto_phasecurve_mcid.png
doc/source/users/tutorials/howto/howto_phasecurve_phases.png
doc/source/users/tutorials/howto/howto_phasecurve_probphases.png
doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb
0 → 100644
| 1 | +{ | |
| 2 | + "cells": [ | |
| 3 | + { | |
| 4 | + "cell_type": "markdown", | |
| 5 | + "metadata": {}, | |
| 6 | + "source": [ | |
| 7 | + "# Data preparation for 1DC How-tos" | |
| 8 | + ] | |
| 9 | + }, | |
| 10 | + { | |
| 11 | + "cell_type": "raw", | |
| 12 | + "metadata": {}, | |
| 13 | + "source": [ | |
| 14 | + "<div align=\"right\"><a href=\"../../../_downloads/howto_prepare_1dc.ipynb\" download=\"howto_prepare_1dc.ipynb\"><img src=\"../../../_static/download-notebook.jpg\" alt=\"Download Notebook\" height=\"40\"></a></div>" | |
| 15 | + ] | |
| 16 | + }, | |
| 17 | + { | |
| 18 | + "cell_type": "markdown", | |
| 19 | + "metadata": {}, | |
| 20 | + "source": [ | |
| 21 | + "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", | |
| 22 | + "\n", | |
| 23 | + "Start by importing the relevant Python modules." | |
| 24 | + ] | |
| 25 | + }, | |
| 26 | + { | |
| 27 | + "cell_type": "code", | |
| 28 | + "execution_count": 1, | |
| 29 | + "metadata": {}, | |
| 30 | + "outputs": [], | |
| 31 | + "source": [ | |
| 32 | + "import gammalib\n", | |
| 33 | + "import ctools\n", | |
| 34 | + "import cscripts" | |
| 35 | + ] | |
| 36 | + }, | |
| 37 | + { | |
| 38 | + "cell_type": "markdown", | |
| 39 | + "metadata": {}, | |
| 40 | + "source": [ | |
| 41 | + "Now set the `CTADATA` and `CALDB` environment variables. Please adjust the path below so that it points to the relevant location." | |
| 42 | + ] | |
| 43 | + }, | |
| 44 | + { | |
| 45 | + "cell_type": "code", | |
| 46 | + "execution_count": 2, | |
| 47 | + "metadata": {}, | |
| 48 | + "outputs": [ | |
| 49 | + { | |
| 50 | + "name": "stdout", | |
| 51 | + "output_type": "stream", | |
| 52 | + "text": [ | |
| 53 | + "env: CTADATA=/Users/jurgen/1dc\n", | |
| 54 | + "env: CALDB=/Users/jurgen/1dc/caldb\n" | |
| 55 | + ] | |
| 56 | + } | |
| 57 | + ], | |
| 58 | + "source": [ | |
| 59 | + "%env CTADATA=/Users/jurgen/1dc\n", | |
| 60 | + "%env CALDB=/Users/jurgen/1dc/caldb" | |
| 61 | + ] | |
| 62 | + }, | |
| 63 | + { | |
| 64 | + "cell_type": "markdown", | |
| 65 | + "metadata": {}, | |
| 66 | + "source": [ | |
| 67 | + "Now prepare a dataset that comprises the Galactic Centre observations that have been performed during the Galactic Plane Scan. Start with selecting the observations." | |
| 68 | + ] | |
| 69 | + }, | |
| 70 | + { | |
| 71 | + "cell_type": "code", | |
| 72 | + "execution_count": 3, | |
| 73 | + "metadata": {}, | |
| 74 | + "outputs": [], | |
| 75 | + "source": [ | |
| 76 | + "obsselect = cscripts.csobsselect()\n", | |
| 77 | + "obsselect['inobs'] = '$CTADATA/obs/obs_gps_baseline.xml'\n", | |
| 78 | + "obsselect['pntselect'] = 'CIRCLE'\n", | |
| 79 | + "obsselect['coordsys'] = 'GAL'\n", | |
| 80 | + "obsselect['glon'] = 0.0\n", | |
| 81 | + "obsselect['glat'] = 0.0\n", | |
| 82 | + "obsselect['rad'] = 3.0\n", | |
| 83 | + "obsselect['tmin'] = 'NONE'\n", | |
| 84 | + "obsselect['tmax'] = 'NONE'\n", | |
| 85 | + "obsselect['outobs'] = 'obs.xml'\n", | |
| 86 | + "obsselect.execute()" | |
| 87 | + ] | |
| 88 | + }, | |
| 89 | + { | |
| 90 | + "cell_type": "markdown", | |
| 91 | + "metadata": {}, | |
| 92 | + "source": [ | |
| 93 | + "Now select the events with energies comprised between 1 and 100 TeV from the observations. " | |
| 94 | + ] | |
| 95 | + }, | |
| 96 | + { | |
| 97 | + "cell_type": "code", | |
| 98 | + "execution_count": 4, | |
| 99 | + "metadata": {}, | |
| 100 | + "outputs": [], | |
| 101 | + "source": [ | |
| 102 | + "select = ctools.ctselect()\n", | |
| 103 | + "select['inobs'] = 'obs.xml'\n", | |
| 104 | + "select['ra'] = 'NONE'\n", | |
| 105 | + "select['dec'] = 'NONE'\n", | |
| 106 | + "select['rad'] = 'NONE'\n", | |
| 107 | + "select['tmin'] = 'NONE'\n", | |
| 108 | + "select['tmax'] = 'NONE'\n", | |
| 109 | + "select['emin'] = 1.0\n", | |
| 110 | + "select['emax'] = 100.0\n", | |
| 111 | + "select['outobs'] = 'obs_selected.xml'\n", | |
| 112 | + "select.execute()" | |
| 113 | + ] | |
| 114 | + }, | |
| 115 | + { | |
| 116 | + "cell_type": "markdown", | |
| 117 | + "metadata": {}, | |
| 118 | + "source": [ | |
| 119 | + "The next step is to stack the selected events into a counts cube." | |
| 120 | + ] | |
| 121 | + }, | |
| 122 | + { | |
| 123 | + "cell_type": "code", | |
| 124 | + "execution_count": 5, | |
| 125 | + "metadata": {}, | |
| 126 | + "outputs": [], | |
| 127 | + "source": [ | |
| 128 | + "binning = ctools.ctbin()\n", | |
| 129 | + "binning['inobs'] = 'obs_selected.xml'\n", | |
| 130 | + "binning['xref'] = 0.0\n", | |
| 131 | + "binning['yref'] = 0.0\n", | |
| 132 | + "binning['coordsys'] = 'GAL'\n", | |
| 133 | + "binning['proj'] = 'CAR'\n", | |
| 134 | + "binning['binsz'] = 0.02\n", | |
| 135 | + "binning['nxpix'] = 300\n", | |
| 136 | + "binning['nypix'] = 300\n", | |
| 137 | + "binning['ebinalg'] = 'LOG'\n", | |
| 138 | + "binning['emin'] = 1.0\n", | |
| 139 | + "binning['emax'] = 100.0\n", | |
| 140 | + "binning['enumbins'] = 20\n", | |
| 141 | + "binning['outcube'] = 'cntcube.fits'\n", | |
| 142 | + "binning.execute()" | |
| 143 | + ] | |
| 144 | + }, | |
| 145 | + { | |
| 146 | + "cell_type": "markdown", | |
| 147 | + "metadata": {}, | |
| 148 | + "source": [ | |
| 149 | + "Now compute the corresponding stacked exposure cube, point spread function cube and background cube." | |
| 150 | + ] | |
| 151 | + }, | |
| 152 | + { | |
| 153 | + "cell_type": "code", | |
| 154 | + "execution_count": 6, | |
| 155 | + "metadata": {}, | |
| 156 | + "outputs": [], | |
| 157 | + "source": [ | |
| 158 | + "expcube = ctools.ctexpcube()\n", | |
| 159 | + "expcube['inobs'] = 'obs_selected.xml'\n", | |
| 160 | + "expcube['incube'] = 'cntcube.fits'\n", | |
| 161 | + "expcube['outcube'] = 'expcube.fits'\n", | |
| 162 | + "expcube.execute()" | |
| 163 | + ] | |
| 164 | + }, | |
| 165 | + { | |
| 166 | + "cell_type": "code", | |
| 167 | + "execution_count": 7, | |
| 168 | + "metadata": {}, | |
| 169 | + "outputs": [], | |
| 170 | + "source": [ | |
| 171 | + "psfcube = ctools.ctpsfcube()\n", | |
| 172 | + "psfcube['inobs'] = 'obs_selected.xml'\n", | |
| 173 | + "psfcube['incube'] = 'NONE'\n", | |
| 174 | + "psfcube['ebinalg'] = 'LOG'\n", | |
| 175 | + "psfcube['emin'] = 1.0\n", | |
| 176 | + "psfcube['emax'] = 100.0\n", | |
| 177 | + "psfcube['enumbins'] = 20\n", | |
| 178 | + "psfcube['nxpix'] = 10\n", | |
| 179 | + "psfcube['nypix'] = 10\n", | |
| 180 | + "psfcube['binsz'] = 1.0\n", | |
| 181 | + "psfcube['coordsys'] = 'GAL'\n", | |
| 182 | + "psfcube['proj'] = 'CAR'\n", | |
| 183 | + "psfcube['xref'] = 0.0\n", | |
| 184 | + "psfcube['yref'] = 0.0\n", | |
| 185 | + "psfcube['outcube'] = 'psfcube.fits'\n", | |
| 186 | + "psfcube.execute()" | |
| 187 | + ] | |
| 188 | + }, | |
| 189 | + { | |
| 190 | + "cell_type": "code", | |
| 191 | + "execution_count": 8, | |
| 192 | + "metadata": {}, | |
| 193 | + "outputs": [], | |
| 194 | + "source": [ | |
| 195 | + "bkgcube = ctools.ctbkgcube()\n", | |
| 196 | + "bkgcube['inobs'] = 'obs_selected.xml'\n", | |
| 197 | + "bkgcube['inmodel'] = '$CTOOLS/share/models/bkg_irf.xml'\n", | |
| 198 | + "bkgcube['incube'] = 'cntcube.fits'\n", | |
| 199 | + "bkgcube['outcube'] = 'bkgcube.fits'\n", | |
| 200 | + "bkgcube['outmodel'] = 'bkgcube.xml' \n", | |
| 201 | + "bkgcube.execute()" | |
| 202 | + ] | |
| 203 | + }, | |
| 204 | + { | |
| 205 | + "cell_type": "markdown", | |
| 206 | + "metadata": {}, | |
| 207 | + "source": [ | |
| 208 | + "Now you are done. All data structures are prepared for the following tutorials." | |
| 209 | + ] | |
| 210 | + } | |
| 211 | + ], | |
| 212 | + "metadata": { | |
| 213 | + "kernelspec": { | |
| 214 | + "display_name": "Python 2", | |
| 215 | + "language": "python", | |
| 216 | + "name": "python2" | |
| 217 | + }, | |
| 218 | + "language_info": { | |
| 219 | + "codemirror_mode": { | |
| 220 | + "name": "ipython", | |
| 221 | + "version": 2 | |
| 222 | + }, | |
| 223 | + "file_extension": ".py", | |
| 224 | + "mimetype": "text/x-python", | |
| 225 | + "name": "python", | |
| 226 | + "nbconvert_exporter": "python", | |
| 227 | + "pygments_lexer": "ipython2", | |
| 228 | + "version": "2.7.11" | |
| 229 | + } | |
| 230 | + }, | |
| 231 | + "nbformat": 4, | |
| 232 | + "nbformat_minor": 2 | |
| 233 | +} | ... | ... |
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 |
| 12 | 12 | attribute ``tscalc="1"`` to the ``<source>`` tag in the |
| 13 | 13 | :ref:`model definition file <glossary_moddef>` |
| 14 | 14 | and execute :ref:`ctlike` using the modified file. |
| 15 | -The structure of the XML file with significance computation requested for | |
| 16 | -``Src001`` is shown below. | |
| 15 | +Copy the 1DC :ref:`model definition <glossary_moddef>` file | |
| 16 | + | |
| 17 | +.. code-block:: bash | |
| 18 | + | |
| 19 | + $ cp $CTOOLS/share/models/1dc_howto.xml ts_model.xml | |
| 20 | + | |
| 21 | +and modify the file by adding ``tscalc="1"`` to the ``<source>`` tag for | |
| 22 | +source ``Src1``. Your | |
| 23 | +:ref:`model definition XML file <glossary_moddef>` | |
| 24 | +should then look like this: | |
| 17 | 25 | |
| 18 | 26 | .. code-block:: xml |
| 19 | 27 | |
| ... | ... | @@ -27,36 +35,39 @@ The structure of the XML file with significance computation requested for |
| 27 | 35 | <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> |
| 28 | 36 | </spectrum> |
| 29 | 37 | <spatialModel type="PointSource"> |
| 30 | - <parameter name="RA" value="266.424004498437" error="0" scale="1" free="1" /> | |
| 31 | - <parameter name="DEC" value="-29.0049010253548" error="0" scale="1" free="1" /> | |
| 38 | + <parameter name="RA" scale="1" value="266.424" free="1" /> | |
| 39 | + <parameter name="DEC" scale="1" value="-29.005" free="1" /> | |
| 32 | 40 | </spatialModel> |
| 33 | 41 | </source> |
| 34 | 42 | ... |
| 35 | 43 | </source_library> |
| 36 | 44 | |
| 37 | -:ref:`ctlike` will compute the so-called Test Statistic, which is twice the | |
| 38 | -difference between the log-likelihood value obtained for a fit that includes | |
| 45 | +Then run :ref:`ctlike` to compute the so-called Test Statistic, which is twice | |
| 46 | +the difference between the log-likelihood value obtained for a fit that includes | |
| 39 | 47 | ``Src001`` and a fit that excludes ``Src001``. The Test Statistic value will |
| 40 | 48 | follow a :math:`\chi^2_p` distribution with :math:`p` degrees of |
| 41 | 49 | freedom, where :math:`p` is the number of free parameters of ``Src001``. |
| 42 | 50 | For :math:`p=1`, the source significance is the square root of the Test |
| 43 | 51 | Statistic. |
| 44 | 52 | |
| 45 | -An excerpt of the :ref:`ctlike` log file is shown below where significance | |
| 46 | -computation was requested for ``Src001`` and ``Src002``. The computation was | |
| 47 | -done using a stacked analysis. | |
| 48 | - | |
| 49 | 53 | .. code-block:: bash |
| 50 | 54 | |
| 51 | - 2017-07-28T01:26:56: === GModelSky === | |
| 52 | - 2017-07-28T01:26:56: Name ......................: Src001 | |
| 53 | - 2017-07-28T01:26:56: Instruments ...............: all | |
| 54 | - 2017-07-28T01:26:56: Test Statistic ............: 15404.1562257314 | |
| 55 | - ... | |
| 56 | - 2017-07-28T01:26:56: === GModelSky === | |
| 57 | - 2017-07-28T01:26:56: Name ......................: Src002 | |
| 58 | - 2017-07-28T01:26:56: Instruments ...............: all | |
| 59 | - 2017-07-28T01:26:56: Test Statistic ............: 3419.3020299729 | |
| 55 | + $ ctlike | |
| 56 | + Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits | |
| 57 | + Input exposure cube file [NONE] expcube.fits | |
| 58 | + Input PSF cube file [NONE] psfcube.fits | |
| 59 | + Input background cube file [NONE] bkgcube.fits | |
| 60 | + Input model definition XML file [$CTOOLS/share/models/crab.xml] ts_model.xml | |
| 61 | + Output model definition XML file [crab_results.xml] result.xml | |
| 62 | + | |
| 63 | +An excerpt of the :ref:`ctlike` log file is shown below | |
| 64 | + | |
| 65 | +.. code-block:: none | |
| 66 | + | |
| 67 | + 2018-01-25T12:46:12: === GModelSky === | |
| 68 | + 2018-01-25T12:46:12: Name ......................: Src001 | |
| 69 | + 2018-01-25T12:46:12: Instruments ...............: all | |
| 70 | + 2018-01-25T12:46:12: Test Statistic ............: 7659.64342272468 | |
| 60 | 71 | |
| 61 | 72 | The Test Statistic values are also written into the |
| 62 | 73 | :ref:`model definition file <glossary_moddef>` |
| ... | ... | @@ -66,12 +77,8 @@ created by :ref:`ctlike`: |
| 66 | 77 | |
| 67 | 78 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 68 | 79 | <source_library title="source library"> |
| 69 | - <source name="Src001" type="PointSource" ts="15404.156" tscalc="1"> | |
| 70 | - ... | |
| 71 | - </source> | |
| 72 | - <source name="Src002" type="PointSource" ts="3419.302" tscalc="1"> | |
| 80 | + <source name="Src001" type="PointSource" ts="7659.643" tscalc="1"> | |
| 73 | 81 | ... |
| 74 | 82 | </source> |
| 75 | 83 | ... |
| 76 | 84 | </source_library> |
| 77 | - | ... | ... |
doc/source/users/tutorials/howto/howto_tsmap.png
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. |
| 21 | 21 | |
| 22 | 22 | $ cttsmap |
| 23 | 23 | Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits |
| 24 | - Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits | |
| 25 | - Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits | |
| 26 | - Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits | |
| 27 | - Test source name [Crab] Src001 | |
| 28 | - Input model definition XML file [$CTOOLS/share/models/crab.xml] stacked_models.xml | |
| 24 | + Input exposure cube file [NONE] expcube.fits | |
| 25 | + Input PSF cube file [NONE] psfcube.fits | |
| 26 | + Input background cube file [NONE] bkgcube.fits | |
| 27 | + Test source name [Crab] Test | |
| 28 | + Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml | |
| 29 | 29 | First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 |
| 30 | 30 | Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 |
| 31 | 31 | 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. |
| 69 | 69 | |
| 70 | 70 | $ cstsmapsplit |
| 71 | 71 | Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits |
| 72 | - Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits | |
| 73 | - Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits | |
| 74 | - Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits | |
| 75 | - Input model definition XML file [$CTOOLS/share/models/crab.xml] stacked_models.xml | |
| 72 | + Input exposure cube file [NONE] expcube.fits | |
| 73 | + Input PSF cube file [NONE] psfcube.fits | |
| 74 | + Input background cube file [NONE] bkgcube.fits | |
| 75 | + Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml | |
| 76 | 76 | First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 |
| 77 | 77 | Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 |
| 78 | - Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] | |
| 78 | + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] | |
| 79 | 79 | Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL |
| 80 | 80 | Image scale (in degrees/pixel) [0.02] 0.05 |
| 81 | 81 | Size of the X axis in pixels [200] 10 |
| 82 | 82 | Size of the Y axis in pixels [200] 10 |
| 83 | - Test source name [Crab] Src001 | |
| 83 | + Test source name [Crab] Test | |
| 84 | 84 | Output Test Statistic map file [tsmap.fits] tsmap_split.fits |
| 85 | 85 | Number of TS map bins per task [5] 10 |
| 86 | 86 | Compute null hypothesis first? [yes] |
| ... | ... | @@ -90,16 +90,16 @@ The figure below shows the resulting Test Statistic map. |
| 90 | 90 | |
| 91 | 91 | .. code-block:: bash |
| 92 | 92 | |
| 93 | - 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 & | |
| 94 | - 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 & | |
| 95 | - 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 & | |
| 96 | - 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 & | |
| 97 | - 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 & | |
| 98 | - 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 & | |
| 99 | - 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 & | |
| 100 | - 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 & | |
| 101 | - 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 & | |
| 102 | - 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 & | |
| 93 | + 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 & | |
| 94 | + 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 & | |
| 95 | + 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 & | |
| 96 | + 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 & | |
| 97 | + 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 & | |
| 98 | + 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 & | |
| 99 | + 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 & | |
| 100 | + 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 & | |
| 101 | + 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 & | |
| 102 | + 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 & | |
| 103 | 103 | |
| 104 | 104 | Now run the ASCII file by typing |
| 105 | 105 | ... | ... |
doc/source/users/tutorials/howto/howto_ulimit.rst
| ... | ... | @@ -12,51 +12,55 @@ You determine upper limits for gamma-ray sources using the :ref:`ctulimit` |
| 12 | 12 | tool. |
| 13 | 13 | |
| 14 | 14 | Suppose you want to know the upper limit on the gamma-ray flux for |
| 15 | -a putative source at position :math:`l=0.1^\circ` and :math:`b=0.4^\circ` | |
| 16 | -(corresponding to :math:`\alpha=266.0753^\circ` and | |
| 17 | -:math:`\delta=-28.6420^\circ`). | |
| 15 | +a putative source at position :math:`l=0.1^\circ` and :math:`b=0.4^\circ`. | |
| 18 | 16 | For this you have to add a test source with the respective coordinates to |
| 19 | 17 | the |
| 20 | -:ref:`model definition file <glossary_moddef>`, | |
| 21 | -for example | |
| 18 | +:ref:`model definition file <glossary_moddef>`. | |
| 19 | +To do this, copy the 1DC :ref:`model definition <glossary_moddef>` file | |
| 20 | + | |
| 21 | +.. code-block:: bash | |
| 22 | + | |
| 23 | + $ cp $CTOOLS/share/models/1dc_howto.xml ulimit_model.xml | |
| 24 | + | |
| 25 | +and add the following source to it | |
| 22 | 26 | |
| 23 | 27 | .. code-block:: xml |
| 24 | 28 | |
| 25 | 29 | <source name="Test" type="PointSource"> |
| 26 | 30 | <spectrum type="PowerLaw"> |
| 27 | - <parameter name="Prefactor" value="1" scale="5.7e-18" min="0" free="1" /> | |
| 28 | - <parameter name="Index" value="1" scale="-2.48" min="-5" max="5" free="0" /> | |
| 29 | - <parameter name="PivotEnergy" value="1" scale="300000" free="0" /> | |
| 31 | + <parameter name="Prefactor" value="1" scale="1.0e-20" min="0" free="1"/> | |
| 32 | + <parameter name="Index" value="1" scale="-2.48" min="-5" max="5" free="0"/> | |
| 33 | + <parameter name="PivotEnergy" value="1" scale="300000" free="0"/> | |
| 30 | 34 | </spectrum> |
| 31 | 35 | <spatialModel type="PointSource"> |
| 32 | - <parameter name="RA" value="266.0753" scale="1" free="0" /> | |
| 33 | - <parameter name="DEC" value="-28.6420" scale="1" free="0" /> | |
| 36 | + <parameter name="GLON" value="0.1" scale="1" free="0"/> | |
| 37 | + <parameter name="GLAT" value="0.4" scale="1" free="0"/> | |
| 34 | 38 | </spatialModel> |
| 35 | 39 | </source> |
| 36 | 40 | |
| 37 | -and then run the :ref:`ctulimit` tool as follows: | |
| 41 | +Now run the :ref:`ctulimit` tool as follows: | |
| 38 | 42 | |
| 39 | 43 | .. code-block:: bash |
| 40 | 44 | |
| 41 | 45 | $ ctulimit |
| 42 | 46 | Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits |
| 43 | - Input exposure cube file (only needed for stacked analysis) [NONE] expcube.fits | |
| 44 | - Input PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits | |
| 45 | - Input background cube file (only needed for stacked analysis) [NONE] bkgcube.fits | |
| 47 | + Input exposure cube file [NONE] expcube.fits | |
| 48 | + Input PSF cube file [NONE] psfcube.fits | |
| 49 | + Input background cube file [NONE] bkgcube.fits | |
| 46 | 50 | Source of interest [Crab] Test |
| 47 | - Input model definition XML file [$CTOOLS/share/models/crab.xml] stacked_models_cutoff_iem_up.xml | |
| 51 | + Input model definition XML file [$CTOOLS/share/models/crab.xml] ulimit_model.xml | |
| 48 | 52 | |
| 49 | 53 | After the run, the upper gamma-ray flux limit for this test source can be |
| 50 | 54 | extracted from the :ref:`ctulimit` log file: |
| 51 | 55 | |
| 52 | 56 | .. code-block:: bash |
| 53 | 57 | |
| 54 | - 2017-07-28T07:03:03: +=====================+ | |
| 55 | - 2017-07-28T07:03:03: | Upper limit results | | |
| 56 | - 2017-07-28T07:03:03: +=====================+ | |
| 57 | - 2017-07-28T07:03:03: Differential flux limit ...: 6.39388221102118e-21 ph/cm2/s/MeV at 1 TeV | |
| 58 | - 2017-07-28T07:03:03: Integral flux limit .......: 4.31545368823519e-15 ph/cm2/s within [1-100] TeV | |
| 59 | - 2017-07-28T07:03:03: Energy flux limit .........: 1.90018365473006e-14 erg/cm2/s within [1-100] TeV | |
| 58 | + 2018-01-25T13:57:23: +=====================+ | |
| 59 | + 2018-01-25T13:57:23: | Upper limit results | | |
| 60 | + 2018-01-25T13:57:23: +=====================+ | |
| 61 | + 2018-01-25T13:57:23: Differential flux limit ...: 1.39791304697722e-20 ph/cm2/s/MeV at 1 TeV | |
| 62 | + 2018-01-25T13:57:23: Integral flux limit .......: 9.43500179595339e-15 ph/cm2/s within [1-100] TeV | |
| 63 | + 2018-01-25T13:57:23: Energy flux limit .........: 4.1544267393937e-14 erg/cm2/s within [1-100] TeV | |
| 60 | 64 | |
| 61 | 65 | .. warning:: |
| 62 | 66 | It is important to fix the spectral index of the test source in the | ... | ... |
doc/source/users/tutorials/howto/index.rst
| ... | ... | @@ -17,11 +17,19 @@ CTA data analysis |
| 17 | 17 | howto_advanced_python_fitting |
| 18 | 18 | howto_connect_irfs |
| 19 | 19 | howto_connect_models |
| 20 | + | |
| 21 | + | |
| 22 | +CTA first Data Challenge data analysis | |
| 23 | +-------------------------------------- | |
| 24 | + | |
| 25 | +.. toctree:: | |
| 26 | + :maxdepth: 1 | |
| 27 | + | |
| 28 | + howto_prepare_1dc | |
| 20 | 29 | howto_ts |
| 21 | 30 | howto_tsmap |
| 22 | 31 | howto_extent |
| 23 | 32 | howto_ulimit |
| 24 | - howto_edisp | |
| 25 | 33 | howto_lightcurve |
| 26 | 34 | howto_phasecurve |
| 27 | 35 | howto_exclude | ... | ... |
doc/source/users/tutorials/notebooks.rst
| ... | ... | @@ -19,3 +19,4 @@ this page. |
| 19 | 19 | * :download:`How to connect observations to specific models? <howto/howto_connect_models.ipynb>` |
| 20 | 20 | * :download:`How to perform a stacked analysis? <howto/howto_stacked_analysis.ipynb>` |
| 21 | 21 | * :download:`How to do advanced model manipulation and fitting in Python? <howto/howto_advanced_python_fitting.ipynb>` |
| 22 | +* :download:`Data preparation for 1DC How-tos <howto/howto_prepare_1dc.ipynb>` | ... | ... |
models/1dc_howto.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
| 2 | +<source_library title="source library"> | |
| 3 | + <source name="Src001" type="PointSource"> | |
| 4 | + <spectrum type="ExponentialCutoffPowerLaw"> | |
| 5 | + <parameter name="Prefactor" scale="1e-18" value="5.7" min="1e-07" max="1000.0" free="1"/> | |
| 6 | + <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/> | |
| 7 | + <parameter name="CutoffEnergy" scale="1e7" value="1.0" min="0.01" max="1000.0" free="1"/> | |
| 8 | + <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | |
| 9 | + </spectrum> | |
| 10 | + <spatialModel type="PointSource"> | |
| 11 | + <parameter name="RA" scale="1" value="266.424" free="1" /> | |
| 12 | + <parameter name="DEC" scale="1" value="-29.005" free="1" /> | |
| 13 | + </spatialModel> | |
| 14 | + </source> | |
| 15 | + <source name="Src002" type="PointSource"> | |
| 16 | + <spectrum type="PowerLaw"> | |
| 17 | + <parameter name="Prefactor" scale="1e-18" value="5.7" min="1e-07" max="1000.0" free="1"/> | |
| 18 | + <parameter name="Index" scale="-1" value="2.48" min="0.0" max="5.0" free="1"/> | |
| 19 | + <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | |
| 20 | + </spectrum> | |
| 21 | + <spatialModel type="PointSource"> | |
| 22 | + <parameter name="RA" scale="1" value="266.832" free="1" /> | |
| 23 | + <parameter name="DEC" scale="1" value="-28.146" free="1" /> | |
| 24 | + </spatialModel> | |
| 25 | + </source> | |
| 26 | + <source name="IEM" type="DiffuseSource"> | |
| 27 | + <spectrum type="ConstantValue"> | |
| 28 | + <parameter name="Value" scale="1" value="1" min="1e-05" max="100000" free="1"/> | |
| 29 | + </spectrum> | |
| 30 | + <spatialModel type="MapCubeFunction" file="$CTADATA/models/cube_iem.fits"> | |
| 31 | + <parameter name="Normalization" scale="1" value="1" min="0.001" max="1000" free="0"/> | |
| 32 | + </spatialModel> | |
| 33 | + </source> | |
| 34 | + <source name="Background" type="CTACubeBackground" instrument="CTA"> | |
| 35 | + <spectrum type="PowerLaw"> | |
| 36 | + <parameter name="Prefactor" scale="1" value="1" min="0.01" max="100" free="1"/> | |
| 37 | + <parameter name="Index" scale="1" value="0" min="-5" max="5" free="1"/> | |
| 38 | + <parameter name="PivotEnergy" scale="1000000" value="1" min="0.01" max="1000.0" free="0"/> | |
| 39 | + </spectrum> | |
| 40 | + </source> | |
| 41 | +</source_library> | ... | ... |
models/1dc_howto_unbinned.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
| 2 | +<source_library title="source library"> | |
| 3 | + <source name="Src001" type="PointSource"> | |
| 4 | + <spectrum type="ExponentialCutoffPowerLaw"> | |
| 5 | + <parameter name="Prefactor" scale="1e-18" value="5.7" min="1e-07" max="1000.0" free="1"/> | |
| 6 | + <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/> | |
| 7 | + <parameter name="CutoffEnergy" scale="1e7" value="1.0" min="0.01" max="1000.0" free="1"/> | |
| 8 | + <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | |
| 9 | + </spectrum> | |
| 10 | + <spatialModel type="PointSource"> | |
| 11 | + <parameter name="RA" scale="1" value="266.424" free="1" /> | |
| 12 | + <parameter name="DEC" scale="1" value="-29.005" free="1" /> | |
| 13 | + </spatialModel> | |
| 14 | + </source> | |
| 15 | + <source name="Src002" type="PointSource"> | |
| 16 | + <spectrum type="PowerLaw"> | |
| 17 | + <parameter name="Prefactor" scale="1e-18" value="5.7" min="1e-07" max="1000.0" free="1"/> | |
| 18 | + <parameter name="Index" scale="-1" value="2.48" min="0.0" max="5.0" free="1"/> | |
| 19 | + <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | |
| 20 | + </spectrum> | |
| 21 | + <spatialModel type="PointSource"> | |
| 22 | + <parameter name="RA" scale="1" value="266.832" free="1" /> | |
| 23 | + <parameter name="DEC" scale="1" value="-28.146" free="1" /> | |
| 24 | + </spatialModel> | |
| 25 | + </source> | |
| 26 | + <source name="IEM" type="DiffuseSource"> | |
| 27 | + <spectrum type="ConstantValue"> | |
| 28 | + <parameter name="Value" scale="1" value="1" min="1e-05" max="100000" free="1"/> | |
| 29 | + </spectrum> | |
| 30 | + <spatialModel type="MapCubeFunction" file="$CTADATA/models/cube_iem.fits"> | |
| 31 | + <parameter name="Normalization" scale="1" value="1" min="0.001" max="1000" free="0"/> | |
| 32 | + </spatialModel> | |
| 33 | + </source> | |
| 34 | + <source name="Background" type="CTAIrfBackground" instrument="CTA"> | |
| 35 | + <spectrum type="PowerLaw"> | |
| 36 | + <parameter name="Prefactor" scale="1" value="1" min="0.01" max="100" free="1"/> | |
| 37 | + <parameter name="Index" scale="1" value="0" min="-5" max="5" free="1"/> | |
| 38 | + <parameter name="PivotEnergy" scale="1000000" value="1" min="0.01" max="1000.0" free="0"/> | |
| 39 | + </spectrum> | |
| 40 | + </source> | |
| 41 | +</source_library> | ... | ... |
models/1dc_howto_vela.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
| 2 | +<source_library title="source library"> | |
| 3 | + <source name="VelaPulsar" type="PointSource"> | |
| 4 | + <spectrum type="PowerLaw"> | |
| 5 | + <parameter name="Prefactor" scale="1e-14" value="19.4" min="1e-07" max="1000.0" free="1"/> | |
| 6 | + <parameter name="Index" scale="-1" value="4.45" min="0.0" max="+10.0" free="1"/> | |
| 7 | + <parameter name="PivotEnergy" scale="1e3" value="20.0" min="0.01" max="1000.0" free="0"/> | |
| 8 | + </spectrum> | |
| 9 | + <spatialModel type="PointSource"> | |
| 10 | + <parameter name="RA" scale="1" value="128.838" min="-360" max="360" free="0"/> | |
| 11 | + <parameter name="DEC" scale="1" value="-45.178" min="-90" max="90" free="0"/> | |
| 12 | + </spatialModel> | |
| 13 | + </source> | |
| 14 | + <source name="Background" type="CTAIrfBackground" instrument="CTA"> | |
| 15 | + <spectrum type="PowerLaw"> | |
| 16 | + <parameter name="Prefactor" value="1" scale="1" min="0" free="1"/> | |
| 17 | + <parameter name="Index" value="0" scale="1" min="-10" max="10" free="1"/> | |
| 18 | + <parameter name="PivotEnergy" value="1" scale="1000000" free="0"/> | |
| 19 | + </spectrum> | |
| 20 | + </source> | |
| 21 | +</source_library> | ... | ... |
models/1dc_howto_velapsr.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
| 2 | +<source_library title="source library"> | |
| 3 | + <source name="VelaPulsar" type="PointSource"> | |
| 4 | + <spectrum type="PowerLaw"> | |
| 5 | + <parameter name="Prefactor" scale="1e-14" value="19.4" min="1e-07" max="1000.0" free="1"/> | |
| 6 | + <parameter name="Index" scale="-1" value="4.45" min="0.0" max="+10.0" free="1"/> | |
| 7 | + <parameter name="PivotEnergy" scale="1e3" value="20.0" min="0.01" max="1000.0" free="0"/> | |
| 8 | + </spectrum> | |
| 9 | + <spatialModel type="PointSource"> | |
| 10 | + <parameter name="RA" scale="1" value="128.838" min="-360" max="360" free="0"/> | |
| 11 | + <parameter name="DEC" scale="1" value="-45.178" min="-90" max="90" free="0"/> | |
| 12 | + </spatialModel> | |
| 13 | + <temporal type="PhaseCurve" file="$CTADATA/models/phasecurve_J0835-4510.fits"> | |
| 14 | + <parameter name="Normalization" scale="1" value="1.0" min="0.0" max="1000.0" free="0"/> | |
| 15 | + <parameter name="MJD" scale="1" value="54686.2" min="0.0" max="100000.0" free="0"/> | |
| 16 | + <parameter name="Phase" scale="1" value="0.0" min="0.0" max="1.0" free="0"/> | |
| 17 | + <parameter name="F0" scale="1" value="11.19" min="0.0" max="1000.0" free="0"/> | |
| 18 | + <parameter name="F1" scale="1e-11" value="-1.55" min="-10.0" max="1000.0" free="0"/> | |
| 19 | + <parameter name="F2" scale="1e-23" value="6.46" min="0.0" max="1000.0" free="0"/> | |
| 20 | + </temporal> | |
| 21 | + </source> | |
| 22 | +</source_library> | ... | ... |
models/Makefile.am
| ... | ... | @@ -20,7 +20,14 @@ |
| 20 | 20 | ############################################################################# |
| 21 | 21 | |
| 22 | 22 | # Models to install |
| 23 | -models = bkg_irf.xml \ | |
| 23 | +models = 1dc_howto.xml \ | |
| 24 | + 1dc_howto_unbinned.xml \ | |
| 25 | + 1dc_howto_vela.xml \ | |
| 26 | + 1dc_howto_velapsr.xml \ | |
| 27 | + bkg_irf.xml \ | |
| 28 | + bkg_cube.xml \ | |
| 29 | + test_irf.xml \ | |
| 30 | + test_cube.xml \ | |
| 24 | 31 | crab.xml \ |
| 25 | 32 | crab_beyond.xml \ |
| 26 | 33 | crab_2bkg.xml \ | ... | ... |
models/bkg_cube.xml
0 → 100644
| 1 | +<?xml version="1.0" standalone="no"?> | |
| 2 | +<source_library title="source library"> | |
| 3 | + <source name="Background" type="CTACubeBackground" instrument="CTA"> | |
| 4 | + <spectrum type="PowerLaw"> | |
| 5 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="0.01" max="100" free="1"/> | |
| 6 | + <parameter name="Index" scale="1.0" value="0.0" min="-5" max="5" free="1"/> | |
| 7 | + <parameter name="PivotEnergy" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 8 | + </spectrum> | |
| 9 | + </source> | |
| 10 | +</source_library> | ... | ... |
models/test_cube.xml
0 → 100644
| 1 | +<?xml version="1.0" standalone="no"?> | |
| 2 | +<source_library title="source library"> | |
| 3 | + <source name="Test" type="PointSource"> | |
| 4 | + <spectrum type="PowerLaw"> | |
| 5 | + <parameter name="Prefactor" scale="1e-18" value="1.0" min="1e-07" max="1000.0" free="1"/> | |
| 6 | + <parameter name="Index" scale="-1" value="2.5" min="0.0" max="+5.0" free="0"/> | |
| 7 | + <parameter name="PivotEnergy" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 8 | + </spectrum> | |
| 9 | + <spatialModel type="PointSource"> | |
| 10 | + <parameter name="RA" scale="1.0" value="0.0" min="-360" max="360" free="0"/> | |
| 11 | + <parameter name="DEC" scale="1.0" value="0.0" min="-90" max="90" free="0"/> | |
| 12 | + </spatialModel> | |
| 13 | + </source> | |
| 14 | + <source name="Background" type="CTACubeBackground" instrument="CTA"> | |
| 15 | + <spectrum type="PowerLaw"> | |
| 16 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="0.01" max="100" free="1"/> | |
| 17 | + <parameter name="Index" scale="1.0" value="0.0" min="-5" max="5" free="1"/> | |
| 18 | + <parameter name="PivotEnergy" scale="1e6" value="3.0" min="0.01" max="1000.0" free="0"/> | |
| 19 | + </spectrum> | |
| 20 | + </source> | |
| 21 | +</source_library> | ... | ... |
models/test_irf.xml
0 → 100644
| 1 | +<?xml version="1.0" standalone="no"?> | |
| 2 | +<source_library title="source library"> | |
| 3 | + <source name="Test" type="PointSource"> | |
| 4 | + <spectrum type="PowerLaw"> | |
| 5 | + <parameter name="Prefactor" scale="1e-17" value="1.0" min="1e-07" max="1000.0" free="1"/> | |
| 6 | + <parameter name="Index" scale="-1" value="2.5" min="0.0" max="+5.0" free="0"/> | |
| 7 | + <parameter name="PivotEnergy" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 8 | + </spectrum> | |
| 9 | + <spatialModel type="PointSource"> | |
| 10 | + <parameter name="RA" scale="1.0" value="0.0" min="-360" max="360" free="0"/> | |
| 11 | + <parameter name="DEC" scale="1.0" value="0.0" min="-90" max="90" free="0"/> | |
| 12 | + </spatialModel> | |
| 13 | + </source> | |
| 14 | + <source name="Background" type="CTAIrfBackground" instrument="CTA"> | |
| 15 | + <spectrum type="PowerLaw"> | |
| 16 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/> | |
| 17 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 18 | + <parameter name="PivotEnergy" scale="1e6" value="3.0" min="0.01" max="1000.0" free="0"/> | |
| 19 | + </spectrum> | |
| 20 | + </source> | |
| 21 | +</source_library> | ... | ... |