Commit 19ce15816035855358d6d896f7c2c9f8aa487cc0
1 parent
8510ca23
Update second section of How Tos
Showing
32 changed files
with
255 additions
and
164 deletions
cscripts/cstsmapsplit.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Create commands to split TS map computation |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Michael Mayer | |
| 5 | +# Copyright (C) 2016-2019 Michael Mayer | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -31,14 +31,14 @@ import ctools |
| 31 | 31 | class cstsmapsplit(ctools.cslikelihood): |
| 32 | 32 | """ |
| 33 | 33 | Generates commands to split TS map computation |
| 34 | - | |
| 34 | + | |
| 35 | 35 | This class implements the creation of file containing commands to split |
| 36 | 36 | the computation of a TS map into several machines. It derives from |
| 37 | 37 | the ctools.cscript class which provides support for parameter files, |
| 38 | 38 | command line arguments, and logging. In that way the Python script |
| 39 | 39 | behaves just as a regular ctool. |
| 40 | 40 | """ |
| 41 | - | |
| 41 | + | |
| 42 | 42 | # Consructor |
| 43 | 43 | def __init__(self, *argv): |
| 44 | 44 | """ |
| ... | ... | @@ -58,8 +58,8 @@ class cstsmapsplit(ctools.cslikelihood): |
| 58 | 58 | |
| 59 | 59 | # Return |
| 60 | 60 | return |
| 61 | - | |
| 62 | - | |
| 61 | + | |
| 62 | + | |
| 63 | 63 | # Private methods |
| 64 | 64 | def _get_parameters(self): |
| 65 | 65 | """ |
| ... | ... | @@ -68,31 +68,31 @@ class cstsmapsplit(ctools.cslikelihood): |
| 68 | 68 | # If there are no observations in container then get some ... |
| 69 | 69 | if self.obs().size() == 0: |
| 70 | 70 | self.obs(self._get_observations()) |
| 71 | - | |
| 71 | + | |
| 72 | 72 | # Set models if we have none |
| 73 | 73 | if self.obs().models().size() == 0: |
| 74 | 74 | self.obs().models(self['inmodel'].filename()) |
| 75 | - | |
| 75 | + | |
| 76 | 76 | # Get TS map paramters |
| 77 | 77 | self._map = self._create_map(self.obs()) |
| 78 | 78 | self._srcname = self['srcname'].string() |
| 79 | 79 | self._outmap = self['outmap'].filename() |
| 80 | - | |
| 80 | + | |
| 81 | 81 | # Get additional parameters |
| 82 | 82 | self._bins_per_job = self['bins_per_job'].integer() |
| 83 | 83 | self._compute_null = self['compute_null'].boolean() |
| 84 | 84 | self._outfile = self['outfile'].filename() |
| 85 | - | |
| 85 | + | |
| 86 | 86 | # Write input parameters into logger |
| 87 | 87 | self._log_parameters(gammalib.TERSE) |
| 88 | - | |
| 88 | + | |
| 89 | 89 | # Return |
| 90 | 90 | return |
| 91 | 91 | |
| 92 | 92 | def _compute_null_hypothesis(self): |
| 93 | 93 | """ |
| 94 | 94 | Compute null hypothesis |
| 95 | - | |
| 95 | + | |
| 96 | 96 | Returns |
| 97 | 97 | ------- |
| 98 | 98 | logl : float |
| ... | ... | @@ -100,29 +100,26 @@ class cstsmapsplit(ctools.cslikelihood): |
| 100 | 100 | """ |
| 101 | 101 | # Store original models |
| 102 | 102 | models_orig = self.obs().models() |
| 103 | - | |
| 103 | + | |
| 104 | 104 | # Get models instance |
| 105 | 105 | models0 = self.obs().models() |
| 106 | - | |
| 106 | + | |
| 107 | 107 | # Remove test source |
| 108 | 108 | models0.remove(self._srcname) |
| 109 | - | |
| 110 | - # Initialise optimizer | |
| 111 | - #opt = gammalib.GOptimizerLM() | |
| 112 | - | |
| 109 | + | |
| 113 | 110 | # Set models for null hypothesis |
| 114 | 111 | self.obs().models(models0) |
| 115 | - | |
| 112 | + | |
| 116 | 113 | # Optimise observation container |
| 117 | 114 | self.obs().optimize(self.opt()) |
| 118 | - | |
| 115 | + | |
| 119 | 116 | # Set original models to container |
| 120 | 117 | self.obs().models(models_orig) |
| 121 | - | |
| 118 | + | |
| 122 | 119 | # Return optimised log-likelihood of null hypothesis |
| 123 | 120 | return -(self.opt().value()) |
| 124 | - | |
| 125 | - | |
| 121 | + | |
| 122 | + | |
| 126 | 123 | # Public methods |
| 127 | 124 | def run(self): |
| 128 | 125 | """ |
| ... | ... | @@ -131,89 +128,87 @@ class cstsmapsplit(ctools.cslikelihood): |
| 131 | 128 | # Switch screen logging on in debug mode |
| 132 | 129 | if self._logDebug(): |
| 133 | 130 | self._log.cout(True) |
| 134 | - | |
| 131 | + | |
| 135 | 132 | # Get parameters |
| 136 | 133 | self._get_parameters() |
| 137 | - | |
| 134 | + | |
| 138 | 135 | # Write information into logger |
| 139 | 136 | self._log_header1(gammalib.TERSE, 'Test source') |
| 140 | 137 | self._log_string(gammalib.TERSE, str(self.obs().models()[self._srcname])) |
| 141 | - | |
| 138 | + | |
| 142 | 139 | # Set log-likelihood to zero |
| 143 | 140 | logL0 = 0.0 |
| 144 | - | |
| 141 | + | |
| 145 | 142 | # Pre-compute null hypothesis if requested |
| 146 | 143 | if self._compute_null: |
| 147 | - | |
| 144 | + | |
| 148 | 145 | # Write information into logger |
| 149 | 146 | self._log_header1(gammalib.TERSE, 'Compute null hypothesis') |
| 150 | - | |
| 147 | + | |
| 151 | 148 | # Compute null hypothesis |
| 152 | 149 | logL0 = self._compute_null_hypothesis() |
| 153 | - | |
| 150 | + | |
| 154 | 151 | # Write likelihood into logger |
| 155 | 152 | self._log_value(gammalib.TERSE, 'Source removed', self._srcname) |
| 156 | 153 | self._log_value(gammalib.TERSE, 'Log-likelihood', repr(logL0)) |
| 157 | - | |
| 154 | + | |
| 158 | 155 | # Get parameters of TS map ctool |
| 159 | 156 | pars = gammalib.GApplicationPars('cttsmap.par') |
| 160 | - | |
| 157 | + | |
| 161 | 158 | # Compute total number of jobs |
| 162 | 159 | nbins = self._map.npix() |
| 163 | 160 | njobs = int(math.ceil(float(nbins) / float(self._bins_per_job)) + 0.1) |
| 164 | - | |
| 161 | + | |
| 165 | 162 | # Set parameters to be skipped now, we will deal with them later |
| 166 | 163 | skip_pars = ['binmin', 'binmax', 'logL0', 'outmap', 'logfile'] |
| 167 | - | |
| 164 | + | |
| 168 | 165 | # Set tool name for computation |
| 169 | 166 | base_command = 'cttsmap' |
| 170 | - | |
| 167 | + | |
| 171 | 168 | # Write information into logger |
| 172 | 169 | self._log_header1(gammalib.TERSE, 'Create commands') |
| 173 | 170 | self._log_value(gammalib.TERSE, 'Number of cttsmap calls', njobs) |
| 174 | - | |
| 171 | + | |
| 175 | 172 | # Loop over TS map parameters |
| 176 | 173 | for par in pars: |
| 177 | - | |
| 174 | + | |
| 178 | 175 | # Skip if we deal with them later |
| 179 | 176 | if par.name() in skip_pars: |
| 180 | 177 | continue |
| 181 | - | |
| 182 | - # Skip if they need to be queried | |
| 183 | - # This way we ensure we pass only parameters | |
| 184 | - # that were queried before | |
| 185 | - if self[par.name()].is_query(): | |
| 178 | + | |
| 179 | + # Skip if parameter was not queried | |
| 180 | + if not self[par.name()].was_queried(): | |
| 186 | 181 | continue |
| 187 | 182 | |
| 188 | 183 | # Set TS map parameter according to input from |
| 189 | 184 | # this script |
| 190 | 185 | par.value(self[par.name()].value()) |
| 191 | - | |
| 186 | + | |
| 192 | 187 | # Append command to set parameter |
| 193 | 188 | base_command += ' ' + par.name() + '=' + par.value() |
| 194 | - | |
| 189 | + | |
| 195 | 190 | # Append null hypothesis parameter |
| 196 | 191 | base_command += ' logL0=' + repr(logL0) |
| 197 | - | |
| 192 | + | |
| 198 | 193 | # Set binning to start from zero |
| 199 | 194 | binmin = 0 |
| 200 | 195 | binmax = 0 |
| 201 | - | |
| 196 | + | |
| 202 | 197 | # Clear command sequence |
| 203 | 198 | self._cmd = [] |
| 204 | - | |
| 199 | + | |
| 205 | 200 | # Loop over jobs and create commands |
| 206 | 201 | for job in range(njobs): |
| 207 | - | |
| 202 | + | |
| 208 | 203 | # Set specific outmap file name |
| 209 | 204 | outmap = self._outmap.url().replace('.fits', '_'+str(job)+'.fits') |
| 210 | - | |
| 205 | + | |
| 211 | 206 | # Set bin numbers to be computed in this job |
| 212 | 207 | binmin = binmax |
| 213 | 208 | binmax = binmin + self._bins_per_job |
| 214 | 209 | if binmax > nbins: |
| 215 | - binmax = nbins | |
| 216 | - | |
| 210 | + binmax = nbins | |
| 211 | + | |
| 217 | 212 | # Setup sliced command |
| 218 | 213 | sliced_command = '%s binmin=%s binmax=%s outmap=%s logfile=%s' % \ |
| 219 | 214 | (base_command, str(binmin), str(binmax), |
| ... | ... | @@ -225,7 +220,7 @@ class cstsmapsplit(ctools.cslikelihood): |
| 225 | 220 | |
| 226 | 221 | # Append command to list of commands |
| 227 | 222 | self._cmd.append(sliced_command) |
| 228 | - | |
| 223 | + | |
| 229 | 224 | # Write information into logger |
| 230 | 225 | if self._logExplicit(): |
| 231 | 226 | self._log('\n') |
| ... | ... | @@ -237,7 +232,7 @@ class cstsmapsplit(ctools.cslikelihood): |
| 237 | 232 | |
| 238 | 233 | # Return |
| 239 | 234 | return |
| 240 | - | |
| 235 | + | |
| 241 | 236 | def save(self): |
| 242 | 237 | """ |
| 243 | 238 | Save commands to ASCII file |
| ... | ... | @@ -247,11 +242,11 @@ class cstsmapsplit(ctools.cslikelihood): |
| 247 | 242 | |
| 248 | 243 | # Open file |
| 249 | 244 | f = open(filename, 'w') |
| 250 | - | |
| 245 | + | |
| 251 | 246 | # Write commands to file |
| 252 | 247 | for cmd in self._cmd: |
| 253 | 248 | f.write(cmd + '\n') |
| 254 | - | |
| 249 | + | |
| 255 | 250 | # Close file |
| 256 | 251 | f.close() |
| 257 | 252 | |
| ... | ... | @@ -266,9 +261,9 @@ class cstsmapsplit(ctools.cslikelihood): |
| 266 | 261 | # Main routine entry point # |
| 267 | 262 | # ======================== # |
| 268 | 263 | if __name__ == '__main__': |
| 269 | - | |
| 264 | + | |
| 270 | 265 | # Create instance of application |
| 271 | 266 | app = cstsmapsplit(sys.argv) |
| 272 | - | |
| 267 | + | |
| 273 | 268 | # Execute application |
| 274 | 269 | app.execute() | ... | ... |
doc/source/users/tutorials/howto/howto_display.rst
| ... | ... | @@ -21,25 +21,33 @@ included in the ctools package that rely on the |
| 21 | 21 | Python module. You can find these scripts in the |
| 22 | 22 | ``$CTOOLS/share/examples/python`` folder. The following scripts are available: |
| 23 | 23 | |
| 24 | - +------------------------+--------------------------------------+ | |
| 25 | - | Script | Usage | | |
| 26 | - +========================+======================================+ | |
| 27 | - | ``show_butterfly.py`` | Display a butterfly diagram | | |
| 28 | - +------------------------+--------------------------------------+ | |
| 29 | - | ``show_irf.py`` | Display Instrument Response Function | | |
| 30 | - +------------------------+--------------------------------------+ | |
| 31 | - | ``show_lightcurve.py`` | Display a light curve | | |
| 32 | - +------------------------+--------------------------------------+ | |
| 33 | - | ``show_obs.py`` | Display observation summary | | |
| 34 | - +------------------------+--------------------------------------+ | |
| 35 | - | ``show_phases.py`` | Display event phases | | |
| 36 | - +------------------------+--------------------------------------+ | |
| 37 | - | ``show_pointings.py`` | Display pointing directions | | |
| 38 | - +------------------------+--------------------------------------+ | |
| 39 | - | ``show_residuals.py`` | Display spectral residuals | | |
| 40 | - +------------------------+--------------------------------------+ | |
| 41 | - | ``show_spectrum.py`` | Display a spectrum | | |
| 42 | - +------------------------+--------------------------------------+ | |
| 24 | + +---------------------------------------+--------------------------------------+ | |
| 25 | + | Script | Usage | | |
| 26 | + +=======================================+======================================+ | |
| 27 | + | ``show_butterfly.py`` | Display butterfly diagram | | |
| 28 | + +---------------------------------------+--------------------------------------+ | |
| 29 | + | ``show_irf.py`` | Display Instrument Response Function | | |
| 30 | + +---------------------------------------+--------------------------------------+ | |
| 31 | + | ``show_lightcurve.py`` | Display light curve | | |
| 32 | + +---------------------------------------+--------------------------------------+ | |
| 33 | + | ``show_obs.py`` | Display observation summary | | |
| 34 | + +---------------------------------------+--------------------------------------+ | |
| 35 | + | ``show_pha.py`` | Display Pulse High Analyser File | | |
| 36 | + +---------------------------------------+--------------------------------------+ | |
| 37 | + | ``show_phases.py`` | Display event phases | | |
| 38 | + +---------------------------------------+--------------------------------------+ | |
| 39 | + | ``show_pointings.py`` | Display pointing directions | | |
| 40 | + +---------------------------------------+--------------------------------------+ | |
| 41 | + | ``show_residuals.py`` | Display spectral residuals | | |
| 42 | + +---------------------------------------+--------------------------------------+ | |
| 43 | + | ``show_response.py`` | Display response components | | |
| 44 | + +---------------------------------------+--------------------------------------+ | |
| 45 | + | ``show_rmf.py`` | Display Redistribution Matrix File | | |
| 46 | + +---------------------------------------+--------------------------------------+ | |
| 47 | + | ``show_significance_distribution.py`` | Display significance distribution | | |
| 48 | + +---------------------------------------+--------------------------------------+ | |
| 49 | + | ``show_spectrum.py`` | Display spectrum | | |
| 50 | + +---------------------------------------+--------------------------------------+ | |
| 43 | 51 | |
| 44 | 52 | **Do not hesitate to copy and adapt these scripts to your needs.** |
| 45 | 53 | |
| ... | ... | @@ -53,7 +61,7 @@ show_butterfly.py |
| 53 | 61 | $ $CTOOLS/share/examples/python/show_butterfly.py butterfly.txt |
| 54 | 62 | |
| 55 | 63 | .. figure:: howto_display_butterfly.png |
| 56 | - :width: 600px | |
| 64 | + :width: 500px | |
| 57 | 65 | :align: center |
| 58 | 66 | |
| 59 | 67 | *Butterfly diagram displayed with show_butterfly.py* |
| ... | ... | @@ -67,7 +75,7 @@ show_irf.py |
| 67 | 75 | $ $CTOOLS/share/examples/python/show_irf.py prod2 South_50h |
| 68 | 76 | |
| 69 | 77 | .. figure:: howto_display_irf.png |
| 70 | - :width: 800px | |
| 78 | + :width: 600px | |
| 71 | 79 | :align: center |
| 72 | 80 | |
| 73 | 81 | *Instrument Response Function displayed with show_irf.py* |
| ... | ... | @@ -81,7 +89,7 @@ show_lightcurve.py |
| 81 | 89 | $ $CTOOLS/share/examples/python/show_lightcurve.py lightcurve.fits |
| 82 | 90 | |
| 83 | 91 | .. figure:: howto_lightcurve.png |
| 84 | - :width: 600px | |
| 92 | + :width: 500px | |
| 85 | 93 | :align: center |
| 86 | 94 | |
| 87 | 95 | *Light curve displayed with show_lightcurve.py* |
| ... | ... | @@ -101,6 +109,20 @@ show_obs.py |
| 101 | 109 | *Observation summary displayed with show_obs.py* |
| 102 | 110 | |
| 103 | 111 | |
| 112 | +show_pha.py | |
| 113 | +^^^^^^^^^^^ | |
| 114 | + | |
| 115 | +.. code-block:: bash | |
| 116 | + | |
| 117 | + $ $CTOOLS/share/examples/python/show_pha.py pha.fits | |
| 118 | + | |
| 119 | +.. figure:: howto_display_pha.png | |
| 120 | + :width: 500px | |
| 121 | + :align: center | |
| 122 | + | |
| 123 | + *Pulse Hight Analyser File displayed with show_pha.py* | |
| 124 | + | |
| 125 | + | |
| 104 | 126 | show_phases.py |
| 105 | 127 | ^^^^^^^^^^^^^^ |
| 106 | 128 | |
| ... | ... | @@ -109,7 +131,7 @@ show_phases.py |
| 109 | 131 | $ $CTOOLS/share/examples/python/show_phases.py -n 50 events_phased.fits |
| 110 | 132 | |
| 111 | 133 | .. figure:: howto_display_phases.png |
| 112 | - :width: 600px | |
| 134 | + :width: 500px | |
| 113 | 135 | :align: center |
| 114 | 136 | |
| 115 | 137 | *Event phases displayed with show_phases.py* |
| ... | ... | @@ -123,7 +145,7 @@ show_pointings.py |
| 123 | 145 | $ $CTOOLS/share/examples/python/show_pointings.py obs.xml |
| 124 | 146 | |
| 125 | 147 | .. figure:: howto_display_pointings.png |
| 126 | - :width: 600px | |
| 148 | + :width: 500px | |
| 127 | 149 | :align: center |
| 128 | 150 | |
| 129 | 151 | *Pointings displayed with show_pointings.py (zoomed in)* |
| ... | ... | @@ -137,12 +159,55 @@ show_residuals.py |
| 137 | 159 | $ $CTOOLS/share/examples/python/show_residuals.py residual.fits |
| 138 | 160 | |
| 139 | 161 | .. figure:: howto_display_residuals.png |
| 140 | - :width: 600px | |
| 162 | + :width: 500px | |
| 141 | 163 | :align: center |
| 142 | 164 | |
| 143 | 165 | *Spectral residuals displayed with show_residuals.py* |
| 144 | 166 | |
| 145 | 167 | |
| 168 | +show_response.py | |
| 169 | +^^^^^^^^^^^^^^^^ | |
| 170 | + | |
| 171 | +.. code-block:: bash | |
| 172 | + | |
| 173 | + $ $CTOOLS/share/examples/python/show_response.py | |
| 174 | + | |
| 175 | +.. image:: howto_display_rsp_aeff.png | |
| 176 | + :width: 32% | |
| 177 | +.. image:: howto_display_rsp_bkg.png | |
| 178 | + :width: 32% | |
| 179 | +.. image:: howto_display_rsp_sens.png | |
| 180 | + :width: 32% | |
| 181 | + | |
| 182 | + | |
| 183 | +show_rmf.py | |
| 184 | +^^^^^^^^^^^ | |
| 185 | + | |
| 186 | +.. code-block:: bash | |
| 187 | + | |
| 188 | + $ $CTOOLS/share/examples/python/show_rmf.py rmf.fits | |
| 189 | + | |
| 190 | +.. figure:: howto_display_rmf.png | |
| 191 | + :width: 500px | |
| 192 | + :align: center | |
| 193 | + | |
| 194 | + *Redistribution Matrix File displayed with show_rmf.py* | |
| 195 | + | |
| 196 | + | |
| 197 | +show_significance_distribution.py | |
| 198 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 199 | + | |
| 200 | +.. code-block:: bash | |
| 201 | + | |
| 202 | + $ $CTOOLS/share/examples/python/show_significance_distribution.py skymap.fits --exclude skymap.fits[EXCLUSION] | |
| 203 | + | |
| 204 | +.. figure:: howto_display_significance.png | |
| 205 | + :width: 500px | |
| 206 | + :align: center | |
| 207 | + | |
| 208 | + *Significance distribution displayed with show_significance_distribution.py* | |
| 209 | + | |
| 210 | + | |
| 146 | 211 | show_spectrum.py |
| 147 | 212 | ^^^^^^^^^^^^^^^^ |
| 148 | 213 | |
| ... | ... | @@ -151,7 +216,7 @@ show_spectrum.py |
| 151 | 216 | $ $CTOOLS/share/examples/python/show_spectrum.py spectrum.fits |
| 152 | 217 | |
| 153 | 218 | .. figure:: howto_display_spectrum.png |
| 154 | - :width: 600px | |
| 219 | + :width: 500px | |
| 155 | 220 | :align: center |
| 156 | 221 | |
| 157 | 222 | *Spectrum displayed with show_spectrum.py* | ... | ... |
doc/source/users/tutorials/howto/howto_display_butterfly.png
doc/source/users/tutorials/howto/howto_display_irf.png
doc/source/users/tutorials/howto/howto_display_obs.png
doc/source/users/tutorials/howto/howto_display_pha.png
0 → 100644
44.8 KB
doc/source/users/tutorials/howto/howto_display_phases.png
doc/source/users/tutorials/howto/howto_display_pointings.png
doc/source/users/tutorials/howto/howto_display_residuals.png
doc/source/users/tutorials/howto/howto_display_rmf.png
0 → 100644
60.8 KB
doc/source/users/tutorials/howto/howto_display_rsp_aeff.png
0 → 100644
80.3 KB
doc/source/users/tutorials/howto/howto_display_rsp_bkg.png
0 → 100644
94 KB
doc/source/users/tutorials/howto/howto_display_rsp_sens.png
0 → 100644
85.6 KB
doc/source/users/tutorials/howto/howto_display_significance.png
0 → 100644
85.7 KB
doc/source/users/tutorials/howto/howto_display_spectrum.png
doc/source/users/tutorials/howto/howto_extent.rst
| ... | ... | @@ -67,29 +67,29 @@ The results can be seen in the log file and will also be written into the |
| 67 | 67 | output :ref:`model definition file <glossary_moddef>`. |
| 68 | 68 | For illustration, an excerpt of the :ref:`ctlike` log file is shown below. |
| 69 | 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. | |
| 70 | +The source is detected with a TS value of 960.3. | |
| 71 | 71 | |
| 72 | 72 | .. code-block:: none |
| 73 | 73 | |
| 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) | |
| 74 | + 2019-04-04T10:02:58: === GModelSky === | |
| 75 | + 2019-04-04T10:02:58: Name ......................: Src003 | |
| 76 | + 2019-04-04T10:02:58: Instruments ...............: all | |
| 77 | + 2019-04-04T10:02:58: Test Statistic ............: 960.322220887407 | |
| 78 | + 2019-04-04T10:02:58: Instrument scale factors ..: unity | |
| 79 | + 2019-04-04T10:02:58: Observation identifiers ...: all | |
| 80 | + 2019-04-04T10:02:58: Model type ................: ExtendedSource | |
| 81 | + 2019-04-04T10:02:58: Model components ..........: "RadialDisk" * "PowerLaw" * "Constant" | |
| 82 | + 2019-04-04T10:02:58: Number of parameters ......: 7 | |
| 83 | + 2019-04-04T10:02:58: Number of spatial par's ...: 3 | |
| 84 | + 2019-04-04T10:02:58: RA .......................: 266.317422676847 +/- 0.00715320609048925 [-360,360] deg (free,scale=1) | |
| 85 | + 2019-04-04T10:02:58: DEC ......................: -30.1850853839605 +/- 0.00616458713967605 [-90,90] deg (free,scale=1) | |
| 86 | + 2019-04-04T10:02:58: Radius ...................: 0.325736814893164 +/- 0.00480422517891009 [0.001,10] deg (free,scale=1) | |
| 87 | + 2019-04-04T10:02:58: Number of spectral par's ..: 3 | |
| 88 | + 2019-04-04T10:02:58: Prefactor ................: 5.63906592494167e-17 +/- 6.89890876156083e-18 [0,5.7e-15] ph/cm2/s/MeV (free,scale=5.7e-18,gradient) | |
| 89 | + 2019-04-04T10:02:58: Index ....................: -2.7048301145616 +/- 0.0560202225832113 [9.92,-9.92] (free,scale=-2.48,gradient) | |
| 90 | + 2019-04-04T10:02:58: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) | |
| 91 | + 2019-04-04T10:02:58: Number of temporal par's ..: 1 | |
| 92 | + 2019-04-04T10:02:58: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 93 | 93 | |
| 94 | 94 | .. warning:: |
| 95 | 95 | The parameter errors returned by :ref:`ctlike` are purely statistical. In |
| ... | ... | @@ -102,7 +102,7 @@ Now generate a residual map using :ref:`csresmap` to check the fit quality |
| 102 | 102 | .. code-block:: bash |
| 103 | 103 | |
| 104 | 104 | $ csresmap |
| 105 | - Input event list, counts cube, or observation definition XML file [cntmap.fits] cntcube.fits | |
| 105 | + Input event list, counts cube, or observation definition XML file [events.fits] cntcube.fits | |
| 106 | 106 | Input model cube file (generated with ctmodel) [NONE] |
| 107 | 107 | Input exposure cube file [NONE] expcube.fits |
| 108 | 108 | Input PSF cube file [NONE] psfcube.fits | ... | ... |
doc/source/users/tutorials/howto/howto_lightcurve.png
doc/source/users/tutorials/howto/howto_lightcurve.rst
| ... | ... | @@ -32,16 +32,16 @@ The time interval is linearly divided into 5 time bins. |
| 32 | 32 | $ cslightcrv |
| 33 | 33 | Input event list or observation definition XML file [events.fits] obs_selected.xml |
| 34 | 34 | Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_unbinned.xml |
| 35 | - Source name [Crab] Src002 | |
| 36 | 35 | Algorithm for defining time bins (FILE|LIN|GTI) [GTI] LIN |
| 37 | 36 | Lightcurve start time (UTC string, JD, MJD or MET in seconds) [MJD 51544.5] MJD 59235.5 |
| 38 | 37 | Lightcurve stop time (UTC string, JD, MJD or MET in seconds) [MJD 51544.6] MJD 59236.0 |
| 39 | 38 | Number of time bins (1-10000) [5] |
| 40 | 39 | Analysis method (3D|ONOFF) [3D] |
| 41 | - Lower energy limit of events (TeV) [0.1] 1.0 | |
| 42 | - Upper energy limit of events (TeV) [100.0] 100.0 | |
| 40 | + Source name [Crab] Src002 | |
| 41 | + Lower energy limit of events (TeV) [0.1] | |
| 42 | + Upper energy limit of events (TeV) [100.0] | |
| 43 | 43 | Number of energy bins for binned (0=unbinned for 3D analysis only) (0-100) [0] |
| 44 | - Output light curve file [lightcurve.fits] | |
| 44 | + Output light curve file [lightcurve.fits] | |
| 45 | 45 | |
| 46 | 46 | The resulting light curve is shown in the figure below. |
| 47 | 47 | ... | ... |
doc/source/users/tutorials/howto/howto_phasecurve.rst
| ... | ... | @@ -86,7 +86,7 @@ has now an associated phase value that was computed from the trigger time of |
| 86 | 86 | the event. |
| 87 | 87 | |
| 88 | 88 | .. figure:: howto_phasecurve_events.png |
| 89 | - :width: 700px | |
| 89 | + :width: 800px | |
| 90 | 90 | :align: center |
| 91 | 91 | |
| 92 | 92 | *Event list file with phase information for the Vela pulsar* |
| ... | ... | @@ -98,21 +98,26 @@ the following: |
| 98 | 98 | |
| 99 | 99 | .. code-block:: bash |
| 100 | 100 | |
| 101 | - $ ctselect | |
| 101 | + $ ctselect usepnt=no | |
| 102 | 102 | Input event list or observation definition XML file [events.fits] obs_vela_phased.xml |
| 103 | 103 | RA for ROI centre (degrees) (0-360) [83.63] 128.838 |
| 104 | 104 | Dec for ROI centre (degrees) (-90-90) [22.51] -45.178 |
| 105 | - Radius of ROI (degrees) (0-180) [3.0] 0.2 | |
| 105 | + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180) [3.0] 0.2 | |
| 106 | 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 |
| 110 | 110 | |
| 111 | +.. note:: | |
| 112 | + By default :ref:`ctselect` selects events around the pointing direction. | |
| 113 | + To select the events around a different sky direction, the hidden ``usepnt=no`` | |
| 114 | + has to be passed to the tool. | |
| 115 | + | |
| 111 | 116 | The selected events as a function of phase are displayed below. There is a |
| 112 | 117 | clear indication for a phase dependence of the event rate. |
| 113 | 118 | |
| 114 | 119 | .. figure:: howto_phasecurve_phases.png |
| 115 | - :width: 600px | |
| 120 | + :width: 500px | |
| 116 | 121 | :align: center |
| 117 | 122 | |
| 118 | 123 | *Phase histogram for events selected within 0.2 degrees of the Vela pulsar* |
| ... | ... | @@ -184,22 +189,37 @@ probability threshold to >10% by adding the attribute |
| 184 | 189 | |
| 185 | 190 | .. code-block:: bash |
| 186 | 191 | |
| 187 | - $ ctselect expr="PROB_VelaPulsar>0.1" | |
| 192 | + $ ctselect expr="PROB_VelaPulsar>0.1" usepnt=no forcesel=yes | |
| 188 | 193 | Input event list or observation definition XML file [obs_vela_phased.xml] obs_vela_phased_prob.xml |
| 189 | 194 | RA for ROI centre (degrees) (0-360) [128.838] |
| 190 | 195 | Dec for ROI centre (degrees) (-90-90) [-45.178] |
| 191 | - Radius of ROI (degrees) (0-180) [0.2] 5.0 | |
| 196 | + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180) [0.2] 5.0 | |
| 192 | 197 | Start time (UTC string, JD, MJD or MET in seconds) [NONE] |
| 193 | 198 | Lower energy limit (TeV) [0.03] |
| 194 | 199 | Upper energy limit (TeV) [160.0] |
| 195 | 200 | Output event list or observation definition XML file [obs_vela_phased_selected.xml] obs_vela_phased_prob_selected.xml |
| 196 | 201 | |
| 202 | +.. warning:: | |
| 203 | + The ``forcesel=yes`` option is required to accomodate for non-overlapping | |
| 204 | + regions of interests (ROIs). The situation is illustrated in the figure | |
| 205 | + below. Due to the large radius of 5 degrees, the ROI selection (red) does | |
| 206 | + not fully overlap with the field of view of the observations (blue), leading | |
| 207 | + to a non-circular selection region (grey). Such data cannot be used for an | |
| 208 | + unbinned maximum likelihood analysis which always requires circular selection | |
| 209 | + regions. However, for data display, as intended here, such a selection may | |
| 210 | + make sense. But you should **never** try fitting such data using :ref:`ctlike` | |
| 211 | + or any other maximum likelihood tool. | |
| 212 | + | |
| 213 | + .. figure:: howto_roi_selection.jpg | |
| 214 | + :width: 30% | |
| 215 | + :align: center | |
| 216 | + | |
| 197 | 217 | The selected events as a function of phase are displayed below. The background |
| 198 | 218 | is considerably reduced with respect to the simple radius cut that was |
| 199 | 219 | used before, and the pulsations of the Vela pulsar are now clearly visible. |
| 200 | 220 | |
| 201 | 221 | .. figure:: howto_phasecurve_probphases.png |
| 202 | - :width: 600px | |
| 222 | + :width: 500px | |
| 203 | 223 | :align: center |
| 204 | 224 | |
| 205 | 225 | *Phase histogram of events for events having a probability of >10% in originating from the Vela pulsar* |
| ... | ... | @@ -216,11 +236,11 @@ after the :ref:`ctselect` command: |
| 216 | 236 | |
| 217 | 237 | .. code-block:: bash |
| 218 | 238 | |
| 219 | - $ ctselect expr="MC_ID==91" | |
| 239 | + $ ctselect expr="MC_ID==91" usepnt=no forcesel=yes | |
| 220 | 240 | Input event list or observation definition XML file [obs_vela_phased_prob.xml] obs_vela_phased.xml |
| 221 | 241 | RA for ROI centre (degrees) (0-360) [128.838] |
| 222 | 242 | Dec for ROI centre (degrees) (-90-90) [-45.178] |
| 223 | - Radius of ROI (degrees) (0-180) [5.0] | |
| 243 | + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180) [5.0] | |
| 224 | 244 | Start time (UTC string, JD, MJD or MET in seconds) [NONE] |
| 225 | 245 | Lower energy limit (TeV) [0.03] |
| 226 | 246 | Upper energy limit (TeV) [160.0] |
| ... | ... | @@ -228,12 +248,12 @@ after the :ref:`ctselect` command: |
| 228 | 248 | |
| 229 | 249 | The resulting phase histogram is shown below. It confirms that the peaks seen |
| 230 | 250 | in the event histogram do indeed correspond to the expected peaks from the Vela |
| 231 | -pulsar. Note that the peak has an amplitude of about 460 events, while the peak | |
| 232 | -in the figures above is about 250 events, indicating that almost half of the | |
| 233 | -events have been surpressed by the radius or probability cuts. | |
| 251 | +pulsar. Note that the peak has an amplitude of about 440 events, while the peak | |
| 252 | +above background in the figures above is about 250 events, indicating that almost | |
| 253 | +half of the events were surpressed by the radius or probability cuts. | |
| 234 | 254 | |
| 235 | 255 | .. figure:: howto_phasecurve_mcid.png |
| 236 | - :width: 700px | |
| 256 | + :width: 500px | |
| 237 | 257 | :align: center |
| 238 | 258 | |
| 239 | 259 | *Distribution of Vela pulsar events as function of event phase* | ... | ... |
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
| ... | ... | @@ -50,14 +50,14 @@ |
| 50 | 50 | "name": "stdout", |
| 51 | 51 | "output_type": "stream", |
| 52 | 52 | "text": [ |
| 53 | - "env: CTADATA=/Users/jurgen/1dc\n", | |
| 54 | - "env: CALDB=/Users/jurgen/1dc/caldb\n" | |
| 53 | + "env: CTADATA=/project-data/cta/data/1dc\n", | |
| 54 | + "env: CALDB=/project-data/cta/data/1dc/caldb\n" | |
| 55 | 55 | ] |
| 56 | 56 | } |
| 57 | 57 | ], |
| 58 | 58 | "source": [ |
| 59 | - "%env CTADATA=/Users/jurgen/1dc\n", | |
| 60 | - "%env CALDB=/Users/jurgen/1dc/caldb" | |
| 59 | + "%env CTADATA=/project-data/cta/data/1dc\n", | |
| 60 | + "%env CALDB=/project-data/cta/data/1dc/caldb" | |
| 61 | 61 | ] |
| 62 | 62 | }, |
| 63 | 63 | { |
| ... | ... | @@ -138,7 +138,7 @@ |
| 138 | 138 | "binning['emin'] = 1.0\n", |
| 139 | 139 | "binning['emax'] = 100.0\n", |
| 140 | 140 | "binning['enumbins'] = 20\n", |
| 141 | - "binning['outcube'] = 'cntcube.fits'\n", | |
| 141 | + "binning['outobs'] = 'cntcube.fits'\n", | |
| 142 | 142 | "binning.execute()" |
| 143 | 143 | ] |
| 144 | 144 | }, | ... | ... |
doc/source/users/tutorials/howto/howto_roi_selection.jpg
0 → 100644
83.3 KB
doc/source/users/tutorials/howto/howto_ts.rst
| ... | ... | @@ -67,7 +67,7 @@ An excerpt of the :ref:`ctlike` log file is shown below |
| 67 | 67 | 2018-01-25T12:46:12: === GModelSky === |
| 68 | 68 | 2018-01-25T12:46:12: Name ......................: Src001 |
| 69 | 69 | 2018-01-25T12:46:12: Instruments ...............: all |
| 70 | - 2018-01-25T12:46:12: Test Statistic ............: 7659.64342272468 | |
| 70 | + 2018-01-25T12:46:12: Test Statistic ............: 7659.72844228207 | |
| 71 | 71 | |
| 72 | 72 | The Test Statistic values are also written into the |
| 73 | 73 | :ref:`model definition file <glossary_moddef>` |
| ... | ... | @@ -77,7 +77,7 @@ created by :ref:`ctlike`: |
| 77 | 77 | |
| 78 | 78 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 79 | 79 | <source_library title="source library"> |
| 80 | - <source name="Src001" type="PointSource" ts="7659.643" tscalc="1"> | |
| 80 | + <source name="Src001" type="PointSource" ts="7659.728" tscalc="1"> | |
| 81 | 81 | ... |
| 82 | 82 | </source> |
| 83 | 83 | ... | ... | ... |
doc/source/users/tutorials/howto/howto_tsmap.png
100755 → 100644
doc/source/users/tutorials/howto/howto_tsmap.rst
| ... | ... | @@ -26,10 +26,10 @@ map of size 0.5 x 0.5 degrees, centred on the Galactic Centre. |
| 26 | 26 | Input background cube file [NONE] bkgcube.fits |
| 27 | 27 | Test source name [Crab] Test |
| 28 | 28 | Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml |
| 29 | + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL | |
| 30 | + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] | |
| 29 | 31 | First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 |
| 30 | 32 | Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 |
| 31 | - Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] | |
| 32 | - Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL | |
| 33 | 33 | Image scale (in degrees/pixel) [0.02] 0.05 |
| 34 | 34 | Size of the X axis in pixels [200] 10 |
| 35 | 35 | Size of the Y axis in pixels [200] 10 |
| ... | ... | @@ -73,10 +73,10 @@ The figure below shows the resulting Test Statistic map. |
| 73 | 73 | Input PSF cube file [NONE] psfcube.fits |
| 74 | 74 | Input background cube file [NONE] bkgcube.fits |
| 75 | 75 | Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml |
| 76 | + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL | |
| 77 | + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] | |
| 76 | 78 | First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 |
| 77 | 79 | Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 |
| 78 | - Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] | |
| 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 |
| ... | ... | @@ -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=$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 & | |
| 93 | + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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 nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 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
| ... | ... | @@ -55,12 +55,12 @@ extracted from the :ref:`ctulimit` log file: |
| 55 | 55 | |
| 56 | 56 | .. code-block:: bash |
| 57 | 57 | |
| 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 | |
| 58 | + 2019-04-04T10:31:20: +=====================+ | |
| 59 | + 2019-04-04T10:31:20: | Upper limit results | | |
| 60 | + 2019-04-04T10:31:20: +=====================+ | |
| 61 | + 2019-04-04T10:31:20: Differential flux limit ...: 1.3961626479978e-20 ph/cm2/s/MeV at 1 TeV | |
| 62 | + 2019-04-04T10:31:20: Integral flux limit .......: 9.42318774389192e-15 ph/cm2/s within [1-100] TeV | |
| 63 | + 2019-04-04T10:31:20: Energy flux limit .........: 4.14922476753972e-14 erg/cm2/s within [1-100] TeV | |
| 64 | 64 | |
| 65 | 65 | .. warning:: |
| 66 | 66 | It is important to fix the spectral index of the test source in the | ... | ... |
doc/source/users/tutorials/howto/howto_vo.rst
| ... | ... | @@ -34,16 +34,16 @@ as argument after the tool name: |
| 34 | 34 | |
| 35 | 35 | $ ctskymap publish=yes |
| 36 | 36 | Input event list or observation definition XML file [events.fits] obs_selected.xml |
| 37 | + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL | |
| 38 | + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] | |
| 37 | 39 | First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 |
| 38 | 40 | Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 |
| 39 | - Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] | |
| 40 | - Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL | |
| 41 | 41 | Image scale (in degrees/pixel) [0.02] |
| 42 | 42 | Size of the X axis in pixels [200] 400 |
| 43 | 43 | Size of the Y axis in pixels [200] 400 |
| 44 | 44 | Lower energy limit (TeV) [0.1] |
| 45 | 45 | Upper energy limit (TeV) [100.0] |
| 46 | - Background subtraction method (NONE|IRF) [NONE] | |
| 46 | + Background subtraction method (NONE|IRF|RING) [NONE] | |
| 47 | 47 | Output skymap file [skymap.fits] |
| 48 | 48 | |
| 49 | 49 | Once :ref:`ctskymap` has terminated, the resulting sky map will automatically |
| ... | ... | @@ -88,12 +88,12 @@ argument after the tool name: |
| 88 | 88 | .. code-block:: bash |
| 89 | 89 | |
| 90 | 90 | $ ctselect publish=yes |
| 91 | - Input event list or observation definition XML file [selected_gps_baseline_120380.fits] | |
| 92 | - RA for ROI centre (degrees) (0-360) [UNDEFINED] | |
| 93 | - Start time (CTA MET in seconds) [UNDEFINED] | |
| 94 | - Lower energy limit (TeV) [0.2] | |
| 95 | - Upper energy limit (TeV) [50.0] | |
| 96 | - Output event list or observation definition XML file [selected_gps_baseline_120380_0.2-50TeV.fits] | |
| 91 | + Input event list or observation definition XML file [events.fits] selected_gps_baseline_110380.fits | |
| 92 | + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180) [3.0] NONE | |
| 93 | + Start time (UTC string, JD, MJD or MET in seconds) [NONE] | |
| 94 | + Lower energy limit (TeV) [0.1] 0.2 | |
| 95 | + Upper energy limit (TeV) [100.0] 50.0 | |
| 96 | + Output event list or observation definition XML file [selected_events.fits] | |
| 97 | 97 | |
| 98 | 98 | Once :ref:`ctselect` has terminated, the resulting event list will automatically |
| 99 | 99 | appear in the | ... | ... |
examples/show_obs.py
| ... | ... | @@ -108,7 +108,7 @@ def plot_information(info, ra, dec, plotfile): |
| 108 | 108 | if info['offset'].boolean() and ebounds.size() > 0: |
| 109 | 109 | ncols += 1 |
| 110 | 110 | iplot = 1 |
| 111 | - plt.figure() | |
| 111 | + plt.figure(figsize=(10,6)) | |
| 112 | 112 | plt.subplot(nrows, ncols, iplot) |
| 113 | 113 | |
| 114 | 114 | # Plot zenith angle histogram |
| ... | ... | @@ -168,6 +168,9 @@ def plot_information(info, ra, dec, plotfile): |
| 168 | 168 | plt.ylabel('Zenith Angle (deg)') |
| 169 | 169 | plt.title('Observation time') |
| 170 | 170 | |
| 171 | + # Adjust | |
| 172 | + plt.tight_layout() | |
| 173 | + | |
| 171 | 174 | # Show plots or save it into file |
| 172 | 175 | if len(plotfile) > 0: |
| 173 | 176 | plt.savefig(plotfile) | ... | ... |
src/cttsmap/cttsmap.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * cttsmap - TS map calculation tool * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2018 by Michael Mayer * | |
| 4 | + * copyright (C) 2014-2019 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -274,9 +274,14 @@ void cttsmap::run(void) |
| 274 | 274 | log_header2(EXPLICIT, "Computing TS for bin number "+gammalib::str(i)+ |
| 275 | 275 | " at "+bincentre.print()); |
| 276 | 276 | |
| 277 | + // Sets unique test source name. This avoids caching of response | |
| 278 | + // values | |
| 279 | + std::string srcname = m_srcname + "_" + gammalib::str(i); | |
| 280 | + | |
| 277 | 281 | // Add test source at current bin position |
| 278 | 282 | (*m_testsource)["RA"].value(bincentre.ra_deg()); |
| 279 | 283 | (*m_testsource)["DEC"].value(bincentre.dec_deg()); |
| 284 | + m_testsource->name(srcname); | |
| 280 | 285 | models.append(*m_testsource); |
| 281 | 286 | |
| 282 | 287 | // Assign models to observations |
| ... | ... | @@ -310,7 +315,7 @@ void cttsmap::run(void) |
| 310 | 315 | |
| 311 | 316 | // Get test source model instance |
| 312 | 317 | GModels best_fit_model = m_obs.models(); |
| 313 | - GModel* testsource = best_fit_model[m_srcname]; | |
| 318 | + GModel* testsource = best_fit_model[srcname]; | |
| 314 | 319 | |
| 315 | 320 | // Assign values to the maps |
| 316 | 321 | m_tsmap(i) = ts; |
| ... | ... | @@ -340,7 +345,7 @@ void cttsmap::run(void) |
| 340 | 345 | m_statusmap(i) = status; |
| 341 | 346 | |
| 342 | 347 | // Remove model from container |
| 343 | - models.remove(m_srcname); | |
| 348 | + models.remove(srcname); | |
| 344 | 349 | |
| 345 | 350 | } // endfor: looped over grid positions |
| 346 | 351 | |
| ... | ... | @@ -375,7 +380,7 @@ void cttsmap::save(void) |
| 375 | 380 | |
| 376 | 381 | // Get TS map filename |
| 377 | 382 | m_outmap = (*this)["outmap"].filename(); |
| 378 | - | |
| 383 | + | |
| 379 | 384 | // Create fits file |
| 380 | 385 | GFits fits; |
| 381 | 386 | |
| ... | ... | @@ -564,7 +569,7 @@ void cttsmap::get_parameters(void) |
| 564 | 569 | GSkyMap map = create_map(m_obs); |
| 565 | 570 | |
| 566 | 571 | // Check if errors should be computed |
| 567 | - m_errors = (*this)["errors"].boolean(); | |
| 572 | + m_errors = (*this)["errors"].boolean(); | |
| 568 | 573 | |
| 569 | 574 | // Initialise maps from user parameters |
| 570 | 575 | init_maps(map); |
| ... | ... | @@ -638,7 +643,7 @@ void cttsmap::init_maps(const GSkyMap& map) |
| 638 | 643 | m_mapnames.push_back("e_" + (*m_testsource)[i].name()); |
| 639 | 644 | |
| 640 | 645 | } // endif: error calculation was requested |
| 641 | - | |
| 646 | + | |
| 642 | 647 | } // endfor: looped over all model parameters |
| 643 | 648 | |
| 644 | 649 | // Return | ... | ... |
src/support/ctobservation.cpp
| ... | ... | @@ -551,11 +551,14 @@ void ctobservation::set_obs_bounds(void) |
| 551 | 551 | (*this)["dec"].real()); |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | + // Get instrument direction | |
| 555 | + GCTAInstDir instdir(dir); | |
| 556 | + | |
| 554 | 557 | // Get radius |
| 555 | 558 | double rad = (*this)["rad"].real(); |
| 556 | 559 | |
| 557 | 560 | // Set ROI |
| 558 | - GCTARoi roi(GCTAInstDir(dir), rad); | |
| 561 | + GCTARoi roi(instdir, rad); | |
| 559 | 562 | |
| 560 | 563 | // Set ROI of list |
| 561 | 564 | list->roi(roi); | ... | ... |