Commit 19ce15816035855358d6d896f7c2c9f8aa487cc0

Authored by Jürgen Knödlseder
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,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Create commands to split TS map computation 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 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -31,14 +31,14 @@ import ctools @@ -31,14 +31,14 @@ import ctools
31 class cstsmapsplit(ctools.cslikelihood): 31 class cstsmapsplit(ctools.cslikelihood):
32 """ 32 """
33 Generates commands to split TS map computation 33 Generates commands to split TS map computation
34 - 34 +
35 This class implements the creation of file containing commands to split 35 This class implements the creation of file containing commands to split
36 the computation of a TS map into several machines. It derives from 36 the computation of a TS map into several machines. It derives from
37 the ctools.cscript class which provides support for parameter files, 37 the ctools.cscript class which provides support for parameter files,
38 command line arguments, and logging. In that way the Python script 38 command line arguments, and logging. In that way the Python script
39 behaves just as a regular ctool. 39 behaves just as a regular ctool.
40 """ 40 """
41 - 41 +
42 # Consructor 42 # Consructor
43 def __init__(self, *argv): 43 def __init__(self, *argv):
44 """ 44 """
@@ -58,8 +58,8 @@ class cstsmapsplit(ctools.cslikelihood): @@ -58,8 +58,8 @@ class cstsmapsplit(ctools.cslikelihood):
58 58
59 # Return 59 # Return
60 return 60 return
61 -  
62 - 61 +
  62 +
63 # Private methods 63 # Private methods
64 def _get_parameters(self): 64 def _get_parameters(self):
65 """ 65 """
@@ -68,31 +68,31 @@ class cstsmapsplit(ctools.cslikelihood): @@ -68,31 +68,31 @@ class cstsmapsplit(ctools.cslikelihood):
68 # If there are no observations in container then get some ... 68 # If there are no observations in container then get some ...
69 if self.obs().size() == 0: 69 if self.obs().size() == 0:
70 self.obs(self._get_observations()) 70 self.obs(self._get_observations())
71 - 71 +
72 # Set models if we have none 72 # Set models if we have none
73 if self.obs().models().size() == 0: 73 if self.obs().models().size() == 0:
74 self.obs().models(self['inmodel'].filename()) 74 self.obs().models(self['inmodel'].filename())
75 - 75 +
76 # Get TS map paramters 76 # Get TS map paramters
77 self._map = self._create_map(self.obs()) 77 self._map = self._create_map(self.obs())
78 self._srcname = self['srcname'].string() 78 self._srcname = self['srcname'].string()
79 self._outmap = self['outmap'].filename() 79 self._outmap = self['outmap'].filename()
80 - 80 +
81 # Get additional parameters 81 # Get additional parameters
82 self._bins_per_job = self['bins_per_job'].integer() 82 self._bins_per_job = self['bins_per_job'].integer()
83 self._compute_null = self['compute_null'].boolean() 83 self._compute_null = self['compute_null'].boolean()
84 self._outfile = self['outfile'].filename() 84 self._outfile = self['outfile'].filename()
85 - 85 +
86 # Write input parameters into logger 86 # Write input parameters into logger
87 self._log_parameters(gammalib.TERSE) 87 self._log_parameters(gammalib.TERSE)
88 - 88 +
89 # Return 89 # Return
90 return 90 return
91 91
92 def _compute_null_hypothesis(self): 92 def _compute_null_hypothesis(self):
93 """ 93 """
94 Compute null hypothesis 94 Compute null hypothesis
95 - 95 +
96 Returns 96 Returns
97 ------- 97 -------
98 logl : float 98 logl : float
@@ -100,29 +100,26 @@ class cstsmapsplit(ctools.cslikelihood): @@ -100,29 +100,26 @@ class cstsmapsplit(ctools.cslikelihood):
100 """ 100 """
101 # Store original models 101 # Store original models
102 models_orig = self.obs().models() 102 models_orig = self.obs().models()
103 - 103 +
104 # Get models instance 104 # Get models instance
105 models0 = self.obs().models() 105 models0 = self.obs().models()
106 - 106 +
107 # Remove test source 107 # Remove test source
108 models0.remove(self._srcname) 108 models0.remove(self._srcname)
109 -  
110 - # Initialise optimizer  
111 - #opt = gammalib.GOptimizerLM()  
112 - 109 +
113 # Set models for null hypothesis 110 # Set models for null hypothesis
114 self.obs().models(models0) 111 self.obs().models(models0)
115 - 112 +
116 # Optimise observation container 113 # Optimise observation container
117 self.obs().optimize(self.opt()) 114 self.obs().optimize(self.opt())
118 - 115 +
119 # Set original models to container 116 # Set original models to container
120 self.obs().models(models_orig) 117 self.obs().models(models_orig)
121 - 118 +
122 # Return optimised log-likelihood of null hypothesis 119 # Return optimised log-likelihood of null hypothesis
123 return -(self.opt().value()) 120 return -(self.opt().value())
124 -  
125 - 121 +
  122 +
