Commit 6acd8596a34fad68b3097431ae5736cdece50b26

Authored by ldivenere
2 parents 771cebd5 b99c8d60

Merge branch 'devel' of https://cta-gitlab.irap.omp.eu/ctools/ctools into devel

Showing 353 changed files with 11329 additions and 6346 deletions

Too many changes.

To preserve performance only 100 of 353 files are displayed.

... ... @@ -15,5 +15,6 @@ Michael Mayer (michael.mayer@physik.hu-berlin.de)
15 15 Stefan Ohm (stefan.ohm81@gmail.com)
16 16 David Sanchez (david.sanchez@lapp.in2p3.fr)
17 17 Hubert Siejkowski (h.siejkowski@cyfronet.pl)
  18 +Andreas Specovius (andreas.specovius@fau.de)
18 19 Luigi Tibaldo (luigi.tibaldo@irap.omp.eu)
19 20 Alexander Ziegler (alexander.ziegler@fau.de)
... ...
ChangeLog
1   -2017-11-28
  1 +2018-01-25
2 2  
3 3 * Version 1.5.0 released
4 4 ========================
5 5  
  6 + Correct diffuse map cube upper limit computation in ctulimit (#2298)
  7 + Add tmin and tmax parameters to csobsselect (#2297)
  8 + Change DATE_OBS, DATE_END, TIME_OBS and TIME_END FITS keywords into DATA-OBS,
  9 + DATE-END, TIME-OBS and TIME-END
  10 + Add CUSTOM background method to csphagen script (#2284)
  11 + Add csresspec script (#2289)
  12 + Add ctools::time_reference constant and remove ctools::time_reference()
  13 + method (#2295)
  14 + Correctly strip .gz suffix from output filenames (#2287)
6 15 Support On/Off analysis in cslightcrv and csphasecrv (#2273)
  16 + ctselect informs about non-overlapping time interval (#2272)
7 17 Add tutorial for classical analysis (#2267)
  18 + In case of an error, test output is now written into log file (#2264)
8 19 Fix chatter level handling in ctpsfcube (#2262)
9 20 Handle On/Off observations by cspull (#2260)
10 21 Add "statistic" parameter to all likelihood tools and scripts (#2237)
... ... @@ -14,9 +25,13 @@
14 25 Add RING background method to ctskymap (#2207)
15 26 Add keywords to sky maps produced by ctskymap (#2194)
16 27 Enhance efficiency of computations in ctmodel (#2189)
  28 + cscripts::execute() no longer creates log files (#2182)
17 29 Add csmodelsois script (#2180)
18 30 Add "NODES" method to csspec to support non-CTA analysis (#1927)
19 31 Use t-type parameters for all "tmin" and "tmax" parameters (#1864)
  32 + Set OBS_ID in ctobssim (#1836)
  33 + Revise cstsdist parameters (#1567)
  34 + Add ctbutterfly::butterfly() method (#1512)
20 35  
21 36  
22 37 2017-07-28
... ...
1   -New Features and Important Changes in ctools 1.5.0
2   -
3   -28 November 2017
  1 +25 January 2018
4 2  
5 3  
6 4 Introduction
... ... @@ -11,7 +9,10 @@ ctools release with respect to the precedent release.
11 9  
12 10 Configuration
13 11 -------------
14   -None
  12 +In case of an error, test output is now written into log file (#2264).
  13 +
  14 +The cscripts::execute() method no longer creates log files, making the
  15 +cscripts behaviour compliant with that of ctools (#2182).
15 16  
16 17  
17 18 Python interface
... ... @@ -24,6 +25,12 @@ Support model
24 25 None
25 26  
26 27  
  28 +Base classes
  29 +------------
  30 +Add ctools::time_reference constant and remove ctools::time_reference() method
  31 +(#2295).
  32 +
  33 +
27 34 ctbin - CTA event binning
28 35 -------------------------
29 36 None
... ... @@ -38,6 +45,8 @@ ctbutterfly - Generate butterfly diagrams
38 45 -----------------------------------------
39 46 Add "statistic" parameter to allow setting of optimizer statistic (#2237).
40 47  
  48 +Add butterfly() method to return the butterfly diagram as CSV object (#1512).
  49 +
41 50  
42 51 ctcubemask - CTA cube filtering
43 52 -------------------------------
... ... @@ -85,6 +94,9 @@ ctobssim - CTA observation simulation
85 94 Use t-type parameters for "tmin" and "tmax" to all specifying times in various
86 95 formats (#1864).
87 96  
  97 +Set the OBS_ID keyword to the number that is used for creating the FITS file
  98 +(#1836).
  99 +
88 100  
89 101 ctphase - Event phase computation
90 102 ---------------------------------
... ... @@ -103,6 +115,12 @@ The chatter level is now correctly forwarded to the PSF cube fill method (#2262)
103 115  
104 116 ctselect - CTA event selection
105 117 ------------------------------
  118 +Any .gz suffix is now correctly stripped from the event filenames when creating
  119 +the output filenames (#2287).
  120 +
  121 +ctselect now informs about non-overlapping time interval; before the time interval
  122 +was set to [0,0] which was disturbing and eventually incorrect (#2272).
  123 +
106 124 Use t-type parameters for "tmin" and "tmax" to all specifying times in various
107 125 formats (#1864).
108 126  
... ... @@ -124,11 +142,18 @@ Add "statistic" parameter to allow setting of optimizer statistic (#2237).
124 142  
125 143 ctulimit - Compute upper limit
126 144 ------------------------------
  145 +The tool now also computes correct upper flux limits for diffuse map cubes
  146 +for which the spectral component is a normalization of the spectral information
  147 +available in the map cube (#2298).
  148 +
127 149 Add "statistic" parameter to allow setting of optimizer statistic (#2237).
128 150  
129 151  
130 152 support - Support classes
131 153 -------------------------
  154 +Change DATE_OBS, DATE_END, TIME_OBS and TIME_END FITS keywords into DATA-OBS,
  155 +DATE-END, TIME-OBS and TIME-END.
  156 +
132 157 Add ctobservation.obs() method to set an observation container.
133 158  
134 159  
... ... @@ -214,11 +239,16 @@ None
214 239  
215 240 csobsselect - Select observations
216 241 ---------------------------------
217   -None
  242 +Add tmin and tmax parameters to allow selection of observation by time (#2297).
218 243  
219 244  
220 245 csphagen - Generate On/Off observations
221 246 ---------------------------------------
  247 +The CUSTOM background method was added to allow specifying On and Off regions
  248 +from a region file or FITS WCS map. For multiple observations, a custom Off
  249 +region per observation can be specified in the observation definition XML file
  250 +using the OffRegions parameter (#2284).
  251 +
222 252 The script was added to allow the generation of PHA, ARF and RMF datasets for classical On/Off IACT analysis (#2208).
223 253  
224 254  
... ... @@ -252,6 +282,11 @@ csresmap - Generate residual map
252 282 None
253 283  
254 284  
  285 +csresspec - Generate residual spectrum
  286 +--------------------------------------
  287 +Add script to generate a residual spectrum (#2289)
  288 +
  289 +
255 290 csroot2caldb - Generates calibration database from ROOT file
256 291 ------------------------------------------------------------
257 292 None
... ... @@ -291,8 +326,14 @@ The script now derives from the csobservation base class. A "statistic"
291 326 parameter was added to allow setting the optimizer statistic for the Test
292 327 Statistic distribution generation (#2237).
293 328  
294   -Use t-type parameters for "tmin" and "tmax" to all specifying times in various
295   -formats (#1864).
  329 +The parameter interface was considerably revised, in particular the following
  330 +parameters were removed: "ra", "dec", "rad", "coordsys", "proj", "emin",
  331 +"emax", "enumbins", "tmin", "tmax", "npix" and "binsz". The "inobs" parameter
  332 +is now always queried. The script now reads in an observation or an observation
  333 +container and derives the TS distribution for a source based on that observation
  334 +container. So far the script supports unbinned, binned and stacked observations.
  335 +If an observation definition XML file is specified the script assumes that all
  336 +observations are event lists (#1567).
296 337  
297 338  
298 339 cstsmapmerge - Merge Test Statistic maps
... ...
README.md
1 1 ctools information
2 2 ==================
3   -* Version: 1.5.0.dev1 (1 August 2017)
  3 +* Version: 1.6.0.dev1 (1 August 2017)
4 4 * Author: Juergen Knoedlseder (jurgen.knodlseder@irap.omp.eu)
5   -* GammaLib dependency: 1.5.0.dev1
  5 +* GammaLib dependency: 1.6.0.dev1
6 6  
7 7 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/)
8 8  
... ...
configure.ac
... ... @@ -28,7 +28,7 @@
28 28 #############################################################################
29 29 # Initialisation #
30 30 #############################################################################
31   -AC_INIT([ctools], [1.5.0.dev1], [jurgen.knodlseder@irap.omp.eu], [ctools])
  31 +AC_INIT([ctools], [1.6.0.dev1], [jurgen.knodlseder@irap.omp.eu], [ctools])
32 32 AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp])
33 33 AC_CONFIG_MACRO_DIR([m4])
34 34 #AM_INIT_AUTOMAKE([gnu no-dependencies foreign])
... ... @@ -54,7 +54,7 @@ AC_CONFIG_HEADER([config.h])
54 54 # 5. If any interfaces have been removed or changed since the last public #
55 55 # release, then set age to 0. #
56 56 #############################################################################
57   -CTOOLS_LT_VERSION="4:1:0"
  57 +CTOOLS_LT_VERSION="5:0:0"
58 58 AC_SUBST(CTOOLS_LT_VERSION)
59 59  
60 60  
... ...
cscripts/Makefile.am
1 1 #############################################################################
2 2 # Makefile for cscripts scripts #
3 3 # ------------------------------------------------------------------------- #
4   -# Copyright (C) 2016-2017 Juergen Knoedlseder #
  4 +# Copyright (C) 2016-2018 Juergen Knoedlseder #
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # This program is free software: you can redistribute it and/or modify #
... ... @@ -37,6 +37,7 @@ pythonscripts = $(top_builddir)/cscripts/__init__.py \
37 37 $(srcdir)/csphasecrv.py \
38 38 $(srcdir)/cspull.py \
39 39 $(srcdir)/csresmap.py \
  40 + $(srcdir)/csresspec.py \
40 41 $(srcdir)/csroot2caldb.py \
41 42 $(srcdir)/cssens.py \
42 43 $(srcdir)/csspec.py \
... ... @@ -71,6 +72,7 @@ parfiles = $(srcdir)/cscaldb.par \
71 72 $(srcdir)/csphasecrv.par \
72 73 $(srcdir)/cspull.par \
73 74 $(srcdir)/csresmap.par \
  75 + $(srcdir)/csresspec.par \
74 76 $(srcdir)/csroot2caldb.par \
75 77 $(srcdir)/cssens.par \
76 78 $(srcdir)/csspec.par \
... ... @@ -102,6 +104,7 @@ linkscripts = cscaldb \
102 104 csphasecrv \
103 105 cspull \
104 106 csresmap \
  107 + csresspec \
105 108 csroot2caldb \
106 109 cssens \
107 110 csspec \
... ... @@ -138,6 +141,7 @@ testscripts = $(srcdir)/tests/__init__.py \
138 141 $(top_srcdir)/test/test_csphasecrv.py \
139 142 $(top_srcdir)/test/test_cspull.py \
140 143 $(top_srcdir)/test/test_csresmap.py \
  144 + $(top_srcdir)/test/test_csresspec.py \
141 145 $(top_srcdir)/test/test_csroot2caldb.py \
142 146 $(top_srcdir)/test/test_cssens.py \
143 147 $(top_srcdir)/test/test_csspec.py \
... ... @@ -168,6 +172,8 @@ testdata = $(top_srcdir)/test/data/crab.xml \
168 172 $(top_srcdir)/test/data/crab_offaxis1.fits.gz \
169 173 $(top_srcdir)/test/data/crab_offaxis2.fits.gz \
170 174 $(top_srcdir)/test/data/crab_exclusion.fits.gz \
  175 + $(top_srcdir)/test/data/crab_src_reg.reg \
  176 + $(top_srcdir)/test/data/crab_bkg_reg.reg \
171 177 $(top_srcdir)/test/data/tsmap_0.fits \
172 178 $(top_srcdir)/test/data/tsmap_1.fits \
173 179 $(top_srcdir)/test/data/exclusion.reg \
... ... @@ -189,6 +195,8 @@ testdata = $(top_srcdir)/test/data/crab.xml \
189 195 $(top_srcdir)/test/data/sensitivity_integral.dat \
190 196 $(top_srcdir)/test/data/skymap.fits \
191 197 $(top_srcdir)/test/data/spectrum.fits \
  198 + $(top_srcdir)/test/data/residual.fits \
  199 + $(top_srcdir)/test/data/residual_onoff.fits \
192 200 $(top_srcdir)/test/data/lightcurve.fits \
193 201 $(top_srcdir)/test/data/ts.dat \
194 202 $(top_srcdir)/test/data/models_spatial.xml \
... ...
cscripts/__init__.py.in
1 1 # ==========================================================================
2 2 # cscripts Python module
3 3 #
4   -# Copyright (C) 2015-2017 Juergen Knoedlseder
  4 +# Copyright (C) 2015-2018 Juergen Knoedlseder
5 5 #
6 6 # This program is free software: you can redistribute it and/or modify
7 7 # it under the terms of the GNU General Public License as published by
... ... @@ -40,6 +40,7 @@ __all__ = [
40 40 "csphasecrv",
41 41 "cspull",
42 42 "csresmap",
  43 + "csresspec",
43 44 "csroot2caldb",
44 45 "cssens",
45 46 "csspec",
... ... @@ -77,6 +78,7 @@ from cscripts.csphagen import csphagen
77 78 from cscripts.csphasecrv import csphasecrv
78 79 from cscripts.cspull import cspull
79 80 from cscripts.csresmap import csresmap
  81 +from cscripts.csresspec import csresspec
80 82 from cscripts.csroot2caldb import csroot2caldb
81 83 from cscripts.cssens import cssens
82 84 from cscripts.csspec import csspec
... ...
cscripts/cscaldb.par
... ... @@ -18,6 +18,6 @@
18 18 #====================
19 19 chatter, i, h, 2,0,4, "Chattiness of output"
20 20 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
21   -debug, b, h, no,,, "Debugging mode activated"
  21 +debug, b, h, no,,, "Activate debugging mode?"
22 22 mode, s, h, ql,,, "Mode of automatic parameters"
23 23 logfile, f, h, cscaldb.log,,, "Log filename"
... ...
cscripts/csebins.par
... ... @@ -34,6 +34,6 @@ bkgthres, r, h, 0.5,,, "Fractional background rate change threshold"
34 34 #====================
35 35 chatter, i, h, 2,0,4, "Chattiness of output"
36 36 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
37   -debug, b, h, no,,, "Debugging mode activated"
  37 +debug, b, h, no,,, "Activate debugging mode?"
38 38 mode, s, h, ql,,, "Mode of automatic parameters"
39 39 logfile, f, h, csebins.log,,, "Log filename"
... ...
cscripts/csfindobs.par
... ... @@ -24,7 +24,7 @@ outfile, f, a, runlist.lis,,, "Output runlist file"
24 24 # Script parameters
25 25 #==================
26 26 ra, r, a, 83.63,,, "Right ascension of selection region centre (deg)"
27   -dec, r, a, 22.01,,, "Declination of selection region centre (deg)"
  27 +dec, r, a, 22.51,,, "Declination of selection region centre (deg)"
28 28 rad, r, a, 2.5,,, "Search radius of selection region (deg)"
29 29 min_qual, i, h, 0,0|1|2,, "Minimum data quality (0=perfect, 1=ok, 2=bad)"
30 30 expression, s, h, NONE,,, "Additional expression"
... ... @@ -35,7 +35,7 @@ master_indx, s, h, master.json,,, "Name of master index file"
35 35 #====================
36 36 chatter, i, h, 2,0,4, "Chattiness of output"
37 37 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
38   -debug, b, h, no,,, "Debugging mode activated"
  38 +debug, b, h, no,,, "Activate debugging mode?"
39 39 mode, s, h, ql,,, "Mode of automatic parameters"
40 40 logfile, f, h, csfindobs.log,,, "Log filename"
41 41  
... ...
cscripts/csiactcopy.par
... ... @@ -26,6 +26,6 @@ outpath, s, a, /path/to/fits,,, "Destination path of FITS data"
26 26 #====================
27 27 chatter, i, h, 2,0,4, "Chattiness of output"
28 28 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
29   -debug, b, h, no,,, "Debugging mode activated"
  29 +debug, b, h, no,,, "Activate debugging mode?"
30 30 mode, s, h, ql,,, "Mode of automatic parameters"
31 31 logfile, f, h, csiactcopy.log,,, "Log filename"
... ...
cscripts/csiactdata.par
... ... @@ -24,7 +24,7 @@ master_indx, s, h, master.json,,, "Name of master index file"
24 24 #====================
25 25 chatter, i, h, 2,0,4, "Chattiness of output"
26 26 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
27   -debug, b, h, no,,, "Debugging mode activated"
  27 +debug, b, h, no,,, "Activate debugging mode?"
28 28 mode, s, h, ql,,, "Mode of automatic parameters"
29 29 logfile, f, h, csiactdata.log,,, "Log filename"
30 30  
... ...
cscripts/csiactobs.par
... ... @@ -47,7 +47,7 @@ bkg_range_factor, r, h, 100.0,,, "Factor to determine range of background normal
47 47 #====================
48 48 chatter, i, h, 2,0,4, "Chattiness of output"
49 49 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
50   -debug, b, h, no,,, "Debugging mode activated"
  50 +debug, b, h, no,,, "Activate debugging mode?"
51 51 mode, s, h, ql,,, "Mode of automatic parameters"
52 52 logfile, f, h, csiactobs.log,,, "Log filename"
53 53  
... ...
cscripts/cslightcrv.par
... ... @@ -16,14 +16,14 @@
16 16 #
17 17 # Input and output parameters
18 18 #============================
19   -inobs, f, a, events.fits,,, "Input event list or observation definition XML file"
20   -inmodel, f, a, $CTOOLS/share/models/crab.xml,,, "Input model definition XML file"
21   -srcname, s, a, Crab,,, "Source name"
22   -caldb, s, a, prod2,,, "Calibration database"
23   -irf, s, a, South_0.5h,,, "Instrument response function"
24   -inexclusion, f, h, NONE,,, "Sky map of exclusion regions for On/Off analysis"
25   -edisp, b, h, no,,, "Apply energy dispersion in Cube analysis?"
26   -outfile, f, a, lightcurve.fits,,, "Output light curve file"
  19 +inobs, f, a, events.fits,,, "Input event list or observation definition XML file"
  20 +inmodel, f, a, $CTOOLS/share/models/crab.xml,,, "Input model definition XML file"
  21 +srcname, s, a, Crab,,, "Source name"
  22 +caldb, s, a, prod2,,, "Calibration database"
  23 +irf, s, a, South_0.5h,,, "Instrument response function"
  24 +inexclusion, f, h, NONE,,, "Sky map of exclusion regions for On/Off analysis"
  25 +edisp, b, h, no,,, "Apply energy dispersion in Cube analysis?"
  26 +outfile, f, a, lightcurve.fits,,, "Output light curve file"
27 27  
28 28 #
29 29 # Script parameters
... ... @@ -40,7 +40,7 @@ enumbins, i, a, 0,0,100, "Number of energy bins for binned (0=unbinned for 3D a
40 40 coordsys, s, a, CEL,CEL|GAL,, "Coordinate System"
41 41 proj, s, a, CAR,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
42 42 xref, r, a, 83.63,0,360, "First coordinate of image/source region center in degrees (RA or galactic l)"
43   -yref, r, a, 22.01,-90,90, "Second coordinate of image/source region center in degrees (DEC or galactic b)"
  43 +yref, r, a, 22.51,-90,90, "Second coordinate of image/source region center in degrees (DEC or galactic b)"
44 44 nxpix, i, a, 200,,, "Size of the X axis in pixels"
45 45 nypix, i, a, 200,,, "Size of the Y axis in pixels"
46 46 binsz, r, a, 0.02,,, "Pixel size (deg/pixel)"
... ... @@ -64,7 +64,7 @@ fix_bkg, b, h, no,,, "Fix background model parameters?"
64 64 publish, b, h, no,,, "Publish light curve on VO Hub?"
65 65 chatter, i, h, 2,0,4, "Chattiness of output"
66 66 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
67   -debug, b, h, no,,, "Debugging mode activated"
  67 +debug, b, h, no,,, "Activate debugging mode?"
68 68 mode, s, h, ql,,, "Mode of automatic parameters"
69 69 logfile, f, h, cslightcrv.log,,, "Log filename"
70 70  
... ...
cscripts/cslightcrv.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Generates a lightcurve.
4 4 #
5   -# Copyright (C) 2014-2017 Michael Mayer
  5 +# Copyright (C) 2014-2018 Michael Mayer
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -107,7 +107,6 @@ class cslightcrv(ctools.csobservation):
107 107 # Set On/Off analysis flag and query relevant user parameters
108 108 self._onoff = self._is_onoff()
109 109  
110   - # If cube analysis is selected
111 110 # Set stacked analysis flag and query relevant user parameters
112 111 if not self._onoff:
113 112 self._stacked = self._is_stacked()
... ... @@ -174,8 +173,8 @@ class cslightcrv(ctools.csobservation):
174 173 elif algorithm == 'LIN':
175 174  
176 175 # Get start and stop time and number of time bins
177   - time_min = self['tmin'].time(self._time_reference())
178   - time_max = self['tmax'].time(self._time_reference())
  176 + time_min = self['tmin'].time(ctools.time_reference)
  177 + time_max = self['tmax'].time(ctools.time_reference)
179 178 nbins = self['tbins'].integer()
180 179  
181 180 # Compute time step in seconds and setup the GTIs
... ... @@ -386,8 +385,8 @@ class cslightcrv(ctools.csobservation):
386 385 select = ctools.ctselect(self.obs())
387 386 select['emin'] = self['emin'].real()
388 387 select['emax'] = self['emax'].real()
389   - select['tmin'] = tmin.convert(self._time_reference())
390   - select['tmax'] = tmax.convert(self._time_reference())
  388 + select['tmin'] = tmin.convert(ctools.time_reference)
  389 + select['tmax'] = tmax.convert(ctools.time_reference)
391 390 select['rad'] = 'UNDEFINED'
392 391 select['ra'] = 'UNDEFINED'
393 392 select['dec'] = 'UNDEFINED'
... ... @@ -445,8 +444,8 @@ class cslightcrv(ctools.csobservation):
445 444 select = ctools.ctselect(self.obs())
446 445 select['emin'] = self['emin'].real()
447 446 select['emax'] = self['emax'].real()
448   - select['tmin'] = tmin.convert(self._time_reference())
449   - select['tmax'] = tmax.convert(self._time_reference())
  447 + select['tmin'] = tmin.convert(ctools.time_reference)
  448 + select['tmax'] = tmax.convert(ctools.time_reference)
450 449 select['rad'] = 'UNDEFINED'
451 450 select['ra'] = 'UNDEFINED'
452 451 select['dec'] = 'UNDEFINED'
... ... @@ -558,12 +557,12 @@ class cslightcrv(ctools.csobservation):
558 557 # fill results table with zeros
559 558 else:
560 559 self._log_value(gammalib.TERSE, 'Warning',
561   - 'No observations available in this time bin',
562   - 'Skip bin.')
  560 + 'No observations available in this time bin, '
  561 + 'skip bin.')
563 562  
564 563 # Set all results to 0
565 564 for par in pars:
566   - result['values'][par] = 0.0
  565 + result['values'][par] = 0.0
567 566 result['values']['e_' + par] = 0.0
568 567  
569 568 # Append result
... ...
cscripts/csmodelinfo.par
... ... @@ -39,6 +39,6 @@ fixed_color, s, h, magenta,,, "Color for source without free parameters (any D
39 39 #====================
40 40 chatter, i, h, 2,0,4, "Chattiness of output"
41 41 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
42   -debug, b, h, no,,, "Debugging mode activated"
  42 +debug, b, h, no,,, "Activate debugging mode?"
43 43 mode, s, h, ql,,, "Mode of automatic parameters"
44 44 logfile, f, h, csmodelinfo.log,,, "Log filename"
... ...
cscripts/csmodelmerge.par
... ... @@ -24,6 +24,6 @@ outmodel, f, a, NONE,,, "Output model definition XML file"
24 24 #====================
25 25 chatter, i, h, 2,0,4, "Chattiness of output"
26 26 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
27   -debug, b, h, no,,, "Debugging mode activated"
  27 +debug, b, h, no,,, "Activate debugging mode?"
28 28 mode, s, h, ql,,, "Mode of automatic parameters"
29 29 logfile, f, h, csmodelmerge.log,,, "Log filename"
... ...
cscripts/csmodelselect.par
... ... @@ -36,6 +36,6 @@ fit_shape, b, h, no,,, "Fit source shapes?"
36 36 #====================
37 37 chatter, i, h, 2,0,4, "Chattiness of output"
38 38 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
39   -debug, b, h, no,,, "Debugging mode activated"
  39 +debug, b, h, no,,, "Activate debugging mode?"
40 40 mode, s, h, ql,,, "Mode of automatic parameters"
41 41 logfile, f, h, csmodelselect.log,,, "Log filename"
... ...
cscripts/csmodelsois.par
... ... @@ -50,6 +50,6 @@ glat, r, a, -5.80,-90,90, "Galactic latitude of image center (in degrees)"
50 50 publish, b, h, no,,, "Publish map cube on VO Hub?"
51 51 chatter, i, h, 2,0,4, "Chattiness of output"
52 52 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
53   -debug, b, h, no,,, "Debugging mode activated"
54   -mode, s, h, "ql",,, "Mode of automatic parameters"
55   -logfile, f, h, "csmodelsois.log",,, "Log filename"
  53 +debug, b, h, no,,, "Activate debugging mode?"
  54 +mode, s, h, ql,,, "Mode of automatic parameters"
  55 +logfile, f, h, csmodelsois.log,,, "Log filename"
... ...
cscripts/csobs2caldb.par
... ... @@ -28,6 +28,6 @@ index, i, h, 0,,, "Index of observation to be used from XML file"
28 28 #====================
29 29 chatter, i, h, 2,0,4, "Chattiness of output"
30 30 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
31   -debug, b, h, no,,, "Debugging mode activated"
  31 +debug, b, h, no,,, "Activate debugging mode?"
32 32 mode, s, h, ql,,, "Mode of automatic parameters"
33 33 logfile, f, h, csobs2caldb.log,,, "Log filename"
... ...
cscripts/csobsdef.par
... ... @@ -36,6 +36,6 @@ deadc, r, h, 0.98,,, "Deadtime correction factor"
36 36 #====================
37 37 chatter, i, h, 2,0,4, "Chattiness of output"
38 38 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
39   -debug, b, h, no,,, "Debugging mode activated"
  39 +debug, b, h, no,,, "Activate debugging mode?"
40 40 mode, s, h, ql,,, "Mode of automatic parameters"
41 41 logfile, f, h, csobsdef.log,,, "Log filename"
... ...
cscripts/csobsdef.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Generation of an observation definition file
4 4 #
5   -# Copyright (C) 2015-2017 Juergen Knoedlseder
  5 +# Copyright (C) 2015-2018 Juergen Knoedlseder
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -274,9 +274,9 @@ class csobsdef(ctools.cscript):
274 274 duration = self['duration'].real()
275 275 tmin = self._tmin
276 276 tmax = self._tmin + duration
277   - gti = gammalib.GGti(self._time_reference())
278   - tstart = gammalib.GTime(tmin, self._time_reference())
279   - tstop = gammalib.GTime(tmax, self._time_reference())
  277 + gti = gammalib.GGti(ctools.time_reference)
  278 + tstart = gammalib.GTime(tmin, ctools.time_reference)
  279 + tstop = gammalib.GTime(tmax, ctools.time_reference)
280 280 self._tmin = tmax
281 281 gti.append(tstart, tstop)
282 282 obs.ontime(gti.ontime())
... ...
cscripts/csobsinfo.par
... ... @@ -31,6 +31,6 @@ dec, r, a, 0.0,,, "Target Declination (deg)")
31 31 #====================
32 32 chatter, i, h, 2,0,4, "Chattiness of output"
33 33 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
34   -debug, b, h, no,,, "Debugging mode activated"
  34 +debug, b, h, no,,, "Activate debugging mode?"
35 35 mode, s, h, ql,,, "Mode of automatic parameters"
36 36 logfile, f, h, csobsinfo.log,,, "Log filename"
... ...
cscripts/csobsinfo.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Dump information about observation into log file
4 4 #
5   -# Copyright (C) 2015-2017 Michael Mayer
  5 +# Copyright (C) 2015-2018 Michael Mayer
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -291,8 +291,8 @@ class csobsinfo(ctools.csobservation):
291 291 # Log time range
292 292 mjd = '%.3f - %.3f' % (self._gti.tstart().mjd(), self._gti.tstop().mjd())
293 293 utc = '%s - %s' % (self._gti.tstart().utc(), self._gti.tstop().utc())
294   - met = '%.3f - %.3f' % (self._gti.tstart().convert(self._time_reference()),
295   - self._gti.tstop().convert(self._time_reference()))
  294 + met = '%.3f - %.3f' % (self._gti.tstart().convert(ctools.time_reference),
  295 + self._gti.tstop().convert(ctools.time_reference))
296 296 self._log_header3(gammalib.NORMAL, 'Time range')
297 297 self._log_value(gammalib.NORMAL, 'MJD (days)', mjd)
298 298 self._log_value(gammalib.NORMAL, 'UTC', utc)
... ...
cscripts/csobsselect.par
... ... @@ -31,12 +31,14 @@ glat, r, a, -5.79,-90,90, "Galactic latitude of selection centre (deg)"
31 31 rad, r, a, 5.0,0,180, "Radius of selection circle (deg)"
32 32 width, r, a, 10.0,0,360, "Width of selection box (deg)"
33 33 height, r, a, 10.0,0,180, "Height of selection box (deg)"
  34 +tmin, t, a, NONE,,, "Start time (UTC string, JD, MJD or MET in seconds)"
  35 +tmax, t, a, NONE,,, "Stop time (UTC string, JD, MJD or MET in seconds)"
34 36  
35 37 #
36 38 # Standard parameters
37 39 #====================
38 40 chatter, i, h, 2,0,4, "Chattiness of output"
39 41 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
40   -debug, b, h, no,,, "Debugging mode activated"
  42 +debug, b, h, no,,, "Activate debugging mode?"
41 43 mode, s, h, ql,,, "Mode of automatic parameters"
42 44 logfile, f, h, csobsselect.log,,, "Log filename"
... ...
cscripts/csobsselect.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Selects observations from an observation definition XML file
4 4 #
5   -# Copyright (C) 2016-2017 Juergen Knoedlseder
  5 +# Copyright (C) 2016-2018 Juergen Knoedlseder
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -68,6 +68,9 @@ class csobsselect(ctools.csobservation):
68 68 self['width'].real()
69 69 self['height'].real()
70 70  
  71 + # Query time interval
  72 + self._get_gti()
  73 +
71 74 # Query ahead output model filename
72 75 if self._read_ahead():
73 76 self['outobs'].filename()
... ... @@ -83,7 +86,34 @@ class csobsselect(ctools.csobservation):
83 86 # Return
84 87 return
85 88  
86   - def _select_observation(self, obs):
  89 + def _log_selection(self, obs, msg):
  90 + """
  91 + Log observation selection
  92 +
  93 + Parameters
  94 + ----------
  95 + obs : `~gammalib.GObservation`
  96 + Observation
  97 + msg : str
  98 + Message
  99 + """
  100 + # Set observation name
  101 + if len(obs.name()) > 0:
  102 + name = obs.name()
  103 + else:
  104 + name = 'Observation'
  105 +
  106 + # Prepend obervation ID
  107 + if len(obs.id()) > 0:
  108 + msg = obs.id()+' '+msg
  109 +
  110 + # Log observation selection
  111 + self._log_value(gammalib.NORMAL, name, msg)
  112 +
  113 + # Return
  114 + return
  115 +
  116 + def _select_observation(self, obs, gti):
87 117 """
88 118 Select observation
89 119  
... ... @@ -91,6 +121,8 @@ class csobsselect(ctools.csobservation):
91 121 ----------
92 122 obs : `~gammalib.GObservation`
93 123 Observation
  124 + gti : `~gammalib.GGti`
  125 + Good time intervals
94 126  
95 127 Returns
96 128 -------
... ... @@ -103,14 +135,27 @@ class csobsselect(ctools.csobservation):
103 135 # Continue only if observation is a CTA observation
104 136 if obs.classname() == 'GCTAObservation':
105 137  
106   - # Get selection type
107   - pntselect = self['pntselect'].string()
  138 + # Get observation start and stop time
  139 + obs_gti = obs.gti()
  140 + tstart = obs_gti.tstart()
  141 + tstop = obs_gti.tstop()
  142 +
  143 + # If the observation is not within the time selection then skip it
  144 + if gti.size() > 0 and not gti.contains(tstart) and \
  145 + not gti.contains(tstop):
  146 + self._log_selection(obs, 'outside time interval')
108 147  
109   - # Dispatch according to selection type
110   - if pntselect == 'CIRCLE':
111   - select = self._select_circle(obs)
  148 + # ... otherwise select spatially
112 149 else:
113   - select = self._select_box(obs)
  150 +
  151 + # Get selection type
  152 + pntselect = self['pntselect'].string()
  153 +
  154 + # Dispatch according to selection type
  155 + if pntselect == 'CIRCLE':
  156 + select = self._select_circle(obs)
  157 + else:
  158 + select = self._select_box(obs)
114 159  
115 160 # Return selection flag
116 161 return select
... ... @@ -150,18 +195,8 @@ class csobsselect(ctools.csobservation):
150 195 select = False
151 196 msg = 'outside selection circle'
152 197  
153   - # Set observation name
154   - if len(obs.name()) > 0:
155   - name = obs.name()
156   - else:
157   - name = 'Observation'
158   -
159   - # Prepend obervation ID
160   - if len(obs.id()) > 0:
161   - msg = obs.id()+' '+msg
162   -
163 198 # Log observation selection
164   - self._log_value(gammalib.NORMAL, name, msg)
  199 + self._log_selection(obs, msg)
165 200  
166 201 # Return selection flag
167 202 return select
... ... @@ -240,18 +275,8 @@ class csobsselect(ctools.csobservation):
240 275 select = True
241 276 msg = 'inside selection box'
242 277  
243   - # Set observation name
244   - if len(obs.name()) > 0:
245   - name = obs.name()
246   - else:
247   - name = 'Observation'
248   -
249   - # Prepend obervation ID
250   - if len(obs.id()) > 0:
251   - msg = obs.id()+' '+msg
252   -
253 278 # Log observation selection
254   - self._log_value(gammalib.NORMAL, name, msg)
  279 + self._log_selection(obs, msg)
255 280  
256 281 # Return selection flag
257 282 return select
... ... @@ -269,6 +294,9 @@ class csobsselect(ctools.csobservation):
269 294 # Get parameters
270 295 self._get_parameters()
271 296  
  297 + # Get Good Time Interval (empty if no time selection is applied)
  298 + gti = self._get_gti()
  299 +
272 300 # Initialise empty observation container for selected observations
273 301 selected_obs = gammalib.GObservations()
274 302  
... ... @@ -282,7 +310,7 @@ class csobsselect(ctools.csobservation):
282 310 for obs in self.obs():
283 311  
284 312 # If observation is selected then append observation
285   - if self._select_observation(obs):
  313 + if self._select_observation(obs, gti):
286 314 selected_obs.append(obs)
287 315  
288 316 # Copy selected observations into observation
... ...
cscripts/csphagen.par
... ... @@ -26,31 +26,33 @@ prefix, s, h, onoff,,, "Prefix for output files"
26 26 #
27 27 # Script parameters
28 28 #==================
29   -emin, r, a, 0.1,,, "Lower energy limit (TeV)"
30   -emax, r, a, 100.0,,, "Upper energy limit (TeV)"
31   -enumbins, i, a, 120,,, "Number of energy bins"
32   -ebinalg, s, a, LOG,LIN|LOG|FILE,, "Binning algorithm"
33   -ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition"
34   -srcshape, s, h, CIRCLE,CIRCLE,, "Shape of the source region"
35   -coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
36   -ra, r, a, 83.63,0,360, "Right Ascension of source region centre (deg)"
37   -dec, r, a, 22.01,-90,90, "Declination of source region centre (deg)"
38   -glon, r, a, 184.56,0,360, "Galactic longitude of source region centre (deg)"
39   -glat, r, a, -5.79,-90,90, "Galactic latitude of source region centre (deg)"
40   -rad, r, a, 0.2,0,180, "Radius of source region circle (deg)"
41   -bkgmethod, s, h, REFLECTED,REFLECTED,, "Method for background estimation"
42   -bkgregmin, i, h, 2,1,1000, "Minimum number of background regions"
43   -maxoffset, r, h, 4.0,,, "Maximum offset of source from camera center to accept observation"
44   -stack, b, a, no,,, "Stack multiple observations into single PHA, ARF and RMF files?"
45   -etruemin, r, h, 0.01,,, "Minimum true energy (TeV)"
46   -etruemax, r, h, 300.0,,, "Maximum true energy (TeV)"
47   -etruebins, i, h, 30,,, "Number of bins per decade for true energy bins"
  29 +ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins"
  30 +emin, r, a, 0.1,,, "Start value for first energy bin in TeV"
  31 +emax, r, a, 100.0,,, "Stop value for last energy bin in TeV"
  32 +enumbins, i, a, 120,,, "Number of energy bins"
  33 +ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition"
  34 +srcshape, s, h, CIRCLE,CIRCLE,, "Shape of the source region"
  35 +coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
  36 +ra, r, a, 83.63,0,360, "Right Ascension of source region centre (deg)"
  37 +dec, r, a, 22.01,-90,90, "Declination of source region centre (deg)"
  38 +glon, r, a, 184.56,0,360, "Galactic longitude of source region centre (deg)"
  39 +glat, r, a, -5.79,-90,90, "Galactic latitude of source region centre (deg)"
  40 +rad, r, a, 0.2,0,180, "Radius of source region circle (deg)"
  41 +srcregfile, f, a, on.reg,,, "Source region file (ds9 or FITS WCS)"
  42 +bkgmethod, s, a, REFLECTED,REFLECTED|CUSTOM,, "Method for background estimation"
  43 +bkgregfile, f, a, bkg.reg,,, "Background regions file (ds9 or FITS WCS)"
  44 +bkgregmin, i, h, 2,1,1000, "Minimum number of background regions"
  45 +maxoffset, r, h, 4.0,,, "Maximum offset of source from camera center to accept observation"
  46 +stack, b, a, no,,, "Stack multiple observations into single PHA, ARF and RMF files?"
  47 +etruemin, r, h, 0.01,,, "Minimum true energy (TeV)"
  48 +etruemax, r, h, 300.0,,, "Maximum true energy (TeV)"
  49 +etruebins, i, h, 30,,, "Number of bins per decade for true energy bins"
48 50  
49 51 #
50 52 # Standard parameters
51 53 #====================
52 54 chatter, i, h, 2,0,4, "Chattiness of output"
53 55 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
54   -debug, b, h, no,,, "Debugging mode activated"
  56 +debug, b, h, no,,, "Activate debugging mode?"
55 57 mode, s, h, ql,,, "Mode of automatic parameters"
56 58 logfile, f, h, csphagen.log,,, "Log filename"
... ...
cscripts/csphagen.py
... ... @@ -3,7 +3,7 @@
3 3 # Computes the PHA spectra for source/background and ARF/RMF files using the
4 4 # reflected region method
5 5 #
6   -# Copyright (C) 2017 Luigi Tibaldo
  6 +# Copyright (C) 2017-2018 Luigi Tibaldo
7 7 #
8 8 # This program is free software: you can redistribute it and/or modify
9 9 # it under the terms of the GNU General Public License as published by
... ... @@ -54,21 +54,14 @@ class csphagen(ctools.csobservation):
54 54 # Return
55 55 return
56 56  
  57 +
57 58 # Private methods
58   - def _get_parameters(self):
  59 + def _query_src_direction(self):
59 60 """
60   - Get parameters from parfile and setup observations
  61 + Set up the source direction parameter.
  62 + Query relevant parameters.
61 63 """
62   - # Setup observations (require response and allow event list, don't
63   - # allow counts cube)
64   - self._setup_observations(self.obs(), True, True, False)
65   -
66   - # Set energy bounds
67   - self._ebounds = self._create_ebounds()
68   -
69   - # Initialise source position/region querying relevant parameters
70 64 self._src_dir = gammalib.GSkyDir()
71   - self._src_reg = gammalib.GSkyRegions()
72 65 coordsys = self['coordsys'].string()
73 66 if coordsys == 'CEL':
74 67 ra = self['ra'].real()
... ... @@ -78,17 +71,100 @@ class csphagen(ctools.csobservation):
78 71 glon = self['glon'].real()
79 72 glat = self['glat'].real()
80 73 self._src_dir.lb_deg(glon, glat)
  74 +
  75 + def _get_parameters_bkgmethod_reflected(self):
  76 + """
  77 + Get parameters for REFLECTED background method
  78 + """
  79 + # Get source shape
81 80 self._srcshape = self['srcshape'].string()
  81 +
  82 + # Set source region (so far only CIRCLE is supported)
82 83 if self._srcshape == 'CIRCLE':
  84 +
  85 + # Query source direction
  86 + self._query_src_direction()
  87 +
  88 + # Query minimum number of background regions
  89 + self['bkgregmin'].integer()
  90 +
  91 + # Set circular source region
83 92 self._rad = self['rad'].real()
84 93 self._src_reg.append(gammalib.GSkyRegionCircle(self._src_dir, self._rad))
85 94  
86   - # Query background estimation method and parameters
  95 + # Return
  96 + return
  97 +
  98 + def _get_parameters_bkgmethod_custom(self):
  99 + """
  100 + Get parameters for CUSTOM background method
  101 +
  102 + Raises
  103 + ------
  104 + RuntimeError
  105 + Only one On region is allowed
  106 + """
  107 + # Set up source region
  108 + filename = self['srcregfile'].filename()
  109 + self._src_reg = gammalib.GSkyRegions(filename)
  110 +
  111 + # Raise an exception if there is more than one source region
  112 + if len(self._src_reg) != 1:
  113 + raise RuntimeError('Only one On region is allowed')
  114 +
  115 + # Set up source direction. Query parameters if neccessary.
  116 + if isinstance(self._src_reg[0], gammalib.GSkyRegionCircle):
  117 + self._src_dir = self._src_reg[0].centre()
  118 + self._rad = self._src_reg[0].radius()
  119 + else:
  120 + self._query_src_direction()
  121 +
  122 + # Make sure that all CTA observations have an Off region by loading the
  123 + # Off region region the parameter 'bkgregfile' for all CTA observations
  124 + # without Off region
  125 + for obs in self.obs():
  126 + if obs.instrument() == 'CTA':
  127 + if obs.off_regions().is_empty():
  128 + filename = self['bkgregfile'].filename()
  129 + regions = gammalib.GSkyRegions(filename)
  130 + obs.off_regions(regions)
  131 +
  132 + # Return
  133 + return
  134 +
  135 + def _get_parameters_bkgmethod(self):
  136 + """
  137 + Get background method parameters
  138 + """
  139 + # Get background method
87 140 bkgmethod = self['bkgmethod'].string()
  141 +
  142 + # Get background method dependent parameters
88 143 if bkgmethod == 'REFLECTED':
89   - self['bkgregmin'].integer()
  144 + self._get_parameters_bkgmethod_reflected()
  145 + elif bkgmethod == 'CUSTOM':
  146 + self._get_parameters_bkgmethod_custom()
  147 +
  148 + # Query parameters that are needed for all background methods
90 149 self['maxoffset'].real()
91 150  
  151 + # Return
  152 + return
  153 +
  154 + def _get_parameters(self):
  155 + """
  156 + Get parameters from parfile and setup observations
  157 + """
  158 + # Setup observations (require response and allow event list, don't
  159 + # allow counts cube)
  160 + self._setup_observations(self.obs(), True, True, False)
  161 +
  162 + # Set energy bounds
  163 + self._ebounds = self._create_ebounds()
  164 +
  165 + # Initialize empty src regions container
  166 + self._src_reg = gammalib.GSkyRegions()
  167 +
92 168 # Exclusion map
93 169 if self['inexclusion'].filename().is_fits():
94 170 self._excl_reg = gammalib.GSkyRegionMap(self['inexclusion'].filename())
... ... @@ -109,6 +185,10 @@ class csphagen(ctools.csobservation):
109 185 if self.obs().is_empty():
110 186 self.obs(self._get_observations(False))
111 187  
  188 + # Get background method parameters (have to come after setting up of
  189 + # observations)
  190 + self._get_parameters_bkgmethod()
  191 +
112 192 # Write input parameters into logger
113 193 self._log_parameters(gammalib.TERSE)
114 194  
... ... @@ -247,6 +327,38 @@ class csphagen(ctools.csobservation):
247 327 # Return energy boundaries
248 328 return ebounds
249 329  
  330 + def _set_background_regions(self, obs):
  331 + """
  332 + Set background regions for an observation
  333 +
  334 + Parameters
  335 + ----------
  336 + obs : `~gammalib.GCTAObservation()`
  337 + CTA observation
  338 +
  339 + Returns
  340 + -------
  341 + regions : `~gammalib.GSkyRegions()`
  342 + Background regions
  343 + """
  344 + # Initialise empty background regions for this observation
  345 + bkg_reg = gammalib.GSkyRegions()
  346 +
  347 + # If reflected background is requested then created reflected
  348 + # background regions
  349 + if self['bkgmethod'].string() == 'REFLECTED':
  350 + bkg_reg = self._reflected_regions(obs)
  351 +
  352 + # ... otherwise if custom background is requested then get the
  353 + # background regions from the observation. We use a copy here since
  354 + # otherwise the background regions go out of scope once the observations
  355 + # are replaced by the On/Off observations.
  356 + elif self['bkgmethod'].string() == 'CUSTOM':
  357 + bkg_reg = obs.off_regions().copy()
  358 +
  359 + # Return background regions
  360 + return bkg_reg
  361 +
250 362  
251 363 # Public methods
252 364 def run(self):
... ... @@ -286,15 +398,20 @@ class csphagen(ctools.csobservation):
286 398 # Loop through observations and generate pha, arf, rmf files
287 399 for obs in self.obs():
288 400  
289   - # Initialise background regions for this observation
290   - bkg_reg = gammalib.GSkyRegions()
  401 + # Skip non CTA observations
  402 + if obs.instrument() != 'CTA':
  403 + self._log_string(gammalib.NORMAL, 'Skip %s observation "%s"' % \
  404 + (obs.instrument(), obs.id()))
  405 + continue
  406 +
  407 + # Log current observation
  408 + self._log_string(gammalib.NORMAL, 'Process observation "%s"' % \
  409 + (obs.id()))
291 410  
292   - # If reflected background is requested then created reflected
293   - # background regions
294   - if self['bkgmethod'].string() == 'REFLECTED':
295   - bkg_reg = self._reflected_regions(obs)
  411 + # Set background regions for this observation
  412 + bkg_reg = self._set_background_regions(obs)
296 413  
297   - # If there are reflected regions then create On/Off observation
  414 + # If there are background regions then create On/Off observation
298 415 # and append it to the output container
299 416 if bkg_reg.size() >= self['bkgregmin'].integer():
300 417 onoff = gammalib.GCTAOnOffObservation(obs, self._src_dir,
... ...
cscripts/csphasecrv.par
... ... @@ -38,7 +38,7 @@ enumbins, i, a, 0,0,100, "Number of energy bins for binned (0=unbinned for 3D a
38 38 coordsys, s, a, CEL,CEL|GAL,, "Coordinate System"
39 39 proj, s, a, CAR,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
40 40 xref, r, a, 83.63,0,360, "First coordinate of image/source region center in degrees (RA or galactic l)"
41   -yref, r, a, 22.01,-90,90, "Second coordinate of image/source region center in degrees (DEC or galactic b)"
  41 +yref, r, a, 22.51,-90,90, "Second coordinate of image/source region center in degrees (DEC or galactic b)"
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)"
... ... @@ -58,7 +58,7 @@ statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
58 58 publish, b, h, no,,, "Publish phase curve on VO Hub?"
59 59 chatter, i, h, 2,0,4, "Chattiness of output"
60 60 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
61   -debug, b, h, no,,, "Debugging mode activated"
  61 +debug, b, h, no,,, "Activate debugging mode?"
62 62 mode, s, h, ql,,, "Mode of automatic parameters"
63 63 logfile, f, h, csphasecrv.log,,, "Log filename"
64 64  
... ...
cscripts/cspull.par
... ... @@ -31,7 +31,7 @@ outfile, f, a, pull.dat,,, "Output pull distribution file"
31 31 #==================
32 32 ntrials, i, a, 10,,, "Number of trials"
33 33 ra, r, a, 83.6331,0,360, "RA of pointing (degrees)"
34   -dec, r, a, 22.0145,-90,90, "Dec of pointing (degrees)"
  34 +dec, r, a, 22.5145,-90,90, "Dec of pointing (degrees)"
35 35 rad, r, h, 5.0,0,180, "Radius of ROI (degrees)"
36 36 coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
37 37 proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
... ... @@ -51,6 +51,6 @@ seed, i, h, 1,,, "Initial random number generator seed"
51 51 #====================
52 52 chatter, i, h, 2,0,4, "Chattiness of output"
53 53 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
54   -debug, b, h, no,,, "Debugging mode activated"
  54 +debug, b, h, no,,, "Activate debugging mode?"
55 55 mode, s, h, ql,,, "Mode of automatic parameters"
56 56 logfile, f, h, cspull.log,,, "Log filename"
... ...
cscripts/csresmap.par
... ... @@ -31,7 +31,7 @@ outmap, f, a, resmap.fits,,, "Output residual map file"
31 31 #
32 32 # Script parameters
33 33 #==================
34   -ebinalg, s, h, LOG,LIN|LOG|FILE,, "Binning algorithm"
  34 +ebinalg, s, h, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins"
35 35 emin, r, a, 0.1,,, "Lower energy limit (TeV)"
36 36 emax, r, a, 100.0,,, "Upper energy limit (TeV)"
37 37 enumbins, i, h, 20,,, "Number of model cube energy bins"
... ... @@ -39,7 +39,7 @@ ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition"
39 39 coordsys, s, a, CEL,CEL|GAL,, "Coordinate System"
40 40 proj, s, a, CAR,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
41 41 xref, r, a, 83.63,0,360, "First coordinate of image center in degrees (RA or galactic l)"
42   -yref, r, a, 22.01,-90,90, "Second coordinate of image center in degrees (DEC or galactic b)"
  42 +yref, r, a, 22.51,-90,90, "Second coordinate of image center in degrees (DEC or galactic b)"
43 43 nxpix, i, a, 200,,, "Size of the X axis in pixels"
44 44 nypix, i, a, 200,,, "Size of the Y axis in pixels"
45 45 binsz, r, a, 0.02,,, "Pixel size (deg/pixel)"
... ... @@ -51,6 +51,6 @@ algorithm, s, a, SIGNIFICANCE,SUB|SUBDIV|SUBDIVSQRT|SIGNIFICANCE,, "Residual map
51 51 publish, b, h, no,,, "Publish residual map on VO Hub?"
52 52 chatter, i, h, 2,0,4, "Chattiness of output"
53 53 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
54   -debug, b, h, no,,, "Debugging mode activated"
  54 +debug, b, h, no,,, "Activate debugging mode?"
55 55 mode, s, h, ql,,, "Mode of automatic parameters"
56 56 logfile, f, h, csresmap.log,,, "Log filename"
... ...
cscripts/csresmap.py
... ... @@ -19,9 +19,9 @@
19 19 #
20 20 # ==========================================================================
21 21 import sys
22   -import math
23 22 import gammalib
24 23 import ctools
  24 +from cscripts import obsutils
25 25  
26 26  
27 27 # ============== #
... ... @@ -209,67 +209,14 @@ class csresmap(ctools.csobservation):
209 209 # Get model map into GSkyMap object
210 210 modelmap = model.cube().counts().copy()
211 211  
212   - # Store counts map as residual map. Note that we need a special
  212 + # Calculate residual maps
  213 + # Note that we need a special
213 214 # construct here to avoid memory leaks. This seems to be a SWIG feature
214 215 # as SWIG creates a new object when calling binning.cube()
215   - self._resmap = countmap.copy()
216   - self._resmap.stack_maps()
  216 + countmap1 = countmap.copy()
  217 + countmap1.stack_maps()
217 218 modelmap.stack_maps()
218   -
219   - # Get residual map algorithm type
220   - algorithm = self['algorithm'].string()
221   -
222   - # Subtract maps
223   - if algorithm == 'SUB':
224   - self._resmap -= modelmap
225   -
226   - # Subtract and divide by model map
227   - elif algorithm == 'SUBDIV':
228   - self._resmap -= modelmap
229   - self._resmap /= modelmap
230   -
231   - # Subtract and divide by sqrt of model map
232   - elif algorithm == 'SUBDIVSQRT':
233   - self._resmap -= modelmap
234   - self._resmap /= modelmap.sqrt()
235   -
236   - # Calculate significance from Li&Ma derivation
237   - elif algorithm == 'SIGNIFICANCE':
238   -
239   - # Compute sign map
240   - signmap = (self._resmap - modelmap).sign()
241   -
242   - # Loop over every bin in the map
243   - for i in range(self._resmap.npix()):
244   -
245   - # If the model value > 0.0 do the computation as normal ...
246   - model_val = modelmap[i]
247   - if model_val > 0.0:
248   -
249   - # If the data value is also > 0 then compute the
250   - # significance^2 and save it to the map ...
251   - data_val = self._resmap[i]
252   - if data_val > 0.0:
253   - log_val = math.log(data_val/model_val)
254   - self._resmap[i] = (data_val*log_val) + model_val - data_val
255   -
256   - # ... otherwise compute the reduced value of the above
257   - # expression. This is necessary to avoid computing log(0).
258   - else:
259   - self._resmap[i] = model_val
260   -
261   - # ... otherwise hard-code the significance to 0
262   - else:
263   - self._resmap[i] = 0.0
264   -
265   - # Compute significance map
266   - self._resmap *= 2.0
267   - self._resmap = self._resmap.sqrt()
268   - self._resmap = self._resmap * signmap
269   -
270   - # Raise exception if algorithm is unknown
271   - else:
272   - raise TypeError('Algorithm "'+algorithm+'" not known')
  219 + self._resmap = obsutils.residuals(self,countmap1,modelmap)
273 220  
274 221 # Optionally publish map
275 222 if self['publish'].boolean():
... ...
cscripts/csresspec.par 0 โ†’ 100644
  1 +#############################################################################
  2 +# #
  3 +# CTA Science Analysis Tools #
  4 +# #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# File: csresspec.par #
  8 +# #
  9 +# Author: Luigi Tibaldo #
  10 +# luigi.tibaldo@irap.omp.eu #
  11 +# IRAP #
  12 +# #
  13 +# Purpose: Parameter file for the csresspec script #
  14 +# #
  15 +#############################################################################
  16 +#
  17 +# Input and output parameters
  18 +#============================
  19 +inobs, f, a, events.fits,,, "Input event list, counts cube, or observation definition XML file"
  20 +inmodel, f, a, $CTOOLS/share/models/crab.xml,,, "Input model definition XML file"
  21 +modcube, f, a, NONE,,, "Input model cube file (generated with ctmodel)"
  22 +expcube, f, a, NONE,,, "Input exposure cube file"
  23 +psfcube, f, a, NONE,,, "Input PSF cube file"
  24 +edispcube, f, a, NONE,,, "Input energy dispersion cube file"
  25 +bkgcube, f, a, NONE,,, "Input background cube file"
  26 +caldb, s, a, prod2,,, "Calibration database"
  27 +irf, s, a, South_0.5h,,, "Instrument response function"
  28 +edisp, b, h, no,,, "Apply energy dispersion?"
  29 +outfile, f, a, resspec.fits,,, "Output residual spectrum file"
  30 +
  31 +#
  32 +# Script parameters
  33 +#==================
  34 +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
  35 +components,b, h, no,,, "Calculate model for individual components?"
  36 +ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins"
  37 +emin, r, a, 0.1,,, "Start value for first energy bin in TeV"
  38 +emax, r, a, 100.0,,, "Stop value for last energy bin in TeV"
  39 +enumbins, i, a, 20,1,200, "Number of energy bins"
  40 +ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition"
  41 +stack, b, a, no,,, "Stack observations?"
  42 +coordsys, s, a, CEL,CEL|GAL,, "Coordinate System"
  43 +proj, s, a, CAR,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
  44 +xref, r, a, 83.63,0,360, "First coordinate of image/source region center in degrees (RA or galactic l)"
  45 +yref, r, a, 22.51,-90,90, "Second coordinate of image/source region center in degrees (DEC or galactic b)"
  46 +nxpix, i, a, 200,,, "Size of the X axis in pixels"
  47 +nypix, i, a, 200,,, "Size of the Y axis in pixels"
  48 +binsz, r, a, 0.02,,, "Pixel size (deg/pixel)"
  49 +mask, b, a, no,,, "Mask data to calculate residuals in ROI?"
  50 +ra, r, a, 83.63,0,360, "RA for ROI centre (degrees)"
  51 +dec, r, a, 22.01,-90,90, "Dec for ROI centre (degrees)"
  52 +rad, r, a, 3.0,0,180, "Radius of ROI (degrees)"
  53 +regfile, f, a, NONE,,, "Input exclusion region file in ds9 format"
  54 +algorithm, s, a, SIGNIFICANCE,SUB|SUBDIV|SUBDIVSQRT|SIGNIFICANCE,, "Residuals computation algorithm"
  55 +
  56 +#
  57 +# Standard parameters
  58 +#====================
  59 +publish, b, h, no,,, "Publish residual map on VO Hub?"
  60 +chatter, i, h, 2,0,4, "Chattiness of output"
  61 +clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
  62 +debug, b, h, no,,, "Activate debugging mode?"
  63 +mode, s, h, ql,,, "Mode of automatic parameters"
  64 +logfile, f, h, csresspec.log,,, "Log filename"
... ...
cscripts/csresspec.py 0 โ†’ 100755
  1 +#! /usr/bin/env python
  2 +# ==========================================================================
  3 +# Generates a residual spectrum.
  4 +#
  5 +# Copyright (C) 2017-2018 Luigi Tibaldo
  6 +#
  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
  9 +# the Free Software Foundation, either version 3 of the License, or
  10 +# (at your option) any later version.
  11 +#
  12 +# This program is distributed in the hope that it will be useful,
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 +# GNU General Public License for more details.
  16 +#
  17 +# You should have received a copy of the GNU General Public License
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
  19 +#
  20 +# ==========================================================================
  21 +import gammalib
  22 +import ctools
  23 +from cscripts import obsutils
  24 +import sys
  25 +
  26 +
  27 +# =============== #
  28 +# csresspec class #
  29 +# =============== #
  30 +class csresspec(ctools.csobservation):
  31 + """
  32 + Generates a residual spectrum
  33 + """
  34 +
  35 + # Constructor
  36 + def __init__(self, *argv):
  37 + """
  38 + Constructor
  39 + """
  40 + # Initialise application by calling the appropriate class constructor
  41 + self._init_csobservation(self.__class__.__name__, ctools.__version__,
  42 + argv)
  43 +
  44 + # Initialise class members
  45 + self._use_maps = False
  46 + self._stack = False
  47 + self._mask = False
  48 + self._fits = gammalib.GFits()
  49 +
  50 + # Return
  51 + return
  52 +
  53 + # Private methods
  54 + def _get_parameters(self):
  55 + """
  56 + Get parameters from parfile and setup the observation
  57 + """
  58 + # Setup observations (require response and allow event list as well as
  59 + # counts cube)
  60 + self._setup_observations(self.obs(), True, True, True)
  61 +
  62 + # Set observation statistic
  63 + self._set_obs_statistic(gammalib.toupper(self['statistic'].string()))
  64 +
  65 + # Collect number of unbinned, binned and On/Off observations in
  66 + # observation container
  67 + n_unbinned = 0
  68 + n_binned = 0
  69 + n_onoff = 0
  70 + for obs in self.obs():
  71 + if obs.classname() == 'GCTAObservation':
  72 + if obs.eventtype() == 'CountsCube':
  73 + n_binned += 1
  74 + else:
  75 + n_unbinned += 1
  76 + elif obs.classname() == 'GCTAOnOffObservation':
  77 + n_onoff += 1
  78 + n_cta = n_unbinned + n_binned + n_onoff
  79 + n_other = self.obs().size() - n_cta
  80 +
  81 + # Query whether to compute model for individual components
  82 + components = self['components'].boolean()
  83 +
  84 + # If there is only one binned observation and no model for individual
  85 + # components is required, query for precomputed model file and set
  86 + # use_maps to True
  87 + if self.obs().size() == 1 and n_binned == 1 and not components:
  88 + modcube = self['modcube'].filename()
  89 + if modcube != 'NONE':
  90 + self._use_maps = True
  91 +
  92 + # If there are unbinned observations query the energy binning parameters
  93 + if n_unbinned != 0:
  94 + self['ebinalg'].string()
  95 + if self['ebinalg'].string() == 'FILE':
  96 + self['ebinfile'].filename()
  97 + else:
  98 + self['emin'].real()
  99 + self['emax'].real()
  100 + self['enumbins'].integer()
  101 + if n_cta > n_unbinned:
  102 + n_notunbin = n_cta - n_unbinned
  103 +
  104 + # If there is more than one observation, and observations are all
  105 + # unbinned or all onoff query user to know if they wish stacked results
  106 + if self.obs().size() > 1 and \
  107 + (n_unbinned == self.obs().size() or n_onoff == self.obs().size()):
  108 + self._stack = self['stack'].boolean()
  109 + # If we are to stack event lists query parameters for cube creation
  110 + if self._stack and n_unbinned == self.obs().size():
  111 + self['coordsys'].string()
  112 + self['proj'].string()
  113 + self['xref'].real()
  114 + self['yref'].real()
  115 + self['nxpix'].integer()
  116 + self['nypix'].integer()
  117 + self['binsz'].real()
  118 +
  119 + # If we are not using a precomputed model and no models are available
  120 + # in the observation container query input XML model file
  121 + if not self._use_maps and self.obs().models().size() == 0:
  122 + self.obs().models(self['inmodel'].filename())
  123 +
  124 + # Unless all observations are On/Off query for mask definition
  125 + if n_onoff == n_cta:
  126 + pass
  127 + else:
  128 + self._mask = self['mask'].boolean()
  129 + if self._mask:
  130 + self['ra'].real()
  131 + self['dec'].real()
  132 + self['rad'].real()
  133 + self['regfile'].filename()
  134 +
  135 + # Unless all observations are On/Off, or we are using precomputed model
  136 + # maps query whether to use energy dispersion
  137 + if n_onoff == n_cta or self._use_maps:
  138 + pass
  139 + else:
  140 + self['edisp'].boolean()
  141 +
  142 + # Query algorithm for residual computation
  143 + self['algorithm'].string()
  144 +
  145 + # Read ahead output parameters
  146 + if self._read_ahead():
  147 + self['outfile'].filename()
  148 +
  149 + # Write input parameters into logger
  150 + self._log_parameters(gammalib.TERSE)
  151 +
  152 + # Write header for observation census
  153 + self._log_header1(gammalib.TERSE, 'Observation census')
  154 +
  155 + # Log census of input observations
  156 + self._log_value(gammalib.NORMAL, 'Unbinned CTA observations', n_unbinned)
  157 + self._log_value(gammalib.NORMAL, 'Binned CTA observations', n_binned)
  158 + self._log_value(gammalib.NORMAL, 'On/off CTA observations', n_onoff)
  159 + self._log_value(gammalib.NORMAL, 'Other observations', n_other)
  160 + if n_other > 0:
  161 + msg = 'WARNING: Only CTA observation can be handled, all non-CTA ' \
  162 + + 'observations will be ignored.'
  163 + self._log_string(gammalib.TERSE, msg)
  164 +
  165 + # Log for unbinned observations
  166 + if n_unbinned != 0:
  167 + msg = ' User defined energy binning will be used for %d unbinned '\
  168 + 'observations.' % (n_unbinned)
  169 + self._log_string(gammalib.TERSE, msg)
  170 + if n_cta > n_unbinned:
  171 + msg = ' The intrinsic binning will be used for the remaining '\
  172 + '%d CTA observations.' % (n_notunbin)
  173 + self._log_string(gammalib.TERSE, msg)
  174 +
  175 + # Signal how energy dispersion is applied
  176 + if n_onoff == n_cta or self._use_maps:
  177 + msg = ' Energy dispersion is applied based on the input data/model ' \
  178 + + 'and not according to the edisp parameter'
  179 + self._log_string(gammalib.TERSE, msg)
  180 +
  181 + # Return
  182 + return
  183 +
  184 + def _stack_observations(self):
  185 + """
  186 + Stack multiple observations and replace observation container
  187 + with single stacked observation
  188 +
  189 + Returns
  190 + -------
  191 + obs : `~gammalib.GObservations'
  192 + Observation container with a single stacked observation
  193 + """
  194 + # Use first observation to determine the type and apply the
  195 + # appropriate stacking method
  196 +
  197 + # If On/Off use the GCTAOnOffObservation constructor
  198 + if self.obs()[0].classname() == 'GCTAOnOffObservation':
  199 + msg = 'Stacking %d On/Off observations.' % (self.obs().size())
  200 + self._log_string(gammalib.NORMAL, msg)
  201 + stacked = gammalib.GCTAOnOffObservation(self.obs())
  202 + stacked_obs = gammalib.GObservations()
  203 + stacked_obs.append(stacked)
  204 + stacked_obs.models(self.obs().models())
  205 +
  206 + # If event list then bin observations
  207 + elif self.obs()[0].classname() == 'GCTAObservation':
  208 + msg = 'Stacking %d event lists.' % (self.obs().size())
  209 + self._log_string(gammalib.NORMAL, msg)
  210 + stacked_obs = obsutils.get_stacked_obs(self, self.obs())
  211 +
  212 + # Return
  213 + return stacked_obs
  214 +
  215 + def _bin_evlist(self, obs):
  216 + """
  217 + Turn single event list into counts cube
  218 +
  219 + Parameters
  220 + ----------
  221 + obs : `~gammalib.GObservations()`
  222 + Observation container with single event list
  223 +
  224 + Returns
  225 + -------
  226 + obs : `~gammalib.GObservations()`
  227 + Binned observation container dict with event list ROI and energy
  228 + range information
  229 + """
  230 + # Retrieve information about ROI in event list
  231 + roi = obs[0].roi()
  232 + ra = roi.centre().dir().ra_deg()
  233 + dec = roi.centre().dir().dec_deg()
  234 + rad = roi.radius()
  235 +
  236 + # We will cover the whole ROI with 0.02 deg binning
  237 + npix = int(2.0 * rad / 0.02) + 1
  238 +
  239 + # Log binning of events
  240 + self._log_string(gammalib.EXPLICIT, 'Binning events')
  241 +
  242 + # Bin events
  243 + cntcube = ctools.ctbin(obs)
  244 + cntcube['xref'] = ra
  245 + cntcube['yref'] = dec
  246 + cntcube['binsz'] = 0.02
  247 + cntcube['nxpix'] = npix
  248 + cntcube['nypix'] = npix
  249 + cntcube['proj'] = 'TAN'
  250 + cntcube['coordsys'] = 'CEL'
  251 + cntcube['ebinalg'] = self['ebinalg'].string()
  252 + if self['ebinalg'].string() == 'FILE':
  253 + cntcube['ebinfile'] = self['ebinfile'].filename()
  254 + else:
  255 + cntcube['enumbins'] = self['enumbins'].integer()
  256 + cntcube['emin'] = self['emin'].real()
  257 + cntcube['emax'] = self['emax'].real()
  258 + cntcube.run()
  259 +
  260 + # Retrieve the binned observation container
  261 + binned_obs = cntcube.obs().copy()
  262 +
  263 + # Log response computation
  264 + self._log_string(gammalib.EXPLICIT, 'Computing binned response')
  265 +
  266 + # Compute binned response
  267 + response = obsutils.get_stacked_response(obs, ra, dec,
  268 + binsz=0.02,
  269 + nxpix=npix,
  270 + nypix=npix,
  271 + coordsys='CEL',
  272 + proj='TAN',
  273 + emin=self['emin'].real(),
  274 + emax=self['emax'].real(),
  275 + edisp=self['edisp'].boolean())
  276 +
  277 + if self['edisp'].boolean():
  278 + binned_obs[0].response(response['expcube'], response['psfcube'],
  279 + response['edispcube'], response['bkgcube'])
  280 + else:
  281 + binned_obs[0].response(response['expcube'], response['psfcube'],
  282 + response['bkgcube'])
  283 +
  284 + # Get new models
  285 + models = response['models']
  286 +
  287 + # Set models for observation container
  288 + binned_obs.models(models)
  289 +
  290 + # Check if energy boundaries provided by user extend beyond
  291 + # the content of the event list
  292 + if self['emin'].real() > obs[0].events().emin().TeV():
  293 + emin = 'INDEF'
  294 + else:
  295 + emin = obs[0].events().emin().TeV()
  296 + if self['emax'].real() < obs[0].events().emax().TeV():
  297 + emax = 'INDEF'
  298 + else:
  299 + emax = obs[0].events().emax().TeV()
  300 +
  301 + # Put ROI and E bound info in dictionary
  302 + info = {'was_list': True, 'roi_ra': ra, 'roi_dec': dec, 'roi_rad': rad,
  303 + 'emin': emin, 'emax': emax}
  304 +
  305 + # Return new oberservation container
  306 + return binned_obs, info
  307 +
  308 + def _masked_cube(self, cube, ra, dec, rad, emin='INDEF', emax='INDEF',
  309 + regfile='NONE'):
  310 + """
  311 + Mask an event cube and returns the masked cube
  312 +
  313 + Parameters
  314 + ----------
  315 + cube : `~gammalib.GCTAEventCube()`
  316 + Event cube
  317 + ra : float (str 'INDEF' for no selection on direction)
  318 + Right Ascension (deg)
  319 + dec : float (str 'INDEF' for no selection on direction)
  320 + Declination (deg)
  321 + rad : float (str 'INDEF' for no selection on direction)
  322 + Radius (deg)
  323 + emin : float (str 'INDEF' for no selection on energy)
  324 + Minimum energy (TeV)
  325 + emax : float (str 'INDEF' for no selection on energy)
  326 + Maximum energy (TeV)
  327 +
  328 + Returns
  329 + -------
  330 + cube : `~gammalib.GCTAEventCube()`
  331 + Event cube
  332 + """
  333 + # Turn cube into observation container to feed to ctcubemask
  334 + obs = gammalib.GCTAObservation()
  335 + obs.events(cube)
  336 + obs_cont = gammalib.GObservations()
  337 + obs_cont.append(obs)
  338 +
  339 + # Use ctcubemask to mask event cube pixels
  340 + cubemask = ctools.ctcubemask(obs_cont)
  341 + cubemask['ra'] = ra
  342 + cubemask['dec'] = dec
  343 + cubemask['rad'] = rad
  344 + cubemask['emin'] = emin
  345 + cubemask['emax'] = emax
  346 + cubemask['regfile'] = regfile
  347 + cubemask.run()
  348 +
  349 + # Extract copy of cube from observation container (copy is needed to
  350 + # avoid memory leaks in SWIG)
  351 + cube = cubemask.obs()[0].events().copy()
  352 +
  353 + # Return cube
  354 + return cube
  355 +
  356 + def _cube_to_spectrum(self, cube, evlist_info):
  357 + """
  358 + Derive from event cube a count spectrum
  359 +
  360 + If data come from event list use only the ROI and energy range of
  361 + the original data. Apply user defined mask if requested.
  362 +
  363 + Parameters
  364 + ----------
  365 + cube : `~gammalib.GCTAEventCube()`
  366 + Event cube
  367 + evlist_info : dict
  368 + Dictionary with information on original event list
  369 +
  370 + Returns
  371 + -------
  372 + array : `~gammalib.GNdarray()'
  373 + Counts spectrum
  374 + """
  375 + # If we started from event list mask the ROI only
  376 + # for residual computation
  377 + if evlist_info['was_list']:
  378 + msg = 'Masking ROI from original event list'
  379 + self._log_string(gammalib.EXPLICIT, msg)
  380 + cube = self._masked_cube(cube, evlist_info['roi_ra'],
  381 + evlist_info['roi_dec'],
  382 + evlist_info['roi_rad'],
  383 + emin=evlist_info['emin'],
  384 + emax=evlist_info['emax'])
  385 +
  386 + # Apply user mask
  387 + if self._mask:
  388 + msg = 'Masking ROI requested by user'
  389 + self._log_string(gammalib.EXPLICIT, msg)
  390 + cube = self._masked_cube(cube, self['ra'], self['dec'],
  391 + self['rad'],
  392 + regfile=self['regfile'])
  393 +
  394 + # Extract skymap and clip at 0 to null masked areas
  395 + counts = cube.counts().copy()
  396 + counts = counts.clip(0.)
  397 +
  398 + # Convert skymap into GNdarray count spectrum
  399 + counts = counts.counts()
  400 +
  401 + # Return
  402 + return counts
  403 +
  404 + def _residuals_table(self, obs_id, ebounds, counts, model, residuals):
  405 + """
  406 + Create a Fits Table and store counts, model, and residuals
  407 +
  408 + Parameters
  409 + ----------
  410 + obs_id : str
  411 + Observation id
  412 + ebounds : `~gammalib.GEbounds()'
  413 + Energy boundaries
  414 + counts : `~gammalib.GNdarray()'
  415 + Counts spectrum
  416 + model : `~gammalib.GNdarray()'
  417 + Model spectrum
  418 + residuals : `~gammalib.GNdarray()'
  419 + Residual spectrum
  420 +
  421 + Returns
  422 + -------
  423 + table : `~gammalib.GFitsBinTable()'
  424 + Residual spectrum as FITS binary table
  425 + """
  426 + # Create FITS table columns
  427 + nrows = ebounds.size()
  428 + energy_low = gammalib.GFitsTableDoubleCol('Emin', nrows)
  429 + energy_high = gammalib.GFitsTableDoubleCol('Emax', nrows)
  430 + counts_col = gammalib.GFitsTableDoubleCol('Counts', nrows)
  431 + model_col = gammalib.GFitsTableDoubleCol('Model', nrows)
  432 + resid_col = gammalib.GFitsTableDoubleCol('Residuals', nrows)
  433 + energy_low.unit('TeV')
  434 + energy_high.unit('TeV')
  435 +
  436 + # Fill FITS table columns
  437 + for i in range(nrows):
  438 + energy_low[i] = ebounds.emin(i).TeV()
  439 + energy_high[i] = ebounds.emax(i).TeV()
  440 + counts_col[i] = counts[i]
  441 + model_col[i] = model[i]
  442 + resid_col[i] = residuals[i]
  443 +
  444 + # Initialise FITS Table with extension set to obs id
  445 + table = gammalib.GFitsBinTable(nrows)
  446 + # If name not empty add leading blank
  447 + if obs_id != '':
  448 + obs_id = ' ' + obs_id
  449 + table.extname('RESIDUALS' + obs_id)
  450 +
  451 + # Add Header card to specify algorithm used for residual computation
  452 + table.card('ALGORITHM', self['algorithm'].string(),
  453 + 'Algorithm used for computation of residuals')
  454 +
  455 + # Append filled columns to fits table
  456 + table.append(energy_low)
  457 + table.append(energy_high)
  458 + table.append(counts_col)
  459 + table.append(model_col)
  460 + table.append(resid_col)
  461 +
  462 + # Return binary table
  463 + return table
  464 +
  465 + def _append_column(self, table, name, data):
  466 + """
  467 + Append optional column to residual table
  468 +
  469 + Parameters
  470 + ----------
  471 + table : `~gammalib.GFitsBinTable()'
  472 + FITS binary table
  473 + name : str
  474 + Column name
  475 + data : `~gammalib.GEbounds()'
  476 + Data to be filled into new column
  477 +
  478 + Returns
  479 + -------
  480 + table : `~gammalib.GFitsBinTable()'
  481 + FITS binary table
  482 + """
  483 + # Check size compatibility
  484 + if table.nrows() == data.size():
  485 + pass
  486 + # Otherwise throw error
  487 + else:
  488 + msg = 'csresspec._append_column: FITS table and data have ' \
  489 + 'incompatible size.'
  490 + raise RuntimeError(msg)
  491 +
  492 + # Create column
  493 + column = gammalib.GFitsTableDoubleCol(name, table.nrows())
  494 +
  495 + # Fill data
  496 + for i, value in enumerate(data):
  497 + column[i] = value
  498 +
  499 + # Append new column to table
  500 + table.append(column)
  501 +
  502 + # Return modified table
  503 + return table
  504 +
  505 +
  506 + # Public methods
  507 + def run(self):
  508 + """
  509 + Run the script
  510 + """
  511 + # Switch screen logging on in debug mode
  512 + if self._logDebug():
  513 + self._log.cout(True)
  514 +
  515 + # Get parameters
  516 + self._get_parameters()
  517 +
  518 + # Write observation into logger
  519 + self._log_observations(gammalib.NORMAL, self.obs(), 'Observation')
  520 +
  521 + # Stack observations if requested
  522 + if self._stack:
  523 + self._log_header1(gammalib.TERSE, 'Stacking Observations')
  524 + self.obs(self._stack_observations())
  525 +
  526 + # Log processing header
  527 + self._log_header1(gammalib.TERSE, 'Processing Observations')
  528 +
  529 + # Loop over observations and calculate residuals
  530 + for s, observation in enumerate(self.obs()):
  531 +
  532 + # Retrieve and store obs id
  533 + obs_id = observation.id()
  534 +
  535 + # If observation id is empty and there is more than one observation
  536 + # replace with incremental number
  537 + if obs_id == '' and self.obs().size() > 1:
  538 + obs_id = str(s)
  539 +
  540 + # Log processing of observation
  541 + if self.obs().size() > 1:
  542 + self._log_header2(gammalib.NORMAL,
  543 + 'Processing observation %s' % obs_id)
  544 +
  545 + # Turn into observation container and assign models
  546 + obs = gammalib.GObservations()
  547 + obs.append(observation)
  548 + obs.models(self.obs().models())
  549 +
  550 + # if 3D observation
  551 + if obs[0].classname() == 'GCTAObservation':
  552 +
  553 + # Prepare Observations
  554 +
  555 + # If already binned set the evlist_info dictionary to have
  556 + # attribute was_list False
  557 + if obs[0].eventtype() == 'CountsCube':
  558 + evlist_info = {'was_list': False}
  559 + # Otherwise bin now
  560 + else:
  561 + # we remember if we binned an event list
  562 + # so that we can mask only the ROI for residual calculation
  563 + msg = 'Setting up binned observation'
  564 + self._log_string(gammalib.NORMAL, msg)
  565 + obs, evlist_info = self._bin_evlist(obs)
  566 +
  567 + # Calculate Model and residuals
  568 + # If model cube is provided load it
  569 + if self._use_maps:
  570 + modcube = gammalib.GCTAEventCube(self['inmodel'].filename())
  571 + # Otherwise calculate it now
  572 + else:
  573 + msg = 'Computing model cube'
  574 + self._log_string(gammalib.NORMAL, msg)
  575 + modelcube = ctools.ctmodel(obs)
  576 + modelcube.run()
  577 + modcube = modelcube.cube().copy()
  578 +
  579 + # Extract cntcube for residual computation
  580 + cntcube = obs[0].events().copy()
  581 +
  582 + # Derive count spectra from cubes
  583 + msg = 'Computing counts, model, and residual spectra'
  584 + self._log_string(gammalib.NORMAL, msg)
  585 + counts = self._cube_to_spectrum(cntcube, evlist_info)
  586 + model = self._cube_to_spectrum(modcube, evlist_info)
  587 +
  588 + # Calculate residuals
  589 + residuals = obsutils.residuals(self, counts, model)
  590 +
  591 + # Extract energy bounds
  592 + ebounds = cntcube.ebounds()
  593 +
  594 + # Fill results table
  595 + msg = 'Filling residual table'
  596 + self._log_string(gammalib.NORMAL, msg)
  597 + table = self._residuals_table(obs_id, ebounds, counts, model,
  598 + residuals)
  599 +
  600 + # Calculate models of individual components if requested
  601 + if self['components'].boolean():
  602 + for component in obs.models():
  603 + self._log_value(gammalib.NORMAL,
  604 + 'Computing model for component',
  605 + component.name())
  606 + # Set model cube models to
  607 + # individual component
  608 + model_cont = gammalib.GModels()
  609 + model_cont.append(component)
  610 + modelcube.obs().models(model_cont)
  611 +
  612 + # Run model cube
  613 + modelcube.run()
  614 +
  615 + # Extract spectrum of individual component
  616 + modcube = modelcube.cube().copy()
  617 + model = self._cube_to_spectrum(modcube, evlist_info)
  618 +
  619 + # append component to table
  620 + table = self._append_column(table, component.name(),
  621 + model)
  622 +
  623 + # otherwise, if On/Off
  624 + elif obs[0].classname() == 'GCTAOnOffObservation':
  625 +
  626 + onoff = obs[0]
  627 +
  628 + # Calculate Counts, Model and residuals
  629 + msg = 'Computing counts, model, and residual spectra'
  630 + self._log_string(gammalib.NORMAL, msg)
  631 +
  632 + # On spectrum
  633 + counts = onoff.on_spec().counts_spectrum()
  634 +
  635 + # Model for On region
  636 + background = onoff.model_background(obs.models()).counts_spectrum()
  637 + alpha = onoff.on_spec().backscal_spectrum()
  638 + model = background.copy()
  639 + model *= alpha
  640 + model += onoff.model_gamma(obs.models()).counts_spectrum()
  641 +
  642 + # On Residuals
  643 + residuals = obsutils.residuals(self, counts, model)
  644 +
  645 + # Extract energy bounds
  646 + ebounds = onoff.on_spec().ebounds()
  647 +
  648 + # Fill results table
  649 + msg = 'Filling residual table'
  650 + self._log_string(gammalib.NORMAL, msg)
  651 + table = self._residuals_table(obs_id, ebounds, counts, model,
  652 + residuals)
  653 +
  654 + # Get Off spectrum and add to table
  655 + msg = 'Computing counts, model, and residual spectra for Off regions'
  656 + self._log_string(gammalib.NORMAL, msg)
  657 + counts_off = onoff.off_spec().counts_spectrum()
  658 + table = self._append_column(table, 'Counts_Off',
  659 + counts_off)
  660 +
  661 + # Add background/Off model to table
  662 + table = self._append_column(table, 'Model_Off',
  663 + background)
  664 +
  665 + # Calculate Off residuals and add to table
  666 + residuals_off = obsutils.residuals(self, counts_off, background)
  667 + table = self._append_column(table, 'Residuals_Off',
  668 + residuals_off)
  669 +
  670 + # Calculate models of individual components if requested
  671 + if self['components'].boolean():
  672 + for component in obs.models():
  673 + # If background pass
  674 + # We always add the background at the end so that
  675 + # we accommodate WSTAT for which the background is not
  676 + # mandatory in the model
  677 + if component.classname() == 'GCTAModelIrfBackground':
  678 + pass
  679 + # Otherwise calculate gamma component and append to Table
  680 + else:
  681 + self._log_value(gammalib.NORMAL,
  682 + 'Computing model for component',
  683 + component.name())
  684 + # Create observation container for individual components
  685 + model_cont = gammalib.GModels()
  686 + model_cont.append(component)
  687 + # Calculate gamma model
  688 + model = onoff.model_gamma(model_cont)
  689 + model = model.counts_spectrum()
  690 + # Append to table
  691 + table = self._append_column(table, component.name(),
  692 + model)
  693 + # Add background already calculated
  694 + self._log_value(gammalib.NORMAL,
  695 + 'Computing model for component',
  696 + 'Background')
  697 + background *= onoff.on_spec().backscal_spectrum()
  698 + table = self._append_column(table, 'Background',
  699 + background)
  700 +
  701 + # Append results table to output file
  702 + self._fits.append(table)
  703 +
  704 + # Return
  705 + return
  706 +
  707 + def save(self):
  708 + """
  709 + Save residuals
  710 + """
  711 + # Write header
  712 + self._log_header1(gammalib.TERSE, 'Save residuals')
  713 +
  714 + # Continue only if FITS file is valid
  715 + if self._fits != None:
  716 +
  717 + # Get outfile parameter
  718 + outfile = self['outfile'].filename()
  719 +
  720 + # Log file name
  721 + self._log_value(gammalib.NORMAL, 'Residuals file', outfile.url())
  722 +
  723 + # Save residuals
  724 + self._fits.saveto(outfile, self['clobber'].boolean())
  725 +
  726 + # Return
  727 + return
  728 +
  729 +
  730 +# ======================== #
  731 +# Main routine entry point #
  732 +# ======================== #
  733 +if __name__ == '__main__':
  734 +
  735 + # Create instance of application
  736 + app = csresspec(sys.argv)
  737 +
  738 + # Execute application
  739 + app.execute()
... ...
cscripts/csroot2caldb.par
... ... @@ -27,9 +27,9 @@ azimuth, r, a, 0.0,0.0,360.0, &quot;Azimuth Angle (deg)&quot;
27 27 emin, r, h, UNDEF,,, "Minimum energy threshold (TeV)"
28 28 emax, r, h, UNDEF,,, "Maximum energy threshold (TeV)"
29 29 psftype, s, h, Gauss,Gauss|King,, "Point spread function type"
30   -split, b, h, no,,, "Split IRF components into different files"
31   -norm1d, b, h, no,,, "Normalize on 1D histograms"
32   -rebin, b, h, no,,, "Rebin"
  30 +split, b, h, no,,, "Split IRF components into different files?"
  31 +norm1d, b, h, no,,, "Normalize on 1D histograms?"
  32 +rebin, b, h, no,,, "Rebin?"
33 33 eascale, r, h, 1.0,,, "Scaling factor for effective areas"
34 34 bgdscale, r, h, 1.0,,, "Scaling factor for background rates"
35 35 bgdoversample, i, h, 1,,, "Spatial oversampling factor for background template"
... ... @@ -41,6 +41,6 @@ bgdinfill, b, h, no,,, &quot;Infill of background template?&quot;
41 41 #====================
42 42 chatter, i, h, 2,0,4, "Chattiness of output"
43 43 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
44   -debug, b, h, no,,, "Debugging mode activated"
  44 +debug, b, h, no,,, "Activate debugging mode?"
45 45 mode, s, h, ql,,, "Mode of automatic parameters"
46 46 logfile, f, h, csroot2caldb.log,,, "Log filename"
... ...
cscripts/cssens.par
... ... @@ -33,7 +33,7 @@ duration, r, a, 180000.0,,, &quot;Effective exposure time (s)&quot;
33 33 rad, r, a, 5.0,,, "Radius of ROI (deg)"
34 34 emin, r, a, 0.03163,,, "Lower energy limit (TeV)"
35 35 emax, r, a, 125.8925,,, "Upper energy limit (TeV)"
36   -bins, i, a, 18,,, "Number of energy bins for differential sensitivity computation"
  36 +bins, i, a, 18,,, "Number of energy bins for sensitivity computation"
37 37 enumbins, i, h, 0,,, "Number of energy bins for binned analysis (0=unbinned)"
38 38 npix, i, h, 200,,, "Number of pixels for binned analysis"
39 39 binsz, r, h, 0.05,,, "Pixel size for binned analysis (deg/pixel)"
... ... @@ -47,7 +47,7 @@ statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, &quot;Optimization statistic&quot;
47 47 #====================
48 48 chatter, i, h, 2,0,4, "Chattiness of output"
49 49 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
50   -debug, b, h, no,,, "Debugging mode activated"
  50 +debug, b, h, no,,, "Activate debugging mode?"
51 51 mode, s, h, ql,,, "Mode of automatic parameters"
52 52 logfile, f, h, cssens.log,,, "Log filename"
53 53  
... ...
cscripts/csspec.par
... ... @@ -32,10 +32,10 @@ outfile, f, a, spectrum.fits,,, &quot;Output spectrum file&quot;
32 32 # Script parameters
33 33 #==================
34 34 method, s, a, AUTO,SLICE|NODES|AUTO,, "Spectrum generation method"
35   -emin, r, a, 0.1,,, "Lower energy limit (TeV)"
36   -emax, r, a, 100.0,,, "Upper energy limit (TeV)"
37   -enumbins, i, a, 20,,, "Number of energy bins"
38   -ebinalg, s, a, LOG,LIN|LOG|FILE,, "Binning algorithm"
  35 +ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins"
  36 +emin, r, a, 0.1,,, "Start value for first energy bin in TeV"
  37 +emax, r, a, 100.0,,, "Stop value for last energy bin in TeV"
  38 +enumbins, i, a, 20,1,200, "Number of energy bins"
39 39 ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition"
40 40 statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
41 41 calc_ts, b, h, yes,,, "Compute TS value in each bin"
... ... @@ -49,6 +49,6 @@ fix_bkg, b, h, no,,, &quot;Fix background parameters&quot;
49 49 publish, b, h, no,,, "Publish spectrum on VO Hub?"
50 50 chatter, i, h, 2,0,4, "Chattiness of output"
51 51 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
52   -debug, b, h, no,,, "Debugging mode activated"
  52 +debug, b, h, no,,, "Activate debugging mode?"
53 53 mode, s, h, ql,,, "Mode of automatic parameters"
54 54 logfile, f, h, csspec.log,,, "Log filename"
... ...
cscripts/csspec.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Generates a spectrum.
4 4 #
5   -# Copyright (C) 2014-2017 Michael Mayer
  5 +# Copyright (C) 2014-2018 Michael Mayer
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -100,26 +100,29 @@ class csspec(ctools.csobservation):
100 100 n_other = self.obs().size() - n_cta
101 101  
102 102 # If spectrum method is not "NODES" then set spectrum method and
103   - # script mode according to type of CTA observations
  103 + # script mode according to type of observations
104 104 if self._method != 'NODES':
105   - if n_unbinned == 0 and n_binned != 0 and n_onoff == 0:
106   - self._binned_mode = True
107   - self._method = 'SLICE'
108   - elif n_unbinned == 0 and n_binned == 0 and n_onoff != 0:
109   - self._onoff_mode = True
110   - self._method = 'SLICE'
111   - elif n_unbinned == 0 and n_binned != 0 and n_onoff != 0:
112   - msg = 'Mix of binned and On/Off CTA observations found in ' \
113   - 'observation container. csscript does not support this ' \
114   - 'mix.'
115   - raise RuntimeError(msg)
116   - elif n_unbinned != 0 and (n_binned != 0 or n_onoff != 0):
117   - msg = 'Mix of unbinned and binned or On/Off CTA observations ' \
118   - 'found in observation container. csscript does not support ' \
119   - 'this mix.'
120   - raise RuntimeError(msg)
121   - elif n_unbinned != 0:
122   - self._method = 'SLICE'
  105 + if n_other > 0:
  106 + self._method = 'NODES'
  107 + else:
  108 + if n_unbinned == 0 and n_binned != 0 and n_onoff == 0:
  109 + self._binned_mode = True
  110 + self._method = 'SLICE'
  111 + elif n_unbinned == 0 and n_binned == 0 and n_onoff != 0:
  112 + self._onoff_mode = True
  113 + self._method = 'SLICE'
  114 + elif n_unbinned == 0 and n_binned != 0 and n_onoff != 0:
  115 + msg = 'Mix of binned and On/Off CTA observations found ' \
  116 + 'in observation container. csscript does not support ' \
  117 + 'this mix.'
  118 + raise RuntimeError(msg)
  119 + elif n_unbinned != 0 and (n_binned != 0 or n_onoff != 0):
  120 + msg = 'Mix of unbinned and binned or On/Off CTA observations ' \
  121 + 'found in observation container. csscript does not ' \
  122 + 'support this mix.'
  123 + raise RuntimeError(msg)
  124 + elif n_unbinned != 0:
  125 + self._method = 'SLICE'
123 126  
124 127 # Set ebounds
125 128 self._set_ebounds()
... ... @@ -148,10 +151,9 @@ class csspec(ctools.csobservation):
148 151 # If there are a mix of CTA and non-CTA observations and the method
149 152 # is 'SLICE' then log a warning that non-CTA observations will be
150 153 # ignored
  154 + warning = False
151 155 if n_cta > 0 and n_other > 0 and self._method == 'SLICE':
152   - self._log_string(gammalib.TERSE, '\nWARNING: Only CTA observation '
153   - 'can be handled with the "SLICE" method, all '
154   - 'non-CTA observation will be ignored.')
  156 + warning = True
155 157  
156 158 # If there are only non-CTA observations and the method is 'SLICE'
157 159 # then stop now
... ... @@ -167,6 +169,12 @@ class csspec(ctools.csobservation):
167 169 # Log selected spectrum method
168 170 self._log_value(gammalib.TERSE, 'Selected spectrum method', self._method)
169 171  
  172 + # Signal warning
  173 + if warning:
  174 + self._log_string(gammalib.TERSE, ' WARNING: Only CTA observation '
  175 + 'can be handled with the "SLICE" method, all '
  176 + 'non-CTA observation will be ignored.')
  177 +
170 178 # Return
171 179 return
172 180  
... ...
cscripts/cssrcdetect.par
... ... @@ -36,6 +36,6 @@ fit_shape, b, h, yes,,, &quot;Fit source shapes?&quot;
36 36 #====================
37 37 chatter, i, h, 2,0,4, "Chattiness of output"
38 38 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
39   -debug, b, h, no,,, "Debugging mode activated"
  39 +debug, b, h, no,,, "Activate debugging mode?"
40 40 mode, s, h, ql,,, "Mode of automatic parameters"
41 41 logfile, f, h, cssrcdetect.log,,, "Log filename"
... ...
cscripts/cstsdist.par
... ... @@ -16,7 +16,7 @@
16 16 #
17 17 # Input and output parameters
18 18 #============================
19   -inobs, f, h, NONE,,, "Input event list, counts cube, or observation definition XML file"
  19 +inobs, f, a, events.fits,,, "Input event list, counts cube, or observation definition XML file"
20 20 inmodel, f, a, $CTOOLS/share/models/crab.xml,,, "Input model definition XML file"
21 21 srcname, s, a, Crab,,, "Source name"
22 22 expcube, f, a, NONE,,, "Input exposure cube file"
... ... @@ -33,18 +33,6 @@ outfile, f, a, ts.dat,,, &quot;Output Test Statistic distribution file&quot;
33 33 # Script parameters
34 34 #==================
35 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 36 statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
49 37  
50 38 #
... ... @@ -52,6 +40,6 @@ statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, &quot;Optimization statistic&quot;
52 40 #====================
53 41 chatter, i, h, 2,0,4, "Chattiness of output"
54 42 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
55   -debug, b, h, no,,, "Debugging mode activated"
  43 +debug, b, h, no,,, "Activate debugging mode?"
56 44 mode, s, h, ql,,, "Mode of automatic parameters"
57 45 logfile, f, h, cstsdist.log,,, "Log filename"
... ...
cscripts/cstsdist.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Generates the TS distribution for a particular model
4 4 #
5   -# Copyright (C) 2011-2017 Juergen Knoedlseder
  5 +# Copyright (C) 2011-2018 Juergen Knoedlseder
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -37,7 +37,7 @@ class cstsdist(ctools.csobservation):
37 37 # Constructor
38 38 def __init__(self, *argv):
39 39 """
40   - Constructor.
  40 + Constructor
41 41 """
42 42 # Initialise application by calling the appropriate class constructor
43 43 self._init_csobservation(self.__class__.__name__, ctools.__version__, argv)
... ... @@ -45,6 +45,7 @@ class cstsdist(ctools.csobservation):
45 45 # Initialise some members
46 46 self._srcname = ''
47 47 self._log_clients = False
  48 + self._model = None
48 49  
49 50 # Return
50 51 return
... ... @@ -65,13 +66,6 @@ class cstsdist(ctools.csobservation):
65 66 # Get source name
66 67 self._srcname = self['srcname'].string()
67 68  
68   - # Query parameters for binned if requested
69   - if self['enumbins'].integer() != 0:
70   - self['npix'].integer()
71   - self['binsz'].real()
72   - self['coordsys'].string()
73   - self['proj'].string()
74   -
75 69 # Set models if we have none
76 70 if self.obs().models().size() == 0:
77 71 self.obs().models(self['inmodel'].filename())
... ... @@ -79,15 +73,73 @@ class cstsdist(ctools.csobservation):
79 73 # Query parameters
80 74 self['edisp'].boolean()
81 75 self['ntrials'].integer()
82   - self['outfile'].filename()
  76 +
83 77 self['debug'].boolean()
84 78  
  79 + # Read ahead output parameters
  80 + #if self._read_ahead():
  81 + # self['outfile'].filename()
  82 + self['outfile'].filename()
  83 +
85 84 # Write input parameters into logger
86 85 self._log_parameters(gammalib.TERSE)
87 86  
88 87 # Return
89 88 return
90 89  
  90 + def _sim(self, seed):
  91 + """
  92 + Return a simulated observation container
  93 +
  94 + Parameters
  95 + ----------
  96 + seed : int
  97 + Random number generator seed
  98 +
  99 + Returns
  100 + -------
  101 + sim : `~gammalib.GObservations`
  102 + Simulated observation container
  103 + """
  104 + # If observation is a counts cube then simulate events from the counts
  105 + # cube model ...
  106 + if self.obs().size() == 1 and self.obs()[0].eventtype() == 'CountsCube':
  107 +
  108 + # If no counts cube model exists then compute it now
  109 + if self._model == None:
  110 + model = ctools.ctmodel(self.obs())
  111 + model['debug'] = self['debug'].boolean()
  112 + model['chatter'] = self['chatter'].integer()
  113 + model.run()
  114 + self._model = model.cube().copy() # Save copy for persistence
  115 +
  116 + # Allocate random number generator
  117 + ran = gammalib.GRan()
  118 +
  119 + # Get copy of model map
  120 + counts = self._model.counts().copy()
  121 +
  122 + # Randomize counts
  123 + for i in range(counts.npix()):
  124 + counts[i] = ran.poisson(counts[i])
  125 +
  126 + # Copy observations
  127 + sim = self.obs().copy()
  128 +
  129 + # Set counts map
  130 + sim[0].events().counts(counts)
  131 +
  132 + # ... otherwise simuate events from the observation container (works
  133 + # only for event lists
  134 + else:
  135 + sim = obsutils.sim(self.obs(),
  136 + seed = seed,
  137 + log = self._log_clients,
  138 + debug = self['debug'].boolean())
  139 +
  140 + # Return simulated observation
  141 + return sim
  142 +
91 143 def _trial(self, seed):
92 144 """
93 145 Create the TS for a single trial
... ... @@ -105,29 +157,8 @@ class cstsdist(ctools.csobservation):
105 157 # Write header
106 158 self._log_header2(gammalib.EXPLICIT, 'Trial %d' % (seed+1))
107 159  
108   - # Set default binned parameters
109   - coordsys = 'CEL'
110   - proj = 'TAN'
111   - npix = 0
112   - binsz = 0.0
113   -
114   - # If binned analysis is requested the read the binned parameters
115   - if self['enumbins'].integer() != 0:
116   - npix = self['npix'].integer()
117   - binsz = self['binsz'].real()
118   - coordsys = self['coordsys'].string()
119   - proj = self['proj'].string()
120   -
121 160 # Simulate events
122   - sim = obsutils.sim(self.obs(),
123   - nbins = self['enumbins'].integer(),
124   - seed = seed,
125   - proj = proj,
126   - coord = coordsys,
127   - binsz = binsz,
128   - npix = npix,
129   - log = self._log_clients,
130   - debug = self['debug'].boolean())
  161 + sim = self._sim(seed)
131 162  
132 163 # Determine number of events in simulation
133 164 nevents = 0.0
... ... @@ -160,7 +191,7 @@ class cstsdist(ctools.csobservation):
160 191 for model in models:
161 192 self._log_value(gammalib.EXPLICIT, 'Model', model.name())
162 193 for par in model:
163   - self._log_string(gammalib.EXPLICIT, str(par)+'\n')
  194 + self._log_string(gammalib.EXPLICIT, str(par))
164 195 elif self._logNormal():
165 196 name = 'Trial %d' % seed
166 197 value = 'TS=%.3f Prefactor=%e +/- %e' % \
... ...
cscripts/cstsmapmerge.par
... ... @@ -30,7 +30,7 @@ delete, b, h, no,,, &quot;Delete merged files?&quot;
30 30 #====================
31 31 chatter, i, h, 2,0,4, "Chattiness of output"
32 32 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
33   -debug, b, h, no,,, "Debugging mode activated"
  33 +debug, b, h, no,,, "Activate debugging mode?"
34 34 mode, s, h, ql,,, "Mode of automatic parameters"
35 35 logfile, f, h, cstsmapmerge.log,,, "Log filename"
36 36  
... ...
cscripts/cstsmapsplit.par
... ... @@ -27,7 +27,7 @@ caldb, s, a, prod2,,, &quot;Calibration database&quot;
27 27 irf, s, a, South_0.5h,,, "Instrument response function"
28 28 edisp, b, h, no,,, "Apply energy dispersion?"
29 29 errors, b, h, no,,, "Compute/store parameter errors?"
30   -statistic, s, h, CSTAT,CSTAT|WSTAT|CHI2,, "Optimization statistic"
  30 +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
31 31 outmap, f, a, tsmap.fits,,, "Output Test Statistic map file"
32 32 bins_per_job, i, a, 5,,, "Number of TS map bins per task"
33 33 compute_null, b, a, yes,,,"Compute null hypothesis first?"
... ... @@ -52,6 +52,6 @@ yref, r, a, 22.01,-90,90, &quot;Second coordinate of image center in degrees (DE
52 52 publish, b, h, no,,, "Publish Test Statistic map on VO Hub?"
53 53 chatter, i, h, 2,0,4, "Chattiness of output"
54 54 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
55   -debug, b, h, no,,, "Debugging mode activated"
  55 +debug, b, h, no,,, "Activate debugging mode?"
56 56 mode, s, h, ql,,, "Mode of automatic parameters"
57 57 logfile, f, h, cstsmapsplit.log,,, "Log filename"
... ...
cscripts/csviscube.par
... ... @@ -37,6 +37,6 @@ zmax, r, h, 60.0,,, &quot;Maximum zenith angle (deg)&quot;
37 37 publish, b, h, no,,, "Publish visibility cube on VO Hub?"
38 38 chatter, i, h, 2,0,4, "Chattiness of output"
39 39 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
40   -debug, b, h, no,,, "Debugging mode activated"
  40 +debug, b, h, no,,, "Activate debugging mode?"
41 41 mode, s, h, ql,,, "Mode of automatic parameters"
42 42 logfile, f, h, csviscube.log,,, "Log filename"
... ...
cscripts/csviscube.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Compute a visibility cube
4 4 #
5   -# Copyright (C) 2016-2017 Juergen Knoedlseder
  5 +# Copyright (C) 2016-2018 Juergen Knoedlseder
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -260,8 +260,8 @@ class csviscube(ctools.cscript):
260 260 #geolon = self['geolon'].real()
261 261  
262 262 # Get time interval
263   - tmin = self['tmin'].time(self._time_reference())
264   - tmax = self['tmax'].time(self._time_reference())
  263 + tmin = self['tmin'].time(ctools.time_reference)
  264 + tmax = self['tmax'].time(ctools.time_reference)
265 265  
266 266 # Initialise hour angle list
267 267 hour_angles = []
... ...
cscripts/csworkflow.par
... ... @@ -23,6 +23,6 @@ inflow, f, a, workflow.xml,,, &quot;Input workflow XML file&quot;
23 23 #====================
24 24 chatter, i, h, 2,0,4, "Chattiness of output"
25 25 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
26   -debug, b, h, no,,, "Debugging mode activated"
  26 +debug, b, h, no,,, "Activate debugging mode?"
27 27 mode, s, h, ql,,, "Mode of automatic parameters"
28 28 logfile, f, h, csworkflow.log,,, "Log filename"
... ...
cscripts/obsutils.py
1 1 # ==========================================================================
2 2 # Utility functions for observation handling
3 3 #
4   -# Copyright (C) 2011-2017 Juergen Knoedlseder
  4 +# Copyright (C) 2011-2018 Juergen Knoedlseder
5 5 #
6 6 # This program is free software: you can redistribute it and/or modify
7 7 # it under the terms of the GNU General Public License as published by
... ... @@ -130,6 +130,7 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0,
130 130 phagen['rad'] = onrad
131 131 phagen['stack'] = False
132 132 phagen['inexclusion'] = 'NONE'
  133 + phagen['bkgmethod'] = 'REFLECTED'
133 134  
134 135 # Optionally open the log file
135 136 if log:
... ... @@ -280,8 +281,9 @@ def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.98, \
280 281 roi.radius(rad)
281 282  
282 283 # Set GTI
283   - gti = gammalib.GGti()
284   - gti.append(gammalib.GTime(tstart), gammalib.GTime(tstart+duration))
  284 + gti = gammalib.GGti(ctools.time_reference)
  285 + gti.append(gammalib.GTime(tstart, ctools.time_reference),
  286 + gammalib.GTime(tstart+duration, ctools.time_reference))
285 287  
286 288 # Set energy boundaries
287 289 ebounds = gammalib.GEbounds(gammalib.GEnergy(emin, 'TeV'),
... ... @@ -828,3 +830,102 @@ def get_onoff_obs(cls, obs):
828 830  
829 831 # Return On/Off oberservation container
830 832 return onoff_obs
  833 +
  834 +
  835 +# ========================================= #
  836 +# Calculate residuals from counts and model #
  837 +# ========================================= #
  838 +def residuals(cls, counts, model):
  839 + """
  840 + Calculate residuals given counts and models, according to algorithm
  841 + specified by user.
  842 +
  843 + Can handle GSkyMap or GNdarray objects
  844 +
  845 +
  846 + Parameters
  847 + ----------
  848 + cls : `~ctools.cscript`
  849 + cscript class
  850 + counts : `~gammalib.GSkyMap/~gammalib.GNdarray'
  851 + Data counts
  852 + model : `~gammalib.GSkyMap/~gammalib.GNdarray'
  853 + Model counts
  854 +
  855 + Returns
  856 + -------
  857 + residuals : `~gammalib.GSkyMap/~gammalib.GNdarray'
  858 + Residuals
  859 + """
  860 + # Find type of objects we are manipulating and set size to iterate later
  861 +
  862 + # If GNdarray
  863 + if counts.classname() == 'GNdarray':
  864 + nelem = counts.size()
  865 + elif counts.classname() == 'GSkyMap':
  866 + nelem = counts.npix()
  867 + else:
  868 + msg = 'cscripts.obsutils.residuals only handles ' \
  869 + + 'gammalib.GNdarray or gammalib.GSkyMap objects.\n'
  870 + raise RuntimeError(msg)
  871 +
  872 + # Copy counts to initialise residuals
  873 + residuals = counts.copy()
  874 +
  875 + # Get residual map algorithm type
  876 + algorithm = cls['algorithm'].string()
  877 +
  878 + # Subtract
  879 + if algorithm == 'SUB':
  880 + residuals -= model
  881 +
  882 + # Subtract and divide by model
  883 + elif algorithm == 'SUBDIV':
  884 + residuals -= model
  885 + residuals /= model
  886 +
  887 + # Subtract and divide by sqrt of model
  888 + elif algorithm == 'SUBDIVSQRT':
  889 + residuals -= model
  890 + residuals /= model.sqrt()
  891 +
  892 + # Calculate significance from Li&Ma
  893 + elif algorithm == 'SIGNIFICANCE':
  894 +
  895 + # Compute sign
  896 + sign = (residuals - model).sign()
  897 +
  898 + # Loop over every bin
  899 + for i in range(nelem):
  900 +
  901 + # If the model value > 0.0 do the computation as normal ...
  902 + model_val = model[i]
  903 + if model_val > 0.0:
  904 +
  905 + # If the data value is also > 0 then compute the
  906 + # significance^2 and save it ...
  907 + data_val = residuals[i]
  908 + if data_val > 0.0:
  909 + log_val = math.log(data_val / model_val)
  910 + residuals[i] = (data_val * log_val) + model_val - data_val
  911 +
  912 + # ... otherwise compute the reduced value of the above
  913 + # expression. This is necessary to avoid computing log(0).
  914 + else:
  915 + residuals[i] = model_val
  916 +
  917 + # ... otherwise hard-code the significance to 0
  918 + else:
  919 + residuals[i] = 0.0
  920 +
  921 + # Compute significance map
  922 + residuals *= 2.0
  923 + residuals = residuals.sqrt()
  924 + residuals *= sign
  925 +
  926 + # Raise exception if algorithm is unknown
  927 + else:
  928 + raise TypeError('Algorithm "' + algorithm + '" not known')
  929 +
  930 + # Return
  931 + return residuals
... ...
ctools.pc.in
... ... @@ -8,7 +8,7 @@ Description: CTA science analysis tools
8 8 URL: http://cta.irap.omp.eu/ctools
9 9 Version: @VERSION@
10 10 Requires:
11   -Requires.private: gammalib == 1.5.0.dev1
  11 +Requires.private: gammalib == @VERSION@
12 12 Conflicts:
13 13 Cflags: -I${includedir}/ctools @OPENMP_CXXFLAGS@
14 14 Libs: -L${libdir} -lctools
... ...
dev/01-ctools-activate.sh
... ... @@ -3,3 +3,5 @@
3 3 export CTOOLS=${CONDA_PREFIX}
4 4 source ${CTOOLS}/bin/ctools-init.sh
5 5 unset PYTHONPATH
  6 +unset LD_LIBRARY_PATH
  7 +unset DYLD_LIBRARY_PATH
... ...
dev/conda.recipe/meta.yaml.in
... ... @@ -17,10 +17,10 @@ requirements:
17 17 - python
18 18 - setuptools
19 19 - swig
20   - - gammalib ==1.5.0.dev1
  20 + - gammalib ==@VERSION@
21 21 run:
22 22 - python
23   - - gammalib ==1.5.0.dev1
  23 + - gammalib ==@VERSION@
24 24  
25 25 about:
26 26 home: http://cta.irap.omp.eu/ctools
... ...
dev/ctools-activate.sh deleted
1   -#!/bin/sh
2   -
3   -export CTOOLS=${CONDA_PREFIX}
4   -source ${CTOOLS}/bin/ctools-init.sh
dev/ctools-deactivate.sh deleted
1   -#!/bin/sh
2   -
3   -unset CTOOLS
4   -unset CALDB
doc/Doxyfile
... ... @@ -32,7 +32,7 @@ PROJECT_NAME = ctools
32 32 # This could be handy for archiving the generated documentation or
33 33 # if some version control system is used.
34 34  
35   -PROJECT_NUMBER = 1.5.0.dev1
  35 +PROJECT_NUMBER = 1.6.0.dev1
36 36  
37 37 # Using the PROJECT_BRIEF tag one can provide an optional one line description
38 38 # for a project that appears at the top of each page and should give viewer
... ...
doc/source/admin/download.rst
... ... @@ -3,17 +3,7 @@
3 3 Download
4 4 ========
5 5  
6   -ctools can be obtained in form of releases or directly from the git
7   -development repository. Prefer a release if you intend using ctools
8   -for production (and publications). Clone the code from git if you need
9   -the most recent code that implements new features and corrects known
10   -bugs.
11   -
12   -
13   -Releases
14   ---------
15   -
16   -The latest ctools release is ``ctools-1.4.3`` (31 October 2017).
  6 +The latest ctools release is ``ctools-1.5.0`` (28 January 2018).
17 7  
18 8 Below a table of ctools releases. Please read the :ref:`sec_release` to
19 9 learn more about new features and corrected bugs in a given release.
... ... @@ -21,170 +11,96 @@ learn more about new features and corrected bugs in a given release.
21 11 .. warning::
22 12 At this stage of the project there is a strict link between the ctools and
23 13 gammalib versions. Please make sure that you have the corresponding gammalib
24   - version installed before installing ctools. The Mac OS X packages comprise
25   - both ctools and gammalib.
26   -
27   -.. list-table::
28   - :header-rows: 1
29   - :widths: 5 5 10
30   -
31   - * - ctools
32   - - gammalib
33   - - Mac OS X package
34   - * - `1.4.3 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.3.tar.gz>`_
35   - - `1.4.3 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.4.3.tar.gz>`_
36   - - `ctools-1.4.3-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.3-macosx10.7.dmg>`_
37   - * - `1.4.2 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.2.tar.gz>`_
38   - - `1.4.2 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.4.2.tar.gz>`_
39   - - `ctools-1.4.2-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.2-macosx10.7.dmg>`_
40   - * - `1.4.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.1.tar.gz>`_
41   - - `1.4.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.4.1.tar.gz>`_
42   - - `ctools-1.4.1-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.1-macosx10.7.dmg>`_
43   - * - `1.4.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.0.tar.gz>`_
44   - - `1.4.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.4.0.tar.gz>`_
45   - - `ctools-1.4.0-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.0-macosx10.7.dmg>`_
46   - * - `1.3.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.1.tar.gz>`_
47   - - `1.3.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.3.1.tar.gz>`_
48   - - `ctools-1.3.1-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.1-macosx10.7.dmg>`_
49   - * - `1.3.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.0.tar.gz>`_
50   - - `1.3.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.3.0.tar.gz>`_
51   - - `ctools-1.3.0-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.0-macosx10.7.dmg>`_
52   - * - `1.2.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.2.1.tar.gz>`_
53   - - `1.2.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.2.0.tar.gz>`_
54   - - `ctools-1.2.1-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.2.1-macosx10.7.dmg>`_
55   - * - `1.2.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.2.0.tar.gz>`_
56   - - `1.2.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.2.0.tar.gz>`_
57   - - `ctools-1.2.0-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.2.0-macosx10.7.dmg>`_
58   - * - `1.1.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.1.0.tar.gz>`_
59   - - `1.1.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.1.0.tar.gz>`_
60   - - `ctools-1.1.0-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.1.0-macosx10.3.dmg>`_
61   - * - `1.0.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.0.1.tar.gz>`_
62   - - `1.0.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.0.1.tar.gz>`_
63   - - `ctools-1.0.1-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.0.1-macosx10.3.dmg>`_
64   - * - `1.0.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.0.0.tar.gz>`_
65   - - `1.0.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.0.0.tar.gz>`_
66   - - `ctools-1.0.0-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.0.0-macosx10.3.dmg>`_
67   - * - `0.10.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.10.0.tar.gz>`_
68   - - `0.11.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.11.0.tar.gz>`_
69   - - `ctools-0.10.0-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.10.0-macosx10.3.dmg>`_
70   - * - `0.9.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.9.0.tar.gz>`_
71   - - `0.10.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.10.0.tar.gz>`_
72   - - `ctools-0.9.1-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.9.1-macosx10.3.dmg>`_
73   - * - `0.8.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-01.tar.gz>`_
74   - - `0.9.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-09-01.tar.gz>`_
75   - - `ctools-00-08-01-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-01-macosx10.3.dmg>`_
76   - * - `0.8.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-00.tar.gz>`_
77   - - `0.9.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-09-00.tar.gz>`_
78   - - `ctools-00-08-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-00-macosx10.3.dmg>`_
79   - * - `0.7.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-07-01.tar.gz>`_
80   - - `0.8.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-08-01.tar.gz>`_
81   - - `ctools-00-07-01-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-07-01-macosx10.3.dmg>`_
82   - * - `0.7.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-07-00.tar.gz>`_
83   - - `0.8.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-08-00.tar.gz>`_
84   - - `ctools-00-07-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-07-00-macosx10.3.dmg>`_
85   - * - `0.6.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-06-00.tar.gz>`_
86   - - `0.7.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-07-00.tar.gz>`_
87   - - `ctools-00-06-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-06-00-macosx10.3.dmg>`_
88   - * - `0.5.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-05-01.tar.gz>`_
89   - - `0.6.2 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-06-02.tar.gz>`_
90   - - `ctools-00-05-01-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-05-01-macosx10.3.dmg>`_
91   - * - `0.5.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-05-00.tar.gz>`_
92   - - `0.6.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-06-01.tar.gz>`_
93   - - `ctools-00-05-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-05-00-macosx10.3.dmg>`_
94   - * - `0.4.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-04-00.tar.gz>`_
95   - - `0.5.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-05-00.tar.gz>`_
96   - - `ctools-00-04-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-04-00-macosx10.3.dmg>`_
97   - * - `0.3.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-03-00.tar.gz>`_
98   - - `0.4.2 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-02.tar.gz>`_
99   - - `ctools-00-03-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-03-00-macosx10.3.dmg>`_
100   - * - `0.2.5 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-02-05.tar.gz>`_
101   - - `0.4.11 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-11.tar.gz>`_
102   - -
103   - * - `0.2.4 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-02-04.tar.gz>`_
104   - - `0.4.10 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-10.tar.gz>`_
105   - -
106   - * - `0.2.3 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-02-03.tar.gz>`_
107   - - `0.4.9 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-09.tar.gz>`_
108   - -
109   - * - `0.2.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-02-01.tar.gz>`_
110   - - `0.4.7 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-07.tar.gz>`_
111   - -
112   -
113   -
114   -Development release
115   --------------------
116   -
117   -The current ctools development release is ``ctools-1.5.0.dev1``.
118   -This release reflects the status of the current ``devel`` branch of
119   -the ctools git repository.
120   -
121   -* `Mac OS X binary package <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.5.0.dev1-macosx10.7.dmg>`_ (Mac OS X 10.7+)
122   -* `GammaLib <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.5.0.dev1.tar.gz>`_ source code tarball
123   -* `ctools <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.5.0.dev1.tar.gz>`_ source code tarball
124   -
125   -
126   -Git repository
127   ---------------
128   -
129   -To clone the gammalib and ctools source codes, type
130   -
131   -.. code-block:: bash
132   -
133   - $ git clone https://cta-gitlab.irap.omp.eu/gammalib/gammalib.git
134   - $ git clone https://cta-gitlab.irap.omp.eu/ctools/ctools.git
135   -
136   -This will create directories named gammalib and ctools under the current
137   -working directory that will contain the gammalib and ctools source code.
138   -In case that the cloning does not work you may try adding
139   -
140   -.. code-block:: bash
141   -
142   - $ export GIT_SSL_NO_VERIFY=true
143   -
144   -or
145   -
146   -.. code-block:: bash
147   -
148   - $ git config --global http.sslverify "false"
149   -
150   -before retrieving the code.
151   -Before you will be able to compile the code you need to generate the
152   -configuration file using the ``autogen.sh`` script.
153   -Also make sure that you're actually on the devel branch of the git
154   -repository. GammaLib and ctools can be compiled and configured using
155   -the following command sequence (the code will be installed into the
156   -``/usr/local/gamma`` directory):
157   -
158   -.. code-block:: bash
159   -
160   - $ cd gammalib
161   - $ git checkout devel
162   - $ ./autogen.sh
163   - $ ./configure
164   - $ make
165   - $ make check
166   - $ sudo make install
167   - $ export GAMMALIB=/usr/local/gamma
168   - $ source $GAMMALIB/bin/gammalib-init.sh
169   - $ cd ../ctools
170   - $ git checkout devel
171   - $ ./autogen.sh
172   - $ ./configure
173   - $ make
174   - $ make check
175   - $ sudo make install
176   - $ export CTOOLS=/usr/local/gamma
177   - $ source $CTOOLS/bin/ctools-init.sh
178   -
179   -Please read the :ref:`sec_install` section if you need more information on
180   -how to install ctools.
181   -
182   -.. note::
183   -
184   - You need `swig <http://www.swig.org/>`_ on your system to build the
185   - Python wrappers when you get the code from Git. Python wrappers are
186   - not stored in the Git repository but are built using
187   - `swig <http://www.swig.org/>`_ from interface files located in the
188   - pyext folder. However, you do not need `swig <http://www.swig.org/>`_
189   - when fetching a release as the Python wrappers are bundled with the
190   - release tarballs.
  14 + version installed before installing ctools. The Mac OS X binary packages
  15 + comprise both ctools and gammalib.
  16 +
  17 +..
  18 +
  19 + .. list-table::
  20 + :header-rows: 1
  21 + :widths: 5 5 10
  22 +
  23 + * - ctools
  24 + - gammalib
  25 + - Mac OS X (10.7+) binary disk image
  26 + * - `1.5.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.5.0.tar.gz>`_
  27 + - `1.5.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.5.0.tar.gz>`_
  28 + - `ctools-1.5.0-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.5.0-macosx10.7.dmg>`_
  29 + * - `1.4.3 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.3.tar.gz>`_
  30 + - `1.4.3 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.4.3.tar.gz>`_
  31 + - `ctools-1.4.3-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.3-macosx10.7.dmg>`_
  32 + * - `1.4.2 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.2.tar.gz>`_
  33 + - `1.4.2 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.4.2.tar.gz>`_
  34 + - `ctools-1.4.2-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.2-macosx10.7.dmg>`_
  35 + * - `1.4.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.1.tar.gz>`_
  36 + - `1.4.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.4.1.tar.gz>`_
  37 + - `ctools-1.4.1-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.1-macosx10.7.dmg>`_
  38 + * - `1.4.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.0.tar.gz>`_
  39 + - `1.4.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.4.0.tar.gz>`_
  40 + - `ctools-1.4.0-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.4.0-macosx10.7.dmg>`_
  41 + * - `1.3.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.1.tar.gz>`_
  42 + - `1.3.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.3.1.tar.gz>`_
  43 + - `ctools-1.3.1-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.1-macosx10.7.dmg>`_
  44 + * - `1.3.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.0.tar.gz>`_
  45 + - `1.3.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.3.0.tar.gz>`_
  46 + - `ctools-1.3.0-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.0-macosx10.7.dmg>`_
  47 + * - `1.2.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.2.1.tar.gz>`_
  48 + - `1.2.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.2.0.tar.gz>`_
  49 + - `ctools-1.2.1-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.2.1-macosx10.7.dmg>`_
  50 + * - `1.2.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.2.0.tar.gz>`_
  51 + - `1.2.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.2.0.tar.gz>`_
  52 + - `ctools-1.2.0-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.2.0-macosx10.7.dmg>`_
  53 + * - `1.1.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.1.0.tar.gz>`_
  54 + - `1.1.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.1.0.tar.gz>`_
  55 + - `ctools-1.1.0-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.1.0-macosx10.3.dmg>`_
  56 + * - `1.0.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.0.1.tar.gz>`_
  57 + - `1.0.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.0.1.tar.gz>`_
  58 + - `ctools-1.0.1-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.0.1-macosx10.3.dmg>`_
  59 + * - `1.0.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.0.0.tar.gz>`_
  60 + - `1.0.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.0.0.tar.gz>`_
  61 + - `ctools-1.0.0-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.0.0-macosx10.3.dmg>`_
  62 + * - `0.10.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.10.0.tar.gz>`_
  63 + - `0.11.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.11.0.tar.gz>`_
  64 + - `ctools-0.10.0-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.10.0-macosx10.3.dmg>`_
  65 + * - `0.9.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.9.0.tar.gz>`_
  66 + - `0.10.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.10.0.tar.gz>`_
  67 + - `ctools-0.9.1-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.9.1-macosx10.3.dmg>`_
  68 + * - `0.8.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-01.tar.gz>`_
  69 + - `0.9.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-09-01.tar.gz>`_
  70 + - `ctools-00-08-01-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-01-macosx10.3.dmg>`_
  71 + * - `0.8.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-00.tar.gz>`_
  72 + - `0.9.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-09-00.tar.gz>`_
  73 + - `ctools-00-08-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-00-macosx10.3.dmg>`_
  74 + * - `0.7.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-07-01.tar.gz>`_
  75 + - `0.8.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-08-01.tar.gz>`_
  76 + - `ctools-00-07-01-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-07-01-macosx10.3.dmg>`_
  77 + * - `0.7.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-07-00.tar.gz>`_
  78 + - `0.8.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-08-00.tar.gz>`_
  79 + - `ctools-00-07-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-07-00-macosx10.3.dmg>`_
  80 + * - `0.6.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-06-00.tar.gz>`_
  81 + - `0.7.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-07-00.tar.gz>`_
  82 + - `ctools-00-06-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-06-00-macosx10.3.dmg>`_
  83 + * - `0.5.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-05-01.tar.gz>`_
  84 + - `0.6.2 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-06-02.tar.gz>`_
  85 + - `ctools-00-05-01-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-05-01-macosx10.3.dmg>`_
  86 + * - `0.5.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-05-00.tar.gz>`_
  87 + - `0.6.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-06-01.tar.gz>`_
  88 + - `ctools-00-05-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-05-00-macosx10.3.dmg>`_
  89 + * - `0.4.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-04-00.tar.gz>`_
  90 + - `0.5.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-05-00.tar.gz>`_
  91 + - `ctools-00-04-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-04-00-macosx10.3.dmg>`_
  92 + * - `0.3.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-03-00.tar.gz>`_
  93 + - `0.4.2 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-02.tar.gz>`_
  94 + - `ctools-00-03-00-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-03-00-macosx10.3.dmg>`_
  95 + * - `0.2.5 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-02-05.tar.gz>`_
  96 + - `0.4.11 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-11.tar.gz>`_
  97 + -
  98 + * - `0.2.4 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-02-04.tar.gz>`_
  99 + - `0.4.10 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-10.tar.gz>`_
  100 + -
  101 + * - `0.2.3 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-02-03.tar.gz>`_
  102 + - `0.4.9 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-09.tar.gz>`_
  103 + -
  104 + * - `0.2.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-02-01.tar.gz>`_
  105 + - `0.4.7 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-04-07.tar.gz>`_
  106 + -
... ...
doc/source/admin/index.rst
... ... @@ -6,6 +6,9 @@ Getting ctools
6 6 .. toctree::
7 7 :maxdepth: 1
8 8  
  9 + install_conda
  10 + install_source
  11 + install_binary
  12 + install_devel
9 13 download
10   - install
11 14 release_history/index
... ...
doc/source/admin/install_binary.rst 0 โ†’ 100644
  1 +.. _sec_install_binary:
  2 +
  3 +Installing as binary package
  4 +============================
  5 +
  6 +Mac OS X
  7 +--------
  8 +
  9 +After :ref:`downloading the Mac OS X binary disk image <sec_download>`
  10 +double-click on the image to mount the disk
  11 +
  12 +.. image:: macosx-disk-image.jpg
  13 + :height: 300px
  14 + :alt: Mac OS X binary disk image
  15 + :align: center
  16 +
  17 +Now open the installer package by right-clicking (ctrl-click) on the installer
  18 +package icon. This allows to install a software package with an invalid
  19 +certificate (ctools has so far no Apple certificate)
  20 +
  21 +.. image:: macosx-open-package.jpg
  22 + :height: 300px
  23 + :alt: Open installer package
  24 + :align: center
  25 +
  26 +A window will show up, warning that the package comes from an unidentified
  27 +developer. Click on ``Open`` to continue.
  28 +
  29 +.. image:: macosx-unidentified.jpg
  30 + :height: 200px
  31 + :alt: Unidentified developer warning
  32 + :align: center
  33 +
  34 +Now the installer opens, warning that the package has been signed with an
  35 +invalid certificate. Click on ``Continue`` to proceed.
  36 +
  37 +.. image:: macosx-invalid-cert.jpg
  38 + :height: 300px
  39 + :alt: Invalid certificate warning
  40 + :align: center
  41 +
  42 +Follow now the installer instructions by clicking on ``Continue``. As the
  43 +software will be installed in ``/usr/local/gamma`` the installer will ask
  44 +you for the ``root`` password on your machine.
  45 +
  46 +.. image:: macosx-installer.jpg
  47 + :height: 300px
  48 + :alt: Installer introduction
  49 + :align: center
  50 +
  51 +At the end you should see a window like this:
  52 +
  53 +.. image:: macosx-installed.jpg
  54 + :height: 300px
  55 + :alt: Installer summary
  56 + :align: center
  57 +
... ...
doc/source/admin/install_conda.rst 0 โ†’ 100644
  1 +.. _sec_install_conda:
  2 +
  3 +Installing via Anaconda
  4 +=======================
  5 +
  6 +`Anaconda <https://www.anaconda.com/download/>`_ (you can also use
  7 +`Miniconda <https://conda.io/miniconda.html>`_ for a smaller footprint) is a
  8 +scientific Python installation shipping with essentially all needed packages.
  9 +Install it according to the instructions on their homepage. You can use any
  10 +Anaconda Python version. An Anaconda Python installation is completely separate
  11 +from any existing system wide or user space Python installation, so Anaconda
  12 +can be tested without the fear of breaking an existing installation.
  13 +
  14 +**Anaconda ctools packages exist for Mac OS X and Linux distributions. Windows
  15 +is not supported.**
  16 +
  17 +
  18 +Installing
  19 +----------
  20 +
  21 +- `Install Anaconda following the instructions on their site <https://www.anaconda.com/download/>`_
  22 +
  23 +- Add the ``conda-forge`` and ``cta-observatory`` channels to your Anaconda
  24 + configuration
  25 +
  26 + .. code-block:: bash
  27 +
  28 + $ conda config --append channels conda-forge
  29 + $ conda config --append channels cta-observatory
  30 +
  31 +- We strongly recommend to work with separate Anaconda environments, and
  32 + especially not use the special root environment (that is used for all conda
  33 + commands and environment manipulations, package installations etc.) for
  34 + anything besides updating the conda package itself. For example create
  35 + a ``myenv`` environment as follows:
  36 +
  37 + .. code-block:: bash
  38 +
  39 + $ conda create -n myenv python=2.7 # or e.g. python=3.5
  40 + $ source activate myenv
  41 + (myenv) $
  42 +
  43 +- Install pre-compiled ctools conda package from Anaconda cloud with:
  44 +
  45 + .. code-block:: bash
  46 +
  47 + (myenv) $ conda install ctools
  48 +
  49 + This will also install the required dependencies, and in particular GammaLib
  50 + and cfitsio.
  51 +
  52 +- Re-activate your environment to initialise the ctools environment variables
  53 +
  54 + .. code-block:: bash
  55 +
  56 + (myenv) $ source activate myenv
  57 +
  58 +
  59 +Testing
  60 +-------
  61 +
  62 +Type the following to test the ctools and GammaLib packages
  63 +
  64 +.. code-block:: bash
  65 +
  66 + (myenv) $ python -c 'import ctools; ctools.test()'
  67 + (myenv) $ python -c 'import cscripts; cscripts.test()'
  68 + (myenv) $ python -c 'import gammalib; gammalib.test()'
  69 +
  70 +
  71 +Updating
  72 +--------
  73 +
  74 +Type the following to update the ctools package
  75 +
  76 +.. code-block:: bash
  77 +
  78 + (myenv) $ conda update ctools
  79 +
  80 +or (if you did not add the ``cta-observatory`` channel to your default
  81 +channels):
  82 +
  83 +.. code-block:: bash
  84 +
  85 + (myenv) $ conda update -c cta-observatory ctools
... ...
doc/source/admin/install_devel.rst 0 โ†’ 100644
  1 +.. _sec_install_devel:
  2 +
  3 +Installing the development version
  4 +==================================
  5 +
  6 +The current development version of the code can be downloaded as source
  7 +tarballs, Mac OS X binaries, or directly from the `Git <https://git-scm.com/>`_
  8 +repository.
  9 +
  10 +The current ctools development release is ``ctools-1.5.0.dev1``.
  11 +
  12 +
  13 +Source tarballs
  14 +---------------
  15 +
  16 +Download the source tarballs from the following links
  17 +
  18 +- `ctools <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.5.0.dev1.tar.gz>`_
  19 +- `GammaLib <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.5.0.dev1.tar.gz>`_
  20 +
  21 +and follow the instructions on :ref:`sec_install_source`.
  22 +
  23 +
  24 +Binary packages
  25 +---------------
  26 +
  27 +Download the installer image from the following link
  28 +
  29 +- `Mac OS X (10.7+) <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.5.0.dev1-macosx10.7.dmg>`_
  30 +
  31 +and follow the instructions on :ref:`sec_install_binary`.
  32 +
  33 +
  34 +Git repository
  35 +--------------
  36 +
  37 +To clone the gammalib and ctools source codes, type
  38 +
  39 +.. code-block:: bash
  40 +
  41 + $ git clone https://cta-gitlab.irap.omp.eu/gammalib/gammalib.git
  42 + $ git clone https://cta-gitlab.irap.omp.eu/ctools/ctools.git
  43 +
  44 +This will create directories named gammalib and ctools under the current
  45 +working directory that will contain the gammalib and ctools source code.
  46 +In case that the cloning does not work you may try adding
  47 +
  48 +.. code-block:: bash
  49 +
  50 + $ export GIT_SSL_NO_VERIFY=true
  51 +
  52 +or
  53 +
  54 +.. code-block:: bash
  55 +
  56 + $ git config --global http.sslverify "false"
  57 +
  58 +before retrieving the code.
  59 +Before you will be able to compile the code you need to generate the
  60 +configuration file using the ``autogen.sh`` script.
  61 +Also make sure that you're actually on the devel branch of the git
  62 +repository. GammaLib and ctools can be compiled and configured using
  63 +the following command sequence (the code will be installed into the
  64 +``/usr/local/gamma`` directory):
  65 +
  66 +.. code-block:: bash
  67 +
  68 + $ cd gammalib
  69 + $ git checkout devel
  70 + $ ./autogen.sh
  71 + $ ./configure
  72 + $ make
  73 + $ make check
  74 + $ sudo make install
  75 + $ export GAMMALIB=/usr/local/gamma
  76 + $ source $GAMMALIB/bin/gammalib-init.sh
  77 + $ cd ../ctools
  78 + $ git checkout devel
  79 + $ ./autogen.sh
  80 + $ ./configure
  81 + $ make
  82 + $ make check
  83 + $ sudo make install
  84 + $ export CTOOLS=/usr/local/gamma
  85 + $ source $CTOOLS/bin/ctools-init.sh
  86 +
  87 +Please read the :ref:`sec_install_source` section if you need more information
  88 +on how to install ctools.
  89 +
  90 +.. note::
  91 + You need `swig <http://www.swig.org/>`_ on your system to build the
  92 + Python wrappers when you get the code from Git. Python wrappers are
  93 + not stored in the Git repository but are built using
  94 + `swig <http://www.swig.org/>`_ from interface files located in the
  95 + pyext folder. However, you do not need `swig <http://www.swig.org/>`_
  96 + when fetching a release as the Python wrappers are bundled with the
  97 + release tarballs.
... ...
doc/source/admin/install.rst renamed to doc/source/admin/install_source.rst
1   -.. _sec_install:
  1 +.. _sec_install_source:
  2 +
  3 +Installing from source code
  4 +===========================
  5 +
  6 +Compiling ctools from source is the recommended method to install the package
  7 +in case that you do not use Anaconda (if you use Anaconda, please follow
  8 +the instructions at :ref:`sec_install_conda`, and better do not try to compile
  9 +the source code against your Anaconda Python installation). You also need to
  10 +compile from source if you want to use the development version of ctools.
2 11  
3   -Installing ctools
4   -=================
5 12  
6 13 Before you start
7 14 ----------------
... ... @@ -24,10 +31,6 @@ software:
24 31 is highly recommended to enable dynamic scripting of ctools and
25 32 developing and using of cscripts.
26 33  
27   -No system administrator privileges are needed to install ctools.
28   -
29   -
30   -.. _sec_installing_gammalib:
31 34  
32 35 Installing GammaLib
33 36 -------------------
... ... @@ -97,8 +100,6 @@ which then installs GammaLib in the ``gamma`` folder of your home
97 100 directory.
98 101  
99 102  
100   -.. _sec_setup_gammalib:
101   -
102 103 Setting up the GammaLib environment
103 104 -----------------------------------
104 105  
... ... @@ -161,8 +162,6 @@ You can get the full list of configuration options by typing
161 162 $ ./configure --help
162 163  
163 164  
164   -.. _sec_testing_ctools:
165   -
166 165 Testing ctools
167 166 --------------
168 167  
... ... @@ -249,7 +248,6 @@ first the :ref:`issues` section. If you cannot fix the problem, please
249 248 create an issue on the ctools tracker
250 249 `here <https://cta-redmine.irap.omp.eu/projects/ctools>`_.
251 250  
252   -.. _sec_installing_ctools:
253 251  
254 252 Installing ctools
255 253 -----------------
... ... @@ -277,7 +275,6 @@ can be given, for example:
277 275  
278 276 $ ./configure --prefix=$HOME/gamma
279 277  
280   -.. _sec_setup_ctools:
281 278  
282 279 Setting up the ctools environment
283 280 ---------------------------------
... ... @@ -302,7 +299,6 @@ If you use C shell or a variant then add the following to your
302 299 setenv CTOOLS /usr/local/gamma
303 300 source $CTOOLS/bin/ctools-init.csh
304 301  
305   -.. _sec_check_ctools_setup:
306 302  
307 303 Checking your setup
308 304 -------------------
... ... @@ -330,8 +326,6 @@ detailed information about your setup. There&#39;s also a ``csinfo list``
330 326 command to quickly list the available tools.
331 327  
332 328  
333   -.. _sec_known_problems:
334   -
335 329 Known problems
336 330 --------------
337 331  
... ...
doc/source/admin/macosx-disk-image.jpg 0 โ†’ 100644

90.3 KB

doc/source/admin/macosx-installed.jpg 0 โ†’ 100644

111 KB

doc/source/admin/macosx-installer.jpg 0 โ†’ 100644

92.7 KB

doc/source/admin/macosx-invalid-cert.jpg 0 โ†’ 100644

114 KB

doc/source/admin/macosx-open-package.jpg 0 โ†’ 100644

136 KB

doc/source/admin/macosx-unidentified.jpg 0 โ†’ 100644

85.3 KB

doc/source/admin/release_history/1.5.rst
1 1 .. _1.5:
2 2  
3   -ctools 1.5 release
4   -==================
  3 +ctools 1.5 release (28 January 2018)
  4 +====================================
5 5  
6 6 Overview
7 7 --------
... ... @@ -12,11 +12,20 @@ In particular, this release provides:
12 12  
13 13 * Support of classical IACT analysis
14 14 * Specifcation of times in various formats (UTC, MJD, JD, MET)
  15 +* Spectrum generation for non-IACT data
  16 +* Generation of residual spectra
  17 +* Jupyter notebooks
15 18  
16 19  
17 20 Bug fixes
18 21 ---------
19 22  
  23 +* [`2298 <https://cta-redmine.irap.omp.eu/issues/2298>`_] -
  24 + Correct diffuse map cube upper limit computation in :ref:`ctulimit`
  25 +* Change ``DATE_OBS``, ``DATE_END``, ``TIME_OBS`` and ``TIME_END`` FITS keywords
  26 + into ``DATA-OBS``, ``DATE-END``, ``TIME-OBS`` and ``TIME-END``
  27 +* [`2287 <https://cta-redmine.irap.omp.eu/issues/2287>`_] -
  28 + Correctly strip .gz suffix from output filenames
20 29 * [`2262 <https://cta-redmine.irap.omp.eu/issues/2262>`_] -
21 30 Fix chatter level handling in :ref:`ctpsfcube`
22 31  
... ... @@ -24,14 +33,25 @@ Bug fixes
24 33 Improvements
25 34 ------------
26 35  
  36 +* [`2297 <https://cta-redmine.irap.omp.eu/issues/2297>`_] -
  37 + Add ``tmin`` and ``tmax`` parameters to :ref:`csobsselect`
  38 +* [`2295 <https://cta-redmine.irap.omp.eu/issues/2295>`_] -
  39 + Add ``ctools::time_reference`` constant and remove ``ctools::time_reference()``
  40 + method
  41 +* [`2284 <https://cta-redmine.irap.omp.eu/issues/2284>`_] -
  42 + Add ``CUSTOM`` background method to :ref:`csphagen` script
27 43 * [`2273 <https://cta-redmine.irap.omp.eu/issues/2273>`_] -
28 44 Support On/Off analysis in :ref:`cslightcrv` and :ref:`csphasecrv`
  45 +* [`2272 <https://cta-redmine.irap.omp.eu/issues/2272>`_] -
  46 + :ref:`ctselect` informs about non-overlapping time interval
29 47 * [`2267 <https://cta-redmine.irap.omp.eu/issues/2267>`_] -
30 48 Add tutorial for classical analysis
  49 +* [`2264 <https://cta-redmine.irap.omp.eu/issues/2264>`_] -
  50 + In case of an error, test output is now written into log file
31 51 * [`2260 <https://cta-redmine.irap.omp.eu/issues/2260>`_] -
32 52 Handle On/Off observations by :ref:`cspull`
33 53 * [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] -
34   - Add ``statistic`` parameters to :ref:`ctbutterfly`, :ref:`cterror`,
  54 + Add ``statistic`` parameter to :ref:`ctbutterfly`, :ref:`cterror`,
35 55 :ref:`cttsmap`, :ref:`ctulimit`, :ref:`cslightcrv`, :ref:`csphasecrv`,
36 56 :ref:`cspull`, :ref:`cssens`, :ref:`csspec`, :ref:`cstsdist` and
37 57 :ref:`cstsmapsplit`
... ... @@ -43,13 +63,21 @@ Improvements
43 63 Add keywords to sky maps produced by :ref:`ctskymap`
44 64 * [`2189 <https://cta-redmine.irap.omp.eu/issues/2189>`_] -
45 65 Enhance efficiency of computations in :ref:`ctmodel`
  66 +* [`2182 <https://cta-redmine.irap.omp.eu/issues/2182>`_] -
  67 + ``cscripts::execute()`` no longer creates log files
46 68 * [`1927 <https://cta-redmine.irap.omp.eu/issues/1927>`_] -
47 69 Add ``NODES`` method to :ref:`csspec` to support non-CTA analysis
  70 +* [`1836 <https://cta-redmine.irap.omp.eu/issues/1836>`_] -
  71 + Set ``OBS_ID`` in :ref:`ctobssim`
  72 +* [`1512 <https://cta-redmine.irap.omp.eu/issues/1512>`_] -
  73 + Add ``ctbutterfly::butterfly()`` method to return butterfly diagram
48 74  
49 75  
50 76 New features
51 77 ------------
52 78  
  79 +* [`2289 <https://cta-redmine.irap.omp.eu/issues/2289>`_] -
  80 + Add :ref:`csresspec` script
53 81 * [`2208 <https://cta-redmine.irap.omp.eu/issues/2208>`_] -
54 82 Add :ref:`csphagen` script
55 83 * [`2180 <https://cta-redmine.irap.omp.eu/issues/2180>`_] -
... ... @@ -57,6 +85,7 @@ New features
57 85 * [`1864 <https://cta-redmine.irap.omp.eu/issues/1864>`_] -
58 86 Use t-type parameters for all ``tmin`` and ``tmax`` parameters
59 87  
  88 +
60 89 Clean up
61 90 --------
62 91  
... ... @@ -66,3 +95,5 @@ Clean up
66 95 Derive :ref:`cslightcrv`, :ref:`csphasecrv`, :ref:`cspull`, :ref:`cssens`,
67 96 :ref:`csspec` and :ref:`cstsdist` scripts from ``cslikelihood`` base
68 97 class
  98 +* [`1567 <https://cta-redmine.irap.omp.eu/issues/1567>`_] -
  99 + Revise :ref:`cstsdist` parameters
... ...
doc/source/admin/release_history/index.rst
... ... @@ -3,29 +3,21 @@
3 3 Release History
4 4 ===============
5 5  
6   -Major releases:
7   -
8 6 .. toctree::
9 7 :maxdepth: 1
10 8  
11 9 ctools 1.5 <1.5>
12   - ctools 1.4 <1.4>
13   - ctools 1.3 <1.3>
14   - ctools 1.2 <1.2>
15   - ctools 1.1 <1.1>
16   - ctools 1.0 <1.0>
17   -
18   -Bug fix releases:
19   -
20   -.. toctree::
21   - :maxdepth: 1
22   -
23 10 ctools 1.4.3 <1.4.3>
24 11 ctools 1.4.2 <1.4.2>
25 12 ctools 1.4.1 <1.4.1>
  13 + ctools 1.4 <1.4>
26 14 ctools 1.3.1 <1.3.1>
  15 + ctools 1.3 <1.3>
27 16 ctools 1.2.1 <1.2.1>
  17 + ctools 1.2 <1.2>
  18 + ctools 1.1 <1.1>
28 19 ctools 1.0.1 <1.0.1>
  20 + ctools 1.0 <1.0>
29 21  
30 22 For older ctools versions see
31 23 `here <https://cta-redmine.irap.omp.eu/projects/ctools/wiki/Release_notes>`_.
... ...
doc/source/conf.py
... ... @@ -37,7 +37,7 @@ except:
37 37  
38 38 try:
39 39 import nbsphinx
40   - extensions += ['nbsphinx']
  40 + extensions += ['nbsphinx','IPython.sphinxext.ipython_console_highlighting']
41 41 except:
42 42 print('WARNING: Python package `nbsphinx` not found.\n'
43 43 'WARNING: Please install it to get fully-functional Sphinx docs.\n'
... ... @@ -61,7 +61,7 @@ templates_path = [&#39;_templates&#39;]
61 61 source_suffix = '.rst'
62 62  
63 63 # The encoding of source files.
64   -#source_encoding = 'utf-8-sig'
  64 +source_encoding = 'utf-8'
65 65  
66 66 # The master toctree document.
67 67 master_doc = 'contents'
... ... @@ -75,10 +75,10 @@ copyright = u&#39;2014-2017, ctools developers&#39;
75 75 # built documents.
76 76 #
77 77 # The short X.Y version.
78   -version = '1.5'
  78 +version = '1.6'
79 79  
80 80 # The full version, including alpha/beta/rc tags.
81   -release = '1.5.0.dev1'
  81 +release = '1.6.0.dev1'
82 82  
83 83 # The language for content autogenerated by Sphinx. Refer to documentation
84 84 # for a list of supported languages.
... ...
doc/source/help/issues.rst
... ... @@ -20,8 +20,9 @@ list of
20 20  
21 21 **Model fitting issues**
22 22  
23   -- :ref:`Broken power law has unreliable errors <issue_bplaw>`
  23 +- :ref:`Pivot energy should be comprised in energy range of fitted data <issue_interval>`
24 24 - :ref:`Errors become unreliable when fitting the pivot energy <issue_pivot>`
  25 +- :ref:`Broken power law has unreliable errors <issue_bplaw>`
25 26 - :ref:`Shell model is biased when width is comparable to angular resolution <issue_shell>`
26 27 - :ref:`Elliptical Gaussian model fit converges slowly <issue_egauss>`
27 28  
... ... @@ -34,14 +35,14 @@ Installation issues
34 35  
35 36 .. topic:: Certificate problem when cloning from Git
36 37  
37   - When cloning ctools from git you may encounter an SSL certificate
38   - problem. This is related to the usage of the https protocol and can
39   - be resolved by setting the ``GIT_SSL_NO_VERIFY`` environment variable
40   - to true:
  38 + When cloning ctools from git you may encounter an SSL certificate
  39 + problem. This is related to the usage of the https protocol and can
  40 + be resolved by setting the ``GIT_SSL_NO_VERIFY`` environment variable
  41 + to true:
41 42  
42   - .. code-block:: bash
  43 + .. code-block:: bash
43 44  
44   - export GIT_SSL_NO_VERIFY=true
  45 + export GIT_SSL_NO_VERIFY=true
45 46  
46 47 .. _issue_python:
47 48  
... ... @@ -71,15 +72,15 @@ Installation issues
71 72  
72 73 .. topic:: Installing on Solaris
73 74  
74   - Although ctools build on Solaris using the Sun compiler, there are
75   - problems with global symbols in shared libraries and exception catching,
76   - which prevents the FITS interface to work correctly. ctools have however
77   - been built and tested successfully using the GNU compiler, and this is
78   - the only build method that is currently supported. Problems have also
79   - been encountered when compiling cfitsio versions more recent than 3.250.
80   - The problems have been reported to the cfitsio developer team, and are
81   - likely to be solved in the future. For the time being, it is recommended
82   - to use cfitsio version 3.250 on Solaris.
  75 + Although ctools build on Solaris using the Sun compiler, there are
  76 + problems with global symbols in shared libraries and exception catching,
  77 + which prevents the FITS interface to work correctly. ctools have however
  78 + been built and tested successfully using the GNU compiler, and this is
  79 + the only build method that is currently supported. Problems have also
  80 + been encountered when compiling cfitsio versions more recent than 3.250.
  81 + The problems have been reported to the cfitsio developer team, and are
  82 + likely to be solved in the future. For the time being, it is recommended
  83 + to use cfitsio version 3.250 on Solaris.
83 84  
84 85 .. _issue_opensolaris:
85 86  
... ... @@ -119,15 +120,13 @@ Analysis issues
119 120 Model fitting issues
120 121 ^^^^^^^^^^^^^^^^^^^^
121 122  
122   -.. _issue_bplaw:
  123 +.. _issue_interval:
123 124  
124   -.. topic:: Broken power law has unreliable errors
  125 +.. topic:: Pivot energy should be comprised in energy range of fitted data
125 126  
126   - The broken power law spectral model has unreliable errors, specifically
127   - for the prefactor and the break value. Errors are in general too large,
128   - and this is related to the fact that the law's gradient is discontinuous
129   - in energy. There is not very much we can do about it, it's inherent in
130   - the law.
  127 + The pivot energy of a spectral model, such as for example a power law model,
  128 + should be comprised within the energy range of the fitted data,
  129 + otherwise some fit instabilities may occur.
131 130  
132 131 .. _issue_pivot:
133 132  
... ... @@ -143,6 +142,16 @@ Model fitting issues
143 142 parameters of the model to assure non-degeneracy of the free
144 143 parameters.
145 144  
  145 +.. _issue_bplaw:
  146 +
  147 +.. topic:: Broken power law has unreliable errors
  148 +
  149 + The broken power law spectral model has unreliable errors, specifically
  150 + for the prefactor and the break value. Errors are in general too large,
  151 + and this is related to the fact that the law's gradient is discontinuous
  152 + in energy. There is not very much we can do about it, it's inherent in
  153 + the law.
  154 +
146 155 .. _issue_shell:
147 156  
148 157 .. topic:: Shell model is biased when width is comparable to angular resolution
... ...
doc/source/users/index.rst
... ... @@ -8,9 +8,9 @@ This documentation will guide you in the process of using ctools.
8 8 .. toctree::
9 9 :maxdepth: 1
10 10  
11   - tips/index
12   - tutorials/index
13 11 user_manual/index
14 12 reference_manual/index
  13 + tips/index
  14 + tutorials/index
15 15 user_contributed/index
16 16 glossary
... ...
doc/source/users/notebooks.rst deleted
1   -.. _notebooks:
2   -
3   -Jupyter notebooks:
4   -
5   - * :download:`ctools from Python <tutorials/quickstart/ctools-from-python.ipynb>`
doc/source/users/reference_manual/cscaldb.rst
... ... @@ -3,22 +3,22 @@
3 3 cscaldb
4 4 =======
5 5  
6   -Dumps all available instrument response functions into log file.
  6 +Logs all available instrument response functions into log file.
7 7  
8 8  
9 9 Synopsis
10 10 --------
11 11  
12   -This scripts dumps all instrument response functions that are available
  12 +This scripts logs all instrument response functions that are available
13 13 in the calibration database into the log file. If you want the information
14   -on the screen, add the ``debug=yes`` parameter.
  14 +on the screen, specify ``debug=yes``.
15 15  
16 16  
17 17 General parameters
18 18 ------------------
19 19  
20 20 None
21   -
  21 +
22 22  
23 23 Standard parameters
24 24 -------------------
... ... @@ -26,23 +26,23 @@ Standard parameters
26 26 ``(chatter = 2) [integer]``
27 27 Verbosity of the executable:
28 28 ``chatter = 0``: no information will be logged
29   -
  29 +
30 30 ``chatter = 1``: only errors will be logged
31   -
  31 +
32 32 ``chatter = 2``: errors and actions will be logged
33   -
  33 +
34 34 ``chatter = 3``: report about the task execution
35   -
  35 +
36 36 ``chatter = 4``: detailed report about the task execution
37   -
  37 +
38 38 ``(clobber = yes) [boolean]``
39 39 Specifies whether an existing output file should be overwritten.
40   -
  40 +
41 41 ``(debug = no) [boolean]``
42 42 Enables debug mode. In debug mode the executable will dump any log file output to the console.
43   -
  43 +
44 44 ``(mode = ql) [string]``
45   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  45 + Mode of automatic parameters (default is `ql``, i.e. "query and learn").
46 46  
47 47  
48 48 Related tools of scripts
... ...
doc/source/users/reference_manual/csebins.rst
... ... @@ -14,7 +14,7 @@ the variation in the effective area and the background template of the response
14 14 functions. The script takes either an observation definition XML file or a
15 15 specific instrument response function on input.
16 16  
17   -csebins writes an energy boundary extension into a FITS file.
  17 +:ref:`csebins` writes an energy boundary extension into a FITS file.
18 18  
19 19  
20 20 General parameters
... ... @@ -25,7 +25,7 @@ General parameters
25 25  
26 26 ``caldb [string]``
27 27 Calibration database.
28   -
  28 +
29 29 ``irf [string]``
30 30 Instrumental response function.
31 31  
... ... @@ -34,7 +34,7 @@ General parameters
34 34  
35 35 ``emin [real]``
36 36 Lower energy limit of energy boundaries (in TeV).
37   -
  37 +
38 38 ``emax [real]``
39 39 Upper energy limit of energy boundaries (in TeV).
40 40  
... ... @@ -53,23 +53,23 @@ Standard parameters
53 53 ``(chatter = 2) [integer]``
54 54 Verbosity of the executable:
55 55 ``chatter = 0``: no information will be logged
56   -
  56 +
57 57 ``chatter = 1``: only errors will be logged
58   -
  58 +
59 59 ``chatter = 2``: errors and actions will be logged
60   -
  60 +
61 61 ``chatter = 3``: report about the task execution
62   -
  62 +
63 63 ``chatter = 4``: detailed report about the task execution
64   -
  64 +
65 65 ``(clobber = yes) [boolean]``
66 66 Specifies whether an existing energy boundaries output file should be overwritten.
67   -
  67 +
68 68 ``(debug = no) [boolean]``
69 69 Enables debug mode. In debug mode the executable will dump any log file output to the console.
70   -
  70 +
71 71 ``(mode = ql) [string]``
72   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  72 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
73 73  
74 74 ``(logfile = csebins.log) [filename]``
75 75 Log filename.
... ...
doc/source/users/reference_manual/csfindobs.rst
... ... @@ -17,7 +17,9 @@ to further constrain criteria to select observations. The user can e.g. select
17 17 all observations within a certain zenith angle range by specifying the hidden
18 18 parameter expression. For example
19 19  
20   -``csfindobs expression="ZEN_PNT<50&&ZEN_PNT>40"``
  20 +.. code-block:: bash
  21 +
  22 + $ csfindobs expression="ZEN_PNT<50&&ZEN_PNT>40"
21 23  
22 24 is used to select observations with zenith angle range between 40 and 50 degrees.
23 25  
... ... @@ -49,7 +51,7 @@ General parameters
49 51  
50 52 ``dec [real]``
51 53 Declination of search region (invoke "INDEF" to avoid spatial selection).
52   -
  54 +
53 55 ``rad [real]``
54 56 Radius of search region (deg) (invoke "INDEF" or negative values to avoid
55 57 spatial selection)
... ... @@ -70,23 +72,23 @@ Standard parameters
70 72 ``(chatter = 2) [integer]``
71 73 Verbosity of the executable:
72 74 ``chatter = 0``: no information will be logged
73   -
  75 +
74 76 ``chatter = 1``: only errors will be logged
75   -
  77 +
76 78 ``chatter = 2``: errors and actions will be logged
77   -
  79 +
78 80 ``chatter = 3``: report about the task execution
79   -
  81 +
80 82 ``chatter = 4``: detailed report about the task execution
81   -
  83 +
82 84 ``(clobber = yes) [boolean]``
83 85 Specifies whether an existing output runlist should be overwritten.
84   -
  86 +
85 87 ``(debug = no) [boolean]``
86 88 Enables debug mode. In debug mode the executable will dump any log file output to the console.
87   -
  89 +
88 90 ``(mode = ql) [string]``
89   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  91 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
90 92  
91 93 ``(logfile = csfindobs.log) [filename]``
92 94 Log filename.
... ...
doc/source/users/reference_manual/csiactcopy.rst
1 1 .. _csiactcopy:
2 2  
3 3 csiactcopy
4   -===========
  4 +==========
5 5  
6 6 Copies IACT data from one location to another
7 7  
... ... @@ -14,7 +14,7 @@ has to be mounted before running the script. For mounting, e.g. sshfs can be use
14 14  
15 15 .. code-block:: bash
16 16  
17   - $ sshfs user@remote.server.com:/path/to/remote/fits /path/to/mountpoint/
  17 + $ sshfs user@remote.server.com:/path/to/remote/fits /path/to/mountpoint/
18 18  
19 19 The script can optionally take an ASCII file with a list of observation IDs as input.
20 20 In this way the user can copy only a specific subset of the data. Index files and data
... ... @@ -36,7 +36,7 @@ General parameters
36 36  
37 37 ``prodname [string]``
38 38 Name of FITS production to download
39   -
  39 +
40 40 ``outpath [file]``
41 41 Destination path of FITS data
42 42  
... ... @@ -50,23 +50,23 @@ Standard parameters
50 50 ``(chatter = 2) [integer]``
51 51 Verbosity of the executable:
52 52 ``chatter = 0``: no information will be logged
53   -
  53 +
54 54 ``chatter = 1``: only errors will be logged
55   -
  55 +
56 56 ``chatter = 2``: errors and actions will be logged
57   -
  57 +
58 58 ``chatter = 3``: report about the task execution
59   -
  59 +
60 60 ``chatter = 4``: detailed report about the task execution
61   -
  61 +
62 62 ``(clobber = yes) [boolean]``
63 63 Specifies whether existing output files should be overwritten.
64   -
  64 +
65 65 ``(debug = no) [boolean]``
66 66 Enables debug mode. In debug mode the executable will dump any log file output to the console.
67   -
  67 +
68 68 ``(mode = ql) [string]``
69   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  69 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
70 70  
71 71 ``(logfile = csiactdload.log) [filename]``
72 72 Log filename.
... ...
doc/source/users/reference_manual/csiactdata.rst
... ... @@ -23,34 +23,34 @@ General parameters
23 23  
24 24 ``datapath [string]``
25 25 Path were data are located.
26   -
  26 +
27 27 ``(master_index = master.json) [string]``
28 28 Name of master index file.
29   -
30   -
  29 +
  30 +
31 31 Standard parameters
32 32 -------------------
33 33  
34 34 ``(chatter = 2) [integer]``
35 35 Verbosity of the executable:
36 36 ``chatter = 0``: no information will be logged
37   -
  37 +
38 38 ``chatter = 1``: only errors will be logged
39   -
  39 +
40 40 ``chatter = 2``: errors and actions will be logged
41   -
  41 +
42 42 ``chatter = 3``: report about the task execution
43   -
  43 +
44 44 ``chatter = 4``: detailed report about the task execution
45   -
  45 +
46 46 ``(clobber = yes) [boolean]``
47 47 Specifies whether existing output files should be overwritten.
48   -
  48 +
49 49 ``(debug = no) [boolean]``
50 50 Enables debug mode. In debug mode the executable will dump any log file output to the console.
51   -
  51 +
52 52 ``(mode = ql) [string]``
53   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  53 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
54 54  
55 55 ``(logfile = csiactdata.log) [filename]``
56 56 Log filename.
... ...
doc/source/users/reference_manual/csiactobs.rst
1 1 .. _csiactobs:
2 2  
3 3 csiactobs
4   -===========
  4 +=========
5 5  
6 6 Creates an observation XML file for IACTs using a list of observation IDs as
7 7 input.
... ... @@ -37,8 +37,8 @@ that will be in the output XML model.
37 37  
38 38 If an observation that given in the input ASCII file is not available on the user
39 39 machine, the script dumps a warning into the logfile and the observation is
40   -skipped.
41   -
  40 +skipped.
  41 +
42 42  
43 43 General parameters
44 44 ------------------
... ... @@ -48,16 +48,16 @@ General parameters
48 48  
49 49 ``prodname [string]``
50 50 Name of FITS production (Run :doc:`csiactdata` to view your options).
51   -
  51 +
52 52 ``infile [file]``
53 53 Input runlist ASCII file.
54 54  
55 55 ``(inmodel = NONE) [file]``
56 56 Input model XML file.
57   -
  57 +
58 58 ``outobs [file]``
59 59 Output Observation Definition XML file.
60   -
  60 +
61 61 ``outmodel [file]``
62 62 Output model XML file.
63 63  
... ... @@ -66,7 +66,7 @@ General parameters
66 66  
67 67 ``(master_indx = master.json) [file]``
68 68 Name of master index file.
69   -
  69 +
70 70 ``(bkg_scale = yes) [boolean]``
71 71 Specifies whether the background scaling factor from the observation index
72 72 file should be applied if available.
... ... @@ -82,10 +82,10 @@ General parameters
82 82  
83 83 ``(edisp_hiera = edisp_2d) [string]``
84 84 Hierarchy of energy disperson formats.
85   -
  85 +
86 86 ``(bkg_hiera = bkg_3d) [string]``
87 87 Hierarchy of background formats.
88   -
  88 +
89 89 ``(bkg_mod_hiera = irf|aeff|gauss) [string]``
90 90 Hierarchy of background models.
91 91  
... ... @@ -107,30 +107,30 @@ General parameters
107 107 ``(bkg_range_factor = 100.0) [real]``
108 108 Factor to determine range of background normalisation.
109 109  
110   -
  110 +
111 111 Standard parameters
112 112 -------------------
113 113  
114 114 ``(chatter = 2) [integer]``
115 115 Verbosity of the executable:
116 116 ``chatter = 0``: no information will be logged
117   -
  117 +
118 118 ``chatter = 1``: only errors will be logged
119   -
  119 +
120 120 ``chatter = 2``: errors and actions will be logged
121   -
  121 +
122 122 ``chatter = 3``: report about the task execution
123   -
  123 +
124 124 ``chatter = 4``: detailed report about the task execution
125   -
  125 +
126 126 ``(clobber = yes) [boolean]``
127 127 Specifies whether existing output files should be overwritten.
128   -
  128 +
129 129 ``(debug = no) [boolean]``
130 130 Enables debug mode. In debug mode the executable will dump any log file output to the console.
131   -
  131 +
132 132 ``(mode = ql) [string]``
133   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  133 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
134 134  
135 135 ``(logfile = csiactobs.log) [filename]``
136 136 Log filename.
... ...
doc/source/users/reference_manual/cslightcrv.rst
... ... @@ -3,21 +3,35 @@
3 3 cslightcrv
4 4 ==========
5 5  
6   -Computes a lightcurve for a given source.
  6 +Computes a light curve for a given source.
7 7  
8 8  
9 9 Synopsis
10 10 --------
11 11  
12   -This script computes a lightcurve by performing a maximum likelihood fit
  12 +This script computes a light curve by performing a maximum likelihood fit
13 13 using :doc:`ctlike` in a series of time bins. The time bins can be either
14 14 specified in an ASCII file, as an interval divided into equally sized time
15 15 bins, or can be taken from the Good Time Intervals of the observation(s).
16 16 The format of the ASCII file is one row per time bin, each specifying the
17 17 start of stop value of the bin, separated by a whitespace. The times are
18   -given in Modified Julian Days (MJD).
19   -
20   -cslightcrv writes the fitted model parameters and their statistical errors
  18 +given in Modified Julian Days (MJD).
  19 +
  20 +:ref:`cslightcrv` can perform the light curve fitting in unbinned, stacked or
  21 +On/Off analysis mode; on input the script always requires unbinned data, i.e.
  22 +event list(s), since only event data retain time information for light curve
  23 +fitting. To select unbinned analysis, specify ``method=3D`` and ``enumbins=0``;
  24 +for stacked analysis specify ``method=3D`` and any positive number for ``enumbins``.
  25 +To perform the analysis in On/Off model, specify ``method=ONOFF``.
  26 +
  27 +For a stacked analysis, :ref:`cslightcrv` will query the parameters that define
  28 +the counts cube (``coordsys``, ``proj``, ``xref``, ``yref``, ``nxpix``, ``nypix``,
  29 +``binsz``) while for an On/Off analysis the script will query the parameters that
  30 +are necessary to run internally the :ref:`csphagen` script (``inexclusion``, ``coordsys``,
  31 +``xref``, ``yref``, ``srcshape``, ``rad``, ``bkgmethod``, ``bkgregmin``, ``maxoffset``,
  32 +``etruemin``, ``etruemax``, ``etruebins``).
  33 +
  34 +:ref:`cslightcrv` writes the fitted model parameters and their statistical errors
21 35 in a FITS file. In addition, it computes for each time bin the statistical
22 36 significance of the detection, expressed by the Test Statistics, and the
23 37 upper flux limit.
... ... @@ -44,12 +58,12 @@ General parameters
44 58  
45 59 ``(inexclusion = NONE) [file]``
46 60 Optional FITS file containing a WCS map in the first hdu that defines sky
47   - regions not to be used for background estimation in ``ONOFF`` analysis (where
  61 + regions not to be used for background estimation in On/Off analysis (where
48 62 map value != 0).
49 63  
50 64 ``(edisp = no) [boolean]``
51 65 Applies energy dispersion to response computation (for ``3D`` analysis only,
52   - energy dispersion is always taken into account in ``ONOFF`` analysis).
  66 + energy dispersion is always taken into account in On/Off analysis).
53 67  
54 68 ``outfile [file]``
55 69 Name of the light curve output file.
... ... @@ -90,11 +104,11 @@ General parameters
90 104  
91 105 ``xref [real]``
92 106 Right Ascension / Galactic longitude of image centre for ``3D`` analysis or
93   - source region centre for ``ONOFF`` analysis (J2000, in degrees).
  107 + source region centre for On/Off analysis (J2000, in degrees).
94 108  
95 109 ``yref [real]``
96 110 Declination / Galactic latitude of image centre for ``3D`` analysis or
97   - source region centre for ``ONOFF`` analysis (J2000, in degrees).
  111 + source region centre for On/Off analysis (J2000, in degrees).
98 112  
99 113 ``nxpix [integer]``
100 114 Size of the Right Ascension / Galactic longitude axis for ``3D`` analysis (in pixels).
... ... @@ -106,14 +120,14 @@ General parameters
106 120 Pixel size for ``3D`` analysis (in degrees/pixel).
107 121  
108 122 ``(srcshape = CIRCLE) [string]``
109   - Shape of the source region for ``ONOFF`` analysis.
  123 + Shape of the source region for On/Off analysis.
110 124 ``CIRCLE``: circular region around given position.
111 125  
112 126 ``rad [real]``
113   - Radius of source region circle for ``ONOFF`` analysis (deg)
  127 + Radius of source region circle for On/Off analysis (deg)
114 128  
115 129 ``(bkgmethod = REFLECTED) [string]``
116   - Method for background estimation in ``ONOFF`` analysis.
  130 + Method for background estimation in On/Off analysis.
117 131 ``REFLECTED:`` background evaluated in regions with the same shape as
118 132 source region reflected w.r.t. pointing direction for each observation.
119 133  
... ... @@ -124,17 +138,17 @@ General parameters
124 138  
125 139 ``(maxoffset = 4.0) [real]``
126 140 Maximum offset in degrees of source from camera center to accept the
127   - observation for ``ONOFF`` analysis.
  141 + observation for On/Off analysis.
128 142  
129 143 ``(etruemin = 0.01) [real]``
130   - Minimum true energy to evaluate instrumental response in ``ONOFF`` analysis (TeV).
  144 + Minimum true energy to evaluate instrumental response in On/Off analysis (TeV).
131 145  
132 146 ``(etruemax = 0.01) [real]``
133   - Maximum true energy to evaluate instrumental response in ``ONOFF`` analysis (TeV).
  147 + Maximum true energy to evaluate instrumental response in On/Off analysis (TeV).
134 148  
135 149 ``(etruebins = 30) [integer]``
136 150 Number of bins per decade for true energy bins to evaluate instrumental
137   - response in ``ONOFF`` analysis.
  151 + response in On/Off analysis.
138 152  
139 153 ``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
140 154 Optimization statistic. ``DEFAULT`` uses the default statistic for all
... ... @@ -174,16 +188,16 @@ Standard parameters
174 188 ``chatter = 3``: report about the task execution
175 189  
176 190 ``chatter = 4``: detailed report about the task execution
177   -
  191 +
178 192 ``(clobber = yes) [boolean]``
179 193 Specifies whether an existing light curve output file should be overwritten.
180   -
  194 +
181 195 ``(debug = no) [boolean]``
182 196 Enables debug mode. In debug mode the executable will dump any log file
183 197 output to the console.
184   -
  198 +
185 199 ``(mode = ql) [string]``
186   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  200 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
187 201  
188 202 ``(logfile = cslightcrv.log) [filename]``
189 203 Log filename.
... ... @@ -193,3 +207,4 @@ Related tools or scripts
193 207 ------------------------
194 208  
195 209 :doc:`ctlike`
  210 +:doc:`csphagen`
... ...
doc/source/users/reference_manual/csmodelinfo.rst
... ... @@ -3,25 +3,25 @@
3 3 csmodelinfo
4 4 ===========
5 5  
6   -Dumps information about a model container into log file or on screen.
  6 +Logs information about a model container into log file or on screen.
7 7  
8 8  
9 9 Synopsis
10 10 --------
11 11  
12   -This script provides detailled information about a given model container.
13   -It presents the number of parameters, the number of free parameters (sub-
14   -divided by spectral, spatial and temporal type). The tool further creates
15   -information about any parameter that is stuck at the parameter boundaries.
16   -This might be quite useful for debugging a fit. Finally the tool also list
17   -the TS values of each source that was fitted, in order have a quick overview
18   -on these quantities on the screen.
  12 +This script provides detailed information about a given model container. It
  13 +presents the number of parameters, the number of free parameters (sub-divided
  14 +by spectral, spatial and temporal type). The tool further creates information
  15 +about any parameter that is stuck at the parameter boundaries. This might be
  16 +quite useful for debugging a fit. Finally the tool also list the TS values of
  17 +each source that was fitted, in order have a quick overview on these quantities
  18 +on the screen.
19 19  
20   -In addition the tool is also capable of exporting the input model XML container
  20 +In addition the script is also capable of exporting the input model XML container
21 21 to a region file which is compatible to be read with ds9 or other displying
22   -tools. To create a region file, the hidden parameter "ds9file" needs to be
23   -specified. There are quite a few further hidden parameters to steer e.g.
24   -color, font, etc of the region file output.
  22 +tools. To create a region file, the hidden parameter ``ds9file`` needs to be
  23 +specified. There are quite a few further hidden parameters to steer e.g. color,
  24 +font, etc of the region file output.
25 25  
26 26  
27 27 General parameters
... ... @@ -36,25 +36,25 @@ General parameters
36 36 ``(pnt_type=cross) <circle|box|diamond|cross|x|arrow|boxcircle> [string]``
37 37 Marker type for point sources
38 38  
39   -``pnt_mark_size [integer]``
  39 +``(pnt_mark_size=12) [integer]``
40 40 Marker size for point sources
41 41  
42 42 ``(show_labels=yes) [boolean]``
43 43 Add source labels?
44   -
  44 +
45 45 ``(width=2) [integer]``
46 46 Line width for regions
47   -
48   - ``(font=helvetica) <helvetica|times|courier> [string]``
  47 +
  48 +``(fontfamily=helvetica) <helvetica|times|courier> [string]``
49 49 Font for source labels
50 50  
51 51 ``(fontsize=12) [integer]``
52 52 Font size for source labels
53 53  
54   -``(fonttype=normal) <normal|bold> [string]``
  54 +``(fontweight=normal) <normal|bold> [string]``
55 55 Use normal or bold font?
56 56  
57   -``(fonttype2=roman) <roman|italic> [string]``
  57 +``(fontslant=roman) <roman|italic> [string]``
58 58 Use roman or italic font?
59 59  
60 60 ``(show_ext_type=yes) [boolean]``
... ... @@ -65,31 +65,31 @@ General parameters
65 65  
66 66 ``(fixed_color=magenta) [string]``
67 67 Color for sources without free parameters (any ds9 color or hex code)
68   -
69   -
  68 +
  69 +
70 70 Standard parameters
71 71 -------------------
72 72  
73 73 ``(chatter = 2) [integer]``
74 74 Verbosity of the executable:
75 75 ``chatter = 0``: no information will be logged
76   -
  76 +
77 77 ``chatter = 1``: only errors will be logged
78   -
  78 +
79 79 ``chatter = 2``: errors and actions will be logged
80   -
  80 +
81 81 ``chatter = 3``: report about the task execution
82   -
  82 +
83 83 ``chatter = 4``: detailed report about the task execution
84   -
  84 +
85 85 ``(clobber = yes) [boolean]``
86 86 Specifies whether existing output files should be overwritten.
87   -
  87 +
88 88 ``(debug = no) [boolean]``
89 89 Enables debug mode. In debug mode the executable will dump any log file output to the console.
90   -
  90 +
91 91 ``(mode = ql) [string]``
92   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  92 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
93 93  
94 94 ``(logfile = csmodelinfo.log) [filename]``
95 95 Log filename.
... ...
doc/source/users/reference_manual/csmodelmerge.rst
... ... @@ -13,14 +13,14 @@ This script merges several model XML file into a single model XML file. The
13 13 files are passed via the ``inmodels`` parameter. There are 4 options to specify
14 14 a list of files that should be merged:
15 15  
16   -* a space-separated list of file names (e.g. ``model1.xml model2.xml``)
17   -* a semi-colon separated list of file names (e.g. ``model1.xml;model2.xml``)
18   -* a wildcard string (e.g. ``mymodel*.xml``)
19   -* an ASCII file containing the file names, one file per line (e.g. ``@mymodels.txt``)
  16 +- a space-separated list of file names (e.g. ``model1.xml model2.xml``)
  17 +- a semi-colon separated list of file names (e.g. ``model1.xml;model2.xml``)
  18 +- a wildcard string (e.g. ``mymodel*.xml``)
  19 +- an ASCII file containing the file names, one file per line (e.g. ``@mymodels.txt``)
20 20  
21 21 Note that the "@" needs to be specified in case of an ASCII file name. It is
22 22 also important to note that models with the same name cannot be appended. The
23   -tool will throw and exception if the provided file contain models with the same
  23 +script will throw and exception if the provided file contain models with the same
24 24 name.
25 25  
26 26  
... ... @@ -32,31 +32,31 @@ General parameters
32 32  
33 33 ``outmodel [file]``
34 34 Output model file
35   -
36   -
  35 +
  36 +
37 37 Standard parameters
38 38 -------------------
39 39  
40 40 ``(chatter = 2) [integer]``
41 41 Verbosity of the executable:
42 42 ``chatter = 0``: no information will be logged
43   -
  43 +
44 44 ``chatter = 1``: only errors will be logged
45   -
  45 +
46 46 ``chatter = 2``: errors and actions will be logged
47   -
  47 +
48 48 ``chatter = 3``: report about the task execution
49   -
  49 +
50 50 ``chatter = 4``: detailed report about the task execution
51   -
  51 +
52 52 ``(clobber = yes) [boolean]``
53 53 Specifies whether an existing output model file should be overwritten.
54   -
  54 +
55 55 ``(debug = no) [boolean]``
56 56 Enables debug mode. In debug mode the executable will dump any log file output to the console.
57   -
  57 +
58 58 ``(mode = ql) [string]``
59   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  59 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
60 60  
61 61 ``(logfile = csmodelmerge.log) [filename]``
62 62 Log filename.
... ...
doc/source/users/reference_manual/csmodelselect.rst
... ... @@ -21,28 +21,28 @@ General parameters
21 21 ------------------
22 22  
23 23 ``inobs [file]``
24   - Input event list or observation definition XML file
  24 + Input event list or observation definition XML file.
25 25  
26 26 ``inmodel [file]``
27   - Input model definition XML file
  27 + Input model definition XML file.
28 28  
29 29 ``outmodel [file]``
30   - Output model definition XML file
  30 + Output model definition XML file.
31 31  
32 32 ``(roilimit = 4.5) [real]``
33   - Maximum RoI radius (degrees)
  33 + Maximum RoI radius (degrees).
34 34  
35 35 ``(roimargin = 0.1) [real]``
36   - Radial margin to be added to RoIs (degrees)
  36 + Radial margin to be added to RoIs (degrees).
37 37  
38 38 ``(ethres = 0.1) [real]``
39   - Energy threshold for source flux selection (TeV)
  39 + Energy threshold for source flux selection (TeV).
40 40  
41 41 ``(fluxlimit = 1.0e-12) [real]``
42   - Minimum source flux for selection (ph/cm2/s)
  42 + Minimum source flux for selection (ph/cm2/s).
43 43  
44 44 ``(tslimit = 10.0) [real]``
45   - Minimum Test Statistic for selection
  45 + Minimum Test Statistic for selection.
46 46  
47 47 ``(fit_pos = yes) [boolean]``
48 48 Fit source positions?
... ... @@ -57,24 +57,24 @@ Standard parameters
57 57 ``(chatter = 2) [integer]``
58 58 Verbosity of the executable:
59 59 ``chatter = 0``: no information will be logged
60   -
  60 +
61 61 ``chatter = 1``: only errors will be logged
62   -
  62 +
63 63 ``chatter = 2``: errors and actions will be logged
64   -
  64 +
65 65 ``chatter = 3``: report about the task execution
66   -
  66 +
67 67 ``chatter = 4``: detailed report about the task execution
68   -
  68 +
69 69 ``(clobber = yes) [boolean]``
70 70 Specifies whether an existing output model file should be overwritten.
71   -
  71 +
72 72 ``(debug = no) [boolean]``
73 73 Enables debug mode. In debug mode the executable will dump any log file
74 74 output to the console.
75   -
  75 +
76 76 ``(mode = ql) [string]``
77   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  77 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
78 78  
79 79 ``(logfile = csmodelselect.log) [filename]``
80 80 Log filename.
... ...
doc/source/users/reference_manual/csmodelsois.rst
... ... @@ -9,45 +9,48 @@ Generate a map cube from a subset of models in an input model.
9 9 Synopsis
10 10 ----------
11 11  
12   -This tool generates a map cube from a subset of sky model components contained
  12 +This script generates a map cube from a subset of sky model components contained
13 13 in an input model. A map cube is a series of sky maps, each spanned by Right
14   -Ascension or Galactic longitude and Declination or Galactic latitude. Each
15   -map corresponds to a specific photon energy. The energy binning of the map
16   -cube may be either linear, logarithmic, or custom defined using an input
17   -file.
  14 +Ascension or Galactic longitude and Declination or Galactic latitude. Each map
  15 +corresponds to a specific photon energy. The energy binning of the map cube may
  16 +be either linear, logarithmic, or custom defined using an input file.
18 17  
19   -csmodelsois generates a map cube FITS file comprising two extensions. The
  18 +:ref:`csmodelsois` generates a map cube FITS file comprising two extensions. The
20 19 primary extension contains a 3-dimensional image containing the map cube
21 20 values. A second extension named ``ENERGIES`` contains a binary table that
22 21 defines the energy values of each map in the cube.
23 22  
24   -Optionally, csmodelsois can also output an updated model XML file in which all
  23 +Optionally, :ref:`csmodelsois` can also output an updated model XML file in which all
25 24 sources from the input model XML file used to generate the map cube are
26 25 replaced with an updated model that uses the generated map cube. This is done
27   -by specifying the 'outmodel' parameter. The 'soilist' parameter specifies a
28   -list of source names (separated by ',') to be excluded from the generated
  26 +by specifying the ``outmodel`` parameter. The ``soilist`` parameter specifies a
  27 +list of source names (separated by ``,``) to be excluded from the generated
29 28 cube.
30 29  
  30 +
31 31 General parameters
32 32 ------------------
33 33  
34 34 ``inmodel [file]``
35 35 Input model XML file.
36 36  
37   -``outmodel [file]``
38   - Output model XML file (not generated if set to ``NONE``).
39   -
40 37 ``outcube [file]``
41 38 Output map cube file.
42 39  
43   -``soilist [string]``
44   - CSV list of sources to be excluded from the generated map cube.
45   -
46 40 ``(ptsrcsig = 1.0) [real]``
47 41 Sigma of Gaussian to be used for point sources (in arcmin).
48 42  
  43 +``soilist [string]``
  44 + CSV list of source names to be excluded from the generated map cube.
  45 +
  46 +``outmodel [file]``
  47 + Output model XML file (not generated if set to ``NONE``).
  48 +
49 49 ``ebinalg <FILE|LIN|LOG> [string]``
50   - Algorithm for defining energy bins.
  50 + Algorithm for defining energy bins. For ``FILE``, the energy bins are defined
  51 + in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN``
  52 + and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or
  53 + logarithmically between ``emin`` and ``emax``, respectively.
51 54  
52 55 ``emin [real]``
53 56 Lower energy value for first energy bin (in TeV).
... ... @@ -59,13 +62,14 @@ General parameters
59 62 Number of energy bins.
60 63  
61 64 ``ebinfile [file]``
62   - Name of the file containing the energy bin definition.
  65 + Name of the file containing the energy bin definition. You may use :ref:`csebins`
  66 + to generate a file with appropriate energy bins.
63 67  
64 68 ``nxpix [integer]``
65   - Number of cube bins in Right Ascension or Galactic longitude.
  69 + Number of map cube bins in Right Ascension or Galactic longitude.
66 70  
67 71 ``nypix [integer]``
68   - Number of cube bins in Declination or Galactic latitude.
  72 + Number of map cube bins in Declination or Galactic latitude.
69 73  
70 74 ``binsz [real]``
71 75 Image scale (in degrees/pixel).
... ... @@ -77,16 +81,16 @@ General parameters
77 81 Projection method.
78 82  
79 83 ``ra [real]``
80   - Right Ascension of cube centre (J2000, in degrees).
  84 + Right Ascension of map cube centre (J2000, in degrees).
81 85  
82 86 ``dec [real]``
83   - Declination of cube centre (J2000, in degrees).
  87 + Declination of map cube centre (J2000, in degrees).
84 88  
85 89 ``glon [real]``
86   - Galactic longitude of cube centre (in degrees).
  90 + Galactic longitude of map cube centre (in degrees).
87 91  
88 92 ``glat [real]``
89   - Galactic latitude of cube centre (in degrees).
  93 + Galactic latitude of map cube centre (in degrees).
90 94  
91 95  
92 96 Standard parameters
... ... @@ -114,7 +118,7 @@ Standard parameters
114 118 Enables debug mode. In debug mode the executable will dump any log file output to the console.
115 119  
116 120 ``(mode = ql) [string]``
117   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  121 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
118 122  
119 123 ``(logfile = csmodelsois.log) [string]``
120 124 Name of log file.
... ...
doc/source/users/reference_manual/csobs2caldb.rst
... ... @@ -11,15 +11,15 @@ Synopsis
11 11  
12 12 This script creates an entry in the local calibration database from an
13 13 input observation container. The caldb entry can be used for simulations
14   -with :doc:`ctobssim` later on. On default csobs2caldb uses the first observation
15   -in the given container. This can be modified using the hidden parameter "index"
16   -(e.g. index=3 instructs the tool to use the third observation in the container).
  14 +with :doc:`ctobssim` later on. On default :ref:`csobs2caldb` uses the first observation
  15 +in the given container. This can be modified using the hidden parameter ``index``
  16 +(e.g. ``index=3`` instructs the tool to use the third observation in the container).
17 17 Note that for the moment, the script only works for unbinned observations which
18   -use the latest CTA IRF format (i.e. 2D/3D FITS binary tables).
  18 +use the latest CTA IRF format (i.e. 2D/3D FITS binary tables).
19 19  
20 20 In particular this script might be useful for simulations of current IACT data.
21   -Provided a specific observation with IRFs e.g. at certain zenith/azimuth angle,
22   -the user can create a caldb entry using this tool and subsequently simulate e.g.
  21 +Provided a specific observation with IRFs e.g. at certain zenith/azimuth angle,
  22 +the user can create a caldb entry using this tool and subsequently simulate e.g.
23 23 50 hours using this configuration.
24 24  
25 25 General parameters
... ... @@ -50,23 +50,23 @@ Standard parameters
50 50 ``(chatter = 2) [integer]``
51 51 Verbosity of the executable:
52 52 ``chatter = 0``: no information will be logged
53   -
  53 +
54 54 ``chatter = 1``: only errors will be logged
55   -
  55 +
56 56 ``chatter = 2``: errors and actions will be logged
57   -
  57 +
58 58 ``chatter = 3``: report about the task execution
59   -
  59 +
60 60 ``chatter = 4``: detailed report about the task execution
61   -
  61 +
62 62 ``(clobber = yes) [boolean]``
63 63 Specifies whether an existing output file should be overwritten.
64   -
  64 +
65 65 ``(debug = no) [boolean]``
66 66 Enables debug mode. In debug mode the executable will dump any log file output to the console.
67   -
  67 +
68 68 ``(mode = ql) [string]``
69   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  69 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
70 70  
71 71 ``(logfile = csobs2caldb.log) [filename]``
72 72 Log filename.
... ...
doc/source/users/reference_manual/csobsdef.rst
... ... @@ -9,33 +9,32 @@ Generates an observation definition file.
9 9 Synopsis
10 10 --------
11 11  
12   -The csobsdef script generates an observation definition file from
13   -a pointing list. The pointing list is a comma-separated value (CSV)
14   -ASCII file with header keywords in the first row followed by a list
15   -of pointings (one pointing per row). The following header keywords
16   -are supported (case sensitive, column order irrelevant):
17   -
18   -* name - Observation name string
19   -* id - Unique observation identifier string
20   -* ra - Right Ascension of pointing (deg)
21   -* dec - Declination of pointing (deg)
22   -* lon - Galactic longitude of pointing (deg)
23   -* lat - Galactic latitude of pointing (deg)
24   -* duration - Duration of pointing (seconds)
25   -* emin - Lower energy limit (TeV)
26   -* emax - Upper energy limit (TeV)
27   -* rad - Radius of region of interest (deg)
28   -* deadc - Deadtime correction factor [0-1]
29   -* caldb - Calibration database
30   -* irf - Response function name
31   -
32   -Only the pairs (ra,dec) or (lon,lat) are mandatory header keywords.
33   -All other keywords are optional and can be specified when calling
34   -csobsdef as user parameters. The only exception is the "duration"
35   -keyword that will automatically be queried.
36   -
  12 +This script generates an observation definition file from a pointing list. The
  13 +pointing list is a comma-separated value (CSV) ASCII file with header keywords
  14 +in the first row followed by a list of pointings (one pointing per row). The
  15 +following header keywords are supported (case sensitive, column order irrelevant):
  16 +
  17 +- name - Observation name string
  18 +- id - Unique observation identifier string
  19 +- ra - Right Ascension of pointing (deg)
  20 +- dec - Declination of pointing (deg)
  21 +- lon - Galactic longitude of pointing (deg)
  22 +- lat - Galactic latitude of pointing (deg)
  23 +- duration - Duration of pointing (seconds)
  24 +- emin - Lower energy limit (TeV)
  25 +- emax - Upper energy limit (TeV)
  26 +- rad - Radius of region of interest (deg)
  27 +- deadc - Deadtime correction factor [0-1]
  28 +- caldb - Calibration database
  29 +- irf - Response function name
  30 +
  31 +Only the pairs (ra,dec) or (lon,lat) are mandatory header keywords. All other
  32 +keywords are optional and can be specified when calling :ref:`csobsdef` as user
  33 +parameters. The only exception is the ``duration`` keyword that will automatically
  34 +be queried.
  35 +
37 36 Here some usage examples:
38   -
  37 +
39 38 ``csobsdef``
40 39 Creates minimal observation definition file.
41 40  
... ... @@ -62,27 +61,27 @@ General parameters
62 61 ``duration [real]``
63 62 Duration of observation (in seconds).
64 63  
65   -``(name = "") [string]``
  64 +``(name = None) [string]``
66 65 Observation name.
67 66  
68 67 ``(caldb = "") [string]``
69 68 Calibration database.
70   -
  69 +
71 70 ``(irf = "") [string]``
72 71 Instrumental response function.
73 72  
74 73 ``(emin = UNDEF) [real]``
75 74 Lower energy limit of events (in TeV).
76   -
  75 +
77 76 ``(emax = UNDEF) [real]``
78 77 Upper energy limit of events (in TeV).
79   -
  78 +
80 79 ``(rad = UNDEF) [real]``
81 80 ROI radius (in degrees).
82 81  
83 82 ``(deadc = 0.95) [real]``
84 83 Average deadtime correction factor.
85   -
  84 +
86 85  
87 86 Standard parameters
88 87 -------------------
... ... @@ -90,23 +89,23 @@ Standard parameters
90 89 ``(chatter = 2) [integer]``
91 90 Verbosity of the executable:
92 91 ``chatter = 0``: no information will be logged
93   -
  92 +
94 93 ``chatter = 1``: only errors will be logged
95   -
  94 +
96 95 ``chatter = 2``: errors and actions will be logged
97   -
  96 +
98 97 ``chatter = 3``: report about the task execution
99   -
  98 +
100 99 ``chatter = 4``: detailed report about the task execution
101   -
  100 +
102 101 ``(clobber = yes) [boolean]``
103 102 Specifies whether an existing Observation Definition XML file should be overwritten.
104   -
  103 +
105 104 ``(debug = no) [boolean]``
106 105 Enables debug mode. In debug mode the executable will dump any log file output to the console.
107   -
  106 +
108 107 ``(mode = ql) [string]``
109   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  108 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
110 109  
111 110 ``(logfile = csobsdef.log) [string]``
112 111 Log filename.
... ...
doc/source/users/reference_manual/csobsinfo.rst
... ... @@ -3,8 +3,7 @@
3 3 csobsinfo
4 4 =========
5 5  
6   -Dumps information about an observation container into log file or on
7   -screen.
  6 +Logs information about an observation container into log file or on screen.
8 7  
9 8  
10 9 Synopsis
... ... @@ -15,43 +14,43 @@ For IACT observations usually several observations with different configurations
15 14 are combined. The script computes e.g. the overall energy range which could be
16 15 an important input for :doc:`ctbin` to create a suitable energy range. In
17 16 addition the script prints the pointing attributes like the average
18   -zenith/azimuth angle. If the hidden boolean parameter "offset" is specified to
19   -"yes", the script queries for the target position and computes the run-by-run
20   -offset as well as its average. In the observation summary, the time range of
21   -the observations including total ontime and (dead-time corrected) livetime is
22   -shown.
  17 +zenith/azimuth angle. If the hidden boolean parameter ``offset`` is set to ``yes``,
  18 +the script queries for the target position and computes the run-by-run offset as
  19 +well as its average. In the observation summary, the time range of the
  20 +observations including total ontime and (dead-time corrected) livetime is shown.
23 21  
24   -The script further contains the hidden parameter "ds9file". If specified with
  22 +The script further contains the hidden parameter ``ds9file``. If specified with
25 23 a file name, the tool writes out a ds9 region file including a cross for each
26 24 pointing position in the sky.
27 25  
28   -When executed from within python, the script provides methods to return arrays
  26 +When executed from within Python, the script provides methods to return arrays
29 27 containing observation-wise parameters. This might be useful for graphical
30 28 display within a script. The following methods are implemented:
31   -- zeniths (returning all zenith angles)
32   -- azimuths (returning all azimuth angles)
33   -- offsets (returning all offset angles, provided the hidden parameter offset=yes)
34   -- ebounds (returning energy boundaries)
35   -- gtis (returning good time intervals)
  29 +
  30 +- ``zeniths`` (return zenith angles)
  31 +- ``azimuths`` (return azimuth angles)
  32 +- ``offsets`` (return offset angles, provided the hidden parameter ``offset=yes``)
  33 +- ``ebounds`` (return energy boundaries)
  34 +- ``gti`` (return good time intervals)
36 35  
37 36  
38 37 General parameters
39 38 ------------------
40 39  
41 40 ``inobs [file]``
42   - Event list, counts cube, or observation definition file
  41 + Event list, counts cube, or observation definition file.
43 42  
44 43 ``outds9file [file]``
45   - DS9 region file containing pointing directions
  44 + DS9 region file containing pointing directions.
46 45  
47 46 ``(offset = no) [file]``
48   - Compute offset from target to pointing positions
  47 + Compute offset from target to pointing positions.
49 48  
50 49 ``ra [real]``
51   - Target right ascension for offset computation (only queried if offset=yes)
  50 + Target right ascension for offset computation (only queried if ``offset=yes``).
52 51  
53 52 ``dec [real]``
54   - Target declination for offset computation (only queried if offset=yes)
  53 + Target declination for offset computation (only queried if ``offset=yes``).
55 54  
56 55  
57 56 Standard parameters
... ... @@ -60,23 +59,23 @@ Standard parameters
60 59 ``(chatter = 2) [integer]``
61 60 Verbosity of the executable:
62 61 ``chatter = 0``: no information will be logged
63   -
  62 +
64 63 ``chatter = 1``: only errors will be logged
65   -
  64 +
66 65 ``chatter = 2``: errors and actions will be logged
67   -
  66 +
68 67 ``chatter = 3``: report about the task execution
69   -
  68 +
70 69 ``chatter = 4``: detailed report about the task execution
71   -
  70 +
72 71 ``(clobber = yes) [boolean]``
73 72 Specifies whether an existing output file should be overwritten.
74   -
  73 +
75 74 ``(debug = no) [boolean]``
76 75 Enables debug mode. In debug mode the executable will dump any log file output to the console.
77   -
  76 +
78 77 ``(mode = ql) [string]``
79   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  78 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
80 79  
81 80 ``(logfile = csobsinfo.log) [filename]``
82 81 Log filename.
... ...
doc/source/users/reference_manual/csobsselect.rst
... ... @@ -10,72 +10,82 @@ Synopsis
10 10 --------
11 11  
12 12 This script selects all observations from an observation definiton XML file that
13   -have pointings within a specified selection region and writes these observations
14   -into a new observation definition XML file. Possible selection regions are a
15   -circle and a box, either in Galactic or Celestial coordinates.
  13 +have pointings within a specified selection region and time interval and writes
  14 +these observations into a new observation definition XML file. Possible selection
  15 +regions are a circle and a box, either in Galactic or Celestial coordinates.
16 16  
17 17  
18 18 General parameters
19 19 ------------------
20 20  
21 21 ``inobs [file]``
22   - Input event list or observation definition XML file
  22 + Input event list or observation definition XML file.
23 23  
24 24 ``outobs [file]``
25   - Output observation definition XML file
  25 + Output observation definition XML file.
26 26  
27 27 ``pntselect <CIRCLE|BOX> [string]``
28   - Pointing selection region shape
  28 + Pointing selection region shape.
29 29  
30 30 ``coordsys <CEL|GAL> [string]``
31   - Coordinate system (CEL - celestial, GAL - galactic)
  31 + Coordinate system (CEL - celestial, GAL - galactic).
32 32  
33 33 ``ra [real]``
34   - Right Ascension of pointing selection centre (J2000, in degrees)
35   -
  34 + Right Ascension of pointing selection centre (J2000, in degrees).
  35 +
36 36 ``dec [real]``
37   - Declination of pointing selection centre (J2000, in degrees)
  37 + Declination of pointing selection centre (J2000, in degrees).
38 38  
39 39 ``glon [real]``
40   - Galactic longitude of pointing selection centre (degrees)
41   -
  40 + Galactic longitude of pointing selection centre (degrees).
  41 +
42 42 ``glat [real]``
43   - Galactic latitude of pointing selection centre (degrees)
  43 + Galactic latitude of pointing selection centre (degrees).
44 44  
45 45 ``rad [real]``
46   - Radius of selection circle (degrees)
  46 + Radius of selection circle (degrees).
47 47  
48 48 ``width [real]``
49   - Width of selection box (degrees)
  49 + Width of selection box (degrees).
50 50  
51 51 ``height [real]``
52   - Height of selection box (degrees)
  52 + Height of selection box (degrees).
  53 +
  54 +``tmin [time]``
  55 + Start time (UTC string, JD, MJD or time in seconds).
  56 + If ``INDEF``, ``NONE``, ``UNDEF`` or ``UNDEFINED`` is passed as value, no time
  57 + selection will be performed.
  58 +
  59 +``tmax [time]``
  60 + Stop time (UTC string, JD, MJD or time in seconds).
  61 + If ``INDEF``, ``NONE``, ``UNDEF`` or ``UNDEFINED`` is passed as value, no time
  62 + selection will be performed.
  63 +
53 64  
54   -
55 65 Standard parameters
56 66 -------------------
57 67  
58 68 ``(chatter = 2) [integer]``
59 69 Verbosity of the executable:
60 70 ``chatter = 0``: no information will be logged
61   -
  71 +
62 72 ``chatter = 1``: only errors will be logged
63   -
  73 +
64 74 ``chatter = 2``: errors and actions will be logged
65   -
  75 +
66 76 ``chatter = 3``: report about the task execution
67   -
  77 +
68 78 ``chatter = 4``: detailed report about the task execution
69   -
  79 +
70 80 ``(clobber = yes) [boolean]``
71 81 Specifies whether an existing output model file should be overwritten
72   -
  82 +
73 83 ``(debug = no) [boolean]``
74 84 Enables debug mode. In debug mode the executable will dump any log file
75 85 output to the console
76   -
  86 +
77 87 ``(mode = ql) [string]``
78   - Mode of automatic parameters (default is "ql", i.e. "query and learn")
  88 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn")
79 89  
80 90 ``(logfile = csobsselect.log) [filename]``
81 91 Log filename
... ...
doc/source/users/reference_manual/csphagen.rst
... ... @@ -3,24 +3,56 @@
3 3 csphagen
4 4 ========
5 5  
6   -Creates files necessary to perform a classical region-based spectral analysis
7   -on IACT data, i.e., source and background PHA files, ARF and RMF files.
  6 +Creates files necessary to perform a region-based spectral On/Off analysis.
8 7  
9 8  
10 9 Synopsis
11 10 --------
12 11  
13   -This script can be used to derive from an observation or a set of observations
14   -the count spectra in a source region and in background regions, as well as the
15   -detector response (effective area, energy redistribution matrix), that can be
16   -used to perform a classical 1D spectral analysis. The output files are saved in
17   -the OGIP format normally used in X-ray astronomy (PHA, ARF, RMF).
18   -`See here <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/node5.html>`__.
19   -
20   -The outputs are:
21   -
22   -1) the PHA, ARF, RMF files, either separately for each observation, or stacked
23   - for a set of observations,
  12 +This script generates the files that are necessary for a region-based spectral
  13 +On/Off analysis from one or several event lists. The output files are saved in
  14 +the OGIP format normally used in X-ray astronomy (PHA, ARF, RMF),
  15 +`see here for a description of the format <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/node5.html>`__.
  16 +
  17 +If the ``bkgmethod`` parameter is ``REFLECTED``, the script will use an On region
  18 +shape defined by the ``srcshape`` parameter and generate reflected regions by
  19 +placing regions of the same shape that are reflected with respect to the pointing
  20 +direction. So far only circular regions are supported, with a center that is
  21 +specified by the ``ra`` and ``dec`` parameters if ``coordsys=CEL`` or the ``glon``
  22 +and ``glat`` parameters if ``coordsys=GAL``, and a radius that is specified by the
  23 +``rad`` parameter. Reflected regions are only generated for offset angles with
  24 +respect to the pointing direction that are smaller than the value specified by
  25 +the ``maxoffset`` parameter. If less than ``bkgregmin`` reflected regions can be
  26 +found because the offset angle between source and pointing direction is too small,
  27 +the observation will be skipped. Regions to be excluded for background
  28 +determination can be specified using a mask file that is specified using the
  29 +``inexclusion`` parameter. A mask file is a sky map where all pixel values that
  30 +differ from zero will be used as exclusion region.
  31 +
  32 +Alternatively, if ``bkgmethod=CUSTOM`` is specified, the source and background
  33 +regions will be specified using the ``srcregfile`` and ``bkgregfile`` parameters,
  34 +respectively. Both parameters accept either a ds9 region file or a sky map where
  35 +all non-zero pixel values define a region. In case that an observation definition
  36 +XML file is specified as input using the ``inobs``, background region files can
  37 +be specified separately for each observation using the ``OffRegions`` parameter
  38 +in the format
  39 +
  40 +.. code-block:: xml
  41 +
  42 + <observation name="Crab" id="00001" instrument="CTA">
  43 + <parameter name="OffRegions" file="ds9.reg"/>
  44 + ...
  45 + </observation>
  46 +
  47 +The :ref:`csphagen` script will produce on output an observation definition XML
  48 +file that points to all relevant files. All relevant files will be prefixed with
  49 +the string specified by the ``prefix`` parameter. If several observations are
  50 +contained in the input observation definition XML file the script can either
  51 +generate region based files for each of the observations or stack all
  52 +observations into single files (controlled via the ``stack`` parameter). The
  53 +script will write out:
  54 +
  55 +1) the PHA, ARF, RMF files;
24 56 2) DS9 regions files listing the source and background regions for each
25 57 observation;
26 58 3) a new observation definition XML file.
... ... @@ -39,8 +71,8 @@ General parameters
39 71 Instrument response function.
40 72  
41 73 ``(inexclusion = NONE) [file]``
42   - Optional FITS file containing a WCS map in the first hdu that defines sky
43   - regions not to be used for background estimation (where map value != 0).
  74 + Optional FITS file containing a WCS map in the first extension that defines
  75 + sky regions not to be used for background estimation (where map value != 0).
44 76  
45 77 ``outobs [string]``
46 78 Output observation definition XML file.
... ... @@ -48,52 +80,70 @@ General parameters
48 80 ``(prefix = onoff) [string]``
49 81 Prefix of the file name for output PHA, ARF, RMF, XML, and DS9 region files.
50 82  
  83 +``ebinalg <FILE|LIN|LOG> [string]``
  84 + Algorithm for defining energy bins. For ``FILE``, the energy bins are defined
  85 + in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN``
  86 + and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or
  87 + logarithmically between ``emin`` and ``emax``, respectively.
  88 +
51 89 ``emin [real]``
52   - Lower energy limit (TeV) if ``LIN`` or ``LOG`` binning algorithms are used.
  90 + Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG``
  91 + energy binning algorithms are used.
53 92  
54 93 ``emax [real]``
55   - Upper energy limit (TeV) if ``LIN`` or ``LOG`` binning algorithms are used.
  94 + Upper energy value for last energy bin (in TeV) if ``LIN`` or ``LOG``
  95 + energy binning algorithms are used.
56 96  
57 97 ``enumbins [integer]``
58   - Number of energy bins. At least 30 bins per decade are recommended for
59   - proper evaluation of the instrument response.
60   -
61   -``ebinalg [string]``
62   - Energy binning algorithm:
63   - ``LOG`` : logarithmically spaced energy bins;
64   - ``LIN`` : linearly spaced energy bins;
65   - ``FILE``: energy bounds retrieved from file.
  98 + Number of energy bins if ``LIN`` or ``LOG`` energy binning algorithms are used.
  99 + At least 30 bins per decade are recommended for proper evaluation of the
  100 + instrument response.
66 101  
67 102 ``ebinfile [file]``
68   - Name of the file containing the energy bin definition if ``FILE`` algorithm
69   - is used.
  103 + Name of the file containing the energy binning definition if ``ebinalg=FILE``.
  104 + You may use :ref:`csebins` to generate a file with appropriate energy binning.
70 105  
71   -``(srcshape = CIRCLE) [string]``
72   - Shape of the source region.
73   - ``CIRCLE``: circular region around given position.
  106 +``(srcshape = CIRCLE) <CIRCLE> [string]``
  107 + Shape of the source region. So far only ``CIRCLE`` exists which defines a
  108 + circular region around given position.
74 109  
75   -``coordsys [string]``
76   - Coordinate system (``CEL`` - celestial, ``GAL`` - galactic)
  110 +``coordsys <CEL|GAL> [string]``
  111 + Coordinate system (CEL - celestial, GAL - galactic).
77 112  
78 113 ``ra [real]``
79   - Right Ascension of source region centre (deg)
  114 + Right Ascension of source region centre (deg).
80 115  
81 116 ``dec [real]``
82   - Declination of source region centre (deg)
  117 + Declination of source region centre (deg).
83 118  
84 119 ``glon [real]``
85   - Galactic longitude of source region centre (deg)
  120 + Galactic longitude of source region centre (deg).
86 121  
87 122 ``glat [real]``
88   - Galactic latitude of source region centre (deg)
  123 + Galactic latitude of source region centre (deg).
89 124  
90 125 ``rad [real]``
91   - Radius of source region circle (deg)
  126 + Radius of source region circle (deg).
  127 +
  128 +``srcregfile [file]``
  129 + Source region file (ds9 or FITS WCS map).
92 130  
93   -``(bkgmethod = REFLECTED) [string]``
94   - Method for background estimation.
95   - ``REFLECTED:`` background evaluated in regions with the same shape as
96   - source region reflected w.r.t. pointing direction for each observation.
  131 +``bkgmethod <REFLECTED|CUSTOM> [string]``
  132 + Method for background estimation:
  133 +
  134 + - ``REFLECTED``: background is evaluated in regions with the same shape as
  135 + the source region reflected w.r.t. pointing direction for each observation
  136 +
  137 + - ``CUSTOM``: background is evaluated in regions specified by user. For an
  138 + event list or a single observation in the observation definition XML file
  139 + a region file will be queried (see ``bkgregfile`` parameter). For multiple
  140 + observations specified in the observation definition XML file the name of
  141 + the region file will be extracted from the ``OffRegions`` parameter that
  142 + needs to be specified for each observation in the observation definition
  143 + XML file. Off region files can be either ds9 region files or FITS WCS maps.
  144 +
  145 +``bkgregfile [file]``
  146 + Background regions file (ds9 or FITS WCS map).
97 147  
98 148 ``(bkgregmin = 2) [integer]``
99 149 Minimum number of background regions that are required for an observation.
... ... @@ -124,22 +174,22 @@ Standard parameters
124 174 ``(chatter = 2) [integer]``
125 175 Verbosity of the executable:
126 176 ``chatter = 0``: no information will be logged
127   -
  177 +
128 178 ``chatter = 1``: only errors will be logged
129   -
  179 +
130 180 ``chatter = 2``: errors and actions will be logged
131   -
  181 +
132 182 ``chatter = 3``: report about the task execution
133   -
  183 +
134 184 ``chatter = 4``: detailed report about the task execution
135   -
  185 +
136 186 ``(clobber = yes) [boolean]``
137 187 Specifies whether an existing output runlist should be overwritten.
138   -
  188 +
139 189 ``(debug = no) [boolean]``
140 190 Enables debug mode. In debug mode the executable will dump any log file
141 191 output to the console.
142   -
  192 +
143 193 ``(mode = ql) [string]``
144 194 Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
145 195  
... ... @@ -147,3 +197,8 @@ Standard parameters
147 197 Log filename.
148 198  
149 199  
  200 +Related tools or scripts
  201 +------------------------
  202 +
  203 +None
  204 +
... ...
doc/source/users/reference_manual/csphasecrv.rst
... ... @@ -12,15 +12,27 @@ Synopsis
12 12 This script computes spectra by performing a maximum likelihood fit using
13 13 :doc:`ctlike` in a series of phase bins for periodic sources. The input event
14 14 list must have a ``PHASE`` column containing the phase values, that can be
15   -assigned using :doc:`ctphase`. The phase bins can be
16   -either specified in an ASCII file or as an interval divided into equally sized
17   -phase bins. The format of the ASCII file is one row per phase bin, each
18   -specifying the start of stop value of the phase bin, separated by a whitespace.
19   -The phase goes from 0.0 to 1.0.
  15 +assigned using :doc:`ctphase`. The phase bins can be either specified in an ASCII
  16 +file or as an interval divided into equally sized phase bins. The format of the
  17 +ASCII file is one row per phase bin, each specifying the start of stop value of
  18 +the phase bin, separated by a whitespace. The phase goes from 0.0 to 1.0.
20 19  
21   -The script writes the fit results into a FITS file. The script
22   -also produces one XML file per phase bin that contains the best-fit model for
23   -that bin.
  20 +:ref:`csphasecrv` can perform the phase curve fitting in unbinned, stacked or
  21 +On/Off analysis mode; on input the script always requires unbinned data, i.e.
  22 +event list(s), since only event data retain phase information for phase curve
  23 +fitting. To select unbinned analysis, specify ``method=3D`` and ``enumbins=0``;
  24 +for stacked analysis specify ``method=3D`` and any positive number for ``enumbins``.
  25 +To perform the analysis in On/Off model, specify ``method=ONOFF``.
  26 +
  27 +For a stacked analysis, :ref:`csphasecrv` will query the parameters that define
  28 +the counts cube (``coordsys``, ``proj``, ``xref``, ``yref``, ``nxpix``, ``nypix``,
  29 +``binsz``) while for an On/Off analysis the script will query the parameters that
  30 +are necessary to run internally the :ref:`csphagen` script (``inexclusion``, ``coordsys``,
  31 +``xref``, ``yref``, ``srcshape``, ``rad``, ``bkgmethod``, ``bkgregmin``, ``maxoffset``,
  32 +``etruemin``, ``etruemax``, ``etruebins``).
  33 +
  34 +The script writes the fit results into a FITS file. The script also produces one
  35 +XML file per phase bin that contains the best-fit model for that bin.
24 36  
25 37  
26 38 General parameters
... ... @@ -43,7 +55,7 @@ General parameters
43 55  
44 56 ``(inexclusion = NONE) [file]``
45 57 Optional FITS file containing a WCS map in the first hdu that defines sky
46   - regions not to be used for background estimation in ``ONOFF`` analysis (where
  58 + regions not to be used for background estimation in On/Off analysis (where
47 59 map value != 0).
48 60  
49 61 ``(edisp = no) [boolean]``
... ... @@ -74,7 +86,7 @@ General parameters
74 86 Upper energy limit of events (in TeV).
75 87  
76 88 ``enumbins [integer]``
77   - Number of energy bins per phase bin (0=unbinned).
  89 + Number of energy bins per phase bin (0=unbinned for ``3D`` analysis only).
78 90  
79 91 ``coordsys <CEL|GAL> [string]``
80 92 Coordinate system (CEL - celestial, GAL - galactic).
... ... @@ -84,11 +96,11 @@ General parameters
84 96  
85 97 ``xref [real]``
86 98 Right Ascension / Galactic longitude of image centre for ``3D`` analysis or
87   - source region centre for ``ONOFF`` analysis (J2000, in degrees).
  99 + source region centre for On/Off analysis (J2000, in degrees).
88 100  
89 101 ``yref [real]``
90 102 Declination / Galactic latitude of image centre for ``3D`` analysis or
91   - source region centre for ``ONOFF`` analysis (J2000, in degrees).
  103 + source region centre for On/Off analysis (J2000, in degrees).
92 104  
93 105 ``nxpix [integer]``
94 106 Size of the Right Ascension / Galactic longitude axis for ``3D`` analysis (in pixels).
... ... @@ -100,35 +112,35 @@ General parameters
100 112 Pixel size for ``3D`` analysis (in degrees/pixel).
101 113  
102 114 ``(srcshape = CIRCLE) [string]``
103   - Shape of the source region for ``ONOFF`` analysis.
  115 + Shape of the source region for On/Off analysis.
104 116 ``CIRCLE``: circular region around given position.
105 117  
106 118 ``rad [real]``
107   - Radius of source region circle for ``ONOFF`` analysis (deg)
  119 + Radius of source region circle for On/Off analysis (deg)
108 120  
109 121 ``(bkgmethod = REFLECTED) [string]``
110   - Method for background estimation in ``ONOFF`` analysis.
  122 + Method for background estimation in On/Off analysis.
111 123 ``REFLECTED:`` background evaluated in regions with the same shape as
112 124 source region reflected w.r.t. pointing direction for each observation.
113 125  
114 126 ``(bkgregmin = 2) [integer]``
115 127 Minimum number of background regions that are required for an observation in
116   - ``ONOFF`` analysis. If this number of background regions is not available the
  128 + On/Off analysis. If this number of background regions is not available the
117 129 observation is skipped.
118 130  
119 131 ``(maxoffset = 4.0) [real]``
120 132 Maximum offset in degrees of source from camera center to accept the
121   - observation for ``ONOFF`` analysis.
  133 + observation for On/Off analysis.
122 134  
123 135 ``(etruemin = 0.01) [real]``
124   - Minimum true energy to evaluate instrumental response in ``ONOFF`` analysis (TeV).
  136 + Minimum true energy to evaluate instrumental response in On/Off analysis (TeV).
125 137  
126 138 ``(etruemax = 0.01) [real]``
127   - Maximum true energy to evaluate instrumental response in ``ONOFF`` analysis (TeV).
  139 + Maximum true energy to evaluate instrumental response in On/Off analysis (TeV).
128 140  
129 141 ``(etruebins = 30) [integer]``
130 142 Number of bins per decade for true energy bins to evaluate instrumental
131   - response in ``ONOFF`` analysis.
  143 + response in On/Off analysis.
132 144  
133 145 ``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
134 146 Optimization statistic. ``DEFAULT`` uses the default statistic for all
... ... @@ -156,7 +168,7 @@ Standard parameters
156 168 ``chatter = 3``: report about the task execution
157 169  
158 170 ``chatter = 4``: detailed report about the task execution
159   -
  171 +
160 172 ``(clobber = yes) [boolean]``
161 173 Specifies whether an existing light curve output file should be overwritten.
162 174  
... ... @@ -165,7 +177,7 @@ Standard parameters
165 177 output to the console.
166 178  
167 179 ``(mode = ql) [string]``
168   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  180 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
169 181  
170 182 ``(logfile = csphasecrv.log) [filename]``
171 183 Log filename.
... ...
doc/source/users/reference_manual/cspull.rst
... ... @@ -11,14 +11,25 @@ Synopsis
11 11  
12 12 This script generates pull distributions for all free model parameters.
13 13 The pull is defined as the fitted model parameter value minus the true
14   -value, divided by the parameter error. cspull will perform ``ntrials``
  14 +value, divided by the parameter error. :ref:`cspull` will perform ``ntrials``
15 15 statistically independent Monte Carlo simulations followed by maximum
16 16 likelihood model fitting to derive the pull distribution for each free
17 17 model parameter. If the model fit is unbiased and the parameters are
18 18 correct, the pull distribution should follow a Gaussian centred on 0
19 19 and with a sigma parameter of 1.
20 20  
21   -cspull will generate an ASCII file in comma-separated value (CSV) format,
  21 +The script can generate pull distributions for unbinned, binned, stacked or
  22 +On/Off analyses. The script always starts from simulating an event list. If
  23 +the ``enumbins`` parameter is zero and ``onsrc=NONE`` an unbinned analysis will
  24 +be performed. If ``enumbins`` is positive and ``onsrc=NONE`` the script will
  25 +perform a binned analysis. To perform a stacked analysis, an observation definition
  26 +XML file with response cube information has to be specified for the ``inobs``
  27 +parameter. Finally, if the ``onsrc`` parameter is set to the name of a source in
  28 +the input model (specified via the ``inmodel`` parameter), the script will perform
  29 +an On/Off analysis using the ``REFLECTED`` method and a On region radius that is
  30 +given by the ``onrad`` parameter.
  31 +
  32 +:ref:`cspull` will generate an ASCII file in comma-separated value (CSV) format,
22 33 containing one row per pull. The first row is a header row providing the
23 34 column names. The following rows give the pull results, one row per pull.
24 35 This includes for each parameter the parameter value, error and pull. The
... ... @@ -35,7 +46,7 @@ of trials. Both scripts require matplotlib for plotting.
35 46 General parameters
36 47 ------------------
37 48  
38   -``inobs [file]``
  49 +``(inobs = NONE) [file]``
39 50 Event list, counts cube, or observation definition XML file.
40 51  
41 52 ``inmodel [file]``
... ... @@ -99,7 +110,7 @@ General parameters
99 110 Number of pixels for binned analysis.
100 111  
101 112 ``binsz [real]``
102   - Pixel size for binned analysis.
  113 + Pixel size for binned analysis (degrees/pixel).
103 114  
104 115 ``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
105 116 Optimization statistic. ``DEFAULT`` uses the default statistic for all
... ... @@ -139,7 +150,7 @@ Standard parameters
139 150 output to the console.
140 151  
141 152 ``(mode = ql) [string]``
142   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  153 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
143 154  
144 155 ``(logfile = cspull.log) [string]``
145 156 Log filename.
... ...
doc/source/users/reference_manual/csresmap.rst
... ... @@ -18,10 +18,10 @@ binning and used for residual computation. Before residual computation,
18 18 the counts and model cubes are collapsed into maps by summing over all
19 19 energies. Four options exist then for residual computation:
20 20  
21   -* the subtraction of the model from the counts (SUB)
22   -* the subtraction and division by the model (SUBDIV)
23   -* the subtraction and division by the square root of the model (SUBDIVSQRT)
24   -* the computation of the significance using Li & Ma (SIGNIFICANCE)
  21 +- the subtraction of the model from the counts (SUB)
  22 +- the subtraction and division by the model (SUBDIV)
  23 +- the subtraction and division by the square root of the model (SUBDIVSQRT)
  24 +- the computation of the significance using Li & Ma (SIGNIFICANCE)
25 25  
26 26 The residual map is written into a FITS file.
27 27  
... ... @@ -32,6 +32,9 @@ General parameters
32 32 ``inobs [file]``
33 33 Input event list, counts cube or observation definition XML file.
34 34  
  35 +``inmodel [file]``
  36 + Input model XML file.
  37 +
35 38 ``modcube [file]``
36 39 Input model cube file (generated with ctmodel).
37 40  
... ... @@ -47,9 +50,6 @@ General parameters
47 50 ``bkgcube [file]``
48 51 Input background cube file.
49 52  
50   -``inmodel [file]``
51   - Input model XML file.
52   -
53 53 ``caldb [string]``
54 54 Calibration database.
55 55  
... ... @@ -63,19 +63,20 @@ General parameters
63 63 Output residual counts map file.
64 64  
65 65 ``(ebinalg = LOG) <FILE|LIN|LOG> [string]``
66   - Algorithm for defining energy bins.
  66 + Algorithm for defining energy bins for internal residual map computation.
67 67  
68 68 ``emin [real]``
69   - Lower energy value for first energy bin (in TeV).
  69 + Lower energy value for residual map (in TeV).
70 70  
71 71 ``emax [real]``
72   - Upper energy value for last energy bin (in TeV).
  72 + Upper energy value for residual map (in TeV).
73 73  
74 74 ``(enumbins = 20) [integer]``
75   - Number of model cube energy bins.
  75 + Number of model cube energy bins for internal residual map computation.
76 76  
77 77 ``ebinfile [file]``
78   - Name of the file containing the energy bin definition.
  78 + Name of the file containing the energy bin definition for internal residual
  79 + map computation.
79 80  
80 81 ``coordsys <CEL|GAL> [string]``
81 82 Coordinate system (CEL - celestial, GAL - galactic).
... ... @@ -135,7 +136,7 @@ Standard parameters
135 136 Enables debug mode. In debug mode the executable will dump any log file output to the console.
136 137  
137 138 ``(mode = ql) [string]``
138   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  139 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
139 140  
140 141 ``(logfile = csresmap.log) [string]``
141 142 Log filename.
... ...
doc/source/users/reference_manual/csresspec.rst 0 โ†’ 100644
  1 +.. _csresspec:
  2 +
  3 +csresspec
  4 +=========
  5 +
  6 +Generates residual spectrum.
  7 +
  8 +
  9 +Synopsis
  10 +--------
  11 +
  12 +This scripts generates a residual spectrum for a given model. It works for event
  13 +lists, counts cubes, On/Off observations or observation definition files. For
  14 +event lists parameters that define the spectral binning need to be provided so
  15 +that the script can bin the data internally. The model is then convolved with
  16 +the instrumental response function for the chosen binning (either specified by
  17 +the user or intrinsic to the observations) and used for residual computation. It
  18 +is possible to compute the model contributions from individual model components.
  19 +
  20 +If starting from event lists or count cubes, before residual computation the 3D
  21 +counts and model cubes are collapsed into spectra by summing over all spatial
  22 +direction. It is possible to specify a mask to compute counts, model, and
  23 +residuals only for a region of interest.
  24 +
  25 +For On/Off observations, counts, model, and residual spectra for the Off regions
  26 +are computed as well.
  27 +
  28 +For an observation definition file, when all observations are event lists or
  29 +On/Off observations it is possible to stack them before residual computation. To
  30 +do so spatial binning parameters for event lists are required. Otherwise the
  31 +residuals are calculated separately for each observation.
  32 +
  33 +Four options exist then for residual computation:
  34 +
  35 +- the subtraction of the model from the counts (SUB)
  36 +- the subtraction and division by the model (SUBDIV)
  37 +- the subtraction and division by the square root of the model (SUBDIVSQRT)
  38 +- the computation of the significance using Li & Ma (SIGNIFICANCE)
  39 +
  40 +The counts, model, and residual spectra are written into a FITS file.
  41 +
  42 +
  43 +General parameters
  44 +------------------
  45 +
  46 +``inobs [file]``
  47 + Input event list, counts cube or observation definition XML file.
  48 +
  49 +``inmodel [file]``
  50 + Input model XML file.
  51 +
  52 +``modcube [file]``
  53 + Input model cube file (generated with ctmodel).
  54 +
  55 +``expcube [file]``
  56 + Input exposure cube file.
  57 +
  58 +``psfcube [file]``
  59 + Input PSF cube file.
  60 +
  61 +``edispcube [file]``
  62 + Input energy dispersion cube file.
  63 +
  64 +``bkgcube [file]``
  65 + Input background cube file.
  66 +
  67 +``caldb [string]``
  68 + Calibration database.
  69 +
  70 +``irf [string]``
  71 + Instrument response function.
  72 +
  73 +``(edisp = no) [boolean]``
  74 + Apply energy dispersion?
  75 +
  76 +``outfile [file]``
  77 + Output residual spectrum file.
  78 +
  79 +``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
  80 + Optimization statistic. ``DEFAULT`` uses the default statistic for all
  81 + observations, which is ``CSTAT`` or the statistic specified in the
  82 + observation definition XML file. ``CSTAT`` uses the C statistic for
  83 + all observations, ``WSTAT`` uses the W statistic for all On/Off
  84 + observations, and ``CHI2`` uses the Chi squared statistic for all
  85 + binned or stacked observations.
  86 +
  87 +``(components = no) [boolean]``
  88 + Calculate model for individual components?
  89 +
  90 +``ebinalg <FILE|LIN|LOG> [string]``
  91 + Algorithm for defining energy bins. For ``FILE``, the energy bins are defined
  92 + in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN``
  93 + and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or
  94 + logarithmically between ``emin`` and ``emax``, respectively.
  95 +
  96 +``emin [real]``
  97 + Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG``
  98 + energy binning algorithms are used.
  99 +
  100 +``emax [real]``
  101 + Upper energy value for last energy bin (in TeV) if ``LIN`` or ``LOG``
  102 + energy binning algorithms are used.
  103 +
  104 +``enumbins [integer]``
  105 + Number of energy bins if ``LIN`` or ``LOG`` energy binning algorithms are
  106 + used.
  107 +
  108 +``ebinfile [file]``
  109 + Name of the file containing the energy binning definition if ``ebinalg=FILE``.
  110 + You may use :ref:`csebins` to generate a file with appropriate energy binning.
  111 +
  112 +``stack [boolean]``
  113 + Stack multiple observations for residual calculation?
  114 +
  115 +``coordsys <CEL|GAL> [string]``
  116 + Coordinate system (CEL - celestial, GAL - galactic) for stacking
  117 + multiple event lists.
  118 +
  119 +``proj <AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN> [string]``
  120 + Projection method for stacking multiple event lists.
  121 +
  122 +``xref [real]``
  123 + Right Ascension / Galactic longitude of cube centre (J2000, in degrees)
  124 + for stacking multiple event lists.
  125 +
  126 +``yref [real]``
  127 + Declination / Galactic latitude of cube centre (J2000, in degrees) for
  128 + stacking multiple event lists.
  129 +
  130 +``nxpix [integer]``
  131 + Number of cube bins in Right Ascension or Galactic longitude for stacking
  132 + multiple event lists.
  133 +
  134 +``nypix [integer]``
  135 + Number of cube bins in Declination or Galactic latitude for stacking
  136 + multiple event lists.
  137 +
  138 +``binsz [real]``
  139 + Cube bin size (in degrees/pixel) for stacking multiple event lists.
  140 +
  141 +``mask [boolean]``
  142 + Mask data to calculate residuals in ROI?
  143 +
  144 +``ra [real]``
  145 + Right Ascension of circular selection region centre (J2000, in degrees).
  146 +
  147 +``dec [real]``
  148 + Declination of circular selection region centre (J2000, in degrees).
  149 +
  150 +``rad [real]``
  151 + Radius of circular selection region (in degrees).
  152 +
  153 +``regfile [file]``
  154 + Input exclusion region file in ds9 format.
  155 +
  156 +``algorithm <SUB|SUBDIV|SUBDIVSQRT|SIGNIFICANCE> [string]``
  157 + Algorithm used to generate the residual map:
  158 +
  159 + ``SUB``: :math:`DATA - MODEL`
  160 +
  161 + ``SUBDIV``: :math:`(DATA - MODEL) / MODEL`
  162 +
  163 + ``SUBDIVSQRT``: :math:`(DATA - MODEL) / \sqrt{MODEL}`
  164 +
  165 + ``SIGNIFICANCE``: :math:`{\rm sign}(DATA-MODEL) \times \sqrt{ 2 \times ( DATA \times \ln \left(\frac{DATA}{MODEL} \right) + MODEL - DATA ) }`
  166 +
  167 +
  168 +Standard parameters
  169 +-------------------
  170 +
  171 +``(publish = no) [boolean]``
  172 + Specifies whether the residual map should be published on VO Hub.
  173 +
  174 +``(chatter = 2) [integer]``
  175 + Verbosity of the executable:
  176 + ``chatter = 0``: no information will be logged
  177 +
  178 + ``chatter = 1``: only errors will be logged
  179 +
  180 + ``chatter = 2``: errors and actions will be logged
  181 +
  182 + ``chatter = 3``: report about the task execution
  183 +
  184 + ``chatter = 4``: detailed report about the task execution
  185 +
  186 +``(clobber = yes) [boolean]``
  187 + Specifies whether an existing residual map file should be overwritten.
  188 +
  189 +``(debug = no) [boolean]``
  190 + Enables debug mode. In debug mode the executable will dump any log file output to the console.
  191 +
  192 +``(mode = ql) [string]``
  193 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
  194 +
  195 +``(logfile = csresspec.log) [string]``
  196 + Log filename.
  197 +
  198 +
  199 +Related tools or scripts
  200 +------------------------
  201 +
  202 +None
... ...
doc/source/users/reference_manual/csroot2caldb.rst
... ... @@ -19,7 +19,7 @@ General parameters
19 19 ``infile [file]``
20 20 Input ROOT performance file file.
21 21  
22   -``(outdir = ) [string]``
  22 +``(outdir = "") [string]``
23 23 Output CALDB directory.
24 24  
25 25 ``inst [string]``
... ... @@ -46,17 +46,17 @@ General parameters
46 46 ``(emax = UNDEF) [real]``
47 47 Maximum energy threshold (TeV).
48 48  
49   -``(psftype = Gauss) [string]``
  49 +``(psftype = Gauss) <Gauss|King> [string]``
50 50 Point spread function type.
51 51  
52 52 ``(split = no) [boolean]``
53   - Split IRF components into different files.
  53 + Split IRF components into different files?
54 54  
55 55 ``(norm1d = no) [boolean]``
56   - Normalize on 1D histograms.
  56 + Normalize on 1D histograms?
57 57  
58 58 ``(rebin = no) [boolean]``
59   - Rebin.
  59 + Rebin?
60 60  
61 61 ``(eascale = 1.0) [real]``
62 62 Scaling factor for effective areas.
... ... @@ -71,7 +71,7 @@ General parameters
71 71 Energy above which to replace background by power law (TeV).
72 72  
73 73 ``(bgdinfill = no) [boolean]``
74   - Infill of background template?.
  74 + Infill of background template?
75 75  
76 76  
77 77 Standard parameters
... ... @@ -80,23 +80,23 @@ Standard parameters
80 80 ``(chatter = 2) [integer]``
81 81 Verbosity of the executable:
82 82 ``chatter = 0``: no information will be logged
83   -
  83 +
84 84 ``chatter = 1``: only errors will be logged
85   -
  85 +
86 86 ``chatter = 2``: errors and actions will be logged
87   -
  87 +
88 88 ``chatter = 3``: report about the task execution
89   -
  89 +
90 90 ``chatter = 4``: detailed report about the task execution
91   -
  91 +
92 92 ``(clobber = yes) [boolean]``
93 93 Specifies whether an existing output file should be overwritten.
94   -
  94 +
95 95 ``(debug = no) [boolean]``
96 96 Enables debug mode. In debug mode the executable will dump any log file output to the console.
97   -
  97 +
98 98 ``(mode = ql) [string]``
99   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  99 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
100 100  
101 101 ``(logfile = csroot2caldb.log) [filename]``
102 102 Log filename.
... ...
doc/source/users/reference_manual/cssens.rst
... ... @@ -10,33 +10,30 @@ Synopsis
10 10 --------
11 11  
12 12 This script computes the differential or integrated CTA sensitivity using
13   -maximum likelihood fitting of a test source. The differential sensitivity
14   -is determined for a number of energy bins, the integral sensitivity is
15   -determined for a number of energy thresholds. The test source is fitted to
16   -simulated data using :doc:`ctlike` to determine it's detection significance
17   -as a function of source flux. The source flux is then varied until the
18   -source significance achieves a given level, specified by the (hidden)
19   -significance parameter ``sigma``. To damp variations between individual
20   -Monte Carlo simulations, a sliding average is applied in the significance
21   -computation (controlled by hidden ``num_avg`` parameter).
22   -
23   -The significance is estimated using the Test Statistic value, defined as
24   -twice the log-likelihood difference that is obtained when fitting the
25   -simulated data with and without the test source. The simplified assumption
26   -is made that the significance (in Gaussian sigma) is the square root of
27   -the Test Statistic.
28   -
29   -cssens will generate an ASCII file in comma-separated value (CSV) format
30   -containing the sensitivity as function of energy. The first row is a header
31   -row providing the column names. The following rows provide the mean
32   -logarithmic energy and the boundaries of the energy bin for which the
33   -sensitivity was computed. They also provide the flux within the energy bin
34   -in Crab units, in photons (ph/cm2/s) and in energy (erg/cm2/s). Finally,
35   -the sensitivity is given as the test source spectrum evaluated at the mean
36   -logarithmic energy multiplied by the energy squared (erg/cm2/s).
37   -
38   -The sensitivity can be displayed using the ``show_sensitivity.py`` script
39   -in the example folder. Matplotlib is required to execute the script.
  13 +maximum likelihood fitting of a test source. The differential sensitivity is
  14 +determined for a number of energy bins, the integral sensitivity is determined
  15 +for a number of energy thresholds. The test source is fitted to simulated data
  16 +using :doc:`ctlike` to determine it's detection significance as a function of
  17 +source flux. The source flux is then varied until the source significance
  18 +achieves a given level, specified by the (hidden) significance parameter
  19 +``sigma``.
  20 +
  21 +The significance is estimated using the Test Statistic value, defined as twice
  22 +the log-likelihood difference that is obtained when fitting the simulated data
  23 +with and without the test source. The simplified assumption is made that the
  24 +significance (in Gaussian sigma) is the square root of the Test Statistic.
  25 +
  26 +:ref:`cssens` will generate an ASCII file in comma-separated value (CSV) format
  27 +containing the sensitivity as function of energy. The first row is a header row
  28 +providing the column names. The following rows provide the mean logarithmic
  29 +energy and the boundaries of the energy bin for which the sensitivity was
  30 +computed. They also provide the flux within the energy bin in Crab units, in
  31 +photons (ph/cm2/s) and in energy (erg/cm2/s). Finally, the sensitivity is given
  32 +as the test source spectrum evaluated at the mean logarithmic energy multiplied
  33 +by the energy squared (erg/cm2/s).
  34 +
  35 +The sensitivity can be displayed using the ``show_sensitivity.py`` script in the
  36 +example folder. Matplotlib is required to execute the script.
40 37  
41 38  
42 39 General parameters
... ... @@ -61,7 +58,7 @@ General parameters
61 58 ``(edisp = no) [boolean]``
62 59 Apply energy dispersion to response computation?
63 60  
64   -``(deadc = 0.95) [real]``
  61 +``(deadc = 0.98) [real]``
65 62 Average deadtime correction factor.
66 63  
67 64 ``outfile [file]``
... ... @@ -86,7 +83,7 @@ General parameters
86 83 Number of energy bins for sensitivity computation.
87 84  
88 85 ``(enumbins = 0) [integer]``
89   - Number of energy bins (0=unbinned).
  86 + Number of energy bins for binned analysis (``0`` = unbinned analysis).
90 87  
91 88 ``(npix = 200) [integer]``
92 89 Number of pixels for binned analysis.
... ... @@ -135,7 +132,7 @@ Standard parameters
135 132 output to the console.
136 133  
137 134 ``(mode = ql) [string]``
138   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  135 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
139 136  
140 137 ``(logfile = cssens.log) [filename]``
141 138 Log filename.
... ...
doc/source/users/reference_manual/csspec.rst
... ... @@ -19,23 +19,28 @@ significance of the source detection. Optionally, it also computes an upper
19 19 flux limit that is particularly useful in case that the source is not
20 20 significantly detected within a spectral bin (hidden parameter ``calc_ulim``).
21 21  
22   -The script works on binned and unbinned data.
23   -
24   -For unbinned data, the spectral binning is either defined by a FITS file
25   -containing the energy boundaries of each bin (option ``ebinalg=FILE``) or
26   -as ``enumbins`` bins spread linearly (option ``ebinalg=LIN``) or
27   -logarithmically (option ``ebinalg=LOG``) from a minimum energy given by
28   -``emin`` to a maximum energy given by ``emax``.
29   -
30   -For binned data, all energy bins within the counts cube that overlap with
31   -the energy range spanned by ``emin`` and ``emax`` are considered. The number
32   -of spectral bins is only approximately determined by the ``enumbins`` parameter.
33   -Naturally, the script cannot create more spectral bins than the number of
34   -energy bins that are available in the cube. Also, in case that ``enumbins``
35   -is smaller than the number of energy bins in the cube, the script will fit
36   -several layers of the counts cube for each spectral bin. The number of
37   -layers fit is determined by the total number of energy bins divided by the
38   -``enumbins`` parameter.
  22 +There are two fundamental methods to run the script depending on the value of
  23 +the ``method`` parameter. If ``method=SLICE`` the energy interval defined by the
  24 +``emin`` and ``emax`` parameters is divided into a number of energy bins and an
  25 +independent maximum likelihood fit is performed in each of the energy bins,
  26 +while if ``method=NODES`` the spectral model will be replaced by a node function
  27 +that will be fit to all data. The latter is particularly useful if non-CTA data
  28 +should be fitted such as data from Fermi/LAT or COMPTEL. By default, ``method`` is
  29 +set to ``AUTO`` which will automatically select the method based on the input data.
  30 +For CTA-only observations ``SLICE`` will be used, otherwise ``NODES`` will be used.
  31 +
  32 +The spectral binning is either defined by a FITS file containing the energy
  33 +boundaries of each bin (option ``ebinalg=FILE``) or as ``enumbins`` bins spread
  34 +linearly (option ``ebinalg=LIN``) or logarithmically (option ``ebinalg=LOG``)
  35 +from a minimum energy, given by ``emin``, to a maximum energy, given by ``emax``.
  36 +
  37 +For binned, stacked or On/Off CTA data, all energy bins that overlap with the
  38 +energy range spanned by ``emin`` and ``emax`` are considered. The number of spectral
  39 +bins is only approximately determined by the ``enumbins`` parameter. Naturally,
  40 +:ref:`csspec` cannot create more spectral bins than the number of energy bins that
  41 +are available in the data. In case that there are more energy bins in the data
  42 +than the number of spectral bins that are requested, :ref:`csspec` will fit the
  43 +data in all energy bins that overlap with a given spectral bin simultaneously.
39 44  
40 45 On output, the script will provide a FITS file with the fitted source
41 46 spectrum in form of a binary table. Each row corresponds to a spectral bin.
... ... @@ -44,11 +49,14 @@ the fitted flux and flux error, the Test Statistics value (option
44 49 ``calc_ts=yes``), the upper flux limit (option ``calc_ulim=yes``) and the
45 50 predicted number of events (only for unbinned data).
46 51  
  52 +.. warning::
  53 + The upper limit computation is not yet implemented for the ``NODES`` method.
  54 +
47 55  
48 56 General parameters
49 57 ------------------
50 58  
51   -``(inobs = NONE) [file]``
  59 +``inobs [file]``
52 60 Input event list, counts cube or observation definition XML file.
53 61  
54 62 ``inmodel [file]``
... ... @@ -84,26 +92,33 @@ General parameters
84 92  
85 93 ``method <SLICE|NODES|AUTO> [string]``
86 94 Spectrum generation method.
87   - ``SLICE``: Slice energy interval into ``enumbins`` independent bins.
88   - ``NODES``: Replace spectral model by node function with ``enumbins`` nodes.
89   - ``AUTO`` : Automatically select method based on input data. Will use
90   - ``SLICE`` for CTA-only observations and ``NODES`` for
91   - observations including non-CTA data.
  95 + ``SLICE`` will slice energy interval into ``enumbins`` independent bins,
  96 + ``NODES`` will replace spectral model by node function with ``enumbins``
  97 + nodes, and ``AUTO`` will automatically select the method based on the input
  98 + data. For CTA-only observations ``SLICE`` will be used, otherwise ``NODES``
  99 + will be used.
  100 +
  101 +``ebinalg <FILE|LIN|LOG> [string]``
  102 + Algorithm for defining energy bins. For ``FILE``, the energy bins are defined
  103 + in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN``
  104 + and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or
  105 + logarithmically between ``emin`` and ``emax``, respectively.
92 106  
93 107 ``emin [real]``
94   - Lower energy limit of events (in TeV).
  108 + Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG``
  109 + energy binning algorithms are used.
95 110  
96 111 ``emax [real]``
97   - Upper energy limit of events (in TeV).
  112 + Upper energy value for last energy bin (in TeV) if ``LIN`` or ``LOG``
  113 + energy binning algorithms are used.
98 114  
99 115 ``enumbins [integer]``
100   - Number of energy bins.
101   -
102   -``ebinalg <FILE|LIN|LOG> [string]``
103   - Algorithm for defining energy bins.
  116 + Number of energy bins if ``LIN`` or ``LOG`` energy binning algorithms are
  117 + used.
104 118  
105 119 ``ebinfile [file]``
106   - Name of the file containing the energy bin definition.
  120 + Name of the file containing the energy binning definition if ``ebinalg=FILE``.
  121 + You may use :ref:`csebins` to generate a file with appropriate energy binning.
107 122  
108 123 ``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
109 124 Optimization statistic. ``DEFAULT`` uses the default statistic for all
... ... @@ -153,7 +168,7 @@ Standard parameters
153 168 output to the console.
154 169  
155 170 ``(mode = ql) [string]``
156   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  171 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
157 172  
158 173 ``(logfile = csspec.log) [filename]``
159 174 Log filename.
... ...
doc/source/users/reference_manual/cssrcdetect.rst
... ... @@ -61,31 +61,31 @@ General parameters
61 61 ``(fit_shape = yes) [boolean]``
62 62 Enable fitting of source shapes in model definiton XML file?
63 63  
64   -
  64 +
65 65 Standard parameters
66 66 -------------------
67 67  
68 68 ``(chatter = 2) [integer]``
69 69 Verbosity of the executable:
70 70 ``chatter = 0``: no information will be logged
71   -
  71 +
72 72 ``chatter = 1``: only errors will be logged
73   -
  73 +
74 74 ``chatter = 2``: errors and actions will be logged
75   -
  75 +
76 76 ``chatter = 3``: report about the task execution
77   -
  77 +
78 78 ``chatter = 4``: detailed report about the task execution
79   -
  79 +
80 80 ``(clobber = yes) [boolean]``
81 81 Specifies whether an existing output model file should be overwritten.
82   -
  82 +
83 83 ``(debug = no) [boolean]``
84 84 Enables debug mode. In debug mode the executable will dump any log file
85 85 output to the console.
86   -
  86 +
87 87 ``(mode = ql) [string]``
88   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  88 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
89 89  
90 90 ``(logfile = cssrcdetect.log) [filename]``
91 91 Log filename.
... ...
doc/source/users/reference_manual/cstsdist.rst
... ... @@ -15,10 +15,7 @@ sets. The Test Statistics is defined as twice the log-likelihood difference
15 15 that is obtained when fitting simulated data with and without a given
16 16 source model component.
17 17  
18   -This script either performs an unbinned or a binned simulation, stacked
19   -analysis is not yet supported.
20   -
21   -cstsdist will create an ASCII file in comma-separated value (CSV) format,
  18 +:ref:`cstsdist` will create an ASCII file in comma-separated value (CSV) format,
22 19 containing one row per TS computation. The first row is a header row providing
23 20 the column names. The following rows give the TS value, the log-likelihood
24 21 values of the fit with or without the source, the number of observed and
... ... @@ -26,13 +23,18 @@ fitted events, as well as the values and errors for all fitted parameters.
26 23  
27 24 From the output file, TS distribution plots can be generated using for
28 25 example the ``show_ts_distribution.py`` script in the examples folder. The
29   -script require matplotlib for plotting.
  26 +script requires matplotlib for plotting.
  27 +
  28 +.. warning::
  29 + This script does not work for On/Off observations. If an observation
  30 + definition XML file is specified the script assumes that all observations
  31 + are event lists.
30 32  
31 33  
32 34 General parameters
33 35 ------------------
34 36  
35   -``(inobs = NONE) [file]``
  37 +``inobs [file]``
36 38 Input event list, counts cube or observation definition XML file.
37 39  
38 40 ``inmodel [file]``
... ... @@ -72,42 +74,6 @@ General parameters
72 74 ``ntrials [integer]``
73 75 Number of Monte Carlo samples.
74 76  
75   -``ra [real]``
76   - Right Ascension of CTA pointing (J2000, in degrees).
77   -
78   -``dec [real]``
79   - Declination of CTA pointing (J2000, in degrees).
80   -
81   -``(rad = 5.0) [real]``
82   - ROI radius (in degrees).
83   -
84   -``coordsys <CEL|GAL> [string]``
85   - Coordinate system (CEL - celestial, GAL - galactic).
86   -
87   -``proj <AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN> [string]``
88   - Projection method.
89   -
90   -``emin [real]``
91   - Lower energy limit (in TeV).
92   -
93   -``emax [real]``
94   - Upper energy limit (in TeV).
95   -
96   -``enumbins [integer]``
97   - Number of energy bins (0=unbinned).
98   -
99   -``tmin [time]``
100   - Start time (UTC string, JD, MJD or MET in seconds).
101   -
102   -``tmax [time]``
103   - Stop time (UTC string, JD, MJD or MET in seconds).
104   -
105   -``npix [integer]``
106   - Number of pixels for binned analysis.
107   -
108   -``binsz [real]``
109   - Pixel size for binned analysis.
110   -
111 77 ``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
112 78 Optimization statistic. ``DEFAULT`` uses the default statistic for all
113 79 observations, which is ``CSTAT`` or the statistic specified in the
... ... @@ -140,7 +106,7 @@ Standard parameters
140 106 output to the console.
141 107  
142 108 ``(mode = ql) [string]``
143   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  109 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
144 110  
145 111 ``(logfile = cstsdist.log) [string]``
146 112 Log filename.
... ... @@ -151,4 +117,3 @@ Related tools or scripts
151 117  
152 118 :doc:`ctlike`
153 119 :doc:`cspull`
154   -
... ...
doc/source/users/reference_manual/cstsmapmerge.rst
... ... @@ -16,10 +16,10 @@ map again. Running :doc:`cttsmap` with the hidden parameters ``binmin`` and
16 16 them into one FITS file. The input slices can be passed via the ``inmaps``
17 17 parameter. There are 4 options to specify a list of files that should be merged:
18 18  
19   -* a space-separated list of file names (e.g. tsmap1.fits tsmap2.fits)
20   -* a comma-separated list of file names (e.g. tsmap1.fits,tsmap2.fits)
21   -* a wildcard string (e.g. tsmap*.xml)
22   -* an ASCII file containing the file names, one file per line (e.g. @mymaps.txt)
  19 +- a space-separated list of file names (e.g. tsmap1.fits tsmap2.fits)
  20 +- a comma-separated list of file names (e.g. tsmap1.fits,tsmap2.fits)
  21 +- a wildcard string (e.g. tsmap*.xml)
  22 +- an ASCII file containing the file names, one file per line (e.g. @mymaps.txt)
23 23  
24 24 Note that the "@" needs to be specified in case of an ASCII file name.
25 25  
... ... @@ -31,37 +31,37 @@ General parameters
31 31  
32 32 ``outmap [file]``
33 33 Output TS map FITS file
34   -
  34 +
35 35 ``(overwrite=yes) [boolean]``
36 36 Overwrite previously filled bins?
37 37  
38 38 ``(delete=no) [boolean]``
39 39 Delete merged files?
40   -
41   -
  40 +
  41 +
42 42 Standard parameters
43 43 -------------------
44 44  
45 45 ``(chatter = 2) [integer]``
46 46 Verbosity of the executable:
47 47 ``chatter = 0``: no information will be logged
48   -
  48 +
49 49 ``chatter = 1``: only errors will be logged
50   -
  50 +
51 51 ``chatter = 2``: errors and actions will be logged
52   -
  52 +
53 53 ``chatter = 3``: report about the task execution
54   -
  54 +
55 55 ``chatter = 4``: detailed report about the task execution
56   -
  56 +
57 57 ``(clobber = yes) [boolean]``
58 58 Specifies whether an existing output TS map file should be overwritten.
59   -
  59 +
60 60 ``(debug = no) [boolean]``
61 61 Enables debug mode. In debug mode the executable will dump any log file output to the console.
62   -
  62 +
63 63 ``(mode = ql) [string]``
64   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  64 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
65 65  
66 66 ``(logfile = cstsmapmerge.log) [filename]``
67 67 Log filename.
... ...
doc/source/users/reference_manual/cstsmapsplit.rst
... ... @@ -3,7 +3,7 @@
3 3 cstsmapsplit
4 4 ============
5 5  
6   -Generate commands to split the Test Statistic map computation
  6 +Generate commands to split the Test Statistic map computation.
7 7  
8 8  
9 9 Synopsis
... ... @@ -48,21 +48,24 @@ General parameters
48 48 Instrumental response function.
49 49  
50 50 ``(edisp = no) [boolean]``
51   - Applies energy dispersion to response computation.
  51 + Applies energy dispersion to response computation?
52 52  
53 53 ``(errors = no) [boolean]``
54 54 Compute and store parameter errors?
55 55  
56   -``(statistic = CSTAT) <CSTAT|WSTAT|CHI2> [string]``
57   - Optimization statistic. ``CSTAT`` applies to all types of observations,
58   - ``WSTAT``applies only to On/Off observations, and ``CHI2`` applies only
59   - to binned or stacked observations.
  56 +``(statistic = DEFAULT) <DEFAULT|CSTAT|WSTAT|CHI2> [string]``
  57 + Optimization statistic. ``DEFAULT`` uses the default statistic for all
  58 + observations, which is ``CSTAT`` or the statistic specified in the
  59 + observation definition XML file. ``CSTAT`` uses the C statistic for
  60 + all observations, ``WSTAT`` uses the W statistic for all On/Off
  61 + observations, and ``CHI2`` uses the Chi squared statistic for all
  62 + binned or stacked observations.
60 63  
61 64 ``outmap [file]``
62 65 Output Test Statistic map file.
63 66  
64 67 ``bins_per_job [integer]``
65   - Number of bins of the TS map that should be computed within one command
  68 + Number of bins of the TS map that should be computed within one command.
66 69  
67 70 ``compute_null [boolean]``
68 71 Pre-computes the null hypothesis globally and passes the value to the
... ... @@ -78,28 +81,28 @@ General parameters
78 81  
79 82 ``(usepnt = no) [boolean]``
80 83 Use CTA pointing direction for map centre instead of xref/yref parameters?
81   -
  84 +
82 85 ``nxpix [integer]``
83 86 Number of map pixels in Right Ascension or Galactic longitude.
84   -
  87 +
85 88 ``nypix [integer]``
86 89 Number of map pixels in Declination or Galactic latitude.
87   -
  90 +
88 91 ``binsz [real]``
89 92 Map pixel size (in degrees/pixel).
90   -
  93 +
91 94 ``coordsys <CEL|GAL> [string]``
92 95 Coordinate system (CEL - celestial, GAL - galactic).
93   -
  96 +
94 97 ``proj <AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN> [string]``
95 98 Projection method.
96 99  
97 100 ``xref [real]``
98 101 Right Ascension / Galactic longitude of map centre (J2000, in degrees).
99   -
  102 +
100 103 ``yref [real]``
101 104 Declination / Galactic latitude of map centre (J2000, in degrees).
102   -
  105 +
103 106  
104 107 Standard parameters
105 108 -------------------
... ... @@ -107,24 +110,24 @@ Standard parameters
107 110 ``(chatter = 2) [integer]``
108 111 Verbosity of the executable:
109 112 ``chatter = 0``: no information will be logged
110   -
  113 +
111 114 ``chatter = 1``: only errors will be logged
112   -
  115 +
113 116 ``chatter = 2``: errors and actions will be logged
114   -
  117 +
115 118 ``chatter = 3``: report about the task execution
116   -
  119 +
117 120 ``chatter = 4``: detailed report about the task execution
118   -
  121 +
119 122 ``(clobber = yes) [boolean]``
120 123 Specifies whether an existing output TS map file should be overwritten.
121   -
  124 +
122 125 ``(debug = no) [boolean]``
123 126 Enables debug mode. In debug mode the executable will dump any log file
124 127 output to the console.
125   -
  128 +
126 129 ``(mode = ql) [string]``
127   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  130 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
128 131  
129 132 ``(logfile = cstsmapsplit.log) [string]``
130 133 Name of log file.
... ...
doc/source/users/reference_manual/csviscube.rst
... ... @@ -64,23 +64,23 @@ Standard parameters
64 64 ``(chatter = 2) [integer]``
65 65 Verbosity of the executable:
66 66 ``chatter = 0``: no information will be logged
67   -
  67 +
68 68 ``chatter = 1``: only errors will be logged
69   -
  69 +
70 70 ``chatter = 2``: errors and actions will be logged
71   -
  71 +
72 72 ``chatter = 3``: report about the task execution
73   -
  73 +
74 74 ``chatter = 4``: detailed report about the task execution
75   -
  75 +
76 76 ``(clobber = yes) [boolean]``
77 77 Specifies whether an existing visibility cube file should be overwritten.
78   -
  78 +
79 79 ``(debug = no) [boolean]``
80 80 Enables debug mode. In debug mode the executable will dump any log file output to the console.
81   -
  81 +
82 82 ``(mode = ql) [string]``
83   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  83 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
84 84  
85 85 ``(logfile = csviscube.log) [filename]``
86 86 Log filename.
... ...
doc/source/users/reference_manual/ctbin.rst
... ... @@ -18,7 +18,7 @@ specified in an observation definition file. In case that multiple event
18 18 lists are given in an observation definition file, the tool will loop over
19 19 all event lists and fill all events into a single counts cube.
20 20  
21   -ctbin generates a counts cube FITS file comprising three extensions. The
  21 +:ref:`ctbin` generates a counts cube FITS file comprising three extensions. The
22 22 primary extension contains a 3-dimensional image that contains the counts
23 23 cube values. The next extension named ``EBOUNDS`` contains a binary table
24 24 that defines the energy boundaries of the counts cube. The last extension
... ... @@ -34,46 +34,53 @@ General parameters
34 34  
35 35 ``outcube [file]``
36 36 Output counts cube file.
37   -
  37 +
38 38 ``ebinalg <FILE|LIN|LOG> [string]``
39   - Algorithm for defining energy bins.
40   -
  39 + Algorithm for defining energy bins. For ``FILE``, the energy bins are defined
  40 + in a FITS file that is specified by the ``ebinfile`` parameter, for ``LIN``
  41 + and ``LOG`` there will be ``enumbins`` energy bins spaced linearly or
  42 + logarithmically between ``emin`` and ``emax``, respectively.
  43 +
41 44 ``emin [real]``
42   - Lower energy value for first energy bin (in TeV).
43   -
  45 + Lower energy value for first energy bin (in TeV) if ``LIN`` or ``LOG``
  46 + energy binning algorithms are used.
  47 +
44 48 ``emax [real]``
45   - Upper energy value for last energy bin (in TeV).
46   -
  49 + Upper energy value for last energy bin (in TeV) if ``LIN`` or ``LOG``
  50 + energy binning algorithms are used.
  51 +
47 52 ``enumbins [integer]``
48   - Number of energy bins.
49   -
  53 + Number of energy bins if ``LIN`` or ``LOG`` energy binning algorithms are
  54 + used.
  55 +
50 56 ``ebinfile [file]``
51   - Name of the file containing the energy bin definition.
52   -
  57 + Name of the file containing the energy binning definition if ``ebinalg=FILE``.
  58 + You may use :ref:`csebins` to generate a file with appropriate energy binning.
  59 +
53 60 ``(usepnt = no) [boolean]``
54 61 Use CTA pointing direction for cube centre instead of xref/yref parameters?
55   -
  62 +
56 63 ``nxpix [integer]``
57 64 Number of cube bins in Right Ascension or Galactic longitude.
58   -
  65 +
59 66 ``nypix [integer]``
60 67 Number of cube bins in Declination or Galactic latitude.
61   -
  68 +
62 69 ``binsz [real]``
63 70 Cube bin size (in degrees/pixel).
64   -
  71 +
65 72 ``coordsys <CEL|GAL> [string]``
66 73 Coordinate system (CEL - celestial, GAL - galactic).
67   -
  74 +
68 75 ``proj <AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN> [string]``
69 76 Projection method.
70   -
  77 +
71 78 ``xref [real]``
72 79 Right Ascension / Galactic longitude of cube centre (J2000, in degrees).
73   -
  80 +
74 81 ``yref [real]``
75 82 Declination / Galactic latitude of cube centre (J2000, in degrees).
76   -
  83 +
77 84  
78 85 Standard parameters
79 86 -------------------
... ... @@ -84,23 +91,23 @@ Standard parameters
84 91 ``(chatter = 2) [integer]``
85 92 Verbosity of the executable:
86 93 ``chatter = 0``: no information will be logged
87   -
  94 +
88 95 ``chatter = 1``: only errors will be logged
89   -
  96 +
90 97 ``chatter = 2``: errors and actions will be logged
91   -
  98 +
92 99 ``chatter = 3``: report about the task execution
93   -
  100 +
94 101 ``chatter = 4``: detailed report about the task execution
95   -
  102 +
96 103 ``(clobber = yes) [boolean]``
97 104 Specifies whether an existing output counts cube file should be overwritten.
98   -
  105 +
99 106 ``(debug = no) [boolean]``
100 107 Enables debug mode. In debug mode the executable will dump any log file output to the console.
101   -
  108 +
102 109 ``(mode = ql) [string]``
103   - Mode of automatic parameters (default is "ql", i.e. "query and learn").
  110 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
104 111  
105 112 ``(logfile = ctbin.log) [string]``
106 113 Name of log file.
... ...