Commit 734b34828efb2718e8b6dd34633bb9b779f222c3

Authored by Jürgen Knödlseder
1 parent 83951372

Add "statistic" parameter to all likelihood scripts (#2237)

The scripts cslightcrv, csphasecrv, cspull, cssens, csspec, cstsdist, and cstsmapsplit now have a "statistics" parameter to allow setting of the optimizer statistic. Except of cstsmapsplit, all of the scripts now derive from the cslikelihood base class.
ChangeLog
1   -2017-10-21
  1 +2017-10-22
2 2  
3 3 * Version 1.5.0 released
4 4 ========================
5 5  
6   - Add "statistic" parameter to all likelihood tools (#2237)
  6 + Add "statistic" parameter to all likelihood tools and scripts (#2237)
7 7 Rename ctlike "stat" parameter to "statistic" (#2237)
8 8 Enable handling of On/Off observations in csspec (#2231)
9 9 Add csphagen script (#2208)
... ...
... ... @@ -164,6 +164,10 @@ None
164 164  
165 165 cslightcrv - Generate light curve
166 166 ---------------------------------
  167 +The script now derived from the cslikelihood base class. A "statistic"
  168 +parameter was added to allow setting the optimizer statistic for the light
  169 +curve generation (#2237).
  170 +
167 171 Use t-type parameters for "tmin" and "tmax" to all specifying times in various
168 172 formats (#1864).
169 173  
... ... @@ -185,8 +189,8 @@ None
185 189  
186 190 csmodelsois - Puts selected sources in diffuse model cube
187 191 ---------------------------------------------------------
188   -Add csmodelsois script that replaces selected models in a model container by
189   -a diffuse map cube (#2180).
  192 +Add script that replaces selected models in a model container by a diffuse
  193 +map cube (#2180).
190 194  
191 195  
192 196 csobs2caldb - Generate calibration database entry for an IACT observation
... ... @@ -211,17 +215,22 @@ None
211 215  
212 216 csphagen - Generate On/Off observations
213 217 ---------------------------------------
214   -The script csphagen was added to allow the generation of PHA, ARF and RMF datasets
215   -for classical On/Off IACT analysis (#2208).
  218 +The script was added to allow the generation of PHA, ARF and RMF datasets for classical On/Off IACT analysis (#2208).
216 219  
217 220  
218 221 csphasecrv - Generate phase curve
219 222 ---------------------------------
220   -None
  223 +The script now derived from the cslikelihood base class. A "statistic"
  224 +parameter was added to allow setting the optimizer statistic for the light
  225 +curve generation (#2237).
221 226  
222 227  
223 228 cspull - Generate pull distributions
224 229 ------------------------------------
  230 +The script now derived from the cslikelihood base class. A "statistic"
  231 +parameter was added to allow setting the optimizer statistic for the pull
  232 +distribution generation (#2237).
  233 +
225 234 Use t-type parameters for "tmin" and "tmax" to all specifying times in various
226 235 formats (#1864).
227 236  
... ... @@ -238,18 +247,20 @@ None
238 247  
239 248 cssens - Computes sensitivity curve
240 249 -----------------------------------
241   -None
  250 +The script now derived from the cslikelihood base class. A "statistic"
  251 +parameter was added to allow setting the optimizer statistic for the sensitivity
  252 +computation (#2237).
242 253  
243 254  
244 255 csspec - Generates Spectral Energy Distribution
245 256 -----------------------------------------------
246   -The csspec script now derived from the cslikelihood base class. A "statistic"
  257 +The script now derived from the cslikelihood base class. A "statistic"
247 258 parameter was added to allow setting the optimizer statistic for the spectrum
248 259 generation (#2237).
249 260  
250   -The csspec script now can also handle On/Off spectra for SED generation (#2231).
  261 +The script now can also handle On/Off spectra for SED generation (#2231).
251 262  
252   -The csspec script now can also handle non-CTA data. For that purpose a "method"
  263 +The script now can also handle non-CTA data. For that purpose a "method"
253 264 parameter has been introduced that allows to selected between slicing of the data
254 265 (method="SLICE"), which is only supported for CTA observations, and replacing of
255 266 the spectral model by a node function (method="NODES"). If method="AUTO" the tool
... ... @@ -264,6 +275,10 @@ None
264 275  
265 276 cstsdist - Computes Test Statistic distribution
266 277 -----------------------------------------------
  278 +The script now derived from the cslikelihood base class. A "statistic"
  279 +parameter was added to allow setting the optimizer statistic for the Test
  280 +Statistic distribution generation (#2237).
  281 +
267 282 Use t-type parameters for "tmin" and "tmax" to all specifying times in various
268 283 formats (#1864).
269 284  
... ... @@ -275,7 +290,8 @@ None
275 290  
276 291 cstsmapsplit - Prepare split Test Statistic computation
277 292 -------------------------------------------------------
278   -None
  293 +A "statistic" parameter was added to allow setting the optimizer statistic for
  294 +the TS map generation (#2237).
279 295  
280 296  
281 297 csviscube - Generate visibility cube
... ...
cscripts/cslightcrv.par
... ... @@ -42,6 +42,7 @@ yref, r, a, 22.01,-90,90, "Second coordinate of image center in degrees (DE
42 42 nxpix, i, a, 200,,, "Size of the X axis in pixels"
43 43 nypix, i, a, 200,,, "Size of the Y axis in pixels"
44 44 binsz, r, a, 0.02,,, "Pixel size (deg/pixel)"
  45 +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
45 46 calc_ts, b, h, yes,,, "Compute TS value for each bin?"
46 47 calc_ulim, b, h, yes,,, "Compute upper limit for each bin?"
47 48 fix_srcs, b, h, yes,,, "Fix other sky model parameters?"
... ...
cscripts/cslightcrv.py
... ... @@ -28,7 +28,7 @@ from cscripts import ioutils
28 28 # ================ #
29 29 # cslightcrv class #
30 30 # ================ #
31   -class cslightcrv(ctools.cscript):
  31 +class cslightcrv(ctools.cslikelihood):
32 32 """
33 33 Generates a lightcurve
34 34  
... ... @@ -68,9 +68,8 @@ class cslightcrv(ctools.cscript):
68 68 """
69 69 Constructor
70 70 """
71   - # Set name
72   - self._name = 'cslightcrv'
73   - self._version = ctools.__version__
  71 + # Initialise application by calling the appropriate class constructor
  72 + self._init_cslikelihood('cslightcrv', ctools.__version__, argv)
74 73  
75 74 # Initialise some members
76 75 self._srcname = ''
... ... @@ -78,12 +77,6 @@ class cslightcrv(ctools.cscript):
78 77 self._stacked = False
79 78 self._fits = gammalib.GFits()
80 79  
81   - # Initialise observation container from constructor arguments.
82   - self._obs, argv = self._set_input_obs(argv)
83   -
84   - # Initialise script by calling the appropriate class constructor.
85   - self._init_cscript(argv)
86   -
87 80 # Return
88 81 return
89 82  
... ... @@ -95,11 +88,14 @@ class cslightcrv(ctools.cscript):
95 88 """
96 89 # Setup observations (require response and allow event list, don't
97 90 # allow counts cube)
98   - self._setup_observations(self._obs, True, True, False)
  91 + self._setup_observations(self.obs(), True, True, False)
  92 +
  93 + # Set observation statistic
  94 + self._set_obs_statistic(gammalib.toupper(self['statistic'].string()))
99 95  
100 96 # Set models if there are none in the container
101   - if self._obs.models().size() == 0:
102   - self._obs.models(self['inmodel'].filename())
  97 + if self.obs().models().size() == 0:
  98 + self.obs().models(self['inmodel'].filename())
103 99  
104 100 # Get source name
105 101 self._srcname = self['srcname'].string()
... ... @@ -188,7 +184,7 @@ class cslightcrv(ctools.cscript):
188 184 elif algorithm == 'GTI':
189 185  
190 186 # Append the GTIs of all observations
191   - for obs in self._obs:
  187 + for obs in self.obs():
192 188 for i in range(obs.events().gti().size()):
193 189 gti.append(obs.events().gti().tstart(i),
194 190 obs.events().gti().tstop(i))
... ... @@ -209,7 +205,7 @@ class cslightcrv(ctools.cscript):
209 205 names = []
210 206  
211 207 # Collect list of free parameter names
212   - for par in self._obs.models()[self._srcname]:
  208 + for par in self.obs().models()[self._srcname]:
213 209 if par.is_free():
214 210 names.append(par.name())
215 211  
... ... @@ -221,12 +217,10 @@ class cslightcrv(ctools.cscript):
221 217 Adjust model parameters dependent on user parameters
222 218 """
223 219 # Write header
224   - if self._logTerse():
225   - self._log('\n')
226   - self._log.header1('Adjust model parameters')
  220 + self._log_header1(gammalib.TERSE, 'Adjust model parameters')
227 221  
228 222 # Adjust model parameters dependent on input user parameters
229   - for model in self._obs.models():
  223 + for model in self.obs().models():
230 224  
231 225 # Set TS flag for all models to false. The source of interest will
232 226 # be set to true later
... ... @@ -237,8 +231,7 @@ class cslightcrv(ctools.cscript):
237 231 classname = model.classname()
238 232  
239 233 # Log model name
240   - if self._logNormal():
241   - self._log.header3(model.name())
  234 + self._log_header3(gammalib.NORMAL, model.name())
242 235  
243 236 # If the model is the source of interest and the 'calc_ts' parameter
244 237 # is true then enable the TS computation for the source
... ... @@ -254,9 +247,7 @@ class cslightcrv(ctools.cscript):
254 247 for par in model:
255 248 if par.is_free():
256 249 par.fix()
257   - if self._logNormal():
258   - self._log(gammalib.parformat(par.name()))
259   - self._log('fixed\n')
  250 + self._log_value(gammalib.NORMAL, par.name(), 'fixed')
260 251  
261 252 # Return
262 253 return
... ... @@ -287,7 +278,8 @@ class cslightcrv(ctools.cscript):
287 278 ioutils.append_result_column(table, results, 'e_MJD', 'days', 'e_mjd')
288 279  
289 280 # Append parameter columns
290   - ioutils.append_model_par_column(table, self._obs.models()[self._srcname],
  281 + ioutils.append_model_par_column(table,
  282 + self.obs().models()[self._srcname],
291 283 results)
292 284  
293 285 # Append Test Statistic column "TS"
... ... @@ -327,8 +319,7 @@ class cslightcrv(ctools.cscript):
327 319 if self['calc_ulim'].boolean():
328 320  
329 321 # Write header in logger
330   - if self._logExplicit():
331   - self._log.header3('Computing upper limit')
  322 + self._log_header3(gammalib.EXPLICIT, 'Computing upper limit')
332 323  
333 324 # Create copy of observations
334 325 cpy_obs = obs.copy()
... ... @@ -358,8 +349,7 @@ class cslightcrv(ctools.cscript):
358 349 ul_flux = ulimit.flux_ulimit()
359 350 ul_eflux = ulimit.eflux_ulimit()
360 351 except:
361   - if self._logTerse():
362   - self._log('Upper limit calculation failed.\n')
  352 + self._log_string(gammalib.TERSE, 'Upper limit calculation failed.')
363 353 ul_diff = -1.0
364 354 ul_flux = -1.0
365 355 ul_eflux = -1.0
... ... @@ -414,14 +404,14 @@ class cslightcrv(ctools.cscript):
414 404 self._get_parameters()
415 405  
416 406 # Write observation into logger
417   - self._log_observations(gammalib.NORMAL, self._obs, 'Observation')
  407 + self._log_observations(gammalib.NORMAL, self.obs(), 'Observation')
418 408  
419 409 # Get time boundaries
420 410 tmin = self._tbins.tstart(0)
421 411 tmax = self._tbins.tstop(self._tbins.size()-1)
422 412  
423 413 # Select events
424   - select = ctools.ctselect(self._obs)
  414 + select = ctools.ctselect(self.obs())
425 415 select['emin'] = self['emin'].real()
426 416 select['emax'] = self['emax'].real()
427 417 select['tmin'] = tmin.convert(self._time_reference())
... ... @@ -432,22 +422,18 @@ class cslightcrv(ctools.cscript):
432 422 select.run()
433 423  
434 424 # Extract observations
435   - self._obs = select.obs().copy()
  425 + self.obs(select.obs().copy())
436 426  
437 427 # Write observation into logger
438   - if self._logTerse():
439   - self._log('\n')
440   - self._log.header1(gammalib.number('Selected observation',len(self._obs)))
441   - self._log(str(self._obs))
442   - self._log('\n')
  428 + self._log_header1(gammalib.TERSE,
  429 + gammalib.number('Selected observation',
  430 + len(self.obs())))
443 431  
444 432 # Adjust model parameters dependent on user parameters
445 433 self._adjust_model_pars()
446 434  
447 435 # Write header
448   - if self._logTerse():
449   - self._log('\n')
450   - self._log.header1('Generate lightcurve')
  436 + self._log_header1(gammalib.TERSE, 'Generate lightcurve')
451 437  
452 438 # Initialise list of result dictionaries
453 439 results = []
... ... @@ -463,8 +449,8 @@ class cslightcrv(ctools.cscript):
463 449 tmax = self._tbins.tstop(i)
464 450  
465 451 # Write time bin into header
466   - if self._logTerse():
467   - self._log.header2('MJD '+str(tmin.mjd())+'-'+str(tmax.mjd()))
  452 + self._log_header2(gammalib.TERSE, 'MJD %f - %f ' %
  453 + (tmin.mjd(), tmax.mjd()))
468 454  
469 455 # Compute time bin center and time width
470 456 twidth = 0.5 * (tmax - tmin) # in seconds
... ... @@ -481,11 +467,10 @@ class cslightcrv(ctools.cscript):
481 467 'values': {}}
482 468  
483 469 # Log information
484   - if self._logExplicit():
485   - self._log.header3('Selecting events')
  470 + self._log_header3(gammalib.EXPLICIT, 'Selecting events')
486 471  
487 472 # Select events
488   - select = ctools.ctselect(self._obs)
  473 + select = ctools.ctselect(self.obs())
489 474 select['emin'] = self['emin'].real()
490 475 select['emax'] = self['emax'].real()
491 476 select['tmin'] = tmin.convert(self._time_reference())
... ... @@ -505,8 +490,7 @@ class cslightcrv(ctools.cscript):
505 490 obs = self._bin_observation(obs)
506 491  
507 492 # Header
508   - if self._logExplicit():
509   - self._log.header3('Fitting the data')
  493 + self._log_header3(gammalib.EXPLICIT, 'Fitting the data')
510 494  
511 495 # Do maximum likelihood model fitting
512 496 like = ctools.ctlike(obs)
... ... @@ -626,7 +610,7 @@ class cslightcrv(ctools.cscript):
626 610  
627 611 # Set default name is user name is empty
628 612 if not name:
629   - user_name = self._name
  613 + user_name = self._name()
630 614 else:
631 615 user_name = name
632 616  
... ... @@ -661,7 +645,7 @@ class cslightcrv(ctools.cscript):
661 645 Set model container
662 646 """
663 647 # Copy models
664   - self._obs.models(models)
  648 + self.obs().models(models)
665 649  
666 650 # Return
667 651 return
... ...
cscripts/csphasecrv.par
... ... @@ -40,6 +40,7 @@ yref, r, a, 22.01,-90,90, "Second coordinate of image center in degrees (DE
40 40 nxpix, i, a, 200,,, "Size of the X axis in pixels"
41 41 nypix, i, a, 200,,, "Size of the Y axis in pixels"
42 42 binsz, r, a, 0.02,,, "Pixel size (deg/pixel)"
  43 +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
43 44  
44 45 #
45 46 # Standard parameters
... ...
cscripts/csphasecrv.py
... ... @@ -28,7 +28,7 @@ from cscripts import ioutils
28 28 # ================ #
29 29 # csphasecrv class #
30 30 # ================ #
31   -class csphasecrv(ctools.cscript):
  31 +class csphasecrv(ctools.cslikelihood):
32 32 """
33 33 Generates spectra in phase bins
34 34  
... ... @@ -56,9 +56,8 @@ class csphasecrv(ctools.cscript):
56 56 """
57 57 Constructor
58 58 """
59   - # Set name
60   - self._name = 'csphasecrv'
61   - self._version = ctools.__version__
  59 + # Initialise application by calling the appropriate class constructor
  60 + self._init_cslikelihood('csphasecrv', ctools.__version__, argv)
62 61  
63 62 # Initialise some members. Phases are stored in a nested list
64 63 # [[ph1min,ph1max], [ph2min,ph2max],..]
... ... @@ -68,12 +67,6 @@ class csphasecrv(ctools.cscript):
68 67 self._fits = gammalib.GFits()
69 68 self._fitmodels = {}
70 69  
71   - # Initialise observation container from constructor arguments.
72   - self._obs, argv = self._set_input_obs(argv)
73   -
74   - # Initialise script by calling the appropriate class constructor.
75   - self._init_cscript(argv)
76   -
77 70 # Return
78 71 return
79 72  
... ... @@ -84,11 +77,14 @@ class csphasecrv(ctools.cscript):
84 77 """
85 78 # Setup observations (require response and allow event list, don't
86 79 # allow counts cube)
87   - self._setup_observations(self._obs, True, True, False)
  80 + self._setup_observations(self.obs(), True, True, False)
  81 +
  82 + # Set observation statistic
  83 + self._set_obs_statistic(gammalib.toupper(self['statistic'].string()))
88 84  
89 85 # Set models if there are none in the container
90   - if self._obs.models().size() == 0:
91   - self._obs.models(self['inmodel'].filename())
  86 + if self.obs().models().size() == 0:
  87 + self.obs().models(self['inmodel'].filename())
92 88  
93 89 # Get source name
94 90 self._srcname = self['srcname'].string()
... ... @@ -101,7 +97,7 @@ class csphasecrv(ctools.cscript):
101 97  
102 98 # Query the hidden parameters, just in case
103 99 self['edisp'].boolean()
104   -
  100 +
105 101 # Read ahead output parameters
106 102 if self._read_ahead():
107 103 self['outfile'].filename()
... ... @@ -176,7 +172,7 @@ class csphasecrv(ctools.cscript):
176 172 names = []
177 173  
178 174 # Collect list of free parameter names
179   - for par in self._obs.models()[self._srcname]:
  175 + for par in self.obs().models()[self._srcname]:
180 176 if par.is_free():
181 177 names.append(par.name())
182 178  
... ... @@ -209,7 +205,7 @@ class csphasecrv(ctools.cscript):
209 205 ioutils.append_result_column(table, results, 'PHASE_MAX', '', 'phmax')
210 206  
211 207 # Append parameter columns
212   - ioutils.append_model_par_column(table, self._obs.models()[self._srcname],
  208 + ioutils.append_model_par_column(table, self.obs().models()[self._srcname],
213 209 results)
214 210  
215 211 # Return table
... ... @@ -323,10 +319,10 @@ class csphasecrv(ctools.cscript):
323 319 self._get_parameters()
324 320  
325 321 # Write observation into logger
326   - self._log_observations(gammalib.NORMAL, self._obs, 'Observation')
  322 + self._log_observations(gammalib.NORMAL, self.obs(), 'Observation')
327 323  
328 324 # Store and clear observations to split them into phase bins
329   - orig_obs = self._obs.copy()
  325 + orig_obs = self.obs().copy()
330 326  
331 327 # Dictionary to save phase fitted models
332 328 self._fitmodels = {}
... ... @@ -338,8 +334,8 @@ class csphasecrv(ctools.cscript):
338 334 for phbin in self._phbins:
339 335  
340 336 # Write time bin into header
341   - if self._logTerse():
342   - self._log.header2('PHASE '+str(phbin[0])+'-'+str(phbin[1]))
  337 + self._log_header2(gammalib.TERSE, 'PHASE %f - %f' %
  338 + (phbin[0], phbin[1]))
343 339  
344 340 # Select events
345 341 select = ctools.ctselect(orig_obs)
... ... @@ -363,12 +359,10 @@ class csphasecrv(ctools.cscript):
363 359 # and compute the stacked response functions and setup
364 360 # an observation container with a single stacked observation.
365 361 if self._stacked:
366   - #obs = self._bin_observation(select.obs())
367 362 obs = obsutils.get_stacked_obs(self, select.obs())
368 363  
369 364 # Header
370   - if self._logExplicit():
371   - self._log.header3('Fitting the data')
  365 + self._log_header3(gammalib.EXPLICIT, 'Fitting the data')
372 366  
373 367 # Do maximum likelihood model fitting
374 368 like = ctools.ctlike(obs)
... ... @@ -378,11 +372,12 @@ class csphasecrv(ctools.cscript):
378 372 # Renormalize models to phase selection
379 373 # TODO move the scaling from the temporal to the spectral component
380 374 for model in like.obs().models():
381   - scaled_norm = model['Normalization'].value()/(phbin[1] - phbin[0])
  375 + scaled_norm = model['Normalization'].value()/(phbin[1]-phbin[0])
382 376 model['Normalization'].value(scaled_norm)
383 377  
384 378 # Store fit model
385   - self._fitmodels[str(phbin[0])+'-'+str(phbin[1])] = like.obs().models().copy()
  379 + self._fitmodels[str(phbin[0])+'-'+str(phbin[1])] = \
  380 + like.obs().models().copy()
386 381  
387 382 # Create FITS file
388 383 self._create_fits()
... ... @@ -424,7 +419,7 @@ class csphasecrv(ctools.cscript):
424 419  
425 420 # Set default name is user name is empty
426 421 if not name:
427   - user_name = self._name
  422 + user_name = self._name()
428 423 else:
429 424 user_name = name
430 425  
... ...
cscripts/cspull.par
... ... @@ -27,21 +27,22 @@ outfile, f, a, pull.dat,,, "Output pull distribution file"
27 27 #
28 28 # Script parameters
29 29 #==================
30   -ntrials, i, a, 10,,, "Number of trials"
31   -ra, r, a, 83.6331,0,360, "RA of pointing (degrees)"
32   -dec, r, a, 22.0145,-90,90, "Dec of pointing (degrees)"
33   -rad, r, h, 5.0,0,180, "Radius of ROI (degrees)"
34   -coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
35   -proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
36   -emin, r, a, 0.1,,, "Lower energy limit (TeV)"
37   -emax, r, a, 100.0,,, "Upper energy limit (TeV)"
38   -enumbins, i, a, 0,,, "Number of energy bins (0=unbinned)"
39   -tmin, t, a, 2020-01-01T00:00:00,,, "Start time (UTC string, JD, MJD or MET in seconds)"
40   -tmax, t, a, 2020-01-01T00:30:00,,, "Stop time (UTC string, JD, MJD or MET in seconds)"
41   -npix, i, a, 200,,, "Number of pixels for binned"
42   -binsz, r, a, 0.05,,, "Pixel size for binned (degrees/pixel)"
43   -profile, b, h, no,,, "Use likelihood profile method for errors?"
44   -seed, i, h, 1,,, "Initial random number generator seed"
  30 +ntrials, i, a, 10,,, "Number of trials"
  31 +ra, r, a, 83.6331,0,360, "RA of pointing (degrees)"
  32 +dec, r, a, 22.0145,-90,90, "Dec of pointing (degrees)"
  33 +rad, r, h, 5.0,0,180, "Radius of ROI (degrees)"
  34 +coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
  35 +proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
  36 +emin, r, a, 0.1,,, "Lower energy limit (TeV)"
  37 +emax, r, a, 100.0,,, "Upper energy limit (TeV)"
  38 +enumbins, i, a, 0,,, "Number of energy bins (0=unbinned)"
  39 +tmin, t, a, 2020-01-01T00:00:00,,, "Start time (UTC string, JD, MJD or MET in seconds)"
  40 +tmax, t, a, 2020-01-01T00:30:00,,, "Stop time (UTC string, JD, MJD or MET in seconds)"
  41 +npix, i, a, 200,,, "Number of pixels for binned"
  42 +binsz, r, a, 0.05,,, "Pixel size for binned (degrees/pixel)"
  43 +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
  44 +profile, b, h, no,,, "Use likelihood profile method for errors?"
  45 +seed, i, h, 1,,, "Initial random number generator seed"
45 46  
46 47 #
47 48 # Standard parameters
... ...
cscripts/cspull.py
... ... @@ -28,7 +28,7 @@ from cscripts import ioutils
28 28 # ============ #
29 29 # cspull class #
30 30 # ============ #
31   -class cspull(ctools.cscript):
  31 +class cspull(ctools.cslikelihood):
32 32 """
33 33 Generates pull distributions for a model
34 34 """
... ... @@ -37,9 +37,8 @@ class cspull(ctools.cscript):
37 37 """
38 38 Constructor
39 39 """
40   - # Set name
41   - self._name = 'cspull'
42   - self._version = ctools.__version__
  40 + # Initialise application by calling the appropriate class constructor
  41 + self._init_cslikelihood('cspull', ctools.__version__, argv)
43 42  
44 43 # Initialise some members
45 44 self._edisp = False
... ... @@ -53,12 +52,6 @@ class cspull(ctools.cscript):
53 52 self._seed = 1
54 53 self._chatter = 2
55 54  
56   - # Initialise observation container from constructor arguments
57   - self._obs, argv = self._set_input_obs(argv)
58   -
59   - # Initialise application by calling the appropriate class constructor
60   - self._init_cscript(argv)
61   -
62 55 # Return
63 56 return
64 57  
... ... @@ -69,13 +62,16 @@ class cspull(ctools.cscript):
69 62 Get parameters from parfile
70 63 """
71 64 # If there are no observations in container then get some ...
72   - if self._obs.size() == 0:
73   - self._obs = self._get_observations()
  65 + if self.obs().size() == 0:
  66 + self.obs(self._get_observations())
74 67  
75 68 # ... otherwise add response information and energy boundaries
76 69 # in case they are missing
77 70 else:
78   - self._setup_observations(self._obs)
  71 + self._setup_observations(self.obs())
  72 +
  73 + # Set observation statistic
  74 + self._set_obs_statistic(gammalib.toupper(self['statistic'].string()))
79 75  
80 76 # Get number of energy bins
81 77 self._enumbins = self['enumbins'].integer()
... ... @@ -88,8 +84,8 @@ class cspull(ctools.cscript):
88 84 self._proj = self['proj'].string()
89 85  
90 86 # Set models if we have none
91   - if self._obs.models().size() == 0:
92   - self._obs.models(self['inmodel'].filename())
  87 + if self.obs().models().size() == 0:
  88 + self.obs().models(self['inmodel'].filename())
93 89  
94 90 # Read other parameters
95 91 self._ntrials = self['ntrials'].integer()
... ... @@ -168,7 +164,7 @@ class cspull(ctools.cscript):
168 164 emax = None
169 165  
170 166 # Simulate events
171   - obs = obsutils.sim(self._obs,
  167 + obs = obsutils.sim(self.obs(),
172 168 emin=emin,
173 169 emax=emax,
174 170 nbins=self._enumbins,
... ... @@ -190,7 +186,7 @@ class cspull(ctools.cscript):
190 186  
191 187 # Write simulation results
192 188 self._log_header3(gammalib.NORMAL, 'Simulation')
193   - for run in self._obs:
  189 + for run in self.obs():
194 190 self._log_value(gammalib.NORMAL, 'Input observation %s' % run.id(),
195 191 self._obs_string(run))
196 192 for run in obs:
... ... @@ -200,7 +196,7 @@ class cspull(ctools.cscript):
200 196  
201 197 # Fit model
202 198 if self['profile'].boolean():
203   - models = self._obs.models()
  199 + models = self.obs().models()
204 200 for model in models:
205 201 like = ctools.cterror(obs)
206 202 like['srcname'] = model.name()
... ... @@ -256,7 +252,7 @@ class cspull(ctools.cscript):
256 252 # (fitted - true) / error
257 253 # In case that the error is 0 the pull is set to 99
258 254 fitted_value = par.value()
259   - real_value = self._obs.models()[i][k].value()
  255 + real_value = self.obs().models()[i][k].value()
260 256 error = par.error()
261 257 if error != 0.0:
262 258 pull = (fitted_value - real_value) / error
... ... @@ -292,7 +288,7 @@ class cspull(ctools.cscript):
292 288 self._get_parameters()
293 289  
294 290 # Write observation into logger
295   - self._log_observations(gammalib.NORMAL, self._obs, 'Input observation')
  291 + self._log_observations(gammalib.NORMAL, self.obs(), 'Input observation')
296 292  
297 293 # Write header
298 294 self._log_header1(gammalib.TERSE, 'Generate pull distribution')
... ... @@ -320,7 +316,7 @@ class cspull(ctools.cscript):
320 316 Set model container
321 317 """
322 318 # Set model container
323   - self._obs.models(models)
  319 + self.obs().models(models)
324 320  
325 321 # Return
326 322 return
... ...
cscripts/cssens.par
... ... @@ -28,18 +28,19 @@ outfile, f, h, sensitivity.dat,,, "Output sensitivity ASCII file"
28 28 #
29 29 # Script parameters
30 30 #==================
31   -offset, r, h, 0.0,,, "Source offset angle (deg)"
32   -duration, r, a, 180000.0,,, "Effective exposure time (s)"
33   -rad, r, a, 5.0,,, "Radius of ROI (deg)"
34   -emin, r, a, 0.03163,,, "Lower energy limit (TeV)"
35   -emax, r, a, 125.8925,,, "Upper energy limit (TeV)"
36   -bins, i, a, 18,,, "Number of energy bins for differential sensitivity computation"
37   -enumbins, i, h, 0,,, "Number of energy bins for binned analysis (0=unbinned)"
38   -npix, i, h, 200,,, "Number of pixels for binned analysis"
39   -binsz, r, h, 0.05,,, "Pixel size for binned analysis (deg/pixel)"
40   -type, s, h, Differential,Differential|Integral,, "Sensitivity type"
41   -sigma, r, h, 5.0,,, "Significance threshold (Gaussian sigma)"
42   -max_iter, i, h, 50,,, "Maximum number of iterations"
  31 +offset, r, h, 0.0,,, "Source offset angle (deg)"
  32 +duration, r, a, 180000.0,,, "Effective exposure time (s)"
  33 +rad, r, a, 5.0,,, "Radius of ROI (deg)"
  34 +emin, r, a, 0.03163,,, "Lower energy limit (TeV)"
  35 +emax, r, a, 125.8925,,, "Upper energy limit (TeV)"
  36 +bins, i, a, 18,,, "Number of energy bins for differential sensitivity computation"
  37 +enumbins, i, h, 0,,, "Number of energy bins for binned analysis (0=unbinned)"
  38 +npix, i, h, 200,,, "Number of pixels for binned analysis"
  39 +binsz, r, h, 0.05,,, "Pixel size for binned analysis (deg/pixel)"
  40 +type, s, h, Differential,Differential|Integral,, "Sensitivity type"
  41 +sigma, r, h, 5.0,,, "Significance threshold (Gaussian sigma)"
  42 +max_iter, i, h, 50,,, "Maximum number of iterations"
  43 +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
43 44  
44 45 #
45 46 # Standard parameters
... ...
cscripts/cssens.py
... ... @@ -30,7 +30,7 @@ from cscripts import ioutils
30 30 # ============ #
31 31 # cssens class #
32 32 # ============ #
33   -class cssens(ctools.cscript):
  33 +class cssens(ctools.cslikelihood):
34 34 """
35 35 Computes the CTA sensitivity
36 36  
... ... @@ -47,9 +47,8 @@ class cssens(ctools.cscript):
47 47 """
48 48 Constructor.
49 49 """
50   - # Set name
51   - self._name = 'cssens'
52   - self._version = ctools.__version__
  50 + # Initialise application by calling the appropriate class constructor
  51 + self._init_cslikelihood('cssens', ctools.__version__, argv)
53 52  
54 53 # Initialise class members
55 54 self._ebounds = gammalib.GEbounds()
... ... @@ -59,12 +58,6 @@ class cssens(ctools.cscript):
59 58 self._dec = None
60 59 self._log_clients = False
61 60  
62   - # Initialise observation container from constructor arguments
63   - self._obs, argv = self._set_input_obs(argv)
64   -
65   - # Initialise application by calling the appropriate class constructor
66   - self._init_cscript(argv)
67   -
68 61 # Return
69 62 return
70 63  
... ... @@ -75,12 +68,15 @@ class cssens(ctools.cscript):
75 68 Get user parameters from parfile
76 69 """
77 70 # Set observation if not done before
78   - if self._obs.size() == 0:
79   - self._obs = self._set_obs(self['emin'].real(), self['emax'].real())
  71 + if self.obs().size() == 0:
  72 + self.obs(self._set_obs(self['emin'].real(), self['emax'].real()))
  73 +
  74 + # Set observation statistic
  75 + self._set_obs_statistic(gammalib.toupper(self['statistic'].string()))
80 76  
81 77 # Set models if we have none
82   - if self._obs.models().size() == 0:
83   - self._obs.models(self['inmodel'].filename())
  78 + if self.obs().models().size() == 0:
  79 + self.obs().models(self['inmodel'].filename())
84 80  
85 81 # Get source name
86 82 self._srcname = self['srcname'].string()
... ... @@ -186,7 +182,7 @@ class cssens(ctools.cscript):
186 182 Maximum energy
187 183 """
188 184 # Loop over all observations in container
189   - for i, obs in enumerate(self._obs):
  185 + for i, obs in enumerate(self.obs()):
190 186  
191 187 # Get energy boundaries of the observation
192 188 obs_ebounds = self._obs_ebounds[i]
... ... @@ -337,11 +333,11 @@ class cssens(ctools.cscript):
337 333 models = test_model.copy()
338 334 crab_prefactor = models[self._srcname]['Prefactor'].value() * crab_unit
339 335 models[self._srcname]['Prefactor'].value(crab_prefactor * test_crab_flux)
340   - self._obs.models(models)
  336 + self.obs().models(models)
341 337  
342 338 # Simulate events for the models. "sim" holds an observation
343 339 # container with observations containing the simulated events.
344   - sim = obsutils.sim(self._obs, nbins=enumbins, seed=iterations,
  340 + sim = obsutils.sim(self.obs(), nbins=enumbins, seed=iterations,
345 341 binsz=binsz, npix=npix,
346 342 log=self._log_clients,
347 343 debug=self['debug'].boolean(),
... ... @@ -488,7 +484,7 @@ class cssens(ctools.cscript):
488 484 self._log_string(gammalib.TERSE, str(par))
489 485  
490 486 # Restore energy boundaries of observation container
491   - for i, obs in enumerate(self._obs):
  487 + for i, obs in enumerate(self.obs()):
492 488 obs.events().ebounds(self._obs_ebounds[i])
493 489  
494 490 # Store result
... ... @@ -583,7 +579,7 @@ class cssens(ctools.cscript):
583 579  
584 580 # Loop over observations and store a deep copy of the energy
585 581 # boundaries for later use
586   - for obs in self._obs:
  582 + for obs in self.obs():
587 583 self._obs_ebounds.append(obs.events().ebounds().copy())
588 584  
589 585 # Initialise script
... ... @@ -593,14 +589,14 @@ class cssens(ctools.cscript):
593 589 results = []
594 590  
595 591 # Set test source model for this observation
596   - models = modutils.test_source(self._obs.models(), self._srcname,
  592 + models = modutils.test_source(self.obs().models(), self._srcname,
597 593 ra=self._ra, dec=self._dec)
598 594  
599 595 # Write observation into logger
600   - self._log_observations(gammalib.NORMAL, self._obs, 'Observation')
  596 + self._log_observations(gammalib.NORMAL, self.obs(), 'Input observation')
601 597  
602 598 # Write models into logger
603   - self._log_models(gammalib.NORMAL, models, 'Model')
  599 + self._log_models(gammalib.TERSE, models, 'Input model')
604 600  
605 601 # Get sensitivity type
606 602 sensitivity_type = self['type'].string()
... ...
cscripts/cstsdist.par
... ... @@ -32,19 +32,20 @@ outfile, f, a, ts.dat,,, "Output Test Statistic distribution file"
32 32 #
33 33 # Script parameters
34 34 #==================
35   -ntrials, i, a, 10,,, "Number of trials"
36   -ra, r, a, 83.63,0,360, "RA of pointing (degrees)"
37   -dec, r, a, 22.01,-90,90, "Dec of pointing (degrees)"
38   -rad, r, h, 5.0,0,180, "Radius of ROI (degrees)"
39   -coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
40   -proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
41   -emin, r, a, 0.1,,, "Lower energy limit (TeV)"
42   -emax, r, a, 100.0,,, "Upper energy limit (TeV)"
43   -enumbins, i, a, 0,,, "Number of energy bins (0=unbinned)"
44   -tmin, t, a, 2020-01-01T00:00:00,,, "Start time (UTC string, JD, MJD or MET in seconds)"
45   -tmax, t, a, 2020-01-01T00:30:00,,, "Stop time (UTC string, JD, MJD or MET in seconds)"
46   -npix, i, a, 200,,, "Number of pixels for binned"
47   -binsz, r, a, 0.05,,, "Pixel size for binned (degrees/pixel)"
  35 +ntrials, i, a, 10,,, "Number of trials"
  36 +ra, r, a, 83.63,0,360, "RA of pointing (degrees)"
  37 +dec, r, a, 22.01,-90,90, "Dec of pointing (degrees)"
  38 +rad, r, h, 5.0,0,180, "Radius of ROI (degrees)"
  39 +coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
  40 +proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
  41 +emin, r, a, 0.1,,, "Lower energy limit (TeV)"
  42 +emax, r, a, 100.0,,, "Upper energy limit (TeV)"
  43 +enumbins, i, a, 0,,, "Number of energy bins (0=unbinned)"
  44 +tmin, t, a, 2020-01-01T00:00:00,,, "Start time (UTC string, JD, MJD or MET in seconds)"
  45 +tmax, t, a, 2020-01-01T00:30:00,,, "Stop time (UTC string, JD, MJD or MET in seconds)"
  46 +npix, i, a, 200,,, "Number of pixels for binned"
  47 +binsz, r, a, 0.05,,, "Pixel size for binned (degrees/pixel)"
  48 +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
48 49  
49 50 #
50 51 # Standard parameters
... ...
cscripts/cstsdist.py
... ... @@ -29,7 +29,7 @@ from cscripts import ioutils
29 29 # ============== #
30 30 # cstsdist class #
31 31 # ============== #
32   -class cstsdist(ctools.cscript):
  32 +class cstsdist(ctools.cslikelihood):
33 33 """
34 34 Generates Test Statistic distribution for a model
35 35 """
... ... @@ -39,20 +39,13 @@ class cstsdist(ctools.cscript):
39 39 """
40 40 Constructor.
41 41 """
42   - # Set name
43   - self._name = 'cstsdist'
44   - self._version = ctools.__version__
  42 + # Initialise application by calling the appropriate class constructor
  43 + self._init_cslikelihood('cstsdist', ctools.__version__, argv)
45 44  
46 45 # Initialise some members
47 46 self._srcname = ''
48 47 self._log_clients = False
49 48  
50   - # Initialise observation container from constructor arguments
51   - self._obs, argv = self._set_input_obs(argv)
52   -
53   - # Initialise application by calling the appropriate class constructor
54   - self._init_cscript(argv)
55   -
56 49 # Return
57 50 return
58 51  
... ... @@ -63,8 +56,11 @@ class cstsdist(ctools.cscript):
63 56 Get parameters from parfile and setup the observation
64 57 """
65 58 # Set observation if not done before
66   - if self._obs.size() == 0:
67   - self._obs = self._get_observations()
  59 + if self.obs().size() == 0:
  60 + self.obs(self._get_observations())
  61 +
  62 + # Set observation statistic
  63 + self._set_obs_statistic(gammalib.toupper(self['statistic'].string()))
68 64  
69 65 # Get source name
70 66 self._srcname = self['srcname'].string()
... ... @@ -77,8 +73,8 @@ class cstsdist(ctools.cscript):
77 73 self['proj'].string()
78 74  
79 75 # Set models if we have none
80   - if self._obs.models().size() == 0:
81   - self._obs.models(self['inmodel'].filename())
  76 + if self.obs().models().size() == 0:
  77 + self.obs().models(self['inmodel'].filename())
82 78  
83 79 # Query parameters
84 80 self['edisp'].boolean()
... ... @@ -107,8 +103,7 @@ class cstsdist(ctools.cscript):
107 103 Result dictionary
108 104 """
109 105 # Write header
110   - if self._logExplicit():
111   - self._log.header2('Trial '+str(seed+1))
  106 + self._log_header2(gammalib.EXPLICIT, 'Trial %d' % (seed+1))
112 107  
113 108 # Set default binned parameters
114 109 coordsys = 'CEL'
... ... @@ -124,7 +119,7 @@ class cstsdist(ctools.cscript):
124 119 proj = self['proj'].string()
125 120  
126 121 # Simulate events
127   - sim = obsutils.sim(self._obs,
  122 + sim = obsutils.sim(self.obs(),
128 123 nbins = self['enumbins'].integer(),
129 124 seed = seed,
130 125 proj = proj,
... ... @@ -226,30 +221,16 @@ class cstsdist(ctools.cscript):
226 221 self._get_parameters()
227 222  
228 223 # Set test source model for this observation
229   - self.models(modutils.test_source(self._obs.models(), self._srcname))
230   -
231   - # Write models into logger
232   - if self._logTerse():
233   - self._log('\n')
234   - self._log.header1('Models')
235   - self._log(str(self._obs.models()))
236   - self._log('\n')
  224 + self.models(modutils.test_source(self.obs().models(), self._srcname))
237 225  
238 226 # Write observation into logger
239   - if self._logTerse():
240   - self._log('\n')
241   - self._log.header1(gammalib.number('Observation',len(self._obs)))
242   - self._log(str(self._obs))
243   - self._log('\n')
244   - if self._logExplicit():
245   - for obs in self._obs:
246   - self._log(str(obs))
247   - self._log('\n')
  227 + self._log_observations(gammalib.NORMAL, self.obs(), 'Input observation')
  228 +
  229 + # Write models into logger
  230 + self._log_models(gammalib.TERSE, self.obs().models(), 'Input model')
248 231  
249 232 # Write header
250   - if self._logTerse():
251   - self._log('\n')
252   - self._log.header1('Generate TS distribution')
  233 + self._log_header1(gammalib.TERSE, 'Generate TS distribution')
253 234  
254 235 # Loop over trials
255 236 for seed in range(self['ntrials'].integer()):
... ... @@ -274,7 +255,7 @@ class cstsdist(ctools.cscript):
274 255 Model container
275 256 """
276 257 # Copy models
277   - self._obs.models(models)
  258 + self.obs().models(models)
278 259  
279 260 # Return
280 261 return
... ...
doc/source/admin/release_history/1.5.rst
... ... @@ -23,6 +23,11 @@ Bug fixes
23 23 Improvements
24 24 ------------
25 25  
  26 +* [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] -
  27 + Add ``statistic`` parameters to :ref:`ctbutterfly`, :ref:`cterror`,
  28 + :ref:`cttsmap`, :ref:`ctulimit`, :ref:`cslightcrv, :ref:`csphasecrv`,
  29 + :ref:`cspull`, :ref:`cssens`, :ref:`csspec`, :ref:`cstsdist` and
  30 + :ref:`cstsmapsplit`
26 31 * [`2231 <https://cta-redmine.irap.omp.eu/issues/2231>`_] -
27 32 Enable handling of On/Off observations in :ref:`csspec`
28 33 * [`2207 <https://cta-redmine.irap.omp.eu/issues/2207>`_] -
... ... @@ -50,3 +55,7 @@ Clean up
50 55  
51 56 * [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] -
52 57 Rename :ref:`ctlike` ``stat`` parameter to ``statistic``
  58 +* [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] -
  59 + Derive :ref:`cslightcrv, :ref:`csphasecrv`, :ref:`cspull`, :ref:`cssens`,
  60 + :ref:`csspec` and :ref:`cttsdist` scripts from ``cslikelihood`` base
  61 + class
... ...
doc/source/users/reference_manual/cslightcrv.rst
... ... @@ -38,7 +38,7 @@ General parameters
38 38  
39 39 ``caldb [string]``
40 40 Calibration database.
41   -
  41 +
42 42 ``irf [string]``
43 43 Instrumental response function.
44 44  
... ... @@ -65,34 +65,42 @@ General parameters
65 65  
66 66 ``emin [real]``
67 67 Lower energy limit of events (in TeV).
68   -
  68 +
69 69 ``emax [real]``
70 70 Upper energy limit of events (in TeV).
71   -
  71 +
72 72 ``enumbins [integer]``
73 73 Number of energy bins per light curve bin (0=unbinned).
74 74  
75 75 ``coordsys <CEL|GAL> [string]``
76 76 Coordinate system (CEL - celestial, GAL - galactic).
77   -
  77 +
78 78 ``proj <AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN> [string]``
79 79 Projection method.
80 80  
81 81 ``xref [real]``
82 82 Right Ascension / Galactic longitude of image centre (J2000, in degrees).
83   -
  83 +
84 84 ``yref [real]``
85 85 Declination / Galactic latitude of image centre (J2000, in degrees).
86 86  
87 87 ``nxpix [integer]``
88 88 Size of the Right Ascension / Galactic longitude axis (in pixels).
89   -
  89 +
90 90 ``nypix [integer]``
91 91 Size of the Declination / Galactic latitude axis (in pixels).
92   -
  92 +
93 93 ``binsz [real]``
94 94 Pixel size (in degrees/pixel).
95 95  
  96 +``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
  97 + Optimization statistic. ``DEFAULT`` uses the default statistic for all
  98 + observations, which is ``CSTAT`` or the statistic specified in the
  99 + observation definition XML file. ``CSTAT`` uses the C statistic for
  100 + all observations, ``WSTAT`` uses the W statistic for all On/Off
  101 + observations, and ``CHI2`` uses the Chi squared statistic for all
  102 + binned or stacked observations.
  103 +
96 104 ``(calc_ts = yes) [boolean]``
97 105 Compute TS value for each time bin?
98 106  
... ... @@ -115,20 +123,21 @@ Standard parameters
115 123 ``(chatter = 2) [integer]``
116 124 Verbosity of the executable:
117 125 ``chatter = 0``: no information will be logged
118   -
  126 +
119 127 ``chatter = 1``: only errors will be logged
120   -
  128 +
121 129 ``chatter = 2``: errors and actions will be logged
122   -
  130 +
123 131 ``chatter = 3``: report about the task execution
124   -
  132 +
125 133 ``chatter = 4``: detailed report about the task execution
126 134  
127 135 ``(clobber = yes) [boolean]``
128 136 Specifies whether an existing light curve output file should be overwritten.
129 137  
130 138 ``(debug = no) [boolean]``
131   - Enables debug mode. In debug mode the executable will dump any log file output to the console.
  139 + Enables debug mode. In debug mode the executable will dump any log file
  140 + output to the console.
132 141  
133 142 ``(mode = ql) [string]``
134 143 Mode of automatic parameters (default is "ql", i.e. "query and learn").
... ...
doc/source/users/reference_manual/csphasecrv.rst
... ... @@ -35,7 +35,7 @@ General parameters
35 35  
36 36 ``caldb [string]``
37 37 Calibration database.
38   -
  38 +
39 39 ``irf [string]``
40 40 Instrumental response function.
41 41  
... ... @@ -57,34 +57,42 @@ General parameters
57 57  
58 58 ``emin [real]``
59 59 Lower energy limit of events (in TeV).
60   -
  60 +
61 61 ``emax [real]``
62 62 Upper energy limit of events (in TeV).
63   -
  63 +
64 64 ``enumbins [integer]``
65 65 Number of energy bins per phase bin (0=unbinned).
66 66  
67 67 ``coordsys <CEL|GAL> [string]``
68 68 Coordinate system (CEL - celestial, GAL - galactic).
69   -
  69 +
70 70 ``proj <AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN> [string]``
71 71 Projection method.
72 72  
73 73 ``xref [real]``
74 74 Right Ascension / Galactic longitude of image centre (J2000, in degrees).
75   -
  75 +
76 76 ``yref [real]``
77 77 Declination / Galactic latitude of image centre (J2000, in degrees).
78 78  
79 79 ``nxpix [integer]``
80 80 Size of the Right Ascension / Galactic longitude axis (in pixels).
81   -
  81 +
82 82 ``nypix [integer]``
83 83 Size of the Declination / Galactic latitude axis (in pixels).
84   -
  84 +
85 85 ``binsz [real]``
86 86 Pixel size (in degrees/pixel).
87 87  
  88 +``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
  89 + Optimization statistic. ``DEFAULT`` uses the default statistic for all
  90 + observations, which is ``CSTAT`` or the statistic specified in the
  91 + observation definition XML file. ``CSTAT`` uses the C statistic for
  92 + all observations, ``WSTAT`` uses the W statistic for all On/Off
  93 + observations, and ``CHI2`` uses the Chi squared statistic for all
  94 + binned or stacked observations.
  95 +
88 96  
89 97 Standard parameters
90 98 -------------------
... ... @@ -95,21 +103,22 @@ Standard parameters
95 103 ``(chatter = 2) [integer]``
96 104 Verbosity of the executable:
97 105 ``chatter = 0``: no information will be logged
98   -
  106 +
99 107 ``chatter = 1``: only errors will be logged
100   -
  108 +
101 109 ``chatter = 2``: errors and actions will be logged
102   -
  110 +
103 111 ``chatter = 3``: report about the task execution
104   -
  112 +
105 113 ``chatter = 4``: detailed report about the task execution
106 114  
107 115 ``(clobber = yes) [boolean]``
108 116 Specifies whether an existing light curve output file should be overwritten.
109   -
  117 +
110 118 ``(debug = no) [boolean]``
111   - Enables debug mode. In debug mode the executable will dump any log file output to the console.
112   -
  119 + Enables debug mode. In debug mode the executable will dump any log file
  120 + output to the console.
  121 +
113 122 ``(mode = ql) [string]``
114 123 Mode of automatic parameters (default is "ql", i.e. "query and learn").
115 124  
... ...
doc/source/users/reference_manual/cspull.rst
... ... @@ -40,31 +40,28 @@ General parameters
40 40  
41 41 ``inmodel [file]``
42 42 Input model XML file.
43   -
44   -``outfile [file]``
45   - ASCII file containing the individual pull values.
46   -
  43 +
47 44 ``caldb [string]``
48 45 Calibration database.
49   -
  46 +
50 47 ``irf [string]``
51 48 Instrumental response function.
52 49  
53   -``(deadc = 0.98) [real]``
54   - Average deadtime correction factor.
55   -
56 50 ``(edisp = no) [boolean]``
57 51 Apply energy dispersion to response computation?
58 52  
59   -``(profile = no) [boolean]``
60   - Use likelihood profile method for errors?
  53 +``(deadc = 0.98) [real]``
  54 + Average deadtime correction factor.
  55 +
  56 +``outfile [file]``
  57 + ASCII file containing the individual pull values.
61 58  
62 59 ``ntrials [integer]``
63 60 Number of samples for generating the pull distribution.
64   -
  61 +
65 62 ``ra [real]``
66 63 Right Ascension of CTA pointing (J2000, in degrees).
67   -
  64 +
68 65 ``dec [real]``
69 66 Declination of CTA pointing (J2000, in degrees).
70 67  
... ... @@ -73,31 +70,45 @@ General parameters
73 70  
74 71 ``coordsys <CEL|GAL> [string]``
75 72 Coordinate system (CEL - celestial, GAL - galactic).
76   -
  73 +
77 74 ``proj <AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN> [string]``
78 75 Projection method.
79   -
  76 +
80 77 ``emin [real]``
81 78 Lower energy limit of events (in TeV).
82   -
  79 +
83 80 ``emax [real]``
84 81 Upper energy limit of events (in TeV).
85   -
  82 +
86 83 ``enumbins [integer]``
87 84 Number of energy bins (0=unbinned).
88   -
  85 +
89 86 ``tmin [time]``
90 87 Start time (UTC string, JD, MJD or MET in seconds).
91   -
  88 +
92 89 ``tmax [time]``
93 90 Stop time (UTC string, JD, MJD or MET in seconds).
94   -
  91 +
95 92 ``npix [integer]``
96 93 Number of pixels for binned analysis.
97   -
  94 +
98 95 ``binsz [real]``
99 96 Pixel size for binned analysis.
100 97  
  98 +``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
  99 + Optimization statistic. ``DEFAULT`` uses the default statistic for all
  100 + observations, which is ``CSTAT`` or the statistic specified in the
  101 + observation definition XML file. ``CSTAT`` uses the C statistic for
  102 + all observations, ``WSTAT`` uses the W statistic for all On/Off
  103 + observations, and ``CHI2`` uses the Chi squared statistic for all
  104 + binned or stacked observations.
  105 +
  106 +``(profile = no) [boolean]``
  107 + Use likelihood profile method for errors?
  108 +
  109 +``(seed = 1) [integer]``
  110 + Initial random number generator seed.
  111 +
101 112  
102 113 Standard parameters
103 114 -------------------
... ... @@ -105,22 +116,22 @@ Standard parameters
105 116 ``(chatter = 2) [integer]``
106 117 Verbosity of the executable:
107 118 ``chatter = 0``: no information will be logged
108   -
  119 +
109 120 ``chatter = 1``: only errors will be logged
110   -
  121 +
111 122 ``chatter = 2``: errors and actions will be logged
112   -
  123 +
113 124 ``chatter = 3``: report about the task execution
114   -
  125 +
115 126 ``chatter = 4``: detailed report about the task execution
116   -
  127 +
117 128 ``(clobber = yes) [boolean]``
118 129 Specifies whether an existing output file should be overwritten.
119   -
  130 +
120 131 ``(debug = no) [boolean]``
121 132 Enables debug mode. In debug mode the executable will dump any log file
122 133 output to the console.
123   -
  134 +
124 135 ``(mode = ql) [string]``
125 136 Mode of automatic parameters (default is "ql", i.e. "query and learn").
126 137  
... ...
doc/source/users/reference_manual/cssens.rst
... ... @@ -52,54 +52,65 @@ General parameters
52 52 Name of the source in the source model XML file which should be used
53 53 for sensitivity computation.
54 54  
55   -``(offset = 0.0) [real]``
56   - Offset angle of source in field of view (in degrees).
57   -
58 55 ``caldb [string]``
59 56 Calibration database.
60   -
  57 +
61 58 ``irf [string]``
62 59 Instrumental response function.
63 60  
  61 +``(edisp = no) [boolean]``
  62 + Apply energy dispersion to response computation?
  63 +
64 64 ``(deadc = 0.95) [real]``
65 65 Average deadtime correction factor.
66   -
  66 +
67 67 ``outfile [file]``
68 68 ASCII file containing the sensitivity values.
69   -
  69 +
  70 +``(offset = 0.0) [real]``
  71 + Offset angle of source in field of view (in degrees).
  72 +
70 73 ``duration [real]``
71 74 Effective exposure time (in seconds).
72   -
  75 +
73 76 ``rad [real]``
74 77 Radius of Region of Interest (RoI) (in degrees).
75   -
  78 +
76 79 ``emin [real]``
77 80 Lower energy limit for sensitivity computation (in TeV).
78   -
  81 +
79 82 ``emax [real]``
80 83 Upper energy limit for sensitivity computation (in TeV).
81 84  
82 85 ``bins [integer]``
83 86 Number of energy bins for sensitivity computation.
84   -
  87 +
85 88 ``(enumbins = 0) [integer]``
86 89 Number of energy bins (0=unbinned).
87   -
  90 +
88 91 ``(npix = 200) [integer]``
89 92 Number of pixels for binned analysis.
90   -
  93 +
91 94 ``(binsz = 0.05) [real]``
92 95 Pixel size for binned analysis.
93   -
  96 +
94 97 ``(type = Differential) <Differential|Integral> [string]``
95 98 Sensitivity type.
96   -
  99 +
97 100 ``(sigma = 5.0) [real]``
98 101 Significance threshold.
99   -
  102 +
100 103 ``(max_iter = 50) [integer]``
101 104 Maximum number of iterations.
102   -
  105 +
  106 +``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
  107 + Optimization statistic. ``DEFAULT`` uses the default statistic for all
  108 + observations, which is ``CSTAT`` or the statistic specified in the
  109 + observation definition XML file. ``CSTAT`` uses the C statistic for
  110 + all observations, ``WSTAT`` uses the W statistic for all On/Off
  111 + observations, and ``CHI2`` uses the Chi squared statistic for all
  112 + binned or stacked observations.
  113 +
103 114  
104 115 Standard parameters
105 116 -------------------
... ... @@ -107,21 +118,22 @@ Standard parameters
107 118 ``(chatter = 2) [integer]``
108 119 Verbosity of the executable:
109 120 ``chatter = 0``: no information will be logged
110   -
  121 +
111 122 ``chatter = 1``: only errors will be logged
112   -
  123 +
113 124 ``chatter = 2``: errors and actions will be logged
114   -
  125 +
115 126 ``chatter = 3``: report about the task execution
116   -
  127 +
117 128 ``chatter = 4``: detailed report about the task execution
118   -
  129 +
119 130 ``(clobber = yes) [boolean]``
120 131 Specifies whether an existing output file should be overwritten.
121   -
  132 +
122 133 ``(debug = no) [boolean]``
123   - Enables debug mode. In debug mode the executable will dump any log file output to the console.
124   -
  134 + Enables debug mode. In debug mode the executable will dump any log file
  135 + output to the console.
  136 +
125 137 ``(mode = ql) [string]``
126 138 Mode of automatic parameters (default is "ql", i.e. "query and learn").
127 139  
... ...
doc/source/users/reference_manual/cstsdist.rst
... ... @@ -42,9 +42,6 @@ General parameters
42 42 Name of the source in the source model XML file which should be used
43 43 for Test Statistics computation.
44 44  
45   -``outfile [file]``
46   - Output ASCII file containing the TS distribution values.
47   -
48 45 ``expcube [file]``
49 46 Input exposure cube file.
50 47  
... ... @@ -59,22 +56,25 @@ General parameters
59 56  
60 57 ``caldb [string]``
61 58 Calibration database.
62   -
  59 +
63 60 ``irf [string]``
64 61 Instrumental response function.
65   -
66   -``(deadc = 0.98) [real]``
67   - Average deadtime correction factor.
68 62  
69 63 ``(edisp = no) [boolean]``
70 64 Apply energy dispersion to response computation.
71 65  
  66 +``(deadc = 0.98) [real]``
  67 + Average deadtime correction factor.
  68 +
  69 +``outfile [file]``
  70 + Output ASCII file containing the TS distribution values.
  71 +
72 72 ``ntrials [integer]``
73 73 Number of Monte Carlo samples.
74 74  
75 75 ``ra [real]``
76 76 Right Ascension of CTA pointing (J2000, in degrees).
77   -
  77 +
78 78 ``dec [real]``
79 79 Declination of CTA pointing (J2000, in degrees).
80 80  
... ... @@ -83,31 +83,39 @@ General parameters
83 83  
84 84 ``coordsys <CEL|GAL> [string]``
85 85 Coordinate system (CEL - celestial, GAL - galactic).
86   -
  86 +
87 87 ``proj <AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN> [string]``
88 88 Projection method.
89 89  
90 90 ``emin [real]``
91 91 Lower energy limit (in TeV).
92   -
  92 +
93 93 ``emax [real]``
94 94 Upper energy limit (in TeV).
95   -
  95 +
96 96 ``enumbins [integer]``
97 97 Number of energy bins (0=unbinned).
98   -
  98 +
99 99 ``tmin [time]``
100 100 Start time (UTC string, JD, MJD or MET in seconds).
101   -
  101 +
102 102 ``tmax [time]``
103 103 Stop time (UTC string, JD, MJD or MET in seconds).
104   -
  104 +
105 105 ``npix [integer]``
106 106 Number of pixels for binned analysis.
107   -
  107 +
108 108 ``binsz [real]``
109 109 Pixel size for binned analysis.
110 110  
  111 +``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
  112 + Optimization statistic. ``DEFAULT`` uses the default statistic for all
  113 + observations, which is ``CSTAT`` or the statistic specified in the
  114 + observation definition XML file. ``CSTAT`` uses the C statistic for
  115 + all observations, ``WSTAT`` uses the W statistic for all On/Off
  116 + observations, and ``CHI2`` uses the Chi squared statistic for all
  117 + binned or stacked observations.
  118 +
111 119  
112 120 Standard parameters
113 121 -------------------
... ... @@ -115,21 +123,22 @@ Standard parameters
115 123 ``(chatter = 2) [integer]``
116 124 Verbosity of the executable:
117 125 ``chatter = 0``: no information will be logged
118   -
  126 +
119 127 ``chatter = 1``: only errors will be logged
120   -
  128 +
121 129 ``chatter = 2``: errors and actions will be logged
122   -
  130 +
123 131 ``chatter = 3``: report about the task execution
124   -
  132 +
125 133 ``chatter = 4``: detailed report about the task execution
126   -
  134 +
127 135 ``(clobber = yes) [boolean]``
128 136 Specifies whether an existing output file should be overwritten.
129   -
  137 +
130 138 ``(debug = no) [boolean]``
131   - Enables debug mode. In debug mode the executable will dump any log file output to the console.
132   -
  139 + Enables debug mode. In debug mode the executable will dump any log file
  140 + output to the console.
  141 +
133 142 ``(mode = ql) [string]``
134 143 Mode of automatic parameters (default is "ql", i.e. "query and learn").
135 144  
... ...