126 # Public methods 123 # Public methods
127 def run(self): 124 def run(self):
128 """ 125 """
@@ -131,89 +128,87 @@ class cstsmapsplit(ctools.cslikelihood): @@ -131,89 +128,87 @@ class cstsmapsplit(ctools.cslikelihood):
131 # Switch screen logging on in debug mode 128 # Switch screen logging on in debug mode
132 if self._logDebug(): 129 if self._logDebug():
133 self._log.cout(True) 130 self._log.cout(True)
134 - 131 +
135 # Get parameters 132 # Get parameters
136 self._get_parameters() 133 self._get_parameters()
137 - 134 +
138 # Write information into logger 135 # Write information into logger
139 self._log_header1(gammalib.TERSE, 'Test source') 136 self._log_header1(gammalib.TERSE, 'Test source')
140 self._log_string(gammalib.TERSE, str(self.obs().models()[self._srcname])) 137 self._log_string(gammalib.TERSE, str(self.obs().models()[self._srcname]))
141 - 138 +
142 # Set log-likelihood to zero 139 # Set log-likelihood to zero
143 logL0 = 0.0 140 logL0 = 0.0
144 - 141 +
145 # Pre-compute null hypothesis if requested 142 # Pre-compute null hypothesis if requested
146 if self._compute_null: 143 if self._compute_null:
147 - 144 +
148 # Write information into logger 145 # Write information into logger
149 self._log_header1(gammalib.TERSE, 'Compute null hypothesis') 146 self._log_header1(gammalib.TERSE, 'Compute null hypothesis')
150 - 147 +
151 # Compute null hypothesis 148 # Compute null hypothesis
152 logL0 = self._compute_null_hypothesis() 149 logL0 = self._compute_null_hypothesis()
153 - 150 +
154 # Write likelihood into logger 151 # Write likelihood into logger
155 self._log_value(gammalib.TERSE, 'Source removed', self._srcname) 152 self._log_value(gammalib.TERSE, 'Source removed', self._srcname)
156 self._log_value(gammalib.TERSE, 'Log-likelihood', repr(logL0)) 153 self._log_value(gammalib.TERSE, 'Log-likelihood', repr(logL0))
157 - 154 +
158 # Get parameters of TS map ctool 155 # Get parameters of TS map ctool
159 pars = gammalib.GApplicationPars('cttsmap.par') 156 pars = gammalib.GApplicationPars('cttsmap.par')
160 - 157 +
161 # Compute total number of jobs 158 # Compute total number of jobs
162 nbins = self._map.npix() 159 nbins = self._map.npix()
163 njobs = int(math.ceil(float(nbins) / float(self._bins_per_job)) + 0.1) 160 njobs = int(math.ceil(float(nbins) / float(self._bins_per_job)) + 0.1)
164 - 161 +
165 # Set parameters to be skipped now, we will deal with them later 162 # Set parameters to be skipped now, we will deal with them later
166 skip_pars = ['binmin', 'binmax', 'logL0', 'outmap', 'logfile'] 163 skip_pars = ['binmin', 'binmax', 'logL0', 'outmap', 'logfile']
167 - 164 +
168 # Set tool name for computation 165 # Set tool name for computation
169 base_command = 'cttsmap' 166 base_command = 'cttsmap'
170 - 167 +
171 # Write information into logger 168 # Write information into logger
172 self._log_header1(gammalib.TERSE, 'Create commands') 169 self._log_header1(gammalib.TERSE, 'Create commands')
173 self._log_value(gammalib.TERSE, 'Number of cttsmap calls', njobs) 170 self._log_value(gammalib.TERSE, 'Number of cttsmap calls', njobs)
174 - 171 +
175 # Loop over TS map parameters 172 # Loop over TS map parameters
176 for par in pars: 173 for par in pars:
177 - 174 +
178 # Skip if we deal with them later 175 # Skip if we deal with them later
179 if par.name() in skip_pars: 176 if par.name() in skip_pars:
180 continue 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 continue 181 continue
187 182
188 # Set TS map parameter according to input from 183 # Set TS map parameter according to input from
189 # this script 184 # this script
190 par.value(self[par.name()].value()) 185 par.value(self[par.name()].value())
191 - 186 +
192 # Append command to set parameter 187 # Append command to set parameter
193 base_command += ' ' + par.name() + '=' + par.value() 188 base_command += ' ' + par.name() + '=' + par.value()
194 - 189 +
195 # Append null hypothesis parameter 190 # Append null hypothesis parameter
196 base_command += ' logL0=' + repr(logL0) 191 base_command += ' logL0=' + repr(logL0)
197 - 192 +
198 # Set binning to start from zero 193 # Set binning to start from zero
199 binmin = 0 194 binmin = 0
200 binmax = 0 195 binmax = 0
201 - 196 +
202 # Clear command sequence 197 # Clear command sequence
203 self._cmd = [] 198 self._cmd = []
204 - 199 +
205 # Loop over jobs and create commands 200 # Loop over jobs and create commands
206 for job in range(njobs): 201 for job in range(njobs):
207 - 202 +
208 # Set specific outmap file name 203 # Set specific outmap file name
209 outmap = self._outmap.url().replace('.fits', '_'+str(job)+'.fits') 204 outmap = self._outmap.url().replace('.fits', '_'+str(job)+'.fits')
210 - 205 +
211 # Set bin numbers to be computed in this job 206 # Set bin numbers to be computed in this job
212 binmin = binmax 207 binmin = binmax
213 binmax = binmin + self._bins_per_job 208 binmax = binmin + self._bins_per_job
214 if binmax > nbins: 209 if binmax > nbins:
215 - binmax = nbins  
216 - 210 + binmax = nbins
  211 +
