Commit 866897a5ba0189ab04e179b8de68c3486ba20dfd
1 parent
ab3c32e7
Add information about calibration database handling
Showing
1 changed file
with
109 additions
and
25 deletions
doc/source/user_manual/getting_started/response.rst
| ... | ... | @@ -49,8 +49,8 @@ Data formats |
| 49 | 49 | ~~~~~~~~~~~~ |
| 50 | 50 | |
| 51 | 51 | So far the data format of the CTA instrument response functions has not |
| 52 | -yet been defined, and information about instrument response functions is | |
| 53 | -provided in various ways. Three types of data formats are so far supported: | |
| 52 | +yet been settled, and information about instrument response functions is | |
| 53 | +provided in various ways. Three types of data formats are supported: | |
| 54 | 54 | |
| 55 | 55 | - :ref:`sec_cta_rsp_perftable` |
| 56 | 56 | |
| ... | ... | @@ -71,12 +71,9 @@ for any analysis. |
| 71 | 71 | |
| 72 | 72 | .. note :: |
| 73 | 73 | |
| 74 | - Instrument response functions are so far only available for a fixed | |
| 74 | + Instrument response functions are so far only provided for a fixed | |
| 75 | 75 | zenith angle of 20 deg. Therefore, no zenith or azimuth angle dependence has |
| 76 | - been implented in the CTA response functions, but the dependence can be | |
| 77 | - handled by cutting the data into short time segments (typically of 30 | |
| 78 | - minutes in length), and by specifying specific response functions for | |
| 79 | - each segment. | |
| 76 | + been implemented so far. | |
| 80 | 77 | |
| 81 | 78 | |
| 82 | 79 | Installing the CTA calibration database |
| ... | ... | @@ -89,13 +86,13 @@ the database is installed using |
| 89 | 86 | |
| 90 | 87 | .. code-block:: bash |
| 91 | 88 | |
| 92 | - $ [sudo] tar -C $CALDB -zxvf cta-caldb-20140216.tar.gz | |
| 89 | + $ [sudo] tar -C $CALDB -zxvf cta-caldb-20140220.tar.gz | |
| 93 | 90 | |
| 94 | 91 | or |
| 95 | 92 | |
| 96 | 93 | .. code-block:: bash |
| 97 | 94 | |
| 98 | - $ [sudo] tar -C $CALDB -xvf cta-caldb-20140216.tar | |
| 95 | + $ [sudo] tar -C $CALDB -xvf cta-caldb-20140220.tar | |
| 99 | 96 | |
| 100 | 97 | depending on whether the database has been retrieved as a gzipped file or |
| 101 | 98 | not. Depending on your access rights to the ``$CALDB`` directory, |
| ... | ... | @@ -110,14 +107,14 @@ enviroment variable to |
| 110 | 107 | |
| 111 | 108 | $CTOOLS/share/caldb |
| 112 | 109 | |
| 113 | -but it may be that some other software installation or configuration | |
| 114 | -setting on your system overwrites this location. If in doubt, type | |
| 110 | +but it may be that due to some other analysis software on your system the | |
| 111 | +``CALDB`` environment variable points to another directory. If in doubt, type | |
| 115 | 112 | |
| 116 | 113 | .. code-block:: bash |
| 117 | 114 | |
| 118 | 115 | echo $CALDB |
| 119 | 116 | |
| 120 | -to find out to which directory your ``CALDB`` environment variable is set. | |
| 117 | +to find out to which directory your ``CALDB`` environment variable points. | |
| 121 | 118 | You may always overwrite this setting using |
| 122 | 119 | |
| 123 | 120 | .. code-block:: bash |
| ... | ... | @@ -136,36 +133,123 @@ Specifying the CTA Instrument Response Functions |
| 136 | 133 | |
| 137 | 134 | The specification of the CTA Instrument Response Functions depends on the |
| 138 | 135 | way how ctools are used. Common to all methods is that the IRFs are |
| 139 | -defined by a response name and a calibration database name. The latter | |
| 140 | -may in some cases be the path to a directory on your filesystem. | |
| 136 | +defined by a response name and a calibration database name. | |
| 141 | 137 | |
| 142 | 138 | There are different means to specify the CTA Instrument Response Functions |
| 143 | 139 | when using ctools, and the following section describe the |
| 144 | 140 | |
| 145 | -Using individual event files | |
| 146 | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 147 | 141 | |
| 148 | -(to be written) | |
| 142 | +Specifying the response function as input parameters | |
| 143 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 149 | 144 | |
| 145 | +ctools that require instrument response functions have two parameters | |
| 146 | +to specify the calibration database name and the response function name. | |
| 147 | +The following example shows a ``ctobssim`` run using the ``dummy`` | |
| 148 | +calibration database and the ``cta_dummy_irf`` response function: | |
| 150 | 149 | |
| 151 | -Using observation definition files | |
| 152 | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 150 | +.. code-block:: bash | |
| 151 | + | |
| 152 | + $ ctobssim | |
| 153 | + Model [$CTOOLS/share/models/crab.xml] | |
| 154 | + Calibration database [dummy] | |
| 155 | + Instrument response function [cta_dummy_irf] | |
| 156 | + RA of pointing (degrees) (0-360) [83.63] | |
| 157 | + Dec of pointing (degrees) (-90-90) [22.01] | |
| 158 | + Radius of FOV (degrees) (0-180) [5.0] | |
| 159 | + Start time (MET in s) (0) [0.0] | |
| 160 | + End time (MET in s) (0) [1800.0] | |
| 161 | + Lower energy limit (TeV) (0) [0.1] | |
| 162 | + Upper energy limit (TeV) (0) [100.0] | |
| 163 | + Output event data file or observation definition file [events.fits] | |
| 164 | + | |
| 165 | +Running the other tools is equivalent. | |
| 166 | + | |
| 167 | + | |
| 168 | +Specifying the response function in an observation definition file | |
| 169 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 170 | + | |
| 171 | +In the above example, only a single global response function can be | |
| 172 | +used for all CTA observations. If you need to specify response functions | |
| 173 | +per observation you can add the information directly in the XML observation | |
| 174 | +definition file: | |
| 153 | 175 | |
| 154 | -(to be written) | |
| 176 | +.. code-block:: xml | |
| 177 | + | |
| 178 | + <observation_list title="observation library"> | |
| 179 | + <observation name="Crab" id="00001" instrument="CTA"> | |
| 180 | + <parameter name="EventList" file="events.fits"/> | |
| 181 | + <parameter name="Calibration" database="dummy" response="cta_dummy_irf"/> | |
| 182 | + </observation> | |
| 183 | + </observation_list> | |
| 184 | + | |
| 185 | +The ``Calibration`` parameter specifies the calibration database and | |
| 186 | +response name. You can then pass this file directly to, e.g., ``ctlike``: | |
| 187 | + | |
| 188 | +.. code-block:: bash | |
| 189 | + | |
| 190 | + $ ctlike | |
| 191 | + Event list, counts map or observation definition file [events.fits] obs_rsp.xml | |
| 192 | + Source model [$CTOOLS/share/models/crab.xml] | |
| 193 | + Source model output file [crab_results.xml] | |
| 194 | + | |
| 195 | +Note that ``ctlike`` does not ask for the calibration database and | |
| 196 | +response name as it found the relevant information in the XML file. | |
| 197 | + | |
| 198 | +.. _sec_cta_rsp_abspath: | |
| 199 | + | |
| 200 | + | |
| 201 | +Specifying individual instrument response files | |
| 202 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 203 | + | |
| 204 | +If you need even more control over individual response files, you can | |
| 205 | +specify them individually in the XML observation file as follows: | |
| 206 | + | |
| 207 | +.. code-block:: xml | |
| 208 | + | |
| 209 | + <observation_list title="observation library"> | |
| 210 | + <observation name="Crab" id="00001" instrument="CTA"> | |
| 211 | + <parameter name="EventList" file="events.fits"/> | |
| 212 | + <parameter name="EffectiveArea" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 213 | + <parameter name="PointSpreadFunction" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 214 | + <parameter name="EnergyDispersion" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 215 | + <parameter name="Background" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 216 | + </observation> | |
| 217 | + </observation_list> | |
| 155 | 218 | |
| 156 | 219 | |
| 157 | 220 | From within a Python script |
| 158 | 221 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 159 | 222 | |
| 160 | -(to be written) | |
| 223 | +The following example illustrates how to set the calibration database | |
| 224 | +and response name from within Python: | |
| 161 | 225 | |
| 226 | +.. code-block:: python | |
| 162 | 227 | |
| 163 | -.. _sec_cta_rsp_abspath: | |
| 228 | + import gammalib | |
| 229 | + obs = gammalib.GCTAObservation() | |
| 230 | + caldb = gammalib.GCaldb("cta", "dummy") | |
| 231 | + irf = "cta_dummy_irf" | |
| 232 | + obs.response(irf, caldb) | |
| 233 | + | |
| 234 | +The calibration database is set by creating a ``GCaldb`` object. The | |
| 235 | +constructor takes as argument the mission (always ``cta``) and the | |
| 236 | +database name, in our case ``dummy``. The response function is then set | |
| 237 | +by passing the response name (here ``cta_dummy_irf``) and the calibration | |
| 238 | +database object to the ``response`` method. | |
| 239 | + | |
| 240 | +Alternatively, you can specify a specific response file by using | |
| 241 | + | |
| 242 | +.. code-block:: python | |
| 164 | 243 | |
| 165 | -Using absolute path names to instrument response files | |
| 166 | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 244 | + import gammalib | |
| 245 | + obs = gammalib.GCTAObservation() | |
| 246 | + caldb = gammalib.GCaldb("$CALDB/data/cta/dummy/bcf") | |
| 247 | + irf = "cta_dummy_irf.dat" | |
| 248 | + obs.response(irf, caldb) | |
| 167 | 249 | |
| 168 | -(to be written) | |
| 250 | +Here, the directory in which the calibration file resides is specified | |
| 251 | +as argument to the ``GCaldb`` constructor, and the filename is passed | |
| 252 | +as response function name to the ``response`` method. | |
| 169 | 253 | |
| 170 | 254 | |
| 171 | 255 | Data format details | ... | ... |