217 # Setup sliced command 212 # Setup sliced command
218 sliced_command = '%s binmin=%s binmax=%s outmap=%s logfile=%s' % \ 213 sliced_command = '%s binmin=%s binmax=%s outmap=%s logfile=%s' % \
219 (base_command, str(binmin), str(binmax), 214 (base_command, str(binmin), str(binmax),
@@ -225,7 +220,7 @@ class cstsmapsplit(ctools.cslikelihood): @@ -225,7 +220,7 @@ class cstsmapsplit(ctools.cslikelihood):
225 220
226 # Append command to list of commands 221 # Append command to list of commands
227 self._cmd.append(sliced_command) 222 self._cmd.append(sliced_command)
228 - 223 +
229 # Write information into logger 224 # Write information into logger
230 if self._logExplicit(): 225 if self._logExplicit():
231 self._log('\n') 226 self._log('\n')
@@ -237,7 +232,7 @@ class cstsmapsplit(ctools.cslikelihood): @@ -237,7 +232,7 @@ class cstsmapsplit(ctools.cslikelihood):
237 232
238 # Return 233 # Return
239 return 234 return
240 - 235 +
241 def save(self): 236 def save(self):
242 """ 237 """
243 Save commands to ASCII file 238 Save commands to ASCII file
@@ -247,11 +242,11 @@ class cstsmapsplit(ctools.cslikelihood): @@ -247,11 +242,11 @@ class cstsmapsplit(ctools.cslikelihood):
247 242
248 # Open file 243 # Open file
249 f = open(filename, 'w') 244 f = open(filename, 'w')
250 - 245 +
251 # Write commands to file 246 # Write commands to file
252 for cmd in self._cmd: 247 for cmd in self._cmd:
253 f.write(cmd + '\n') 248 f.write(cmd + '\n')
254 - 249 +
255 # Close file 250 # Close file
256 f.close() 251 f.close()
257 252
@@ -266,9 +261,9 @@ class cstsmapsplit(ctools.cslikelihood): @@ -266,9 +261,9 @@ class cstsmapsplit(ctools.cslikelihood):
266 # Main routine entry point # 261 # Main routine entry point #
267 # ======================== # 262 # ======================== #
268 if __name__ == '__main__': 263 if __name__ == '__main__':
269 - 264 +
270 # Create instance of application 265 # Create instance of application
271 app = cstsmapsplit(sys.argv) 266 app = cstsmapsplit(sys.argv)
272 - 267 +
273 # Execute application 268 # Execute application
274 app.execute() 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,25 +21,33 @@ included in the ctools package that rely on the
21 Python module. You can find these scripts in the 21 Python module. You can find these scripts in the
22 ``$CTOOLS/share/examples/python`` folder. The following scripts are available: 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 **Do not hesitate to copy and adapt these scripts to your needs.** 52 **Do not hesitate to copy and adapt these scripts to your needs.**
45 53
@@ -53,7 +61,7 @@ show_butterfly.py @@ -53,7 +61,7 @@ show_butterfly.py
53 $ $CTOOLS/share/examples/python/show_butterfly.py butterfly.txt 61 $ $CTOOLS/share/examples/python/show_butterfly.py butterfly.txt
54 62
55 .. figure:: howto_display_butterfly.png 63 .. figure:: howto_display_butterfly.png
56 - :width: 600px 64 + :width: 500px
57 :align: center 65 :align: center
58 66
59 *Butterfly diagram displayed with show_butterfly.py* 67 *Butterfly diagram displayed with show_butterfly.py*
@@ -67,7 +75,7 @@ show_irf.py @@ -67,7 +75,7 @@ show_irf.py
67 $ $CTOOLS/share/examples/python/show_irf.py prod2 South_50h 75 $ $CTOOLS/share/examples/python/show_irf.py prod2 South_50h
68 76
69 .. figure:: howto_display_irf.png 77 .. figure:: howto_display_irf.png
70 - :width: 800px 78 + :width: 600px
71 :align: center 79 :align: center
72 80
73 *Instrument Response Function displayed with show_irf.py* 81 *Instrument Response Function displayed with show_irf.py*
@@ -81,7 +89,7 @@ show_lightcurve.py @@ -81,7 +89,7 @@ show_lightcurve.py
81 $ $CTOOLS/share/examples/python/show_lightcurve.py lightcurve.fits 89 $ $CTOOLS/share/examples/python/show_lightcurve.py lightcurve.fits
82 90
83 .. figure:: howto_lightcurve.png 91 .. figure:: howto_lightcurve.png
84 - :width: 600px 92 + :width: 500px
85 :align: center 93 :align: center
86 94
87 *Light curve displayed with show_lightcurve.py* 95 *Light curve displayed with show_lightcurve.py*
@@ -101,6 +109,20 @@ show_obs.py @@ -101,6 +109,20 @@ show_obs.py
101 *Observation summary displayed with show_obs.py* 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 show_phases.py 126 show_phases.py
105 ^^^^^^^^^^^^^^ 127 ^^^^^^^^^^^^^^
106 128
@@ -109,7 +131,7 @@ show_phases.py @@ -109,7 +131,7 @@ show_phases.py
109 $ $CTOOLS/share/examples/python/show_phases.py -n 50 events_phased.fits 131 $ $CTOOLS/share/examples/python/show_phases.py -n 50 events_phased.fits
110 132
111 .. figure:: howto_display_phases.png 133 .. figure:: howto_display_phases.png
112 - :width: 600px 134 + :width: 500px
113 :align: center 135 :align: center
114 136
115 *Event phases displayed with show_phases.py* 137 *Event phases displayed with show_phases.py*
@@ -123,7 +145,7 @@ show_pointings.py @@ -123,7 +145,7 @@ show_pointings.py
123 $ $CTOOLS/share/examples/python/show_pointings.py obs.xml 145 $ $CTOOLS/share/examples/python/show_pointings.py obs.xml
124 146
125 .. figure:: howto_display_pointings.png 147 .. figure:: howto_display_pointings.png
126 - :width: 600px 148 + :width: 500px
127 :align: center 149 :align: center
128 150
129 *Pointings displayed with show_pointings.py (zoomed in)* 151 *Pointings displayed with show_pointings.py (zoomed in)*
@@ -137,12 +159,55 @@ show_residuals.py @@ -137,12 +159,55 @@ show_residuals.py
137 $ $CTOOLS/share/examples/python/show_residuals.py residual.fits 159 $ $CTOOLS/share/examples/python/show_residuals.py residual.fits
138 160
139 .. figure:: howto_display_residuals.png 161 .. figure:: howto_display_residuals.png
140 - :width: 600px 162 + :width: 500px
141 :align: center 163 :align: center
142 164
143 *Spectral residuals displayed with show_residuals.py* 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 show_spectrum.py 211 show_spectrum.py
147 ^^^^^^^^^^^^^^^^ 212 ^^^^^^^^^^^^^^^^
148 213
@@ -151,7 +216,7 @@ show_spectrum.py @@ -151,7 +216,7 @@ show_spectrum.py
151 $ $CTOOLS/share/examples/python/show_spectrum.py spectrum.fits 216 $ $CTOOLS/share/examples/python/show_spectrum.py spectrum.fits
152 217
153 .. figure:: howto_display_spectrum.png 218 .. figure:: howto_display_spectrum.png
154 - :width: 600px 219 + :width: 500px
155 :align: center 220 :align: center
156 221
157 *Spectrum displayed with show_spectrum.py* 222 *Spectrum displayed with show_spectrum.py*
doc/source/users/tutorials/howto/howto_display_butterfly.png

33.2 KB | W: | H:

88.9 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_display_irf.png

147 KB | W: | H:

234 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_display_obs.png

72.1 KB | W: | H:

104 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_display_pha.png 0 → 100644

44.8 KB

doc/source/users/tutorials/howto/howto_display_phases.png

18 KB | W: | H:

40.5 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_display_pointings.png

26.6 KB | W: | H:

71.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_display_residuals.png

35.4 KB | W: | H:

72.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
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

22.5 KB | W: | H:

42.5 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
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,29 +67,29 @@ The results can be seen in the log file and will also be written into the
67 output :ref:`model definition file <glossary_moddef>`. 67 output :ref:`model definition file <glossary_moddef>`.
68 For illustration, an excerpt of the :ref:`ctlike` log file is shown below. 68 For illustration, an excerpt of the :ref:`ctlike` log file is shown below.
69 The disk with of ``Src003`` has been fitted to 0.326 +/- 0.005 degrees. 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 .. code-block:: none 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 .. warning:: 94 .. warning::
95 The parameter errors returned by :ref:`ctlike` are purely statistical. In 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,7 +102,7 @@ Now generate a residual map using :ref:`csresmap` to check the fit quality
102 .. code-block:: bash 102 .. code-block:: bash
103 103
104 $ csresmap 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 Input model cube file (generated with ctmodel) [NONE] 106 Input model cube file (generated with ctmodel) [NONE]
107 Input exposure cube file [NONE] expcube.fits 107 Input exposure cube file [NONE] expcube.fits
108 Input PSF cube file [NONE] psfcube.fits 108 Input PSF cube file [NONE] psfcube.fits
doc/source/users/tutorials/howto/howto_lightcurve.png

26 KB | W: | H:

45 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_lightcurve.rst
@@ -32,16 +32,16 @@ The time interval is linearly divided into 5 time bins. @@ -32,16 +32,16 @@ The time interval is linearly divided into 5 time bins.
32 $ cslightcrv 32 $ cslightcrv
33 Input event list or observation definition XML file [events.fits] obs_selected.xml 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] $CTOOLS/share/models/1dc_howto_unbinned.xml 34 Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_unbinned.xml
35 - Source name [Crab] Src002  
36 Algorithm for defining time bins (FILE|LIN|GTI) [GTI] LIN 35 Algorithm for defining time bins (FILE|LIN|GTI) [GTI] LIN
37 Lightcurve start time (UTC string, JD, MJD or MET in seconds) [MJD 51544.5] MJD 59235.5 36 Lightcurve start time (UTC string, JD, MJD or MET in seconds) [MJD 51544.5] MJD 59235.5
38 Lightcurve stop time (UTC string, JD, MJD or MET in seconds) [MJD 51544.6] MJD 59236.0 37 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] 38 Number of time bins (1-10000) [5]
40 Analysis method (3D|ONOFF) [3D] 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 Number of energy bins for binned (0=unbinned for 3D analysis only) (0-100) [0] 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 The resulting light curve is shown in the figure below. 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,7 +86,7 @@ has now an associated phase value that was computed from the trigger time of
86 the event. 86 the event.
87 87
88 .. figure:: howto_phasecurve_events.png 88 .. figure:: howto_phasecurve_events.png
89 - :width: 700px 89 + :width: 800px
90 :align: center 90 :align: center
91 91
92 *Event list file with phase information for the Vela pulsar* 92 *Event list file with phase information for the Vela pulsar*
@@ -98,21 +98,26 @@ the following: @@ -98,21 +98,26 @@ the following:
98 98
99 .. code-block:: bash 99 .. code-block:: bash
100 100
101 - $ ctselect 101 + $ ctselect usepnt=no
102 Input event list or observation definition XML file [events.fits] obs_vela_phased.xml 102 Input event list or observation definition XML file [events.fits] obs_vela_phased.xml
103 RA for ROI centre (degrees) (0-360) [83.63] 128.838 103 RA for ROI centre (degrees) (0-360) [83.63] 128.838
104 Dec for ROI centre (degrees) (-90-90) [22.51] -45.178 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 Start time (UTC string, JD, MJD or MET in seconds) [NONE] 106 Start time (UTC string, JD, MJD or MET in seconds) [NONE]
107 Lower energy limit (TeV) [0.1] 0.03 107 Lower energy limit (TeV) [0.1] 0.03
108 Upper energy limit (TeV) [100.0] 160.0 108 Upper energy limit (TeV) [100.0] 160.0
109 Output event list or observation definition XML file [selected_events.fits] obs_vela_phased_selected.xml 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 The selected events as a function of phase are displayed below. There is a 116 The selected events as a function of phase are displayed below. There is a
112 clear indication for a phase dependence of the event rate. 117 clear indication for a phase dependence of the event rate.
113 118
114 .. figure:: howto_phasecurve_phases.png 119 .. figure:: howto_phasecurve_phases.png
115 - :width: 600px 120 + :width: 500px
116 :align: center 121 :align: center
117 122
118 *Phase histogram for events selected within 0.2 degrees of the Vela pulsar* 123 *Phase histogram for events selected within 0.2 degrees of the Vela pulsar*
@@ -184,22 +189,37 @@ probability threshold to &gt;10% by adding the attribute @@ -184,22 +189,37 @@ probability threshold to &gt;10% by adding the attribute
184 189
185 .. code-block:: bash 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 Input event list or observation definition XML file [obs_vela_phased.xml] obs_vela_phased_prob.xml 193 Input event list or observation definition XML file [obs_vela_phased.xml] obs_vela_phased_prob.xml
189 RA for ROI centre (degrees) (0-360) [128.838] 194 RA for ROI centre (degrees) (0-360) [128.838]
190 Dec for ROI centre (degrees) (-90-90) [-45.178] 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 Start time (UTC string, JD, MJD or MET in seconds) [NONE] 197 Start time (UTC string, JD, MJD or MET in seconds) [NONE]
193 Lower energy limit (TeV) [0.03] 198 Lower energy limit (TeV) [0.03]
194 Upper energy limit (TeV) [160.0] 199 Upper energy limit (TeV) [160.0]
195 Output event list or observation definition XML file [obs_vela_phased_selected.xml] obs_vela_phased_prob_selected.xml 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 The selected events as a function of phase are displayed below. The background 217 The selected events as a function of phase are displayed below. The background
198 is considerably reduced with respect to the simple radius cut that was 218 is considerably reduced with respect to the simple radius cut that was
199 used before, and the pulsations of the Vela pulsar are now clearly visible. 219 used before, and the pulsations of the Vela pulsar are now clearly visible.
200 220
201 .. figure:: howto_phasecurve_probphases.png 221 .. figure:: howto_phasecurve_probphases.png
202 - :width: 600px 222 + :width: 500px
203 :align: center 223 :align: center
204 224
205 *Phase histogram of events for events having a probability of >10% in originating from the Vela pulsar* 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,11 +236,11 @@ after the :ref:`ctselect` command:
216 236
217 .. code-block:: bash 237 .. code-block:: bash
218 238
219 - $ ctselect expr="MC_ID==91" 239 + $ ctselect expr="MC_ID==91" usepnt=no forcesel=yes
220 Input event list or observation definition XML file [obs_vela_phased_prob.xml] obs_vela_phased.xml 240 Input event list or observation definition XML file [obs_vela_phased_prob.xml] obs_vela_phased.xml
221 RA for ROI centre (degrees) (0-360) [128.838] 241 RA for ROI centre (degrees) (0-360) [128.838]
222 Dec for ROI centre (degrees) (-90-90) [-45.178] 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 Start time (UTC string, JD, MJD or MET in seconds) [NONE] 244 Start time (UTC string, JD, MJD or MET in seconds) [NONE]
225 Lower energy limit (TeV) [0.03] 245 Lower energy limit (TeV) [0.03]
226 Upper energy limit (TeV) [160.0] 246 Upper energy limit (TeV) [160.0]
@@ -228,12 +248,12 @@ after the :ref:`ctselect` command: @@ -228,12 +248,12 @@ after the :ref:`ctselect` command:
228 248
229 The resulting phase histogram is shown below. It confirms that the peaks seen 249 The resulting phase histogram is shown below. It confirms that the peaks seen
230 in the event histogram do indeed correspond to the expected peaks from the Vela 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 .. figure:: howto_phasecurve_mcid.png 255 .. figure:: howto_phasecurve_mcid.png
236 - :width: 700px 256 + :width: 500px
237 :align: center 257 :align: center
238 258
239 *Distribution of Vela pulsar events as function of event phase* 259 *Distribution of Vela pulsar events as function of event phase*
doc/source/users/tutorials/howto/howto_phasecurve_mcid.png

18.3 KB | W: | H:

45.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_phasecurve_phases.png

15 KB | W: | H:

39.8 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_phasecurve_probphases.png

18.3 KB | W: | H:

45.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb
@@ -50,14 +50,14 @@ @@ -50,14 +50,14 @@
50 "name": "stdout", 50 "name": "stdout",
51 "output_type": "stream", 51 "output_type": "stream",
52 "text": [ 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 "source": [ 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,7 +138,7 @@
138 "binning['emin'] = 1.0\n", 138 "binning['emin'] = 1.0\n",
139 "binning['emax'] = 100.0\n", 139 "binning['emax'] = 100.0\n",
140 "binning['enumbins'] = 20\n", 140 "binning['enumbins'] = 20\n",
141 - "binning['outcube'] = 'cntcube.fits'\n", 141 + "binning['outobs'] = 'cntcube.fits'\n",
142 "binning.execute()" 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,7 +67,7 @@ An excerpt of the :ref:`ctlike` log file is shown below
67 2018-01-25T12:46:12: === GModelSky === 67 2018-01-25T12:46:12: === GModelSky ===
68 2018-01-25T12:46:12: Name ......................: Src001 68 2018-01-25T12:46:12: Name ......................: Src001
69 2018-01-25T12:46:12: Instruments ...............: all 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 The Test Statistic values are also written into the 72 The Test Statistic values are also written into the
73 :ref:`model definition file <glossary_moddef>` 73 :ref:`model definition file <glossary_moddef>`
@@ -77,7 +77,7 @@ created by :ref:`ctlike`: @@ -77,7 +77,7 @@ created by :ref:`ctlike`:
77 77
78 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 78 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
79 <source_library title="source library"> 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 </source> 82 </source>
83 ... 83 ...
doc/source/users/tutorials/howto/howto_tsmap.png 100755 → 100644

24 KB | W: | H:

20.6 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
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,10 +26,10 @@ map of size 0.5 x 0.5 degrees, centred on the Galactic Centre.
26 Input background cube file [NONE] bkgcube.fits 26 Input background cube file [NONE] bkgcube.fits
27 Test source name [Crab] Test 27 Test source name [Crab] Test
28 Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml 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 First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 31 First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0
30 Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 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 Image scale (in degrees/pixel) [0.02] 0.05 33 Image scale (in degrees/pixel) [0.02] 0.05
34 Size of the X axis in pixels [200] 10 34 Size of the X axis in pixels [200] 10
35 Size of the Y axis in pixels [200] 10 35 Size of the Y axis in pixels [200] 10
@@ -73,10 +73,10 @@ The figure below shows the resulting Test Statistic map. @@ -73,10 +73,10 @@ The figure below shows the resulting Test Statistic map.
73 Input PSF cube file [NONE] psfcube.fits 73 Input PSF cube file [NONE] psfcube.fits
74 Input background cube file [NONE] bkgcube.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 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 First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 78 First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0
77 Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 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 Image scale (in degrees/pixel) [0.02] 0.05 80 Image scale (in degrees/pixel) [0.02] 0.05
81 Size of the X axis in pixels [200] 10 81 Size of the X axis in pixels [200] 10
82 Size of the Y axis in pixels [200] 10 82 Size of the Y axis in pixels [200] 10
@@ -90,16 +90,16 @@ The figure below shows the resulting Test Statistic map. @@ -90,16 +90,16 @@ The figure below shows the resulting Test Statistic map.
90 90
91 .. code-block:: bash 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 Now run the ASCII file by typing 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,12 +55,12 @@ extracted from the :ref:`ctulimit` log file:
55 55
56 .. code-block:: bash 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 .. warning:: 65 .. warning::
66 It is important to fix the spectral index of the test source in the 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,16 +34,16 @@ as argument after the tool name:
34 34
35 $ ctskymap publish=yes 35 $ ctskymap publish=yes
36 Input event list or observation definition XML file [events.fits] obs_selected.xml 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 First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 39 First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0
38 Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 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 Image scale (in degrees/pixel) [0.02] 41 Image scale (in degrees/pixel) [0.02]
42 Size of the X axis in pixels [200] 400 42 Size of the X axis in pixels [200] 400
43 Size of the Y axis in pixels [200] 400 43 Size of the Y axis in pixels [200] 400
44 Lower energy limit (TeV) [0.1] 44 Lower energy limit (TeV) [0.1]
45 Upper energy limit (TeV) [100.0] 45 Upper energy limit (TeV) [100.0]
46 - Background subtraction method (NONE|IRF) [NONE] 46 + Background subtraction method (NONE|IRF|RING) [NONE]
47 Output skymap file [skymap.fits] 47 Output skymap file [skymap.fits]
48 48
49 Once :ref:`ctskymap` has terminated, the resulting sky map will automatically 49 Once :ref:`ctskymap` has terminated, the resulting sky map will automatically
@@ -88,12 +88,12 @@ argument after the tool name: @@ -88,12 +88,12 @@ argument after the tool name:
88 .. code-block:: bash 88 .. code-block:: bash
89 89
90 $ ctselect publish=yes 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 Once :ref:`ctselect` has terminated, the resulting event list will automatically 98 Once :ref:`ctselect` has terminated, the resulting event list will automatically
99 appear in the 99 appear in the
examples/show_obs.py
@@ -108,7 +108,7 @@ def plot_information(info, ra, dec, plotfile): @@ -108,7 +108,7 @@ def plot_information(info, ra, dec, plotfile):
108 if info['offset'].boolean() and ebounds.size() > 0: 108 if info['offset'].boolean() and ebounds.size() > 0:
109 ncols += 1 109 ncols += 1
110 iplot = 1 110 iplot = 1
111 - plt.figure() 111 + plt.figure(figsize=(10,6))
112 plt.subplot(nrows, ncols, iplot) 112 plt.subplot(nrows, ncols, iplot)
113 113
114 # Plot zenith angle histogram 114 # Plot zenith angle histogram
@@ -168,6 +168,9 @@ def plot_information(info, ra, dec, plotfile): @@ -168,6 +168,9 @@ def plot_information(info, ra, dec, plotfile):
168 plt.ylabel('Zenith Angle (deg)') 168 plt.ylabel('Zenith Angle (deg)')
169 plt.title('Observation time') 169 plt.title('Observation time')
170 170
  171 + # Adjust
  172 + plt.tight_layout()
  173 +
171 # Show plots or save it into file 174 # Show plots or save it into file
172 if len(plotfile) > 0: 175 if len(plotfile) > 0:
173 plt.savefig(plotfile) 176 plt.savefig(plotfile)
src/cttsmap/cttsmap.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * cttsmap - TS map calculation tool * 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 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -274,9 +274,14 @@ void cttsmap::run(void) @@ -274,9 +274,14 @@ void cttsmap::run(void)
274 log_header2(EXPLICIT, "Computing TS for bin number "+gammalib::str(i)+ 274 log_header2(EXPLICIT, "Computing TS for bin number "+gammalib::str(i)+
275 " at "+bincentre.print()); 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 // Add test source at current bin position 281 // Add test source at current bin position
278 (*m_testsource)["RA"].value(bincentre.ra_deg()); 282 (*m_testsource)["RA"].value(bincentre.ra_deg());
279 (*m_testsource)["DEC"].value(bincentre.dec_deg()); 283 (*m_testsource)["DEC"].value(bincentre.dec_deg());
  284 + m_testsource->name(srcname);
280 models.append(*m_testsource); 285 models.append(*m_testsource);
281 286
282 // Assign models to observations 287 // Assign models to observations
@@ -310,7 +315,7 @@ void cttsmap::run(void) @@ -310,7 +315,7 @@ void cttsmap::run(void)
310 315
311 // Get test source model instance 316 // Get test source model instance
312 GModels best_fit_model = m_obs.models(); 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 // Assign values to the maps 320 // Assign values to the maps
316 m_tsmap(i) = ts; 321 m_tsmap(i) = ts;
@@ -340,7 +345,7 @@ void cttsmap::run(void) @@ -340,7 +345,7 @@ void cttsmap::run(void)
340 m_statusmap(i) = status; 345 m_statusmap(i) = status;
341 346
342 // Remove model from container 347 // Remove model from container
343 - models.remove(m_srcname); 348 + models.remove(srcname);
344 349
345 } // endfor: looped over grid positions 350 } // endfor: looped over grid positions
346 351
@@ -375,7 +380,7 @@ void cttsmap::save(void) @@ -375,7 +380,7 @@ void cttsmap::save(void)
375 380
376 // Get TS map filename 381 // Get TS map filename
377 m_outmap = (*this)["outmap"].filename(); 382 m_outmap = (*this)["outmap"].filename();
378 - 383 +
379 // Create fits file 384 // Create fits file
380 GFits fits; 385 GFits fits;
381 386
@@ -564,7 +569,7 @@ void cttsmap::get_parameters(void) @@ -564,7 +569,7 @@ void cttsmap::get_parameters(void)
564 GSkyMap map = create_map(m_obs); 569 GSkyMap map = create_map(m_obs);
565 570
566 // Check if errors should be computed 571 // Check if errors should be computed
567 - m_errors = (*this)["errors"].boolean(); 572 + m_errors = (*this)["errors"].boolean();
568 573
569 // Initialise maps from user parameters 574 // Initialise maps from user parameters
570 init_maps(map); 575 init_maps(map);
@@ -638,7 +643,7 @@ void cttsmap::init_maps(const GSkyMap&amp; map) @@ -638,7 +643,7 @@ void cttsmap::init_maps(const GSkyMap&amp; map)
638 m_mapnames.push_back("e_" + (*m_testsource)[i].name()); 643 m_mapnames.push_back("e_" + (*m_testsource)[i].name());
639 644
640 } // endif: error calculation was requested 645 } // endif: error calculation was requested
641 - 646 +
642 } // endfor: looped over all model parameters 647 } // endfor: looped over all model parameters
643 648
644 // Return 649 // Return
src/support/ctobservation.cpp
@@ -551,11 +551,14 @@ void ctobservation::set_obs_bounds(void) @@ -551,11 +551,14 @@ void ctobservation::set_obs_bounds(void)
551 (*this)["dec"].real()); 551 (*this)["dec"].real());
552 } 552 }
553 553
  554 + // Get instrument direction
  555 + GCTAInstDir instdir(dir);
  556 +
554 // Get radius 557 // Get radius
555 double rad = (*this)["rad"].real(); 558 double rad = (*this)["rad"].real();
556 559
557 // Set ROI 560 // Set ROI
558 - GCTARoi roi(GCTAInstDir(dir), rad); 561 + GCTARoi roi(instdir, rad);
559 562
560 // Set ROI of list 563 // Set ROI of list
561 list->roi(roi); 564 list->roi(roi);