Commit f748897372c220551364d9bce4e0a760e28b5843

Authored by Michael Mayer
2 parents 8ac139ce c4bf507e

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

Showing 89 changed files with 973 additions and 344 deletions
ChangeLog
1 -2016-02-17 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> 1 +2016-02-24 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2
3 * Version 1.1.0 released 3 * Version 1.1.0 released
4 ======================== 4 ========================
5 5
  6 + Add publish() methods to tools producing images (#1710)
  7 + Read ahead output filename in cterror (#1700)
6 Subdivide simulation energy range in ctobssim (#1673) 8 Subdivide simulation energy range in ctobssim (#1673)
7 Delete existing events before simulation in ctobssim (#1663) 9 Delete existing events before simulation in ctobssim (#1663)
8 Add csiactcopy script (#1661) 10 Add csiactcopy script (#1661)
@@ -2,7 +2,7 @@ New Features and Important Changes in ctools 1.1.0 @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 1.1.0
2 2
3 Author(s) : Juergen Knoedlseder 3 Author(s) : Juergen Knoedlseder
4 4
5 -17 February 2016 5 +24 February 2016
6 6
7 7
8 1. Introduction 8 1. Introduction
@@ -81,7 +81,8 @@ Intervals) extensions. @@ -81,7 +81,8 @@ Intervals) extensions.
81 81
82 7. ctbin - CTA event binning 82 7. ctbin - CTA event binning
83 ---------------------------- 83 ----------------------------
84 -None 84 +Add publish() method to publish the counts cube via a SAMP Hub to Virtual
  85 +Observatory interoperable tools (e.g. Aladin).
85 86
86 87
87 8. ctlike - Maximum likelihood fitting 88 8. ctlike - Maximum likelihood fitting
@@ -89,24 +90,28 @@ None @@ -89,24 +90,28 @@ None
89 None 90 None
90 91
91 92
92 -9. cttsmap - Generation of Test Statistics map  
93 -----------------------------------------------  
94 -None 93 +9. cttsmap - Generation of Test Statistic map
  94 +---------------------------------------------
  95 +Add publish() method to publish the Test Statistic map via a SAMP Hub to
  96 +Virtual Observatory interoperable tools (e.g. Aladin).
95 97
96 98
97 10. ctskymap - CTA sky mapping 99 10. ctskymap - CTA sky mapping
98 ------------------------------ 100 ------------------------------
99 -None 101 +Add publish() method to publish the sky map via a SAMP Hub to Virtual
  102 +Observatory interoperable tools (e.g. Aladin).
100 103
101 104
102 11. ctmodel - CTA counts cube modelling 105 11. ctmodel - CTA counts cube modelling
103 --------------------------------------- 106 ---------------------------------------
104 -None 107 +Add publish() method to publish the model cube via a SAMP Hub to Virtual
  108 +Observatory interoperable tools (e.g. Aladin).
105 109
106 110
107 12. ctexpcube - CTA exposure cube generation 111 12. ctexpcube - CTA exposure cube generation
108 -------------------------------------------- 112 --------------------------------------------
109 -None 113 +Add publish() method to publish the exposure cube via a SAMP Hub to
  114 +Virtual Observatory interoperable tools (e.g. Aladin).
110 115
111 116
112 13. ctpsfcube - CTA point spread function cube generation 117 13. ctpsfcube - CTA point spread function cube generation
@@ -116,12 +121,14 @@ None @@ -116,12 +121,14 @@ None
116 121
117 14. ctbkgcube - CTA background cube generation 122 14. ctbkgcube - CTA background cube generation
118 ---------------------------------------------- 123 ----------------------------------------------
119 -None 124 +Add publish() method to publish the background cube via a SAMP Hub to
  125 +Virtual Observatory interoperable tools (e.g. Aladin).
120 126
121 127
122 15. ctcubemask - CTA cube filtering 128 15. ctcubemask - CTA cube filtering
123 ----------------------------------- 129 -----------------------------------
124 -None 130 +Add publish() method to publish the masked counts cube via a SAMP Hub
  131 +to Virtual Observatory interoperable tools (e.g. Aladin).
125 132
126 133
127 16. ctbutterfly - Generate butterfly diagrams 134 16. ctbutterfly - Generate butterfly diagrams
@@ -136,7 +143,8 @@ None @@ -136,7 +143,8 @@ None
136 143
137 18. cterror - Likelihood profile error computation 144 18. cterror - Likelihood profile error computation
138 -------------------------------------------------- 145 --------------------------------------------------
139 -None 146 +The output filename is now read ahead in case that the tool is executed
  147 +(#1700).
140 148
141 149
142 19. cscripts 150 19. cscripts
@@ -144,6 +152,9 @@ None @@ -144,6 +152,9 @@ None
144 Added the csiactcopy script that copies IACT data from a remote machine to 152 Added the csiactcopy script that copies IACT data from a remote machine to
145 the user's machine (#1661). 153 the user's machine (#1661).
146 154
  155 +Add csresmap::publish() method to publish the residual map via a SAMP Hub
  156 +to Virtual Observatory interoperable tools (e.g. Aladin).
  157 +
147 158
148 20. Examples 159 20. Examples
149 ------------ 160 ------------
cscripts/csresmap.py
@@ -36,18 +36,19 @@ class csresmap(ctools.cscript): @@ -36,18 +36,19 @@ class csresmap(ctools.cscript):
36 """ 36 """
37 Constructor. 37 Constructor.
38 """ 38 """
39 -  
40 # Set name 39 # Set name
41 self.name = "csresmap" 40 self.name = "csresmap"
42 - self.version = "1.0.0" 41 + self.version = "1.1.0"
43 42
44 # Initialise some members 43 # Initialise some members
45 self.obs = None 44 self.obs = None
46 self.algorithm = "SUB" 45 self.algorithm = "SUB"
47 self.resmap = None 46 self.resmap = None
48 self.m_modcube = "None" 47 self.m_modcube = "None"
  48 + self.m_outmap = "None"
49 self.m_use_maps = False 49 self.m_use_maps = False
50 self.m_skip_binning = False 50 self.m_skip_binning = False
  51 + self.m_publish = False
51 52
52 # Initialise some members 53 # Initialise some members
53 if len(argv) > 0 and isinstance(argv[0],gammalib.GObservations): 54 if len(argv) > 0 and isinstance(argv[0],gammalib.GObservations):
@@ -126,6 +127,7 @@ class csresmap(ctools.cscript): @@ -126,6 +127,7 @@ class csresmap(ctools.cscript):
126 pars.append(gammalib.GApplicationPar("nypix","i","a","200","","","Size of the Y axis in pixels")) 127 pars.append(gammalib.GApplicationPar("nypix","i","a","200","","","Size of the Y axis in pixels"))
127 pars.append(gammalib.GApplicationPar("binsz","r","a","0.02","","","Pixel size (deg/pixel)")) 128 pars.append(gammalib.GApplicationPar("binsz","r","a","0.02","","","Pixel size (deg/pixel)"))
128 pars.append(gammalib.GApplicationPar("algorithm","s","a","SUBDIV","SUB|SUBDIV|SUBDIVSQRT","","Residual map computation algorithm")) 129 pars.append(gammalib.GApplicationPar("algorithm","s","a","SUBDIV","SUB|SUBDIV|SUBDIVSQRT","","Residual map computation algorithm"))
  130 + pars.append(gammalib.GApplicationPar("publish","b","h","no","","","Publish residual map on VO Hub?"))
129 pars.append_standard() 131 pars.append_standard()
130 pars.append(gammalib.GApplicationPar("logfile","f","h","csresmap.log","","","Log filename")) 132 pars.append(gammalib.GApplicationPar("logfile","f","h","csresmap.log","","","Log filename"))
131 pars.save(parfile) 133 pars.save(parfile)
@@ -193,18 +195,22 @@ class csresmap(ctools.cscript): @@ -193,18 +195,22 @@ class csresmap(ctools.cscript):
193 self.m_binsz = self["binsz"].real() 195 self.m_binsz = self["binsz"].real()
194 196
195 # Read energy dispersion flag 197 # Read energy dispersion flag
196 - self.m_edisp = self["edisp"].boolean() 198 + self.m_edisp = self["edisp"].boolean()
197 199
198 - # Read necessary parameters  
199 - self.m_outfile = self["outmap"].filename() 200 + # Read algorithm
200 self.m_algorithm = self["algorithm"].string() 201 self.m_algorithm = self["algorithm"].string()
201 202
202 - # Set some fixed parameters 203 + # Read standard parameters
  204 + self.m_publish = self["publish"].boolean()
203 self.m_log = False # Logging in client tools 205 self.m_log = False # Logging in client tools
204 self.m_chatter = self["chatter"].integer() 206 self.m_chatter = self["chatter"].integer()
205 self.m_clobber = self["clobber"].boolean() 207 self.m_clobber = self["clobber"].boolean()
206 self.m_debug = self["debug"].boolean() 208 self.m_debug = self["debug"].boolean()
207 209
  210 + # Read ahead output parameters
  211 + if (self.read_ahead()):
  212 + self.m_outmap = self["outmap"].filename()
  213 +
208 # Return 214 # Return
209 return 215 return
210 216
@@ -222,11 +228,64 @@ class csresmap(ctools.cscript): @@ -222,11 +228,64 @@ class csresmap(ctools.cscript):
222 """ 228 """
223 Execute the script. 229 Execute the script.
224 """ 230 """
  231 + # Read ahead output parameters
  232 + self.read_ahead(True)
  233 +
225 # Run the script 234 # Run the script
226 self.run() 235 self.run()
227 236
228 # Save residual map 237 # Save residual map
229 - self.resmap.save(self.m_outfile, self.m_clobber) 238 + self.save()
  239 +
  240 + # Return
  241 + return
  242 +
  243 + def save(self):
  244 + """
  245 + Save residual map.
  246 + """
  247 + # Write header
  248 + if self.logTerse():
  249 + self.log("\n")
  250 + self.log.header1("Save residual map")
  251 +
  252 + # Continue only filename and residual map are valid
  253 + if self.m_outmap != "None" and self.resmap != None:
  254 +
  255 + # Log file name
  256 + if self.logTerse():
  257 + self.log("Save residual map into \""+self.m_outmap+"\".\n")
  258 +
  259 + # Save residual map
  260 + self.resmap.save(self.m_outmap, self.m_clobber)
  261 +
  262 + # Return
  263 + return
  264 +
  265 + def publish(self, name=""):
  266 + """
  267 + Publish residual map.
  268 + """
  269 + # Write header
  270 + if self.logTerse():
  271 + self.log("\n")
  272 + self.log.header1("Publish sky map")
  273 +
  274 + # Continue only if residual map is valid
  275 + if self.resmap != None:
  276 +
  277 + # Set default name is user name is empty
  278 + if not name:
  279 + user_name = self.name
  280 + else:
  281 + user_name = name
  282 +
  283 + # Log map name
  284 + if self.logTerse():
  285 + self.log("Publish residual map \""+user_name+"\".\n")
  286 +
  287 + # Publish map
  288 + self.resmap.publish(user_name)
230 289
231 # Return 290 # Return
232 return 291 return
@@ -353,6 +412,10 @@ class csresmap(ctools.cscript): @@ -353,6 +412,10 @@ class csresmap(ctools.cscript):
353 # Raise error if algorithm is unkown 412 # Raise error if algorithm is unkown
354 raise TypeError("Algorithm \""+self.m_algorithm+"\" not known") 413 raise TypeError("Algorithm \""+self.m_algorithm+"\" not known")
355 414
  415 + # Optionally publish map
  416 + if self.m_publish:
  417 + self.publish()
  418 +
356 # Return 419 # Return
357 return 420 return
358 421
doc/source/reference_manual/cscaldb.rst
@@ -36,7 +36,7 @@ Standard parameters @@ -36,7 +36,7 @@ Standard parameters
36 chatter = 4: detailed report about the task execution 36 chatter = 4: detailed report about the task execution
37 37
38 ``(clobber = yes) [boolean]`` 38 ``(clobber = yes) [boolean]``
39 - Specifies whether an existing output counts cube should be overwritten. 39 + Specifies whether an existing output file should be overwritten.
40 40
41 ``(debug = no) [boolean]`` 41 ``(debug = no) [boolean]``
42 Enables debug mode. In debug mode the executable will dump any log file output to the console. 42 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csfindobs.rst
@@ -80,7 +80,7 @@ Standard parameters @@ -80,7 +80,7 @@ Standard parameters
80 chatter = 4: detailed report about the task execution 80 chatter = 4: detailed report about the task execution
81 81
82 ``(clobber = yes) [boolean]`` 82 ``(clobber = yes) [boolean]``
83 - Specifies whether an existing output counts cube should be overwritten. 83 + Specifies whether an existing output runlist should be overwritten.
84 84
85 ``(debug = no) [boolean]`` 85 ``(debug = no) [boolean]``
86 Enables debug mode. In debug mode the executable will dump any log file output to the console. 86 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csiactcopy.rst
@@ -60,7 +60,7 @@ Standard parameters @@ -60,7 +60,7 @@ Standard parameters
60 chatter = 4: detailed report about the task execution 60 chatter = 4: detailed report about the task execution
61 61
62 ``(clobber = yes) [boolean]`` 62 ``(clobber = yes) [boolean]``
63 - Specifies whether an existing output counts cube should be overwritten. 63 + Specifies whether existing output files should be overwritten.
64 64
65 ``(debug = no) [boolean]`` 65 ``(debug = no) [boolean]``
66 Enables debug mode. In debug mode the executable will dump any log file output to the console. 66 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csiactdata.rst
@@ -44,7 +44,7 @@ Standard parameters @@ -44,7 +44,7 @@ Standard parameters
44 chatter = 4: detailed report about the task execution 44 chatter = 4: detailed report about the task execution
45 45
46 ``(clobber = yes) [boolean]`` 46 ``(clobber = yes) [boolean]``
47 - Specifies whether an existing output counts cube should be overwritten. 47 + Specifies whether existing output files should be overwritten.
48 48
49 ``(debug = no) [boolean]`` 49 ``(debug = no) [boolean]``
50 Enables debug mode. In debug mode the executable will dump any log file output to the console. 50 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csiactobs.rst
@@ -124,7 +124,7 @@ Standard parameters @@ -124,7 +124,7 @@ Standard parameters
124 chatter = 4: detailed report about the task execution 124 chatter = 4: detailed report about the task execution
125 125
126 ``(clobber = yes) [boolean]`` 126 ``(clobber = yes) [boolean]``
127 - Specifies whether an existing output counts cube should be overwritten. 127 + Specifies whether existing output files should be overwritten.
128 128
129 ``(debug = no) [boolean]`` 129 ``(debug = no) [boolean]``
130 Enables debug mode. In debug mode the executable will dump any log file output to the console. 130 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/cslightcrv.rst
@@ -131,7 +131,7 @@ Standard parameters @@ -131,7 +131,7 @@ Standard parameters
131 chatter = 4: detailed report about the task execution 131 chatter = 4: detailed report about the task execution
132 132
133 ``(clobber = yes) [boolean]`` 133 ``(clobber = yes) [boolean]``
134 - Specifies whether an existing output counts cube should be overwritten. 134 + Specifies whether an existing source spectrum output file should be overwritten.
135 135
136 ``(debug = no) [boolean]`` 136 ``(debug = no) [boolean]``
137 Enables debug mode. In debug mode the executable will dump any log file output to the console. 137 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csmodelinfo.rst
@@ -83,7 +83,7 @@ Standard parameters @@ -83,7 +83,7 @@ Standard parameters
83 chatter = 4: detailed report about the task execution 83 chatter = 4: detailed report about the task execution
84 84
85 ``(clobber = yes) [boolean]`` 85 ``(clobber = yes) [boolean]``
86 - Specifies whether an existing output counts cube should be overwritten. 86 + Specifies whether existing output files should be overwritten.
87 87
88 ``(debug = no) [boolean]`` 88 ``(debug = no) [boolean]``
89 Enables debug mode. In debug mode the executable will dump any log file output to the console. 89 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csmodelmerge.rst
@@ -49,7 +49,7 @@ Standard parameters @@ -49,7 +49,7 @@ Standard parameters
49 chatter = 4: detailed report about the task execution 49 chatter = 4: detailed report about the task execution
50 50
51 ``(clobber = yes) [boolean]`` 51 ``(clobber = yes) [boolean]``
52 - Specifies whether an existing output counts cube should be overwritten. 52 + Specifies whether an existing output model file should be overwritten.
53 53
54 ``(debug = no) [boolean]`` 54 ``(debug = no) [boolean]``
55 Enables debug mode. In debug mode the executable will dump any log file output to the console. 55 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csobs2caldb.rst
@@ -54,7 +54,7 @@ Standard parameters @@ -54,7 +54,7 @@ Standard parameters
54 chatter = 4: detailed report about the task execution 54 chatter = 4: detailed report about the task execution
55 55
56 ``(clobber = yes) [boolean]`` 56 ``(clobber = yes) [boolean]``
57 - Specifies whether an existing output counts cube should be overwritten. 57 + Specifies whether an existing output file should be overwritten.
58 58
59 ``(debug = no) [boolean]`` 59 ``(debug = no) [boolean]``
60 Enables debug mode. In debug mode the executable will dump any log file output to the console. 60 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csobsdef.rst
@@ -97,7 +97,7 @@ Standard parameters @@ -97,7 +97,7 @@ Standard parameters
97 chatter = 4: detailed report about the task execution 97 chatter = 4: detailed report about the task execution
98 98
99 ``(clobber = yes) [boolean]`` 99 ``(clobber = yes) [boolean]``
100 - Specifies whether an existing output counts cube should be overwritten. 100 + Specifies whether an existing Observation Definition XML file should be overwritten.
101 101
102 ``(debug = no) [boolean]`` 102 ``(debug = no) [boolean]``
103 Enables debug mode. In debug mode the executable will dump any log file output to the console. 103 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csobsinfo.rst
@@ -70,7 +70,7 @@ Standard parameters @@ -70,7 +70,7 @@ Standard parameters
70 chatter = 4: detailed report about the task execution 70 chatter = 4: detailed report about the task execution
71 71
72 ``(clobber = yes) [boolean]`` 72 ``(clobber = yes) [boolean]``
73 - Specifies whether an existing output counts cube should be overwritten. 73 + Specifies whether an existing output file should be overwritten.
74 74
75 ``(debug = no) [boolean]`` 75 ``(debug = no) [boolean]``
76 Enables debug mode. In debug mode the executable will dump any log file output to the console. 76 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/cspull.rst
@@ -121,7 +121,7 @@ Standard parameters @@ -121,7 +121,7 @@ Standard parameters
121 chatter = 4: detailed report about the task execution 121 chatter = 4: detailed report about the task execution
122 122
123 ``(clobber = yes) [boolean]`` 123 ``(clobber = yes) [boolean]``
124 - Specifies whether an existing output counts cube should be overwritten. 124 + Specifies whether an existing output file should be overwritten.
125 125
126 ``(debug = no) [boolean]`` 126 ``(debug = no) [boolean]``
127 Enables debug mode. In debug mode the executable will dump any log file output to the console. 127 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csresmap.rst
@@ -101,6 +101,9 @@ General parameters @@ -101,6 +101,9 @@ General parameters
101 Standard parameters 101 Standard parameters
102 ------------------- 102 -------------------
103 103
  104 +``(publish = no) [boolean]``
  105 + Specifies whether the residual map should be published on VO Hub.
  106 +
104 ``(chatter = 2) [integer]`` 107 ``(chatter = 2) [integer]``
105 Verbosity of the executable: 108 Verbosity of the executable:
106 chatter = 0: no information will be logged 109 chatter = 0: no information will be logged
@@ -114,7 +117,7 @@ Standard parameters @@ -114,7 +117,7 @@ Standard parameters
114 chatter = 4: detailed report about the task execution 117 chatter = 4: detailed report about the task execution
115 118
116 ``(clobber = yes) [boolean]`` 119 ``(clobber = yes) [boolean]``
117 - Specifies whether an existing output counts cube should be overwritten. 120 + Specifies whether an existing residual map file should be overwritten.
118 121
119 ``(debug = no) [boolean]`` 122 ``(debug = no) [boolean]``
120 Enables debug mode. In debug mode the executable will dump any log file output to the console. 123 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/cssens.rst
@@ -120,7 +120,7 @@ Standard parameters @@ -120,7 +120,7 @@ Standard parameters
120 chatter = 4: detailed report about the task execution 120 chatter = 4: detailed report about the task execution
121 121
122 ``(clobber = yes) [boolean]`` 122 ``(clobber = yes) [boolean]``
123 - Specifies whether an existing output counts cube should be overwritten. 123 + Specifies whether an existing output file should be overwritten.
124 124
125 ``(debug = no) [boolean]`` 125 ``(debug = no) [boolean]``
126 Enables debug mode. In debug mode the executable will dump any log file output to the console. 126 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/csspec.rst
@@ -123,7 +123,7 @@ Standard parameters @@ -123,7 +123,7 @@ Standard parameters
123 chatter = 4: detailed report about the task execution 123 chatter = 4: detailed report about the task execution
124 124
125 ``(clobber = yes) [boolean]`` 125 ``(clobber = yes) [boolean]``
126 - Specifies whether an existing output counts cube should be overwritten. 126 + Specifies whether an existing source spectrum output file should be overwritten.
127 127
128 ``(debug = no) [boolean]`` 128 ``(debug = no) [boolean]``
129 Enables debug mode. In debug mode the executable will dump any log file output to the console. 129 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/cstsdist.rst
@@ -122,7 +122,7 @@ Standard parameters @@ -122,7 +122,7 @@ Standard parameters
122 chatter = 4: detailed report about the task execution 122 chatter = 4: detailed report about the task execution
123 123
124 ``(clobber = yes) [boolean]`` 124 ``(clobber = yes) [boolean]``
125 - Specifies whether an existing output counts cube should be overwritten. 125 + Specifies whether an existing output file should be overwritten.
126 126
127 ``(debug = no) [boolean]`` 127 ``(debug = no) [boolean]``
128 Enables debug mode. In debug mode the executable will dump any log file output to the console. 128 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/cstsmapmerge.rst
@@ -54,7 +54,7 @@ Standard parameters @@ -54,7 +54,7 @@ Standard parameters
54 chatter = 4: detailed report about the task execution 54 chatter = 4: detailed report about the task execution
55 55
56 ``(clobber = yes) [boolean]`` 56 ``(clobber = yes) [boolean]``
57 - Specifies whether an existing output counts cube should be overwritten. 57 + Specifies whether an existing output TS map file should be overwritten.
58 58
59 ``(debug = no) [boolean]`` 59 ``(debug = no) [boolean]``
60 Enables debug mode. In debug mode the executable will dump any log file output to the console. 60 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctbin.rst
@@ -78,6 +78,9 @@ General parameters @@ -78,6 +78,9 @@ General parameters
78 Standard parameters 78 Standard parameters
79 ------------------- 79 -------------------
80 80
  81 +``(publish = no) [boolean]``
  82 + Specifies whether the counts cube should be published on VO Hub.
  83 +
81 ``(chatter = 2) [integer]`` 84 ``(chatter = 2) [integer]``
82 Verbosity of the executable: 85 Verbosity of the executable:
83 chatter = 0: no information will be logged 86 chatter = 0: no information will be logged
@@ -91,7 +94,7 @@ Standard parameters @@ -91,7 +94,7 @@ Standard parameters
91 chatter = 4: detailed report about the task execution 94 chatter = 4: detailed report about the task execution
92 95
93 ``(clobber = yes) [boolean]`` 96 ``(clobber = yes) [boolean]``
94 - Specifies whether an existing output counts cube should be overwritten. 97 + Specifies whether an existing output counts cube file should be overwritten.
95 98
96 ``(debug = no) [boolean]`` 99 ``(debug = no) [boolean]``
97 Enables debug mode. In debug mode the executable will dump any log file output to the console. 100 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctbkgcube.rst
@@ -111,6 +111,9 @@ General parameters @@ -111,6 +111,9 @@ General parameters
111 Standard parameters 111 Standard parameters
112 ------------------- 112 -------------------
113 113
  114 +``(publish = no) [boolean]``
  115 + Specifies whether the background cube should be published on VO Hub.
  116 +
114 ``(chatter = 2) [integer]`` 117 ``(chatter = 2) [integer]``
115 Verbosity of the executable: 118 Verbosity of the executable:
116 chatter = 0: no information will be logged 119 chatter = 0: no information will be logged
@@ -124,7 +127,7 @@ Standard parameters @@ -124,7 +127,7 @@ Standard parameters
124 chatter = 4: detailed report about the task execution 127 chatter = 4: detailed report about the task execution
125 128
126 ``(clobber = yes) [boolean]`` 129 ``(clobber = yes) [boolean]``
127 - Specifies whether an existing output counts cube should be overwritten. 130 + Specifies whether an existing output background cube file should be overwritten.
128 131
129 ``(debug = no) [boolean]`` 132 ``(debug = no) [boolean]``
130 Enables debug mode. In debug mode the executable will dump any log file output to the console. 133 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctbutterfly.rst
@@ -111,7 +111,7 @@ Standard parameters @@ -111,7 +111,7 @@ Standard parameters
111 chatter = 4: detailed report about the task execution 111 chatter = 4: detailed report about the task execution
112 112
113 ``(clobber = yes) [boolean]`` 113 ``(clobber = yes) [boolean]``
114 - Specifies whether an existing output counts cube should be overwritten. 114 + Specifies whether an existing output file should be overwritten.
115 115
116 ``(debug = no) [boolean]`` 116 ``(debug = no) [boolean]``
117 Enables debug mode. In debug mode the executable will dump any log file output to the console. 117 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctcubemask.rst
@@ -69,6 +69,9 @@ General parameters @@ -69,6 +69,9 @@ General parameters
69 Standard parameters 69 Standard parameters
70 ------------------- 70 -------------------
71 71
  72 +``(publish = no) [boolean]``
  73 + Specifies whether the counts cube should be published on VO Hub.
  74 +
72 ``(chatter = 2) [integer]`` 75 ``(chatter = 2) [integer]``
73 Verbosity of the executable: 76 Verbosity of the executable:
74 chatter = 0: no information will be logged 77 chatter = 0: no information will be logged
@@ -82,7 +85,7 @@ Standard parameters @@ -82,7 +85,7 @@ Standard parameters
82 chatter = 4: detailed report about the task execution 85 chatter = 4: detailed report about the task execution
83 86
84 ``(clobber = yes) [boolean]`` 87 ``(clobber = yes) [boolean]``
85 - Specifies whether an existing output counts cube should be overwritten. 88 + Specifies whether an existing output counts cube file should be overwritten.
86 89
87 ``(debug = no) [boolean]`` 90 ``(debug = no) [boolean]``
88 Enables debug mode. In debug mode the executable will dump any log file output to the console. 91 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/cterror.rst
@@ -85,7 +85,7 @@ Standard parameters @@ -85,7 +85,7 @@ Standard parameters
85 chatter = 4: detailed report about the task execution 85 chatter = 4: detailed report about the task execution
86 86
87 ``(clobber = yes) [boolean]`` 87 ``(clobber = yes) [boolean]``
88 - Specifies whether an existing output counts cube should be overwritten. 88 + Specifies whether an existing output file should be overwritten.
89 89
90 ``(debug = no) [boolean]`` 90 ``(debug = no) [boolean]``
91 Enables debug mode. In debug mode the executable will dump any log file output to the console. 91 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctexpcube.rst
@@ -105,6 +105,9 @@ General parameters @@ -105,6 +105,9 @@ General parameters
105 Standard parameters 105 Standard parameters
106 ------------------- 106 -------------------
107 107
  108 +``(publish = no) [boolean]``
  109 + Specifies whether the exposure cube should be published on VO Hub.
  110 +
108 ``(chatter = 2) [integer]`` 111 ``(chatter = 2) [integer]``
109 Verbosity of the executable: 112 Verbosity of the executable:
110 chatter = 0: no information will be logged 113 chatter = 0: no information will be logged
@@ -118,7 +121,7 @@ Standard parameters @@ -118,7 +121,7 @@ Standard parameters
118 chatter = 4: detailed report about the task execution 121 chatter = 4: detailed report about the task execution
119 122
120 ``(clobber = yes) [boolean]`` 123 ``(clobber = yes) [boolean]``
121 - Specifies whether an existing output counts cube should be overwritten. 124 + Specifies whether an existing output exposure cube file should be overwritten.
122 125
123 ``(debug = no) [boolean]`` 126 ``(debug = no) [boolean]``
124 Enables debug mode. In debug mode the executable will dump any log file output to the console. 127 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctlike.rst
@@ -111,7 +111,7 @@ Standard parameters @@ -111,7 +111,7 @@ Standard parameters
111 chatter = 4: detailed report about the task execution 111 chatter = 4: detailed report about the task execution
112 112
113 ``(clobber = yes) [boolean]`` 113 ``(clobber = yes) [boolean]``
114 - Specifies whether an existing output counts cube should be overwritten. 114 + Specifies whether an existing output model file should be overwritten.
115 115
116 ``(debug = no) [boolean]`` 116 ``(debug = no) [boolean]``
117 Enables debug mode. In debug mode the executable will dump any log file output to the console. 117 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctmodel.rst
@@ -138,6 +138,9 @@ General parameters @@ -138,6 +138,9 @@ General parameters
138 Standard parameters 138 Standard parameters
139 ------------------- 139 -------------------
140 140
  141 +``(publish = no) [boolean]``
  142 + Specifies whether the model cube should be published on VO Hub.
  143 +
141 ``(chatter = 2) [integer]`` 144 ``(chatter = 2) [integer]``
142 Verbosity of the executable: 145 Verbosity of the executable:
143 chatter = 0: no information will be logged 146 chatter = 0: no information will be logged
@@ -151,7 +154,7 @@ Standard parameters @@ -151,7 +154,7 @@ Standard parameters
151 chatter = 4: detailed report about the task execution 154 chatter = 4: detailed report about the task execution
152 155
153 ``(clobber = yes) [boolean]`` 156 ``(clobber = yes) [boolean]``
154 - Specifies whether an existing output counts cube should be overwritten. 157 + Specifies whether an existing output model cube file should be overwritten.
155 158
156 ``(debug = no) [boolean]`` 159 ``(debug = no) [boolean]``
157 Enables debug mode. In debug mode the executable will dump any log file output to the console. 160 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctobssim.rst
@@ -119,7 +119,7 @@ Standard parameters @@ -119,7 +119,7 @@ Standard parameters
119 chatter = 4: detailed report about the task execution 119 chatter = 4: detailed report about the task execution
120 120
121 ``(clobber = yes) [boolean]`` 121 ``(clobber = yes) [boolean]``
122 - Specifies whether an existing output counts cube should be overwritten. 122 + Specifies whether existing files should be overwritten.
123 123
124 ``(debug = no) [boolean]`` 124 ``(debug = no) [boolean]``
125 Enables debug mode. In debug mode the executable will dump any log file output to the console. 125 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctpsfcube.rst
@@ -122,7 +122,7 @@ Standard parameters @@ -122,7 +122,7 @@ Standard parameters
122 chatter = 4: detailed report about the task execution 122 chatter = 4: detailed report about the task execution
123 123
124 ``(clobber = yes) [boolean]`` 124 ``(clobber = yes) [boolean]``
125 - Specifies whether an existing output counts cube should be overwritten. 125 + Specifies whether an existing output point spread function cube file should be overwritten.
126 126
127 ``(debug = no) [boolean]`` 127 ``(debug = no) [boolean]``
128 Enables debug mode. In debug mode the executable will dump any log file output to the console. 128 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctselect.rst
@@ -108,7 +108,7 @@ Standard parameters @@ -108,7 +108,7 @@ Standard parameters
108 chatter = 4: detailed report about the task execution 108 chatter = 4: detailed report about the task execution
109 109
110 ``(clobber = yes) [boolean]`` 110 ``(clobber = yes) [boolean]``
111 - Specifies whether an existing output counts cube should be overwritten. 111 + Specifies whether existing output files should be overwritten.
112 112
113 ``(debug = no) [boolean]`` 113 ``(debug = no) [boolean]``
114 Enables debug mode. In debug mode the executable will dump any log file output to the console. 114 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctskymap.rst
@@ -60,6 +60,9 @@ General parameters @@ -60,6 +60,9 @@ General parameters
60 Standard parameters 60 Standard parameters
61 ------------------- 61 -------------------
62 62
  63 +``(publish = no) [boolean]``
  64 + Specifies whether the sky map should be published on VO Hub.
  65 +
63 ``(chatter = 2) [integer]`` 66 ``(chatter = 2) [integer]``
64 Verbosity of the executable: 67 Verbosity of the executable:
65 chatter = 0: no information will be logged 68 chatter = 0: no information will be logged
@@ -73,7 +76,7 @@ Standard parameters @@ -73,7 +76,7 @@ Standard parameters
73 chatter = 4: detailed report about the task execution 76 chatter = 4: detailed report about the task execution
74 77
75 ``(clobber = yes) [boolean]`` 78 ``(clobber = yes) [boolean]``
76 - Specifies whether an existing output counts cube should be overwritten. 79 + Specifies whether an existing output sky map file should be overwritten.
77 80
78 ``(debug = no) [boolean]`` 81 ``(debug = no) [boolean]``
79 Enables debug mode. In debug mode the executable will dump any log file output to the console. 82 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/cttsmap.rst
@@ -94,6 +94,9 @@ General parameters @@ -94,6 +94,9 @@ General parameters
94 Standard parameters 94 Standard parameters
95 ------------------- 95 -------------------
96 96
  97 +``(publish = no) [boolean]``
  98 + Specifies whether the TS map should be published on VO Hub.
  99 +
97 ``(chatter = 2) [integer]`` 100 ``(chatter = 2) [integer]``
98 Verbosity of the executable: 101 Verbosity of the executable:
99 chatter = 0: no information will be logged 102 chatter = 0: no information will be logged
@@ -107,7 +110,7 @@ Standard parameters @@ -107,7 +110,7 @@ Standard parameters
107 chatter = 4: detailed report about the task execution 110 chatter = 4: detailed report about the task execution
108 111
109 ``(clobber = yes) [boolean]`` 112 ``(clobber = yes) [boolean]``
110 - Specifies whether an existing output counts cube should be overwritten. 113 + Specifies whether an existing output TS map file should be overwritten.
111 114
112 ``(debug = no) [boolean]`` 115 ``(debug = no) [boolean]``
113 Enables debug mode. In debug mode the executable will dump any log file output to the console. 116 Enables debug mode. In debug mode the executable will dump any log file output to the console.
doc/source/reference_manual/ctulimit.rst
@@ -97,7 +97,7 @@ Standard parameters @@ -97,7 +97,7 @@ Standard parameters
97 chatter = 4: detailed report about the task execution 97 chatter = 4: detailed report about the task execution
98 98
99 ``(clobber = yes) [boolean]`` 99 ``(clobber = yes) [boolean]``
100 - Specifies whether an existing output counts cube should be overwritten. 100 + Specifies whether an existing output file should be overwritten.
101 101
102 ``(debug = no) [boolean]`` 102 ``(debug = no) [boolean]``
103 Enables debug mode. In debug mode the executable will dump any log file output to the console. 103 Enables debug mode. In debug mode the executable will dump any log file output to the console.
pyext/ctbin.i
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbin - Event binning tool * 2 * ctbin - Event binning tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2014 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -47,6 +47,7 @@ public: @@ -47,6 +47,7 @@ public:
47 void clear(void); 47 void clear(void);
48 void run(void); 48 void run(void);
49 void save(void); 49 void save(void);
  50 + void publish(const std::string& name = "");
50 const GObservations& obs(void) const; 51 const GObservations& obs(void) const;
51 GCTAEventCube cube(void) const; 52 GCTAEventCube cube(void) const;
52 }; 53 };
pyext/ctbkgcube.i
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbkgcube - Background cube generation tool * 2 * ctbkgcube - Background cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Chia-Chun Lu * 4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -47,6 +47,7 @@ public: @@ -47,6 +47,7 @@ public:
47 void clear(void); 47 void clear(void);
48 void run(void); 48 void run(void);
49 void save(void); 49 void save(void);
  50 + void publish(const std::string& name = "");
50 const GCTACubeBackground& bkgcube(void) const; 51 const GCTACubeBackground& bkgcube(void) const;
51 const GModels& models(void) const; 52 const GModels& models(void) const;
52 }; 53 };
pyext/ctcubemask.i
1 /*************************************************************************** 1 /***************************************************************************
2 * ctcubemask - Cube filter tool * 2 * ctcubemask - Cube filter tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014 Chia-Chun Lu * 4 + * copyright (C) 2014-2016 Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -47,6 +47,7 @@ public: @@ -47,6 +47,7 @@ public:
47 void clear(void); 47 void clear(void);
48 void run(void); 48 void run(void);
49 void save(void); 49 void save(void);
  50 + void publish(const std::string& name = "");
50 const GObservations& obs(void) const; 51 const GObservations& obs(void) const;
51 }; 52 };
52 53
pyext/ctexpcube.i
1 /*************************************************************************** 1 /***************************************************************************
2 * ctexpcube - Exposure cube generation tool * 2 * ctexpcube - Exposure cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -47,6 +47,7 @@ public: @@ -47,6 +47,7 @@ public:
47 void clear(void); 47 void clear(void);
48 void run(void); 48 void run(void);
49 void save(void); 49 void save(void);
  50 + void publish(const std::string& name = "");
50 const GCTACubeExposure& expcube(void) const; 51 const GCTACubeExposure& expcube(void) const;
51 }; 52 };
52 53
pyext/ctmodel.i
1 /*************************************************************************** 1 /***************************************************************************
2 * ctmodel - Model cube generation tool * 2 * ctmodel - Model cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -47,6 +47,7 @@ public: @@ -47,6 +47,7 @@ public:
47 void clear(void); 47 void clear(void);
48 void run(void); 48 void run(void);
49 void save(void); 49 void save(void);
  50 + void publish(const std::string& name = "");
50 const GObservations& obs(void) const; 51 const GObservations& obs(void) const;
51 const GCTAEventCube& cube(void) const; 52 const GCTAEventCube& cube(void) const;
52 void cube(const GCTAEventCube& cube); 53 void cube(const GCTAEventCube& cube);
pyext/ctool.i
@@ -136,3 +136,14 @@ public: @@ -136,3 +136,14 @@ public:
136 virtual void save(void); 136 virtual void save(void);
137 }; 137 };
138 138
  139 +
  140 +/***********************************************************************//**
  141 + * @brief ctool base class Python extension
  142 + ***************************************************************************/
  143 +%extend ctool {
  144 + void read_ahead(const bool& flag) {
  145 + self->m_read_ahead = flag;
  146 + return;
  147 + }
  148 +}
  149 +
pyext/ctskymap.i
1 /*************************************************************************** 1 /***************************************************************************
2 * ctskymap - Sky mapping tool * 2 * ctskymap - Sky mapping tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -47,6 +47,7 @@ public: @@ -47,6 +47,7 @@ public:
47 void clear(void); 47 void clear(void);
48 void run(void); 48 void run(void);
49 void save(void); 49 void save(void);
  50 + void publish(const std::string& name = "");
50 const GSkyMap& map(void) const; 51 const GSkyMap& map(void) const;
51 }; 52 };
52 53
pyext/cttsmap.i
1 /*************************************************************************** 1 /***************************************************************************
2 * cttsmap - TS map calculation tool * 2 * cttsmap - TS map calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Michael Mayer * 4 + * copyright (C) 2014-2016 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -47,6 +47,7 @@ public: @@ -47,6 +47,7 @@ public:
47 void clear(void); 47 void clear(void);
48 void run(void); 48 void run(void);
49 void save(void); 49 void save(void);
  50 + void publish(const std::string& name = "");
50 const GObservations& obs(void) const; 51 const GObservations& obs(void) const;
51 const GSkyMap& tsmap(void) const; 52 const GSkyMap& tsmap(void) const;
52 }; 53 };
src/ctbin/ctbin.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbin - Event binning tool * 2 * ctbin - Event binning tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -302,6 +302,11 @@ void ctbin::run(void) @@ -302,6 +302,11 @@ void ctbin::run(void)
302 log << m_obs << std::endl; 302 log << m_obs << std::endl;
303 } 303 }
304 304
  305 + // Optionally publish counts cube
  306 + if (m_publish) {
  307 + publish();
  308 + }
  309 +
305 // Return 310 // Return
306 return; 311 return;
307 } 312 }
@@ -310,26 +315,21 @@ void ctbin::run(void) @@ -310,26 +315,21 @@ void ctbin::run(void)
310 /***********************************************************************//** 315 /***********************************************************************//**
311 * @brief Save counts cube 316 * @brief Save counts cube
312 * 317 *
313 - * This method saves the counts cube into a FITS file. 318 + * Saves the counts cube into a FITS file.
314 ***************************************************************************/ 319 ***************************************************************************/
315 void ctbin::save(void) 320 void ctbin::save(void)
316 { 321 {
317 // Write header 322 // Write header
318 if (logTerse()) { 323 if (logTerse()) {
319 log << std::endl; 324 log << std::endl;
320 - if (m_obs.size() > 1) {  
321 - log.header1("Save observations");  
322 - }  
323 - else {  
324 - log.header1("Save observation");  
325 - } 325 + log.header1("Save counts cube");
326 } 326 }
327 327
328 - // Get output filename 328 + // Get counts cube filename
329 m_outcube = (*this)["outcube"].filename(); 329 m_outcube = (*this)["outcube"].filename();
330 330
331 // Save only if filename is non-empty 331 // Save only if filename is non-empty
332 - if (m_outcube.length() > 0) { 332 + if (!m_outcube.is_empty()) {
333 333
334 // Get CTA observation from observation container 334 // Get CTA observation from observation container
335 GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); 335 GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]);
@@ -337,9 +337,10 @@ void ctbin::save(void) @@ -337,9 +337,10 @@ void ctbin::save(void)
337 // Save only if observation is valid 337 // Save only if observation is valid
338 if (obs != NULL) { 338 if (obs != NULL) {
339 339
340 - // Dump filename 340 + // Log filename
341 if (logTerse()) { 341 if (logTerse()) {
342 - log << "Save \""+m_outcube+"\"" << std::endl; 342 + log << "Save counts cube into file \""+m_outcube+"\".";
  343 + log << std::endl;
343 } 344 }
344 345
345 // Save cube 346 // Save cube
@@ -354,6 +355,38 @@ void ctbin::save(void) @@ -354,6 +355,38 @@ void ctbin::save(void)
354 } 355 }
355 356
356 357
  358 +/***********************************************************************//**
  359 + * @brief Publish counts cube
  360 + *
  361 + * @param[in] name Counts cube name.
  362 + ***************************************************************************/
  363 +void ctbin::publish(const std::string& name)
  364 +{
  365 + // Write header
  366 + if (logTerse()) {
  367 + log << std::endl;
  368 + log.header1("Publish counts cube");
  369 + }
  370 +
  371 + // Set default name is user name is empty
  372 + std::string user_name(name);
  373 + if (user_name.empty()) {
  374 + user_name = CTBIN_NAME;
  375 + }
  376 +
  377 + // Log filename
  378 + if (logTerse()) {
  379 + log << "Publish \""+user_name+"\" counts cube." << std::endl;
  380 + }
  381 +
  382 + // Publish counts cube
  383 + m_cube.publish(user_name);
  384 +
  385 + // Return
  386 + return;
  387 +}
  388 +
  389 +
357 /*========================================================================== 390 /*==========================================================================
358 = = 391 = =
359 = Private methods = 392 = Private methods =
@@ -367,7 +400,8 @@ void ctbin::init_members(void) @@ -367,7 +400,8 @@ void ctbin::init_members(void)
367 { 400 {
368 // Initialise members 401 // Initialise members
369 m_outcube.clear(); 402 m_outcube.clear();
370 - m_usepnt = false; 403 + m_usepnt = false;
  404 + m_publish = false;
371 405
372 // Initialise protected members 406 // Initialise protected members
373 m_obs.clear(); 407 m_obs.clear();
@@ -392,6 +426,7 @@ void ctbin::copy_members(const ctbin&amp; app) @@ -392,6 +426,7 @@ void ctbin::copy_members(const ctbin&amp; app)
392 // Copy attributes 426 // Copy attributes
393 m_outcube = app.m_outcube; 427 m_outcube = app.m_outcube;
394 m_usepnt = app.m_usepnt; 428 m_usepnt = app.m_usepnt;
  429 + m_publish = app.m_publish;
395 430
396 // Copy protected members 431 // Copy protected members
397 m_obs = app.m_obs; 432 m_obs = app.m_obs;
@@ -452,6 +487,9 @@ void ctbin::get_parameters(void) @@ -452,6 +487,9 @@ void ctbin::get_parameters(void)
452 // Get energy boundaries 487 // Get energy boundaries
453 m_ebounds = cube.ebounds(); 488 m_ebounds = cube.ebounds();
454 489
  490 + // Get remaining parameters
  491 + m_publish = (*this)["publish"].boolean();
  492 +
455 // Optionally read ahead parameters so that they get correctly 493 // Optionally read ahead parameters so that they get correctly
456 // dumped into the log file 494 // dumped into the log file
457 if (read_ahead()) { 495 if (read_ahead()) {
src/ctbin/ctbin.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbin - Event binning tool * 2 * ctbin - Event binning tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /* __Definitions _________________________________________________________ */ 35 /* __Definitions _________________________________________________________ */
36 #define CTBIN_NAME "ctbin" 36 #define CTBIN_NAME "ctbin"
37 -#define CTBIN_VERSION "1.0.0" 37 +#define CTBIN_VERSION "1.1.0"
38 38
39 39
40 /***********************************************************************//** 40 /***********************************************************************//**
@@ -78,6 +78,7 @@ public: @@ -78,6 +78,7 @@ public:
78 void clear(void); 78 void clear(void);
79 void run(void); 79 void run(void);
80 void save(void); 80 void save(void);
  81 + void publish(const std::string& name = "");
81 const GObservations& obs(void) const; 82 const GObservations& obs(void) const;
82 GCTAEventCube cube(void) const; 83 GCTAEventCube cube(void) const;
83 84
@@ -91,8 +92,9 @@ protected: @@ -91,8 +92,9 @@ protected:
91 void obs_cube(void); 92 void obs_cube(void);
92 93
93 // User parameters 94 // User parameters
94 - std::string m_outcube; //!< Output counts map file 95 + GFilename m_outcube; //!< Output counts map file name
95 bool m_usepnt; //!< Use pointing instead of xref/yref parameters 96 bool m_usepnt; //!< Use pointing instead of xref/yref parameters
  97 + bool m_publish; //!< Publish counts cube?
96 98
97 // Protected members 99 // Protected members
98 GObservations m_obs; //!< Observation container 100 GObservations m_obs; //!< Observation container
src/ctbin/ctbin.par
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # File: ctbin.par # 7 # File: ctbin.par #
8 -# Version: 1.0.0 # 8 +# Version: 1.1.0 #
9 # # 9 # #
10 # Author: Jurgen Knodlseder # 10 # Author: Jurgen Knodlseder #
11 # Jurgen.Knodlseder@irap.omp.eu # 11 # Jurgen.Knodlseder@irap.omp.eu #
@@ -44,6 +44,7 @@ proj, s, a, &quot;CAR&quot;,AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot; @@ -44,6 +44,7 @@ proj, s, a, &quot;CAR&quot;,AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
44 # 44 #
45 # Standard parameters 45 # Standard parameters
46 #==================== 46 #====================
  47 +publish, b, h, no,,, "Publish counts cube on VO Hub?"
47 chatter, i, h, 2,0,4, "Chattiness of output" 48 chatter, i, h, 2,0,4, "Chattiness of output"
48 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 49 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
49 debug, b, h, no,,, "Debugging mode activated" 50 debug, b, h, no,,, "Debugging mode activated"
src/ctbkgcube/ctbkgcube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbkgcube - Background cube generation tool * 2 * ctbkgcube - Background cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Chia-Chun Lu * 4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -340,6 +340,11 @@ void ctbkgcube::run(void) @@ -340,6 +340,11 @@ void ctbkgcube::run(void)
340 // Recover original models 340 // Recover original models
341 m_obs.models(models_orig); 341 m_obs.models(models_orig);
342 342
  343 + // Optionally publish background cube
  344 + if (m_publish) {
  345 + publish();
  346 + }
  347 +
343 // Return 348 // Return
344 return; 349 return;
345 } 350 }
@@ -348,7 +353,8 @@ void ctbkgcube::run(void) @@ -348,7 +353,8 @@ void ctbkgcube::run(void)
348 /***********************************************************************//** 353 /***********************************************************************//**
349 * @brief Save background cube 354 * @brief Save background cube
350 * 355 *
351 - * Save the background cube into the file specified by the outfile parameter. 356 + * Save the background cube into a FITS file and the output model into an
  357 + * XML file.
352 ***************************************************************************/ 358 ***************************************************************************/
353 void ctbkgcube::save(void) 359 void ctbkgcube::save(void)
354 { 360 {
@@ -358,21 +364,71 @@ void ctbkgcube::save(void) @@ -358,21 +364,71 @@ void ctbkgcube::save(void)
358 log.header1("Save background cube"); 364 log.header1("Save background cube");
359 } 365 }
360 366
361 - // Get output filenames  
362 - std::string outfile = (*this)["outcube"].filename();  
363 - std::string outmodel = (*this)["outmodel"].filename(); 367 + // Get background cube and model file names
  368 + m_outcube = (*this)["outcube"].filename();
  369 + m_outmodel = (*this)["outmodel"].filename();
  370 +
  371 + // Save only if filename is non-empty
  372 + if (!m_outcube.is_empty()) {
364 373
365 - // Save background cube  
366 - m_background.save(outfile, clobber()); 374 + // Log filename
  375 + if (logTerse()) {
  376 + log << "Save background cube into file \""+m_outcube+"\".";
  377 + log << std::endl;
  378 + }
  379 +
  380 + // Save background cube
  381 + m_background.save(m_outcube, clobber());
  382 +
  383 + }
367 384
368 // Write output models if filename is valid 385 // Write output models if filename is valid
369 - if ((outmodel.length() > 0) && (gammalib::tolower(outmodel) != "none")) { 386 + if ((!m_outmodel.is_empty()) &&
  387 + (gammalib::tolower(m_outmodel.url()) != "none")) {
  388 +
  389 + // Log filename
  390 + if (logTerse()) {
  391 + log << "Save model into file \""+m_outmodel.url()+"\".";
  392 + log << std::endl;
  393 + }
  394 +
  395 + // Save output model for stacked analyses
  396 + m_outmdl.save(m_outmodel.url());
  397 +
  398 + }
  399 +
  400 + // Return
  401 + return;
  402 +}
370 403
371 - // Save output model for binned analyses  
372 - m_outmdl.save(outmodel);  
373 404
  405 +/***********************************************************************//**
  406 + * @brief Publish background cube
  407 + *
  408 + * @param[in] name Background cube name.
  409 + ***************************************************************************/
  410 +void ctbkgcube::publish(const std::string& name)
  411 +{
  412 + // Write header
  413 + if (logTerse()) {
  414 + log << std::endl;
  415 + log.header1("Publish background cube");
  416 + }
  417 +
  418 + // Set default name is user name is empty
  419 + std::string user_name(name);
  420 + if (user_name.empty()) {
  421 + user_name = CTBKGCUBE_NAME;
  422 + }
  423 +
  424 + // Log filename
  425 + if (logTerse()) {
  426 + log << "Publish \""+user_name+"\" background cube." << std::endl;
374 } 427 }
375 428
  429 + // Publish exposure cube
  430 + m_background.cube().publish(user_name);
  431 +
376 // Return 432 // Return
377 return; 433 return;
378 } 434 }
@@ -392,6 +448,7 @@ void ctbkgcube::init_members(void) @@ -392,6 +448,7 @@ void ctbkgcube::init_members(void)
392 // Initialise members 448 // Initialise members
393 m_outcube.clear(); 449 m_outcube.clear();
394 m_outmodel.clear(); 450 m_outmodel.clear();
  451 + m_publish = false;
395 m_obs.clear(); 452 m_obs.clear();
396 m_background.clear(); 453 m_background.clear();
397 m_bkgmdl.clear(); 454 m_bkgmdl.clear();
@@ -412,6 +469,7 @@ void ctbkgcube::copy_members(const ctbkgcube&amp; app) @@ -412,6 +469,7 @@ void ctbkgcube::copy_members(const ctbkgcube&amp; app)
412 // Copy members 469 // Copy members
413 m_outmodel = app.m_outmodel; 470 m_outmodel = app.m_outmodel;
414 m_outcube = app.m_outcube; 471 m_outcube = app.m_outcube;
  472 + m_publish = app.m_publish;
415 m_obs = app.m_obs; 473 m_obs = app.m_obs;
416 m_background = app.m_background; 474 m_background = app.m_background;
417 m_bkgmdl = app.m_bkgmdl; 475 m_bkgmdl = app.m_bkgmdl;
@@ -499,6 +557,9 @@ void ctbkgcube::get_parameters(void) @@ -499,6 +557,9 @@ void ctbkgcube::get_parameters(void)
499 m_obs.models(models); 557 m_obs.models(models);
500 } 558 }
501 559
  560 + // Get remaining parameters
  561 + m_publish = (*this)["publish"].boolean();
  562 +
502 // Read output filenames (if needed) 563 // Read output filenames (if needed)
503 if (read_ahead()) { 564 if (read_ahead()) {
504 m_outcube = (*this)["outcube"].filename(); 565 m_outcube = (*this)["outcube"].filename();
src/ctbkgcube/ctbkgcube.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbkgcube - Background cube generation tool * 2 * ctbkgcube - Background cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Chia-Chun Lu * 4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /* __Definitions _________________________________________________________ */ 35 /* __Definitions _________________________________________________________ */
36 #define CTBKGCUBE_NAME "ctbkgcube" 36 #define CTBKGCUBE_NAME "ctbkgcube"
37 -#define CTBKGCUBE_VERSION "1.0.0" 37 +#define CTBKGCUBE_VERSION "1.1.0"
38 38
39 39
40 /***********************************************************************//** 40 /***********************************************************************//**
@@ -59,6 +59,7 @@ public: @@ -59,6 +59,7 @@ public:
59 void clear(void); 59 void clear(void);
60 void run(void); 60 void run(void);
61 void save(void); 61 void save(void);
  62 + void publish(const std::string& name = "");
62 const GCTACubeBackground& bkgcube(void) const; 63 const GCTACubeBackground& bkgcube(void) const;
63 const GModels& models(void) const; 64 const GModels& models(void) const;
64 65
@@ -70,11 +71,14 @@ protected: @@ -70,11 +71,14 @@ protected:
70 void get_parameters(void); 71 void get_parameters(void);
71 void fill_cube(GCTAObservation* obs); 72 void fill_cube(GCTAObservation* obs);
72 73
  74 + // User parameters
  75 + GFilename m_outcube; //!< Filename of output cube
  76 + GFilename m_outmodel; //!< Filename of output XML model
  77 + bool m_publish; //!< Publish background cube?
  78 +
73 // Protected members 79 // Protected members
74 - std::string m_outcube; //!< Filename of output cube  
75 - std::string m_outmodel; //!< Filename of output XML model  
76 GObservations m_obs; //!< Observation container 80 GObservations m_obs; //!< Observation container
77 - GCTACubeBackground m_background; //!< Background cube response 81 + GCTACubeBackground m_background; //!< Background cube
78 GModels m_bkgmdl; //!< CTA background models 82 GModels m_bkgmdl; //!< CTA background models
79 GModels m_outmdl; //!< Output models 83 GModels m_outmdl; //!< Output models
80 }; 84 };
src/ctbkgcube/ctbkgcube.par
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # File: ctbkgcube.par # 7 # File: ctbkgcube.par #
8 -# Version: 1.0.0 # 8 +# Version: 1.1.0 #
9 # # 9 # #
10 # Author: Chia-Chun Lu # 10 # Author: Chia-Chun Lu #
11 # c.lu@mpi-hd.mpg.de # 11 # c.lu@mpi-hd.mpg.de #
@@ -49,6 +49,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot; @@ -49,6 +49,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
49 # 49 #
50 # Standard parameters 50 # Standard parameters
51 #==================== 51 #====================
  52 +publish, b, h, no,,, "Publish sky map on VO Hub?"
52 chatter, i, h, 2,0,4, "Chattiness of output" 53 chatter, i, h, 2,0,4, "Chattiness of output"
53 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 54 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
54 debug, b, h, no,,, "Debugging mode activated" 55 debug, b, h, no,,, "Debugging mode activated"
src/ctbutterfly/ctbutterfly.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbutterfly - butterfly calculation tool * 2 * ctbutterfly - butterfly calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Michael Mayer * 4 + * copyright (C) 2014-2016 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -501,25 +501,36 @@ void ctbutterfly::save(void) @@ -501,25 +501,36 @@ void ctbutterfly::save(void)
501 // Write header 501 // Write header
502 if (logTerse()) { 502 if (logTerse()) {
503 log << std::endl; 503 log << std::endl;
504 - log.header1("Save Butterfly to file"); 504 + log.header1("Save Butterfly diagram");
505 } 505 }
506 506
507 // Get output filename 507 // Get output filename
508 m_outfile = (*this)["outfile"].filename(); 508 m_outfile = (*this)["outfile"].filename();
509 509
510 - // Create CSV table with 4 columns  
511 - GCsv table(m_energies.size(), 4); 510 + // Save only if filename is non-empty
  511 + if (!m_outfile.is_empty()) {
512 512
513 - // Fill CSV table  
514 - for (int i = 0; i < m_energies.size(); ++i) {  
515 - table.real(i, 0, m_energies[i]);  
516 - table.real(i, 1, m_intensities[i]);  
517 - table.real(i, 2, m_min_intensities[i]);  
518 - table.real(i, 3, m_max_intensities[i]);  
519 - } 513 + // Log filename
  514 + if (logTerse()) {
  515 + log << "Save butterfly diagram into file \""+m_outfile+"\".";
  516 + log << std::endl;
  517 + }
  518 +
  519 + // Create CSV table with 4 columns
  520 + GCsv table(m_energies.size(), 4);
520 521
521 - // Save CSV table  
522 - table.save(m_outfile, " ", clobber()); 522 + // Fill CSV table
  523 + for (int i = 0; i < m_energies.size(); ++i) {
  524 + table.real(i, 0, m_energies[i]);
  525 + table.real(i, 1, m_intensities[i]);
  526 + table.real(i, 2, m_min_intensities[i]);
  527 + table.real(i, 3, m_max_intensities[i]);
  528 + }
  529 +
  530 + // Save CSV table
  531 + table.save(m_outfile, " ", clobber());
  532 +
  533 + }
523 534
524 // Return 535 // Return
525 return; 536 return;
src/ctbutterfly/ctbutterfly.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbutterfly - butterfly calculation tool * 2 * ctbutterfly - butterfly calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Michael Mayer * 4 + * copyright (C) 2014-2016 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /* __Definitions _________________________________________________________ */ 35 /* __Definitions _________________________________________________________ */
36 #define CTBUTTERFLY_NAME "ctbutterfly" 36 #define CTBUTTERFLY_NAME "ctbutterfly"
37 -#define CTBUTTERFLY_VERSION "1.0.0" 37 +#define CTBUTTERFLY_VERSION "1.1.0"
38 38
39 39
40 /***********************************************************************//** 40 /***********************************************************************//**
@@ -95,7 +95,7 @@ protected: @@ -95,7 +95,7 @@ protected:
95 bool m_apply_edisp; //!< Apply energy dispersion? 95 bool m_apply_edisp; //!< Apply energy dispersion?
96 bool m_fit; //!< Do fit? 96 bool m_fit; //!< Do fit?
97 GEbounds m_ebounds; //!< Energy binning definition 97 GEbounds m_ebounds; //!< Energy binning definition
98 - std::string m_outfile; //!< Output ascii file 98 + GFilename m_outfile; //!< Output ASCII file name
99 99
100 // Protected members 100 // Protected members
101 GOptimizerLM m_opt; //!< Optimizer 101 GOptimizerLM m_opt; //!< Optimizer
@@ -107,6 +107,7 @@ protected: @@ -107,6 +107,7 @@ protected:
107 std::vector<double> m_max_intensities; //!< Maximum intensities 107 std::vector<double> m_max_intensities; //!< Maximum intensities
108 }; 108 };
109 109
  110 +
110 /***********************************************************************//** 111 /***********************************************************************//**
111 * @brief Return observation container 112 * @brief Return observation container
112 * 113 *
src/ctcubemask/ctcubemask.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctcubemask - Cube filter tool * 2 * ctcubemask - Cube filter tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Chia-Chun Lu * 4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -282,6 +282,11 @@ void ctcubemask::run(void) @@ -282,6 +282,11 @@ void ctcubemask::run(void)
282 log << m_obs << std::endl; 282 log << m_obs << std::endl;
283 } 283 }
284 284
  285 + // Optionally publish counts cube
  286 + if (m_publish) {
  287 + publish();
  288 + }
  289 +
285 // Return 290 // Return
286 return; 291 return;
287 } 292 }
@@ -312,15 +317,23 @@ void ctcubemask::save(void) @@ -312,15 +317,23 @@ void ctcubemask::save(void)
312 if (logTerse()) { 317 if (logTerse()) {
313 log << std::endl; 318 log << std::endl;
314 if (m_obs.size() > 1) { 319 if (m_obs.size() > 1) {
315 - log.header1("Save observations"); 320 + log.header1("Save counts cubes");
316 } 321 }
317 else { 322 else {
318 - log.header1("Save observation"); 323 + log.header1("Save counts cube");
319 } 324 }
320 } 325 }
321 326
  327 + // Get counts cube filename
  328 + m_outcube = (*this)["outcube"].filename();
  329 +
322 // Case A: Save event file(s) and XML metadata information 330 // Case A: Save event file(s) and XML metadata information
323 if (m_use_xml) { 331 if (m_use_xml) {
  332 +
  333 + // Get prefix
  334 + m_prefix = (*this)["prefix"].string();
  335 +
  336 + // Save XML
324 save_xml(); 337 save_xml();
325 } 338 }
326 339
@@ -335,6 +348,52 @@ void ctcubemask::save(void) @@ -335,6 +348,52 @@ void ctcubemask::save(void)
335 348
336 349
337 /***********************************************************************//** 350 /***********************************************************************//**
  351 + * @brief Publish counts cube
  352 + *
  353 + * @param[in] name Counts cube name.
  354 + *
  355 + * Publishes the first counts cube in the observation container on the VO
  356 + * Hub.
  357 + ***************************************************************************/
  358 +void ctcubemask::publish(const std::string& name)
  359 +{
  360 + // Write header
  361 + if (logTerse()) {
  362 + log << std::endl;
  363 + log.header1("Publish counts cube");
  364 + }
  365 +
  366 + // Set default name is user name is empty
  367 + std::string user_name(name);
  368 + if (user_name.empty()) {
  369 + user_name = CTCUBEMASK_NAME;
  370 + }
  371 +
  372 + // Get first CTA observation from observation container
  373 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]);
  374 + if (obs != NULL) {
  375 +
  376 + // Get counts cube
  377 + GCTAEventCube* cube = dynamic_cast<GCTAEventCube*>(obs->events());
  378 + if (cube != NULL) {
  379 +
  380 + // Log filename
  381 + if (logTerse()) {
  382 + log << "Publish \""+user_name+"\" counts cube." << std::endl;
  383 + }
  384 +
  385 + // Publish counts cube
  386 + cube->map().publish(user_name);
  387 +
  388 + }
  389 + }
  390 +
  391 + // Return
  392 + return;
  393 +}
  394 +
  395 +
  396 +/***********************************************************************//**
338 * @brief Get application parameters 397 * @brief Get application parameters
339 * 398 *
340 * @exception GException::invalid_value 399 * @exception GException::invalid_value
@@ -402,10 +461,14 @@ void ctcubemask::get_parameters(void) @@ -402,10 +461,14 @@ void ctcubemask::get_parameters(void)
402 m_select_energy = false; 461 m_select_energy = false;
403 } 462 }
404 463
  464 + // Get remaining parameters
  465 + m_publish = (*this)["publish"].boolean();
  466 +
405 // Optionally read ahead parameters so that they get correctly 467 // Optionally read ahead parameters so that they get correctly
406 // dumped into the log file 468 // dumped into the log file
407 if (read_ahead()) { 469 if (read_ahead()) {
408 m_outcube = (*this)["outcube"].filename(); 470 m_outcube = (*this)["outcube"].filename();
  471 + m_prefix = (*this)["prefix"].string();
409 } 472 }
410 473
411 // Return 474 // Return
@@ -586,12 +649,13 @@ void ctcubemask::init_members(void) @@ -586,12 +649,13 @@ void ctcubemask::init_members(void)
586 m_regfile.clear(); 649 m_regfile.clear();
587 m_outcube.clear(); 650 m_outcube.clear();
588 m_prefix.clear(); 651 m_prefix.clear();
589 - m_usepnt = false;  
590 - m_ra = 0.0;  
591 - m_dec = 0.0;  
592 - m_rad = 0.0;  
593 - m_emin = 0.0;  
594 - m_emax = 0.0; 652 + m_usepnt = false;
  653 + m_ra = 0.0;
  654 + m_dec = 0.0;
  655 + m_rad = 0.0;
  656 + m_emin = 0.0;
  657 + m_emax = 0.0;
  658 + m_publish = false;
595 659
596 // Initialise protected members 660 // Initialise protected members
597 m_obs.clear(); 661 m_obs.clear();
@@ -621,6 +685,7 @@ void ctcubemask::copy_members(const ctcubemask&amp; app) @@ -621,6 +685,7 @@ void ctcubemask::copy_members(const ctcubemask&amp; app)
621 m_rad = app.m_rad; 685 m_rad = app.m_rad;
622 m_emin = app.m_emin; 686 m_emin = app.m_emin;
623 m_emax = app.m_emax; 687 m_emax = app.m_emax;
  688 + m_publish = app.m_publish;
624 689
625 // Copy protected members 690 // Copy protected members
626 m_obs = app.m_obs; 691 m_obs = app.m_obs;
@@ -698,21 +763,29 @@ std::string ctcubemask::set_outfile_name(const std::string&amp; filename) const @@ -698,21 +763,29 @@ std::string ctcubemask::set_outfile_name(const std::string&amp; filename) const
698 763
699 764
700 /***********************************************************************//** 765 /***********************************************************************//**
701 - * @brief Save counts map in FITS format. 766 + * @brief Save counts cube in FITS format.
702 * 767 *
703 - * Save the counts map as a FITS file. The filename of the FITS file is 768 + * Save the counts cube as a FITS file. The filename of the FITS file is
704 * specified by the m_outfile member. 769 * specified by the m_outfile member.
705 ***************************************************************************/ 770 ***************************************************************************/
706 void ctcubemask::save_fits(void) 771 void ctcubemask::save_fits(void)
707 { 772 {
708 - // Get output filename  
709 - m_outcube = (*this)["outcube"].filename(); 773 + // Save only if filename is non-empty
  774 + if (!m_outcube.is_empty()) {
  775 +
  776 + // Get CTA observation from observation container
  777 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]);
710 778
711 - // Get CTA observation from observation container  
712 - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); 779 + // Log filename
  780 + if (logTerse()) {
  781 + log << "Save counts cube into file \""+m_outcube+"\".";
  782 + log << std::endl;
  783 + }
713 784
714 - // Save event list  
715 - save_counts_map(obs, m_outcube); 785 + // Save event list
  786 + save_counts_map(obs, m_outcube);
  787 +
  788 + }
716 789
717 // Return 790 // Return
718 return; 791 return;
@@ -732,12 +805,8 @@ void ctcubemask::save_fits(void) @@ -732,12 +805,8 @@ void ctcubemask::save_fits(void)
732 ***************************************************************************/ 805 ***************************************************************************/
733 void ctcubemask::save_xml(void) 806 void ctcubemask::save_xml(void)
734 { 807 {
735 - // Get output filename and prefix  
736 - m_outcube = (*this)["m_outcube"].filename();  
737 - m_prefix = (*this)["prefix"].string();  
738 -  
739 // Issue warning if output filename has no .xml suffix 808 // Issue warning if output filename has no .xml suffix
740 - std::string suffix = gammalib::tolower(m_outcube.substr(m_outcube.length()-4,4)); 809 + std::string suffix = gammalib::tolower(m_outcube.url().substr(m_outcube.length()-4,4));
741 if (suffix != ".xml") { 810 if (suffix != ".xml") {
742 log << "*** WARNING: Name of observation definition output file \""+ 811 log << "*** WARNING: Name of observation definition output file \""+
743 m_outcube+"\"" << std::endl; 812 m_outcube+"\"" << std::endl;
@@ -763,6 +832,12 @@ void ctcubemask::save_xml(void) @@ -763,6 +832,12 @@ void ctcubemask::save_xml(void)
763 // Store output file name in observation 832 // Store output file name in observation
764 obs->eventfile(outfile); 833 obs->eventfile(outfile);
765 834
  835 + // Log filename
  836 + if (logTerse()) {
  837 + log << "Save counts cube into file \""+outfile+"\".";
  838 + log << std::endl;
  839 + }
  840 +
766 // Save event list 841 // Save event list
767 save_counts_map(obs, outfile); 842 save_counts_map(obs, outfile);
768 843
src/ctcubemask/ctcubemask.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctcubemask - Cube filter tool * 2 * ctcubemask - Cube filter tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Chia-Chun Lu * 4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 36
37 /* __Definitions _________________________________________________________ */ 37 /* __Definitions _________________________________________________________ */
38 #define CTCUBEMASK_NAME "ctcubemask" 38 #define CTCUBEMASK_NAME "ctcubemask"
39 -#define CTCUBEMASK_VERSION "1.0.0" 39 +#define CTCUBEMASK_VERSION "1.1.0"
40 40
41 41
42 /***********************************************************************//** 42 /***********************************************************************//**
@@ -61,6 +61,7 @@ public: @@ -61,6 +61,7 @@ public:
61 void clear(void); 61 void clear(void);
62 void run(void); 62 void run(void);
63 void save(void); 63 void save(void);
  64 + void publish(const std::string& name = "");
64 const GObservations& obs(void) const; 65 const GObservations& obs(void) const;
65 66
66 protected: 67 protected:
@@ -78,9 +79,8 @@ protected: @@ -78,9 +79,8 @@ protected:
78 const std::string& outfile) const; 79 const std::string& outfile) const;
79 80
80 // User parameters 81 // User parameters
81 - //std::string m_infile; //!< Input event list or XML file  
82 - std::string m_regfile; //!< ds9 region file  
83 - std::string m_outcube; //!< Output event list or XML file 82 + GFilename m_regfile; //!< ds9 region file
  83 + GFilename m_outcube; //!< Output event list or XML file
84 std::string m_prefix; //!< Prefix for multiple counts maps 84 std::string m_prefix; //!< Prefix for multiple counts maps
85 bool m_usepnt; //!< Use pointing instead of RA/DEC parameters 85 bool m_usepnt; //!< Use pointing instead of RA/DEC parameters
86 double m_ra; //!< RA of ROI centre 86 double m_ra; //!< RA of ROI centre
@@ -88,6 +88,7 @@ protected: @@ -88,6 +88,7 @@ protected:
88 double m_rad; //!< ROI radius 88 double m_rad; //!< ROI radius
89 double m_emin; //!< Lower energy 89 double m_emin; //!< Lower energy
90 double m_emax; //!< Upper energy 90 double m_emax; //!< Upper energy
  91 + bool m_publish; //!< Publish counts cube?
91 92
92 // Protected members 93 // Protected members
93 GObservations m_obs; //!< Observations container 94 GObservations m_obs; //!< Observations container
src/ctcubemask/ctcubemask.par
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # File: ctcubemask.par # 7 # File: ctcubemask.par #
8 -# Version: 1.0.0 # 8 +# Version: 1.1.0 #
9 # # 9 # #
10 # Author: Chia-Chun Lu # 10 # Author: Chia-Chun Lu #
11 # c.lu@mpi-hd.mpg.de # 11 # c.lu@mpi-hd.mpg.de #
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 # 17 #
18 # General parameters 18 # General parameters
19 #=================== 19 #===================
20 -inobs, f, a, "cntmap.fits",,, "Input counts cube or observation definition XML file" 20 +inobs, f, a, "cntcube.fits",,, "Input counts cube or observation definition XML file"
21 outcube, f, a, "filtered_cube.fits",,, "Output counts cube or observation definition XML file" 21 outcube, f, a, "filtered_cube.fits",,, "Output counts cube or observation definition XML file"
22 prefix, s, h, "filtered_",,, "Prefix for counts cube in observation definition XML file" 22 prefix, s, h, "filtered_",,, "Prefix for counts cube in observation definition XML file"
23 23
@@ -35,7 +35,9 @@ emax, r, a, 100.0,,, &quot;Upper energy limit (TeV)&quot; @@ -35,7 +35,9 @@ emax, r, a, 100.0,,, &quot;Upper energy limit (TeV)&quot;
35 # 35 #
36 # Standard parameters 36 # Standard parameters
37 #==================== 37 #====================
  38 +publish, b, h, no,,, "Publish counts cube on VO Hub?"
38 chatter, i, h, 2,0,4, "Chattiness of output" 39 chatter, i, h, 2,0,4, "Chattiness of output"
39 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 40 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
40 debug, b, h, no,,, "Debugging mode activated" 41 debug, b, h, no,,, "Debugging mode activated"
41 mode, s, h, "ql",,, "Mode of automatic parameters" 42 mode, s, h, "ql",,, "Mode of automatic parameters"
  43 +logfile, f, h, "ctcubemask.par.log",,, "Log filename"
src/cterror/cterror.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * cterror - Parameter error calculation tool * 2 * cterror - Parameter error calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2015 by Florent Forest * 4 + * copyright (C) 2015-2016 by Florent Forest *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -51,6 +51,8 @@ @@ -51,6 +51,8 @@
51 51
52 /***********************************************************************//** 52 /***********************************************************************//**
53 * @brief Void constructor 53 * @brief Void constructor
  54 + *
  55 + * Constructs an empty cterror tool.
54 ***************************************************************************/ 56 ***************************************************************************/
55 cterror::cterror(void) : ctool(CTERROR_NAME, CTERROR_VERSION) 57 cterror::cterror(void) : ctool(CTERROR_NAME, CTERROR_VERSION)
56 { 58 {
@@ -67,8 +69,8 @@ cterror::cterror(void) : ctool(CTERROR_NAME, CTERROR_VERSION) @@ -67,8 +69,8 @@ cterror::cterror(void) : ctool(CTERROR_NAME, CTERROR_VERSION)
67 * 69 *
68 * param[in] obs Observation container. 70 * param[in] obs Observation container.
69 * 71 *
70 - * This method creates an instance of the class by copying an existing  
71 - * observations container. 72 + * Constructs an instance of the cterror tool that will operate on the
  73 + * provided observation container.
72 ***************************************************************************/ 74 ***************************************************************************/
73 cterror::cterror(const GObservations& obs) : 75 cterror::cterror(const GObservations& obs) :
74 ctool(CTERROR_NAME, CTERROR_VERSION) 76 ctool(CTERROR_NAME, CTERROR_VERSION)
@@ -90,6 +92,9 @@ cterror::cterror(const GObservations&amp; obs) : @@ -90,6 +92,9 @@ cterror::cterror(const GObservations&amp; obs) :
90 * 92 *
91 * @param[in] argc Number of arguments in command line. 93 * @param[in] argc Number of arguments in command line.
92 * @param[in] argv Array of command line arguments. 94 * @param[in] argv Array of command line arguments.
  95 + *
  96 + * Constructs an instance of the cterror tool that will parse user
  97 + * parameters that are provided as command line arguments.
93 ***************************************************************************/ 98 ***************************************************************************/
94 cterror::cterror(int argc, char *argv[]) : 99 cterror::cterror(int argc, char *argv[]) :
95 ctool(CTERROR_NAME, CTERROR_VERSION, argc, argv) 100 ctool(CTERROR_NAME, CTERROR_VERSION, argc, argv)
@@ -106,6 +111,9 @@ cterror::cterror(int argc, char *argv[]) : @@ -106,6 +111,9 @@ cterror::cterror(int argc, char *argv[]) :
106 * @brief Copy constructor 111 * @brief Copy constructor
107 * 112 *
108 * @param[in] app Application. 113 * @param[in] app Application.
  114 + *
  115 + * Constructs an instance of the cterror tool by copying information from
  116 + * another ctulimit tool.
109 ***************************************************************************/ 117 ***************************************************************************/
110 cterror::cterror(const cterror& app) : ctool(app) 118 cterror::cterror(const cterror& app) : ctool(app)
111 { 119 {
@@ -122,6 +130,8 @@ cterror::cterror(const cterror&amp; app) : ctool(app) @@ -122,6 +130,8 @@ cterror::cterror(const cterror&amp; app) : ctool(app)
122 130
123 /***********************************************************************//** 131 /***********************************************************************//**
124 * @brief Destructor 132 * @brief Destructor
  133 + *
  134 + * Destructs the cterror tool.
125 ***************************************************************************/ 135 ***************************************************************************/
126 cterror::~cterror(void) 136 cterror::~cterror(void)
127 { 137 {
@@ -144,6 +154,8 @@ cterror::~cterror(void) @@ -144,6 +154,8 @@ cterror::~cterror(void)
144 * 154 *
145 * @param[in] app Application. 155 * @param[in] app Application.
146 * @return Application. 156 * @return Application.
  157 + *
  158 + * Assigns a cterror tool.
147 ***************************************************************************/ 159 ***************************************************************************/
148 cterror& cterror::operator=(const cterror& app) 160 cterror& cterror::operator=(const cterror& app)
149 { 161 {
@@ -177,6 +189,8 @@ cterror&amp; cterror::operator=(const cterror&amp; app) @@ -177,6 +189,8 @@ cterror&amp; cterror::operator=(const cterror&amp; app)
177 189
178 /***********************************************************************//** 190 /***********************************************************************//**
179 * @brief Clear instance 191 * @brief Clear instance
  192 + *
  193 + * Resets the cterror tool to a clean initial state.
180 ***************************************************************************/ 194 ***************************************************************************/
181 void cterror::clear(void) 195 void cterror::clear(void)
182 { 196 {
@@ -196,7 +210,9 @@ void cterror::clear(void) @@ -196,7 +210,9 @@ void cterror::clear(void)
196 210
197 211
198 /***********************************************************************//** 212 /***********************************************************************//**
199 - * @brief Computes 213 + * @brief Compute parameter errors using a likelihood profile method
  214 + *
  215 + * Computes the parameter errors using a likelihood profile method.
200 ***************************************************************************/ 216 ***************************************************************************/
201 void cterror::run(void) 217 void cterror::run(void)
202 { 218 {
@@ -381,9 +397,9 @@ void cterror::run(void) @@ -381,9 +397,9 @@ void cterror::run(void)
381 397
382 398
383 /***********************************************************************//** 399 /***********************************************************************//**
384 - * @brief Save source model 400 + * @brief Save model
385 * 401 *
386 - * This method saves the soutce model to an XML file. 402 + * Saves the model into an XML file.
387 ***************************************************************************/ 403 ***************************************************************************/
388 void cterror::save(void) 404 void cterror::save(void)
389 { 405 {
@@ -394,11 +410,21 @@ void cterror::save(void) @@ -394,11 +410,21 @@ void cterror::save(void)
394 } 410 }
395 411
396 // Get output filename 412 // Get output filename
397 - std::string outmodel = (*this)["outmodel"].filename(); 413 + m_outmodel = (*this)["outmodel"].filename();
  414 +
  415 + // Save only if filename is non-empty
  416 + if (!m_outmodel.is_empty() &&
  417 + gammalib::toupper(m_outmodel.url()) != "NONE") {
  418 +
  419 + // Log filename
  420 + if (logTerse()) {
  421 + log << "Save errors into file \""+m_outmodel+"\".";
  422 + log << std::endl;
  423 + }
  424 +
  425 + // Write results out as XML model
  426 + m_obs.models().save(m_outmodel);
398 427
399 - // Write results out as XML model  
400 - if (gammalib::toupper(outmodel) != "NONE") {  
401 - m_obs.models().save(outmodel);  
402 } 428 }
403 429
404 // Return 430 // Return
@@ -419,6 +445,7 @@ void cterror::init_members(void) @@ -419,6 +445,7 @@ void cterror::init_members(void)
419 { 445 {
420 // Initialise user parameters 446 // Initialise user parameters
421 m_srcname.clear(); 447 m_srcname.clear();
  448 + m_outmodel.clear();
422 m_confidence = 0.68; 449 m_confidence = 0.68;
423 m_tol = 1.0e-3; 450 m_tol = 1.0e-3;
424 m_max_iter = 50; 451 m_max_iter = 50;
@@ -427,9 +454,9 @@ void cterror::init_members(void) @@ -427,9 +454,9 @@ void cterror::init_members(void)
427 // Initialise protected members 454 // Initialise protected members
428 m_obs.clear(); 455 m_obs.clear();
429 m_opt.clear(); 456 m_opt.clear();
430 - m_dlogL = 0.0;  
431 - m_best_logL = 0.0;  
432 - m_model_par = NULL; 457 + m_dlogL = 0.0;
  458 + m_best_logL = 0.0;
  459 + m_model_par = NULL;
433 m_apply_edisp = false; 460 m_apply_edisp = false;
434 461
435 // Set optimizer parameters 462 // Set optimizer parameters
@@ -449,10 +476,11 @@ void cterror::init_members(void) @@ -449,10 +476,11 @@ void cterror::init_members(void)
449 void cterror::copy_members(const cterror& app) 476 void cterror::copy_members(const cterror& app)
450 { 477 {
451 // Copy user parameters 478 // Copy user parameters
452 - m_srcname = app.m_srcname;  
453 - m_confidence = app.m_confidence;  
454 - m_tol = app.m_tol;  
455 - m_max_iter = app.m_max_iter; 479 + m_srcname = app.m_srcname;
  480 + m_outmodel = app.m_outmodel;
  481 + m_confidence = app.m_confidence;
  482 + m_tol = app.m_tol;
  483 + m_max_iter = app.m_max_iter;
456 m_apply_edisp = app.m_apply_edisp; 484 m_apply_edisp = app.m_apply_edisp;
457 485
458 // Copy protected members 486 // Copy protected members
@@ -534,18 +562,24 @@ void cterror::get_parameters(void) @@ -534,18 +562,24 @@ void cterror::get_parameters(void)
534 m_tol = (*this)["tol"].real(); 562 m_tol = (*this)["tol"].real();
535 m_max_iter = (*this)["max_iter"].integer(); 563 m_max_iter = (*this)["max_iter"].integer();
536 564
  565 + // Read ahead parameters that are only needed when the tool gets
  566 + // executed
  567 + if (read_ahead()) {
  568 + m_outmodel = (*this)["outmodel"].filename();
  569 + }
  570 +
537 // Return 571 // Return
538 return; 572 return;
539 } 573 }
540 574
541 575
542 /***********************************************************************//** 576 /***********************************************************************//**
543 - * @brief Performs error computation by using a bisection method 577 + * @brief Calculate error using a bisection method
544 * 578 *
545 * @param[in] min Minimum parameter value 579 * @param[in] min Minimum parameter value
546 * @param[in] max Maximum parameter value 580 * @param[in] max Maximum parameter value
547 * 581 *
548 - * This method calculates the error using a bisection method. 582 + * Calculates the error using a bisection method.
549 ***************************************************************************/ 583 ***************************************************************************/
550 double cterror::error_bisection(const double& min, const double& max) 584 double cterror::error_bisection(const double& min, const double& max)
551 { 585 {
@@ -667,8 +701,7 @@ double cterror::error_bisection(const double&amp; min, const double&amp; max) @@ -667,8 +701,7 @@ double cterror::error_bisection(const double&amp; min, const double&amp; max)
667 * @param[in] value Parameter factor value 701 * @param[in] value Parameter factor value
668 * @return Log-likelihood value 702 * @return Log-likelihood value
669 * 703 *
670 - * This method evaluates the log-likelihood as a function of the parameter  
671 - * of interest. 704 + * Evaluates the log-likelihood as a function of the parameter of interest.
672 ***************************************************************************/ 705 ***************************************************************************/
673 double cterror::evaluate(const double& value) 706 double cterror::evaluate(const double& value)
674 { 707 {
src/cterror/cterror.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * cterror - Parameter error calculation tool * 2 * cterror - Parameter error calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2015 by Florent Forest * 4 + * copyright (C) 2015-2016 by Florent Forest *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -28,20 +28,20 @@ @@ -28,20 +28,20 @@
28 #define CTERROR_HPP 28 #define CTERROR_HPP
29 29
30 /* __ Includes ___________________________________________________________ */ 30 /* __ Includes ___________________________________________________________ */
  31 +#include <string>
31 #include "GammaLib.hpp" 32 #include "GammaLib.hpp"
32 #include "GCTALib.hpp" 33 #include "GCTALib.hpp"
33 #include "ctool.hpp" 34 #include "ctool.hpp"
34 35
35 /* __Definitions _________________________________________________________ */ 36 /* __Definitions _________________________________________________________ */
36 #define CTERROR_NAME "cterror" 37 #define CTERROR_NAME "cterror"
37 -#define CTERROR_VERSION "01-00-00" 38 +#define CTERROR_VERSION "1.1.0"
38 39
39 40
40 /***********************************************************************//** 41 /***********************************************************************//**
41 * @class cterror 42 * @class cterror
42 * 43 *
43 * @brief Parameter error calculation tool 44 * @brief Parameter error calculation tool
44 - *  
45 ***************************************************************************/ 45 ***************************************************************************/
46 class cterror : public ctool { 46 class cterror : public ctool {
47 47
@@ -74,6 +74,7 @@ protected: @@ -74,6 +74,7 @@ protected:
74 74
75 // User parameters 75 // User parameters
76 std::string m_srcname; //!< Name of source 76 std::string m_srcname; //!< Name of source
  77 + GFilename m_outmodel; //!< Output model XML file
77 double m_confidence; //!< Confidence level 78 double m_confidence; //!< Confidence level
78 double m_tol; //!< Tolerance for limit determination 79 double m_tol; //!< Tolerance for limit determination
79 int m_max_iter; //!< Maximum number of iterations 80 int m_max_iter; //!< Maximum number of iterations
src/ctexpcube/ctexpcube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctexpcube - Exposure cube generation tool * 2 * ctexpcube - Exposure cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -258,6 +258,11 @@ void ctexpcube::run(void) @@ -258,6 +258,11 @@ void ctexpcube::run(void)
258 } 258 }
259 } 259 }
260 260
  261 + // Optionally publish exposure cube
  262 + if (m_publish) {
  263 + publish();
  264 + }
  265 +
261 // Return 266 // Return
262 return; 267 return;
263 } 268 }
@@ -265,6 +270,8 @@ void ctexpcube::run(void) @@ -265,6 +270,8 @@ void ctexpcube::run(void)
265 270
266 /***********************************************************************//** 271 /***********************************************************************//**
267 * @brief Save exposure cube 272 * @brief Save exposure cube
  273 + *
  274 + * Saves the exposure cube into a FITS file.
268 ***************************************************************************/ 275 ***************************************************************************/
269 void ctexpcube::save(void) 276 void ctexpcube::save(void)
270 { 277 {
@@ -274,11 +281,54 @@ void ctexpcube::save(void) @@ -274,11 +281,54 @@ void ctexpcube::save(void)
274 log.header1("Save exposure cube"); 281 log.header1("Save exposure cube");
275 } 282 }
276 283
277 - // Get output filename 284 + // Get exposure cube filename
278 m_outcube = (*this)["outcube"].filename(); 285 m_outcube = (*this)["outcube"].filename();
279 286
280 - // Save exposure cube  
281 - m_expcube.save(m_outcube, clobber()); 287 + // Save only if filename is non-empty
  288 + if (!m_outcube.is_empty()) {
  289 +
  290 + // Log filename
  291 + if (logTerse()) {
  292 + log << "Save exposure cube into file \""+m_outcube+"\".";
  293 + log << std::endl;
  294 + }
  295 +
  296 + // Save exposure cube
  297 + m_expcube.save(m_outcube, clobber());
  298 +
  299 + }
  300 +
  301 + // Return
  302 + return;
  303 +}
  304 +
  305 +
  306 +/***********************************************************************//**
  307 + * @brief Publish exposure cube
  308 + *
  309 + * @param[in] name Exposure cube name.
  310 + ***************************************************************************/
  311 +void ctexpcube::publish(const std::string& name)
  312 +{
  313 + // Write header
  314 + if (logTerse()) {
  315 + log << std::endl;
  316 + log.header1("Publish exposure cube");
  317 + }
  318 +
  319 + // Set default name is user name is empty
  320 + std::string user_name(name);
  321 + if (user_name.empty()) {
  322 + user_name = CTEXPCUBE_NAME;
  323 + }
  324 +
  325 + // Log filename
  326 + if (logTerse()) {
  327 + log << "Publish \""+user_name+"\" exposure cube." << std::endl;
  328 + }
  329 +
  330 + // Publish exposure cube
  331 + m_expcube.cube().publish(user_name);
282 332
283 // Return 333 // Return
284 return; 334 return;
@@ -299,6 +349,7 @@ void ctexpcube::init_members(void) @@ -299,6 +349,7 @@ void ctexpcube::init_members(void)
299 // Initialise members 349 // Initialise members
300 m_outcube.clear(); 350 m_outcube.clear();
301 m_apply_edisp = false; 351 m_apply_edisp = false;
  352 + m_publish = false;
302 353
303 // Initialise protected members 354 // Initialise protected members
304 m_obs.clear(); 355 m_obs.clear();
@@ -319,6 +370,7 @@ void ctexpcube::copy_members(const ctexpcube&amp; app) @@ -319,6 +370,7 @@ void ctexpcube::copy_members(const ctexpcube&amp; app)
319 // Copy attributes 370 // Copy attributes
320 m_outcube = app.m_outcube; 371 m_outcube = app.m_outcube;
321 m_apply_edisp = app.m_apply_edisp; 372 m_apply_edisp = app.m_apply_edisp;
  373 + m_publish = app.m_publish;
322 374
323 // Copy protected members 375 // Copy protected members
324 m_obs = app.m_obs; 376 m_obs = app.m_obs;
@@ -390,6 +442,9 @@ void ctexpcube::get_parameters(void) @@ -390,6 +442,9 @@ void ctexpcube::get_parameters(void)
390 442
391 } // endelse: cube loaded from file 443 } // endelse: cube loaded from file
392 444
  445 + // Get remaining parameters
  446 + m_publish = (*this)["publish"].boolean();
  447 +
393 // Read output filename (if needed) 448 // Read output filename (if needed)
394 if (read_ahead()) { 449 if (read_ahead()) {
395 m_outcube = (*this)["outcube"].filename(); 450 m_outcube = (*this)["outcube"].filename();
src/ctexpcube/ctexpcube.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctexpcube - Exposure cube generation tool * 2 * ctexpcube - Exposure cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /* __Definitions _________________________________________________________ */ 35 /* __Definitions _________________________________________________________ */
36 #define CTEXPCUBE_NAME "ctexpcube" 36 #define CTEXPCUBE_NAME "ctexpcube"
37 -#define CTEXPCUBE_VERSION "1.0.0" 37 +#define CTEXPCUBE_VERSION "1.1.0"
38 38
39 39
40 /***********************************************************************//** 40 /***********************************************************************//**
@@ -59,6 +59,7 @@ public: @@ -59,6 +59,7 @@ public:
59 void clear(void); 59 void clear(void);
60 void run(void); 60 void run(void);
61 void save(void); 61 void save(void);
  62 + void publish(const std::string& name = "");
62 const GCTACubeExposure& expcube(void) const; 63 const GCTACubeExposure& expcube(void) const;
63 64
64 protected: 65 protected:
@@ -69,8 +70,9 @@ protected: @@ -69,8 +70,9 @@ protected:
69 void get_parameters(void); 70 void get_parameters(void);
70 71
71 // User parameters 72 // User parameters
72 - std::string m_outcube; //!< Output exposure cube file  
73 - bool m_apply_edisp; //!< Apply energy dispersion? 73 + GFilename m_outcube; //!< Output exposure cube file
  74 + bool m_apply_edisp; //!< Apply energy dispersion?
  75 + bool m_publish; //!< Publish exposure cube?
74 76
75 // Protected members 77 // Protected members
76 GObservations m_obs; //!< Observation container 78 GObservations m_obs; //!< Observation container
src/ctexpcube/ctexpcube.par
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # File: ctexpcube.par # 7 # File: ctexpcube.par #
8 -# Version: 1.0.0 # 8 +# Version: 1.1.0 #
9 # # 9 # #
10 # Author: Juergen Knoedlseder # 10 # Author: Juergen Knoedlseder #
11 # Jurgen.Knodlseder@irap.omp.eu # 11 # Jurgen.Knodlseder@irap.omp.eu #
@@ -48,6 +48,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot; @@ -48,6 +48,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
48 # 48 #
49 # Standard parameters 49 # Standard parameters
50 #==================== 50 #====================
  51 +publish, b, h, no,,, "Publish sky map on VO Hub?"
51 chatter, i, h, 2,0,4, "Chattiness of output" 52 chatter, i, h, 2,0,4, "Chattiness of output"
52 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 53 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
53 debug, b, h, no,,, "Debugging mode activated" 54 debug, b, h, no,,, "Debugging mode activated"
src/ctlike/ctlike.cpp
@@ -353,9 +353,19 @@ void ctlike::save(void) @@ -353,9 +353,19 @@ void ctlike::save(void)
353 // Get output filename 353 // Get output filename
354 m_outmodel = (*this)["outmodel"].filename(); 354 m_outmodel = (*this)["outmodel"].filename();
355 355
356 - // Write results out as XML model  
357 - if (gammalib::toupper(m_outmodel) != "NONE") { 356 + // Save only if filename is non-empty
  357 + if (!m_outmodel.is_empty() &&
  358 + gammalib::toupper(m_outmodel.url()) != "NONE") {
  359 +
  360 + // Log filename
  361 + if (logTerse()) {
  362 + log << "Save fitted parameters into file \""+m_outmodel+"\".";
  363 + log << std::endl;
  364 + }
  365 +
  366 + // Write results out as XML model
358 m_obs.models().save(m_outmodel); 367 m_obs.models().save(m_outmodel);
  368 +
359 } 369 }
360 370
361 // Return 371 // Return
src/ctlike/ctlike.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctlike - Maximum likelihood fitting tool * 2 * ctlike - Maximum likelihood fitting tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 35
36 /* __Definitions _________________________________________________________ */ 36 /* __Definitions _________________________________________________________ */
37 #define CTLIKE_NAME "ctlike" 37 #define CTLIKE_NAME "ctlike"
38 -#define CTLIKE_VERSION "1.0.0" 38 +#define CTLIKE_VERSION "1.1.0"
39 39
40 40
41 /***********************************************************************//** 41 /***********************************************************************//**
@@ -74,7 +74,7 @@ protected: @@ -74,7 +74,7 @@ protected:
74 74
75 // User parameters 75 // User parameters
76 bool m_refit; //!< Refitting 76 bool m_refit; //!< Refitting
77 - std::string m_outmodel; //!< Source model output XML file 77 + GFilename m_outmodel; //!< Source model output XML file name
78 bool m_apply_edisp; //!< Apply energy dispersion? 78 bool m_apply_edisp; //!< Apply energy dispersion?
79 bool m_fix_spat_for_ts; //!< Fix spatial parameters for TS computation? 79 bool m_fix_spat_for_ts; //!< Fix spatial parameters for TS computation?
80 80
src/ctmodel/ctmodel.cpp
@@ -324,6 +324,11 @@ void ctmodel::run(void) @@ -324,6 +324,11 @@ void ctmodel::run(void)
324 } 324 }
325 } 325 }
326 326
  327 + // Optionally publish model cube
  328 + if (m_publish) {
  329 + publish();
  330 + }
  331 +
327 // Return 332 // Return
328 return; 333 return;
329 } 334 }
@@ -343,15 +348,16 @@ void ctmodel::save(void) @@ -343,15 +348,16 @@ void ctmodel::save(void)
343 log.header1("Save cube"); 348 log.header1("Save cube");
344 } 349 }
345 350
346 - // Make sure we have the FITS filename 351 + // Get model cube filename
347 m_outcube = (*this)["outcube"].filename(); 352 m_outcube = (*this)["outcube"].filename();
348 353
349 // Save only if filename is non-empty 354 // Save only if filename is non-empty
350 - if (m_outcube.length() > 0) { 355 + if (!m_outcube.is_empty()) {
351 356
352 - // Dump filename 357 + // Log filename
353 if (logTerse()) { 358 if (logTerse()) {
354 - log << "Save \""+m_outcube+"\"" << std::endl; 359 + log << "Save model cube into file \""+m_outcube+"\".";
  360 + log << std::endl;
355 } 361 }
356 362
357 // Save model cube into FITS file 363 // Save model cube into FITS file
@@ -365,6 +371,38 @@ void ctmodel::save(void) @@ -365,6 +371,38 @@ void ctmodel::save(void)
365 371
366 372
367 /***********************************************************************//** 373 /***********************************************************************//**
  374 + * @brief Publish model cube
  375 + *
  376 + * @param[in] name Model cube name.
  377 + ***************************************************************************/
  378 +void ctmodel::publish(const std::string& name)
  379 +{
  380 + // Write header
  381 + if (logTerse()) {
  382 + log << std::endl;
  383 + log.header1("Publish model cube");
  384 + }
  385 +
  386 + // Set default name is user name is empty
  387 + std::string user_name(name);
  388 + if (user_name.empty()) {
  389 + user_name = CTMODEL_NAME;
  390 + }
  391 +
  392 + // Log filename
  393 + if (logTerse()) {
  394 + log << "Publish \""+user_name+"\" model cube." << std::endl;
  395 + }
  396 +
  397 + // Publish model cube
  398 + m_cube.map().publish(user_name);
  399 +
  400 + // Return
  401 + return;
  402 +}
  403 +
  404 +
  405 +/***********************************************************************//**
368 * @brief Set model cube 406 * @brief Set model cube
369 * 407 *
370 * @param[in] cube Model cube. 408 * @param[in] cube Model cube.
@@ -403,6 +441,7 @@ void ctmodel::init_members(void) @@ -403,6 +441,7 @@ void ctmodel::init_members(void)
403 // Initialise members 441 // Initialise members
404 m_outcube.clear(); 442 m_outcube.clear();
405 m_apply_edisp = false; 443 m_apply_edisp = false;
  444 + m_publish = false;
406 445
407 // Initialise protected members 446 // Initialise protected members
408 m_obs.clear(); 447 m_obs.clear();
@@ -427,6 +466,7 @@ void ctmodel::copy_members(const ctmodel&amp; app) @@ -427,6 +466,7 @@ void ctmodel::copy_members(const ctmodel&amp; app)
427 // Copy attributes 466 // Copy attributes
428 m_outcube = app.m_outcube; 467 m_outcube = app.m_outcube;
429 m_apply_edisp = app.m_apply_edisp; 468 m_apply_edisp = app.m_apply_edisp;
  469 + m_publish = app.m_publish;
430 470
431 // Copy protected members 471 // Copy protected members
432 m_obs = app.m_obs; 472 m_obs = app.m_obs;
@@ -550,6 +590,9 @@ void ctmodel::get_parameters(void) @@ -550,6 +590,9 @@ void ctmodel::get_parameters(void)
550 590
551 } // endif: we had no cube yet 591 } // endif: we had no cube yet
552 592
  593 + // Get remaining parameters
  594 + m_publish = (*this)["publish"].boolean();
  595 +
553 // Read optionally output cube filenames 596 // Read optionally output cube filenames
554 if (read_ahead()) { 597 if (read_ahead()) {
555 m_outcube = (*this)["outcube"].filename(); 598 m_outcube = (*this)["outcube"].filename();
src/ctmodel/ctmodel.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctmodel - Model cube generation tool * 2 * ctmodel - Model cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /* __Definitions _________________________________________________________ */ 35 /* __Definitions _________________________________________________________ */
36 #define CTMODEL_NAME "ctmodel" 36 #define CTMODEL_NAME "ctmodel"
37 -#define CTMODEL_VERSION "1.0.1" 37 +#define CTMODEL_VERSION "1.1.0"
38 38
39 39
40 /***********************************************************************//** 40 /***********************************************************************//**
@@ -68,6 +68,7 @@ public: @@ -68,6 +68,7 @@ public:
68 void clear(void); 68 void clear(void);
69 void run(void); 69 void run(void);
70 void save(void); 70 void save(void);
  71 + void publish(const std::string& name = "");
71 const GObservations& obs(void) const; 72 const GObservations& obs(void) const;
72 const GCTAEventCube& cube(void) const; 73 const GCTAEventCube& cube(void) const;
73 void cube(const GCTAEventCube& cube); 74 void cube(const GCTAEventCube& cube);
@@ -84,8 +85,9 @@ protected: @@ -84,8 +85,9 @@ protected:
84 bool has_cube(void) const; 85 bool has_cube(void) const;
85 86
86 // User parameters 87 // User parameters
87 - std::string m_outcube; //!< Output model cube  
88 - bool m_apply_edisp; //!< Apply energy dispersion? 88 + GFilename m_outcube; //!< Output model cube
  89 + bool m_apply_edisp; //!< Apply energy dispersion?
  90 + bool m_publish; //!< Publish model cube?
89 91
90 // Protected members 92 // Protected members
91 GObservations m_obs; //!< Observation container 93 GObservations m_obs; //!< Observation container
src/ctmodel/ctmodel.par
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # File: ctmodel.par # 7 # File: ctmodel.par #
8 -# Version: 1.0.1 # 8 +# Version: 1.1.0 #
9 # # 9 # #
10 # Author: Juergen Knoedlseder # 10 # Author: Juergen Knoedlseder #
11 # Jurgen.Knodlseder@irap.omp.eu # 11 # Jurgen.Knodlseder@irap.omp.eu #
@@ -62,6 +62,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot; @@ -62,6 +62,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
62 # 62 #
63 # Standard parameters 63 # Standard parameters
64 #==================== 64 #====================
  65 +publish, b, h, no,,, "Publish model cube on VO Hub?"
65 chatter, i, h, 2,0,4, "Chattiness of output" 66 chatter, i, h, 2,0,4, "Chattiness of output"
66 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 67 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
67 debug, b, h, no,,, "Debugging mode activated" 68 debug, b, h, no,,, "Debugging mode activated"
src/ctobssim/ctobssim.cpp
@@ -1454,6 +1454,12 @@ void ctobssim::save_fits(void) @@ -1454,6 +1454,12 @@ void ctobssim::save_fits(void)
1454 // Get CTA observation from observation container 1454 // Get CTA observation from observation container
1455 GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); 1455 GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]);
1456 1456
  1457 + // Log filename
  1458 + if (logTerse()) {
  1459 + log << "Save event list into file \""+m_outevents+"\".";
  1460 + log << std::endl;
  1461 + }
  1462 +
1457 // Save observation into FITS file 1463 // Save observation into FITS file
1458 obs->save(m_outevents, clobber()); 1464 obs->save(m_outevents, clobber());
1459 1465
@@ -1513,6 +1519,12 @@ void ctobssim::save_xml(void) @@ -1513,6 +1519,12 @@ void ctobssim::save_xml(void)
1513 // Store output file name in observation 1519 // Store output file name in observation
1514 obs->eventfile(outfile); 1520 obs->eventfile(outfile);
1515 1521
  1522 + // Log filename
  1523 + if (logTerse()) {
  1524 + log << "Save event list into file \""+outfile+"\".";
  1525 + log << std::endl;
  1526 + }
  1527 +
1516 // Save observation into FITS file 1528 // Save observation into FITS file
1517 obs->save(outfile, clobber()); 1529 obs->save(outfile, clobber());
1518 1530
src/ctpsfcube/ctpsfcube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctpsfcube - PSF cube generation tool * 2 * ctpsfcube - PSF cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Chia-Chun Lu * 4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -276,8 +276,19 @@ void ctpsfcube::save(void) @@ -276,8 +276,19 @@ void ctpsfcube::save(void)
276 // Get output filename 276 // Get output filename
277 m_outcube = (*this)["outcube"].filename(); 277 m_outcube = (*this)["outcube"].filename();
278 278
279 - // Save PSF cube  
280 - m_psfcube.save(m_outcube, clobber()); 279 + // Save only if filename is non-empty
  280 + if (!m_outcube.is_empty()) {
  281 +
  282 + // Log filename
  283 + if (logTerse()) {
  284 + log << "Save PSF cube into file \""+m_outcube+"\".";
  285 + log << std::endl;
  286 + }
  287 +
  288 + // Save PSF cube
  289 + m_psfcube.save(m_outcube, clobber());
  290 +
  291 + }
281 292
282 // Return 293 // Return
283 return; 294 return;
src/ctpsfcube/ctpsfcube.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctpsfcube - PSF cube generation tool * 2 * ctpsfcube - PSF cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Chia-Chun Lu * 4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /* __Definitions _________________________________________________________ */ 35 /* __Definitions _________________________________________________________ */
36 #define CTPSFCUBE_NAME "ctpsfcube" 36 #define CTPSFCUBE_NAME "ctpsfcube"
37 -#define CTPSFCUBE_VERSION "1.0.0" 37 +#define CTPSFCUBE_VERSION "1.1.0"
38 38
39 39
40 /***********************************************************************//** 40 /***********************************************************************//**
@@ -69,7 +69,7 @@ protected: @@ -69,7 +69,7 @@ protected:
69 void get_parameters(void); 69 void get_parameters(void);
70 70
71 // User parameters 71 // User parameters
72 - std::string m_outcube; //!< Output PSF cube file 72 + GFilename m_outcube; //!< Output PSF cube file name
73 bool m_apply_edisp; //!< Apply energy dispersion? 73 bool m_apply_edisp; //!< Apply energy dispersion?
74 74
75 // Protected members 75 // Protected members
src/ctselect/ctselect.cpp
@@ -413,10 +413,10 @@ void ctselect::save(void) @@ -413,10 +413,10 @@ void ctselect::save(void)
413 if (logTerse()) { 413 if (logTerse()) {
414 log << std::endl; 414 log << std::endl;
415 if (m_obs.size() > 1) { 415 if (m_obs.size() > 1) {
416 - log.header1("Save observations"); 416 + log.header1("Save event lists");
417 } 417 }
418 else { 418 else {
419 - log.header1("Save observation"); 419 + log.header1("Save event list");
420 } 420 }
421 } 421 }
422 422
@@ -1267,7 +1267,8 @@ void ctselect::save_fits(void) @@ -1267,7 +1267,8 @@ void ctselect::save_fits(void)
1267 1267
1268 // Log filename 1268 // Log filename
1269 if (logTerse()) { 1269 if (logTerse()) {
1270 - log << "Save \""+outfile+"\"" << std::endl; 1270 + log << "Save event list into file \""+outfile+"\".";
  1271 + log << std::endl;
1271 } 1272 }
1272 1273
1273 // Save event list 1274 // Save event list
@@ -1335,7 +1336,8 @@ void ctselect::save_xml(void) @@ -1335,7 +1336,8 @@ void ctselect::save_xml(void)
1335 1336
1336 // Log filename 1337 // Log filename
1337 if (logTerse()) { 1338 if (logTerse()) {
1338 - log << "Save \""+outfile+"\"" << std::endl; 1339 + log << "Save event list into file \""+outfile+"\".";
  1340 + log << std::endl;
1339 } 1341 }
1340 1342
1341 // Store output file name in observation 1343 // Store output file name in observation
src/ctskymap/ctskymap.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctskymap - Sky mapping tool * 2 * ctskymap - Sky mapping tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2011-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2011-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -290,15 +290,21 @@ void ctskymap::run(void) @@ -290,15 +290,21 @@ void ctskymap::run(void)
290 290
291 } // endfor: looped over observations 291 } // endfor: looped over observations
292 292
  293 + // Optionally publish sky map
  294 + if (m_publish) {
  295 + publish();
  296 + }
  297 +
293 // Return 298 // Return
294 return; 299 return;
295 } 300 }
296 301
297 302
298 /***********************************************************************//** 303 /***********************************************************************//**
299 - * @brief Save observation 304 + * @brief Save sky map
300 * 305 *
301 - * This method saves the counts map(s) into (a) FITS file(s). 306 + * Saves the sky map into a FITS file. The FITS file name is specified by the
  307 + * @p outname parameter.
302 ***************************************************************************/ 308 ***************************************************************************/
303 void ctskymap::save(void) 309 void ctskymap::save(void)
304 { 310 {
@@ -308,15 +314,15 @@ void ctskymap::save(void) @@ -308,15 +314,15 @@ void ctskymap::save(void)
308 log.header1("Save sky map"); 314 log.header1("Save sky map");
309 } 315 }
310 316
311 - // Get output filename  
312 - m_outmap = (*this)["outmap"].filename(); 317 + // Get sky map filename
  318 + m_outmap = (*this)["outmap"].filename();
313 319
314 // Save only if filename is non-empty 320 // Save only if filename is non-empty
315 - if (m_outmap.length() > 0) { 321 + if (!m_outmap.is_empty()) {
316 322
317 - // Dump filename 323 + // Log filename
318 if (logTerse()) { 324 if (logTerse()) {
319 - log << "Save \""+m_outmap+"\"" << std::endl; 325 + log << "Save sky map into file \""+m_outmap+"\"." << std::endl;
320 } 326 }
321 327
322 // Save sky map 328 // Save sky map
@@ -330,6 +336,38 @@ void ctskymap::save(void) @@ -330,6 +336,38 @@ void ctskymap::save(void)
330 336
331 337
332 /***********************************************************************//** 338 /***********************************************************************//**
  339 + * @brief Publish sky map
  340 + *
  341 + * @param[in] name Sky map name.
  342 + ***************************************************************************/
  343 +void ctskymap::publish(const std::string& name)
  344 +{
  345 + // Write header
  346 + if (logTerse()) {
  347 + log << std::endl;
  348 + log.header1("Publish sky map");
  349 + }
  350 +
  351 + // Set default name is user name is empty
  352 + std::string user_name(name);
  353 + if (user_name.empty()) {
  354 + user_name = CTSKYMAP_NAME;
  355 + }
  356 +
  357 + // Log filename
  358 + if (logTerse()) {
  359 + log << "Publish \""+user_name+"\" sky map." << std::endl;
  360 + }
  361 +
  362 + // Publish sky map
  363 + m_skymap.publish(user_name);
  364 +
  365 + // Return
  366 + return;
  367 +}
  368 +
  369 +
  370 +/***********************************************************************//**
333 * @brief Get application parameters 371 * @brief Get application parameters
334 * 372 *
335 * Get all task parameters from parameter file or (if required) by querying 373 * Get all task parameters from parameter file or (if required) by querying
@@ -359,12 +397,13 @@ void ctskymap::get_parameters(void) @@ -359,12 +397,13 @@ void ctskymap::get_parameters(void)
359 m_skymap = create_map(m_obs); 397 m_skymap = create_map(m_obs);
360 398
361 // Get remaining parameters 399 // Get remaining parameters
362 - m_emin = (*this)["emin"].real();  
363 - m_emax = (*this)["emax"].real(); 400 + m_emin = (*this)["emin"].real();
  401 + m_emax = (*this)["emax"].real();
  402 + m_publish = (*this)["publish"].boolean();
364 403
365 // Read ahead parameters 404 // Read ahead parameters
366 if (read_ahead()) { 405 if (read_ahead()) {
367 - m_outmap = (*this)["outmap"].filename(); 406 + m_outmap = (*this)["outmap"].filename();
368 } 407 }
369 408
370 // Return 409 // Return
@@ -478,8 +517,9 @@ void ctskymap::init_members(void) @@ -478,8 +517,9 @@ void ctskymap::init_members(void)
478 // Initialise members 517 // Initialise members
479 m_obs.clear(); 518 m_obs.clear();
480 m_skymap.clear(); 519 m_skymap.clear();
481 - m_emin = 0.0;  
482 - m_emax = 0.0; 520 + m_emin = 0.0;
  521 + m_emax = 0.0;
  522 + m_publish = false;
483 523
484 // Return 524 // Return
485 return; 525 return;
@@ -494,10 +534,11 @@ void ctskymap::init_members(void) @@ -494,10 +534,11 @@ void ctskymap::init_members(void)
494 void ctskymap::copy_members(const ctskymap& app) 534 void ctskymap::copy_members(const ctskymap& app)
495 { 535 {
496 // Copy attributes 536 // Copy attributes
497 - m_obs = app.m_obs;  
498 - m_skymap = app.m_skymap;  
499 - m_emin = app.m_emin;  
500 - m_emax = app.m_emax; 537 + m_obs = app.m_obs;
  538 + m_skymap = app.m_skymap;
  539 + m_emin = app.m_emin;
  540 + m_emax = app.m_emax;
  541 + m_publish = app.m_publish;
501 542
502 // Return 543 // Return
503 return; 544 return;
src/ctskymap/ctskymap.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctskymap - Sky mapping tool * 2 * ctskymap - Sky mapping tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /* __Definitions _________________________________________________________ */ 35 /* __Definitions _________________________________________________________ */
36 #define CTSKYMAP_NAME "ctskymap" 36 #define CTSKYMAP_NAME "ctskymap"
37 -#define CTSKYMAP_VERSION "1.0.0" 37 +#define CTSKYMAP_VERSION "1.1.0"
38 38
39 39
40 /***********************************************************************//** 40 /***********************************************************************//**
@@ -61,6 +61,7 @@ public: @@ -61,6 +61,7 @@ public:
61 void clear(void); 61 void clear(void);
62 void run(void); 62 void run(void);
63 void save(void); 63 void save(void);
  64 + void publish(const std::string& name = "");
64 const GSkyMap& map(void) const; 65 const GSkyMap& map(void) const;
65 66
66 protected: 67 protected:
@@ -72,10 +73,10 @@ protected: @@ -72,10 +73,10 @@ protected:
72 void map_events(GCTAObservation* obs); 73 void map_events(GCTAObservation* obs);
73 74
74 // User parameters 75 // User parameters
75 - std::string m_outmap; //!< Output counts map 76 + GFilename m_outmap; //!< Output file name
76 double m_emin; //!< Minimum energy (TeV) 77 double m_emin; //!< Minimum energy (TeV)
77 double m_emax; //!< Maximum energy (TeV) 78 double m_emax; //!< Maximum energy (TeV)
78 - 79 + bool m_publish; //!< Publish sky map?
79 80
80 // Protected members 81 // Protected members
81 GObservations m_obs; //!< Observation container 82 GObservations m_obs; //!< Observation container
src/ctskymap/ctskymap.par
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # File: ctskymap.par # 7 # File: ctskymap.par #
8 -# Version: 1.0.0 # 8 +# Version: 1.1.0 #
9 # # 9 # #
10 # Author: Jurgen Knodlseder # 10 # Author: Jurgen Knodlseder #
11 # knodlseder@cesr.fr # 11 # knodlseder@cesr.fr #
@@ -41,6 +41,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot; @@ -41,6 +41,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
41 # 41 #
42 # Standard parameters 42 # Standard parameters
43 #==================== 43 #====================
  44 +publish, b, h, no,,, "Publish sky map on VO Hub?"
44 chatter, i, h, 2,0,4, "Chattiness of output" 45 chatter, i, h, 2,0,4, "Chattiness of output"
45 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 46 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
46 debug, b, h, no,,, "Debugging mode activated" 47 debug, b, h, no,,, "Debugging mode activated"
src/cttsmap/cttsmap.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * cttsmap - TS map calculation tool * 2 * cttsmap - TS map calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Michael Mayer * 4 + * copyright (C) 2014-2016 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -368,6 +368,11 @@ void cttsmap::run(void) @@ -368,6 +368,11 @@ void cttsmap::run(void)
368 } 368 }
369 } 369 }
370 370
  371 + // Optionally publish TS map
  372 + if (m_publish) {
  373 + publish();
  374 + }
  375 +
371 // Return 376 // Return
372 return; 377 return;
373 } 378 }
@@ -386,31 +391,73 @@ void cttsmap::save(void) @@ -386,31 +391,73 @@ void cttsmap::save(void)
386 log.header1("Save TS map"); 391 log.header1("Save TS map");
387 } 392 }
388 393
389 - // Get output filename 394 + // Get TS map filename
390 m_outmap = (*this)["outmap"].filename(); 395 m_outmap = (*this)["outmap"].filename();
391 396
392 - // Create fits file instance  
393 - GFits fitsfile = GFits(); 397 + // Save only if filename is non-empty
  398 + if (!m_outmap.is_empty()) {
  399 +
  400 + // Log filename
  401 + if (logTerse()) {
  402 + log << "Save TS map into file \""+m_outmap+"\"." << std::endl;
  403 + }
  404 +
  405 + // Create fits file
  406 + GFits fits;
  407 +
  408 + // Write the sky maps to the FITS file
  409 + m_tsmap.write(fits);
  410 + for (int i = 0; i < m_mapnames.size(); i++) {
  411 + m_maps[i].write(fits);
  412 + }
  413 +
  414 + // Set extension name for all maps
  415 + for (int i = 0; i < m_mapnames.size(); i++) {
  416 + fits[i+1]->extname(m_mapnames[i]);
  417 + }
  418 +
  419 + // Add computation log if not all bins are computed
  420 + if (m_binmin != -1 || m_binmax != -1) {
  421 + m_statusmap.write(fits);
  422 + fits[m_mapnames.size()+1]->extname("STATUS MAP");
  423 + }
  424 +
  425 + // Save FITS file
  426 + fits.saveto(m_outmap, clobber());
  427 +
  428 + } // endif: TS map filename was valid
394 429
395 - // Write the sky maps to the FITS file  
396 - m_tsmap.write(fitsfile);  
397 - for (int i = 0; i < m_mapnames.size(); i++) {  
398 - m_maps[i].write(fitsfile); 430 + // Return
  431 + return;
  432 +}
  433 +
  434 +
  435 +/***********************************************************************//**
  436 + * @brief Publish TS map
  437 + *
  438 + * @param[in] name TS map name.
  439 + ***************************************************************************/
  440 +void cttsmap::publish(const std::string& name)
  441 +{
  442 + // Write header
  443 + if (logTerse()) {
  444 + log << std::endl;
  445 + log.header1("Publish TS map");
399 } 446 }
400 447
401 - // Set extension name for all maps  
402 - for (int i = 0; i < m_mapnames.size(); i++) {  
403 - fitsfile[i+1]->extname(m_mapnames[i]); 448 + // Set default name is user name is empty
  449 + std::string user_name(name);
  450 + if (user_name.empty()) {
  451 + user_name = CTTSMAP_NAME;
404 } 452 }
405 453
406 - // Add computation log if not all bins are computed  
407 - if (m_binmin != -1 || m_binmax != -1) {  
408 - m_statusmap.write(fitsfile);  
409 - fitsfile[m_mapnames.size()+1]->extname("STATUS MAP"); 454 + // Log filename
  455 + if (logTerse()) {
  456 + log << "Publish \""+user_name+"\" TS map." << std::endl;
410 } 457 }
411 458
412 - // Save FITS file  
413 - fitsfile.saveto(m_outmap,true); 459 + // Publish TS map
  460 + m_tsmap.publish(user_name);
414 461
415 // Return 462 // Return
416 return; 463 return;
@@ -432,6 +479,7 @@ void cttsmap::init_members(void) @@ -432,6 +479,7 @@ void cttsmap::init_members(void)
432 m_srcname.clear(); 479 m_srcname.clear();
433 m_outmap.clear(); 480 m_outmap.clear();
434 m_apply_edisp = false; 481 m_apply_edisp = false;
  482 + m_publish = false;
435 483
436 // Initialise protected members 484 // Initialise protected members
437 m_obs.clear(); 485 m_obs.clear();
@@ -457,9 +505,10 @@ void cttsmap::init_members(void) @@ -457,9 +505,10 @@ void cttsmap::init_members(void)
457 void cttsmap::copy_members(const cttsmap& app) 505 void cttsmap::copy_members(const cttsmap& app)
458 { 506 {
459 // Copy attributes 507 // Copy attributes
460 - m_srcname = app.m_srcname;  
461 - m_outmap = app.m_outmap; 508 + m_srcname = app.m_srcname;
  509 + m_outmap = app.m_outmap;
462 m_apply_edisp = app.m_apply_edisp; 510 m_apply_edisp = app.m_apply_edisp;
  511 + m_publish = app.m_publish;
463 512
464 // Copy protected members 513 // Copy protected members
465 m_binmin = app.m_binmin; 514 m_binmin = app.m_binmin;
@@ -568,9 +617,10 @@ void cttsmap::get_parameters(void) @@ -568,9 +617,10 @@ void cttsmap::get_parameters(void)
568 m_apply_edisp = (*this)["edisp"].boolean(); 617 m_apply_edisp = (*this)["edisp"].boolean();
569 618
570 // Get optional splitting parameters 619 // Get optional splitting parameters
571 - m_binmin = (*this)["binmin"].integer();  
572 - m_binmax = (*this)["binmax"].integer();  
573 - m_logL0 = (*this)["logL0"].real(); 620 + m_binmin = (*this)["binmin"].integer();
  621 + m_binmax = (*this)["binmax"].integer();
  622 + m_logL0 = (*this)["logL0"].real();
  623 + m_publish = (*this)["publish"].boolean();
574 624
575 // Optionally read ahead parameters so that they get correctly 625 // Optionally read ahead parameters so that they get correctly
576 // dumped into the log file 626 // dumped into the log file
src/cttsmap/cttsmap.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * cttsmap - TS map calculation tool * 2 * cttsmap - TS map calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2015 by Michael Mayer * 4 + * copyright (C) 2014-2016 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 34
35 /* __Definitions _________________________________________________________ */ 35 /* __Definitions _________________________________________________________ */
36 #define CTTSMAP_NAME "cttsmap" 36 #define CTTSMAP_NAME "cttsmap"
37 -#define CTTSMAP_VERSION "1.0.0" 37 +#define CTTSMAP_VERSION "1.1.0"
38 38
39 39
40 /***********************************************************************//** 40 /***********************************************************************//**
@@ -72,6 +72,7 @@ public: @@ -72,6 +72,7 @@ public:
72 void clear(void); 72 void clear(void);
73 void run(void); 73 void run(void);
74 void save(void); 74 void save(void);
  75 + void publish(const std::string& name = "");
75 const GObservations& obs(void) const; 76 const GObservations& obs(void) const;
76 const GSkyMap& tsmap(void) const; 77 const GSkyMap& tsmap(void) const;
77 78
@@ -85,8 +86,9 @@ protected: @@ -85,8 +86,9 @@ protected:
85 86
86 // User parameters 87 // User parameters
87 std::string m_srcname; //!< Name of source which is moved around 88 std::string m_srcname; //!< Name of source which is moved around
88 - std::string m_outmap; //!< Output counts map or XML file 89 + GFilename m_outmap; //!< Output TS map file name
89 bool m_apply_edisp; //!< Apply energy dispersion? 90 bool m_apply_edisp; //!< Apply energy dispersion?
  91 + bool m_publish; //!< Publish TS map?
90 92
91 // Parameters to control speed and job splitting 93 // Parameters to control speed and job splitting
92 int m_binmin; //!< Map bin number from which computation should start 94 int m_binmin; //!< Map bin number from which computation should start
src/cttsmap/cttsmap.par
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # File: cttsmap.par # 7 # File: cttsmap.par #
8 -# Version: 1.0.0 # 8 +# Version: 1.1.0 #
9 # # 9 # #
10 # Author: Michael Mayer # 10 # Author: Michael Mayer #
11 # michael.mayer@desy.de # 11 # michael.mayer@desy.de #
@@ -50,6 +50,7 @@ logL0, r, h, 0.0,,, &quot;LogLikelihood value of null hypothesis&quot; @@ -50,6 +50,7 @@ logL0, r, h, 0.0,,, &quot;LogLikelihood value of null hypothesis&quot;
50 # 50 #
51 # Standard parameters 51 # Standard parameters
52 #==================== 52 #====================
  53 +publish, b, h, no,,, "Publish Test Statistic map on VO Hub?"
53 chatter, i, h, 2,0,4, "Chattiness of output" 54 chatter, i, h, 2,0,4, "Chattiness of output"
54 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 55 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
55 debug, b, h, no,,, "Debugging mode activated" 56 debug, b, h, no,,, "Debugging mode activated"
src/ctulimit/ctulimit.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctulimit - Upper limit calculation tool * 2 * ctulimit - Upper limit calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2015 by Michael Mayer * 4 + * copyright (C) 2015-2016 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -52,6 +52,8 @@ @@ -52,6 +52,8 @@
52 52
53 /***********************************************************************//** 53 /***********************************************************************//**
54 * @brief Void constructor 54 * @brief Void constructor
  55 + *
  56 + * Constructs an empty ctulimit tool.
55 ***************************************************************************/ 57 ***************************************************************************/
56 ctulimit::ctulimit(void) : ctool(CTULIMIT_NAME, CTULIMIT_VERSION) 58 ctulimit::ctulimit(void) : ctool(CTULIMIT_NAME, CTULIMIT_VERSION)
57 { 59 {
@@ -68,8 +70,8 @@ ctulimit::ctulimit(void) : ctool(CTULIMIT_NAME, CTULIMIT_VERSION) @@ -68,8 +70,8 @@ ctulimit::ctulimit(void) : ctool(CTULIMIT_NAME, CTULIMIT_VERSION)
68 * 70 *
69 * param[in] obs Observation container. 71 * param[in] obs Observation container.
70 * 72 *
71 - * This method creates an instance of the class by copying an existing  
72 - * observations container. 73 + * Constructs an instance of the ctulimit tool that will operate on the
  74 + * provided observation container.
73 ***************************************************************************/ 75 ***************************************************************************/
74 ctulimit::ctulimit(const GObservations& obs) : 76 ctulimit::ctulimit(const GObservations& obs) :
75 ctool(CTULIMIT_NAME, CTULIMIT_VERSION) 77 ctool(CTULIMIT_NAME, CTULIMIT_VERSION)
@@ -91,6 +93,9 @@ ctulimit::ctulimit(const GObservations&amp; obs) : @@ -91,6 +93,9 @@ ctulimit::ctulimit(const GObservations&amp; obs) :
91 * 93 *
92 * @param[in] argc Number of arguments in command line. 94 * @param[in] argc Number of arguments in command line.
93 * @param[in] argv Array of command line arguments. 95 * @param[in] argv Array of command line arguments.
  96 + *
  97 + * Constructs an instance of the ctulimit tool that will parse user
  98 + * parameters that are provided as command line arguments.
94 ***************************************************************************/ 99 ***************************************************************************/
95 ctulimit::ctulimit(int argc, char *argv[]) : 100 ctulimit::ctulimit(int argc, char *argv[]) :
96 ctool(CTULIMIT_NAME, CTULIMIT_VERSION, argc, argv) 101 ctool(CTULIMIT_NAME, CTULIMIT_VERSION, argc, argv)
@@ -107,6 +112,9 @@ ctulimit::ctulimit(int argc, char *argv[]) : @@ -107,6 +112,9 @@ ctulimit::ctulimit(int argc, char *argv[]) :
107 * @brief Copy constructor 112 * @brief Copy constructor
108 * 113 *
109 * @param[in] app Application. 114 * @param[in] app Application.
  115 + *
  116 + * Constructs an instance of the ctulimit tool by copying information from
  117 + * another ctulimit tool.
110 ***************************************************************************/ 118 ***************************************************************************/
111 ctulimit::ctulimit(const ctulimit& app) : ctool(app) 119 ctulimit::ctulimit(const ctulimit& app) : ctool(app)
112 { 120 {
@@ -123,6 +131,8 @@ ctulimit::ctulimit(const ctulimit&amp; app) : ctool(app) @@ -123,6 +131,8 @@ ctulimit::ctulimit(const ctulimit&amp; app) : ctool(app)
123 131
124 /***********************************************************************//** 132 /***********************************************************************//**
125 * @brief Destructor 133 * @brief Destructor
  134 + *
  135 + * Destructs the ctulimit tool.
126 ***************************************************************************/ 136 ***************************************************************************/
127 ctulimit::~ctulimit(void) 137 ctulimit::~ctulimit(void)
128 { 138 {
@@ -145,6 +155,8 @@ ctulimit::~ctulimit(void) @@ -145,6 +155,8 @@ ctulimit::~ctulimit(void)
145 * 155 *
146 * @param[in] app Application. 156 * @param[in] app Application.
147 * @return Application. 157 * @return Application.
  158 + *
  159 + * Assigns a ctulimit tool.
148 ***************************************************************************/ 160 ***************************************************************************/
149 ctulimit& ctulimit::operator=(const ctulimit& app) 161 ctulimit& ctulimit::operator=(const ctulimit& app)
150 { 162 {
@@ -177,7 +189,9 @@ ctulimit&amp; ctulimit::operator=(const ctulimit&amp; app) @@ -177,7 +189,9 @@ ctulimit&amp; ctulimit::operator=(const ctulimit&amp; app)
177 ==========================================================================*/ 189 ==========================================================================*/
178 190
179 /***********************************************************************//** 191 /***********************************************************************//**
180 - * @brief Clear instance 192 + * @brief Clear ctulimit tool
  193 + *
  194 + * Resets the ctulimit tool to a clean initial state.
181 ***************************************************************************/ 195 ***************************************************************************/
182 void ctulimit::clear(void) 196 void ctulimit::clear(void)
183 { 197 {
@@ -197,9 +211,9 @@ void ctulimit::clear(void) @@ -197,9 +211,9 @@ void ctulimit::clear(void)
197 211
198 212
199 /***********************************************************************//** 213 /***********************************************************************//**
200 - * @brief Computes the upper limit 214 + * @brief Compute upper limit
201 * 215 *
202 - * This method calculates the upper limit depending on the given algorithm 216 + * Computes the upper limit depending on the given algorithm
203 ***************************************************************************/ 217 ***************************************************************************/
204 void ctulimit::run(void) 218 void ctulimit::run(void)
205 { 219 {
@@ -369,22 +383,22 @@ void ctulimit::run(void) @@ -369,22 +383,22 @@ void ctulimit::run(void)
369 383
370 384
371 /***********************************************************************//** 385 /***********************************************************************//**
372 - * @brief Save maps 386 + * @brief Save upper limits
373 * 387 *
374 - * This method saves the upper limit to an ascii file. 388 + * Saves the upper limit to an ASCII file in comma-separated value format.
375 * 389 *
376 * @todo No yet implemented as we have no clear use case yet for saving 390 * @todo No yet implemented as we have no clear use case yet for saving
377 * the result. 391 * the result.
378 ***************************************************************************/ 392 ***************************************************************************/
379 void ctulimit::save(void) 393 void ctulimit::save(void)
380 { 394 {
  395 + /*
381 // Write header 396 // Write header
382 if (logTerse()) { 397 if (logTerse()) {
383 log << std::endl; 398 log << std::endl;
384 log.header1("Save upper limit"); 399 log.header1("Save upper limit");
385 } 400 }
386 401
387 - /*  
388 // Get output filename 402 // Get output filename
389 m_outfile = (*this)["outfile"].filename(); 403 m_outfile = (*this)["outfile"].filename();
390 404
@@ -417,14 +431,14 @@ void ctulimit::init_members(void) @@ -417,14 +431,14 @@ void ctulimit::init_members(void)
417 { 431 {
418 // Initialise user parameters 432 // Initialise user parameters
419 m_srcname.clear(); 433 m_srcname.clear();
420 - m_confidence = 0.95;  
421 - m_sigma_min = 0.0;  
422 - m_sigma_max = 0.0;  
423 - m_eref = 0.0;  
424 - m_emin = 0.0;  
425 - m_emax = 0.0;  
426 - m_tol = 1.0e-6;  
427 - m_max_iter = 50; 434 + m_confidence = 0.95;
  435 + m_sigma_min = 0.0;
  436 + m_sigma_max = 0.0;
  437 + m_eref = 0.0;
  438 + m_emin = 0.0;
  439 + m_emax = 0.0;
  440 + m_tol = 1.0e-6;
  441 + m_max_iter = 50;
428 m_apply_edisp = false; 442 m_apply_edisp = false;
429 443
430 // Initialise protected members 444 // Initialise protected members
@@ -455,15 +469,15 @@ void ctulimit::init_members(void) @@ -455,15 +469,15 @@ void ctulimit::init_members(void)
455 void ctulimit::copy_members(const ctulimit& app) 469 void ctulimit::copy_members(const ctulimit& app)
456 { 470 {
457 // Copy user parameters 471 // Copy user parameters
458 - m_srcname = app.m_srcname;  
459 - m_confidence = app.m_confidence;  
460 - m_sigma_min = app.m_sigma_min;  
461 - m_sigma_max = app.m_sigma_max;  
462 - m_eref = app.m_eref;  
463 - m_emin = app.m_emin;  
464 - m_emax = app.m_emax;  
465 - m_tol = app.m_tol;  
466 - m_max_iter = app.m_max_iter; 472 + m_srcname = app.m_srcname;
  473 + m_confidence = app.m_confidence;
  474 + m_sigma_min = app.m_sigma_min;
  475 + m_sigma_max = app.m_sigma_max;
  476 + m_eref = app.m_eref;
  477 + m_emin = app.m_emin;
  478 + m_emax = app.m_emax;
  479 + m_tol = app.m_tol;
  480 + m_max_iter = app.m_max_iter;
467 m_apply_edisp = app.m_apply_edisp; 481 m_apply_edisp = app.m_apply_edisp;
468 482
469 // Copy protected members 483 // Copy protected members
@@ -624,12 +638,12 @@ void ctulimit::get_model_parameter(void) @@ -624,12 +638,12 @@ void ctulimit::get_model_parameter(void)
624 638
625 639
626 /***********************************************************************//** 640 /***********************************************************************//**
627 - * @brief Performs upper limit computation by using a bisection method 641 + * @brief Calculate upper limit using a bisection method
628 * 642 *
629 * @param[in] min Minimum parameter value 643 * @param[in] min Minimum parameter value
630 * @param[in] max Maximum parameter value 644 * @param[in] max Maximum parameter value
631 * 645 *
632 - * This method calculates the upper limit using a bisection method. 646 + * Calculates the upper limit using a bisection method.
633 ***************************************************************************/ 647 ***************************************************************************/
634 void ctulimit::ulimit_bisection(const double& min, const double& max) 648 void ctulimit::ulimit_bisection(const double& min, const double& max)
635 { 649 {
@@ -697,8 +711,7 @@ void ctulimit::ulimit_bisection(const double&amp; min, const double&amp; max) @@ -697,8 +711,7 @@ void ctulimit::ulimit_bisection(const double&amp; min, const double&amp; max)
697 * @param[in] value Parameter factor value 711 * @param[in] value Parameter factor value
698 * @return Log-likelihood value 712 * @return Log-likelihood value
699 * 713 *
700 - * This method evaluates the log-likelihood as a function of the parameter  
701 - * of interest. 714 + * Evaluates the log-likelihood as a function of the parameter of interest.
702 ***************************************************************************/ 715 ***************************************************************************/
703 double ctulimit::evaluate(const double& value) 716 double ctulimit::evaluate(const double& value)
704 { 717 {
src/support/ctool.hpp
@@ -91,12 +91,14 @@ protected: @@ -91,12 +91,14 @@ protected:
91 GSkyDir get_mean_pointing(const GObservations& obs); 91 GSkyDir get_mean_pointing(const GObservations& obs);
92 size_t get_current_rss(void); 92 size_t get_current_rss(void);
93 93
  94 + // Protected members
  95 + bool m_read_ahead; //!< Read ahead parameters
  96 +
94 protected: 97 protected:
95 // Protected methods 98 // Protected methods
96 void provide_help(void) const; 99 void provide_help(void) const;
97 100
98 // Protected members 101 // Protected members
99 - bool m_read_ahead; //!< Read ahead parameters  
100 bool m_use_xml; //!< Use XML file instead of FITS file for observations 102 bool m_use_xml; //!< Use XML file instead of FITS file for observations
101 GTimeReference m_cta_ref; //!< CTA time reference 103 GTimeReference m_cta_ref; //!< CTA time reference
102 }; 104 };
test/test_ctbin.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctbin tool. 3 # This scripts performs unit tests for the ctbin tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -83,16 +83,18 @@ class Test(gammalib.GPythonTestSuite): @@ -83,16 +83,18 @@ class Test(gammalib.GPythonTestSuite):
83 try: 83 try:
84 bin.run() 84 bin.run()
85 self.test_try_success() 85 self.test_try_success()
86 - except:  
87 - self.test_try_failure("Exception occured in ctbin.") 86 + except Exception, e:
  87 + msg = "Exception occured in ctbin: %s." % (e,)
  88 + self.test_try_failure(msg)
88 89
89 # Save counts cube 90 # Save counts cube
90 self.test_try("Save counts cube") 91 self.test_try("Save counts cube")
91 try: 92 try:
92 bin.save() 93 bin.save()
93 self.test_try_success() 94 self.test_try_success()
94 - except:  
95 - self.test_try_failure("Exception occured in saving counts cube.") 95 + except Exception, e:
  96 + msg = "Exception occured in saving counts cube: %s." % (e,)
  97 + self.test_try_failure(msg)
96 98
97 # Return 99 # Return
98 return 100 return
test/test_ctbkgcube.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctbkgcube tool. 3 # This scripts performs unit tests for the ctbkgcube tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -91,16 +91,18 @@ class Test(gammalib.GPythonTestSuite): @@ -91,16 +91,18 @@ class Test(gammalib.GPythonTestSuite):
91 try: 91 try:
92 bkgcube.run() 92 bkgcube.run()
93 self.test_try_success() 93 self.test_try_success()
94 - except:  
95 - self.test_try_failure("Exception occured in ctbkgcube.") 94 + except Exception, e:
  95 + msg = "Exception occured in ctbkgcube: %s." % (e,)
  96 + self.test_try_failure(msg)
96 97
97 # Save background cube 98 # Save background cube
98 self.test_try("Save background cube") 99 self.test_try("Save background cube")
99 try: 100 try:
100 bkgcube.save() 101 bkgcube.save()
101 self.test_try_success() 102 self.test_try_success()
102 - except:  
103 - self.test_try_failure("Exception occured in saving background cube.") 103 + except Exception, e:
  104 + msg = "Exception occured in saving background cube: %s." % (e,)
  105 + self.test_try_failure(msg)
104 106
105 # Return 107 # Return
106 return 108 return
test/test_ctbutterfly.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctbutterfly tool. 3 # This scripts performs unit tests for the ctbutterfly tool.
4 # 4 #
5 -# Copyright (C) 2014 Michal Mayer 5 +# Copyright (C) 2014-2016 Michal Mayer
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -81,16 +81,18 @@ class Test(gammalib.GPythonTestSuite): @@ -81,16 +81,18 @@ class Test(gammalib.GPythonTestSuite):
81 try: 81 try:
82 butterfly.run() 82 butterfly.run()
83 self.test_try_success() 83 self.test_try_success()
84 - except:  
85 - self.test_try_failure("Exception occured in butterfly.") 84 + except Exception, e:
  85 + msg = "Exception occured in ctbutterfly: %s." % (e,)
  86 + self.test_try_failure(msg)
86 87
87 # Save results 88 # Save results
88 self.test_try("Save results") 89 self.test_try("Save results")
89 try: 90 try:
90 butterfly.save() 91 butterfly.save()
91 self.test_try_success() 92 self.test_try_success()
92 - except:  
93 - self.test_try_failure("Exception occured in saving results.") 93 + except Exception, e:
  94 + msg = "Exception occured in saving butterfly diagram: %s." % (e,)
  95 + self.test_try_failure(msg)
94 96
95 # Return 97 # Return
96 return 98 return
test/test_ctcubemask.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctcubemask tool. 3 # This scripts performs unit tests for the ctcubemask tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -79,16 +79,18 @@ class Test(gammalib.GPythonTestSuite): @@ -79,16 +79,18 @@ class Test(gammalib.GPythonTestSuite):
79 try: 79 try:
80 mask.run() 80 mask.run()
81 self.test_try_success() 81 self.test_try_success()
82 - except:  
83 - self.test_try_failure("Exception occured in ctcubemask.") 82 + except Exception, e:
  83 + msg = "Exception occured in ctcubemask: %s." % (e,)
  84 + self.test_try_failure(msg)
84 85
85 # Save counts cube 86 # Save counts cube
86 self.test_try("Save counts cube") 87 self.test_try("Save counts cube")
87 try: 88 try:
88 mask.save() 89 mask.save()
89 self.test_try_success() 90 self.test_try_success()
90 - except:  
91 - self.test_try_failure("Exception occured in saving counts cube.") 91 + except Exception, e:
  92 + msg = "Exception occured in saving counts cube: %s." % (e,)
  93 + self.test_try_failure(msg)
92 94
93 # Return 95 # Return
94 return 96 return
test/test_cterror.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the cterror tool. 3 # This scripts performs unit tests for the cterror tool.
4 # 4 #
5 -# Copyright (C) 2015 Florent Forest 5 +# Copyright (C) 2015-2016 Florent Forest
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -80,16 +80,18 @@ class Test(gammalib.GPythonTestSuite): @@ -80,16 +80,18 @@ class Test(gammalib.GPythonTestSuite):
80 try: 80 try:
81 error.run() 81 error.run()
82 self.test_try_success() 82 self.test_try_success()
83 - except:  
84 - self.test_try_failure("Exception occured in cterror.") 83 + except Exception, e:
  84 + msg = "Exception occured in cterror: %s." % (e,)
  85 + self.test_try_failure(msg)
85 86
86 # Save results 87 # Save results
87 self.test_try("Save results") 88 self.test_try("Save results")
88 try: 89 try:
89 error.save() 90 error.save()
90 self.test_try_success() 91 self.test_try_success()
91 - except:  
92 - self.test_try_failure("Exception occured in saving results.") 92 + except Exception, e:
  93 + msg = "Exception occured in saving results: %s." % (e,)
  94 + self.test_try_failure(msg)
93 95
94 # Return 96 # Return
95 return 97 return
test/test_ctexpcube.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctexpcube tool. 3 # This scripts performs unit tests for the ctexpcube tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -88,16 +88,18 @@ class Test(gammalib.GPythonTestSuite): @@ -88,16 +88,18 @@ class Test(gammalib.GPythonTestSuite):
88 try: 88 try:
89 expcube.run() 89 expcube.run()
90 self.test_try_success() 90 self.test_try_success()
91 - except:  
92 - self.test_try_failure("Exception occured in ctexpcube.") 91 + except Exception, e:
  92 + msg = "Exception occured in ctexpcube: %s." % (e,)
  93 + self.test_try_failure(msg)
93 94
94 # Save exposure cube 95 # Save exposure cube
95 self.test_try("Save exposure cube") 96 self.test_try("Save exposure cube")
96 try: 97 try:
97 expcube.save() 98 expcube.save()
98 self.test_try_success() 99 self.test_try_success()
99 - except:  
100 - self.test_try_failure("Exception occured in saving exposure cube.") 100 + except Exception, e:
  101 + msg = "Exception occured in saving exposure cube: %s." % (e,)
  102 + self.test_try_failure(msg)
101 103
102 # Return 104 # Return
103 return 105 return
test/test_ctlike.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctlike tool. 3 # This scripts performs unit tests for the ctlike tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -78,16 +78,18 @@ class Test(gammalib.GPythonTestSuite): @@ -78,16 +78,18 @@ class Test(gammalib.GPythonTestSuite):
78 try: 78 try:
79 like.run() 79 like.run()
80 self.test_try_success() 80 self.test_try_success()
81 - except:  
82 - self.test_try_failure("Exception occured in ctlike.") 81 + except Exception, e:
  82 + msg = "Exception occured in ctlike: %s." % (e,)
  83 + self.test_try_failure(msg)
83 84
84 # Save results 85 # Save results
85 self.test_try("Save results") 86 self.test_try("Save results")
86 try: 87 try:
87 like.save() 88 like.save()
88 self.test_try_success() 89 self.test_try_success()
89 - except:  
90 - self.test_try_failure("Exception occured in saving results.") 90 + except Exception, e:
  91 + msg = "Exception occured in saving results: %s." % (e,)
  92 + self.test_try_failure(msg)
91 93
92 # Return 94 # Return
93 return 95 return
test/test_ctmodel.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctmodel tool. 3 # This scripts performs unit tests for the ctmodel tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -96,16 +96,18 @@ class Test(gammalib.GPythonTestSuite): @@ -96,16 +96,18 @@ class Test(gammalib.GPythonTestSuite):
96 try: 96 try:
97 model.run() 97 model.run()
98 self.test_try_success() 98 self.test_try_success()
99 - except:  
100 - self.test_try_failure("Exception occured in ctmodel.") 99 + except Exception, e:
  100 + msg = "Exception occured in ctmodel: %s." % (e,)
  101 + self.test_try_failure(msg)
101 102
102 # Save counts cube 103 # Save counts cube
103 self.test_try("Save model cube") 104 self.test_try("Save model cube")
104 try: 105 try:
105 model.save() 106 model.save()
106 self.test_try_success() 107 self.test_try_success()
107 - except:  
108 - self.test_try_failure("Exception occured in saving model cube.") 108 + except Exception, e:
  109 + msg = "Exception occured in saving model cube: %s." % (e,)
  110 + self.test_try_failure(msg)
109 111
110 # Return 112 # Return
111 return 113 return
test/test_ctobssim.py
@@ -84,8 +84,9 @@ class Test(gammalib.GPythonTestSuite): @@ -84,8 +84,9 @@ class Test(gammalib.GPythonTestSuite):
84 try: 84 try:
85 sim.run() 85 sim.run()
86 self.test_try_success() 86 self.test_try_success()
87 - except:  
88 - self.test_try_failure("Exception occured in ctobssim.") 87 + except Exception, e:
  88 + msg = "Exception occured in ctobssim: %s." % (e,)
  89 + self.test_try_failure(msg)
89 90
90 # Retrieve observation and check content 91 # Retrieve observation and check content
91 obs = gammalib.GCTAObservation(sim.obs()[0]) 92 obs = gammalib.GCTAObservation(sim.obs()[0])
@@ -104,8 +105,9 @@ class Test(gammalib.GPythonTestSuite): @@ -104,8 +105,9 @@ class Test(gammalib.GPythonTestSuite):
104 try: 105 try:
105 sim.save() 106 sim.save()
106 self.test_try_success() 107 self.test_try_success()
107 - except:  
108 - self.test_try_failure("Exception occured in saving events.") 108 + except Exception, e:
  109 + msg = "Exception occured in saving events: %s." % (e,)
  110 + self.test_try_failure(msg)
109 111
110 # Test ctobssim on observation container 112 # Test ctobssim on observation container
111 def test_container(self): 113 def test_container(self):
@@ -124,8 +126,9 @@ class Test(gammalib.GPythonTestSuite): @@ -124,8 +126,9 @@ class Test(gammalib.GPythonTestSuite):
124 try: 126 try:
125 sim.run() 127 sim.run()
126 self.test_try_success() 128 self.test_try_success()
127 - except:  
128 - self.test_try_failure("Exception occured in ctobssim.") 129 + except Exception, e:
  130 + msg = "Exception occured in ctobssim: %s." % (e,)
  131 + self.test_try_failure(msg)
129 132
130 # Retrieve observation and check content 133 # Retrieve observation and check content
131 self.test_value(sim.obs().size(), 4, "There are not 4 observations") 134 self.test_value(sim.obs().size(), 4, "There are not 4 observations")
@@ -135,8 +138,9 @@ class Test(gammalib.GPythonTestSuite): @@ -135,8 +138,9 @@ class Test(gammalib.GPythonTestSuite):
135 try: 138 try:
136 sim.save() 139 sim.save()
137 self.test_try_success() 140 self.test_try_success()
138 - except:  
139 - self.test_try_failure("Exception occured in saving events.") 141 + except Exception, e:
  142 + msg = "Exception occured in saving events: %s." % (e,)
  143 + self.test_try_failure(msg)
140 144
141 # Setup observation container 145 # Setup observation container
142 def set_obs(self, number): 146 def set_obs(self, number):
test/test_ctpsfcube.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctpsfcube tool. 3 # This scripts performs unit tests for the ctpsfcube tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -90,16 +90,18 @@ class Test(gammalib.GPythonTestSuite): @@ -90,16 +90,18 @@ class Test(gammalib.GPythonTestSuite):
90 try: 90 try:
91 psfcube.run() 91 psfcube.run()
92 self.test_try_success() 92 self.test_try_success()
93 - except:  
94 - self.test_try_failure("Exception occured in ctpsfcube.") 93 + except Exception, e:
  94 + msg = "Exception occured in ctpsfcube: %s." % (e,)
  95 + self.test_try_failure(msg)
95 96
96 # Save PSF cube 97 # Save PSF cube
97 self.test_try("Save PSF cube") 98 self.test_try("Save PSF cube")
98 try: 99 try:
99 psfcube.save() 100 psfcube.save()
100 self.test_try_success() 101 self.test_try_success()
101 - except:  
102 - self.test_try_failure("Exception occured in saving PSF cube.") 102 + except Exception, e:
  103 + msg = "Exception occured in saving PSF cube: %s." % (e,)
  104 + self.test_try_failure(msg)
103 105
104 # Return 106 # Return
105 return 107 return
test/test_ctselect.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctselect tool. 3 # This scripts performs unit tests for the ctselect tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -79,16 +79,18 @@ class Test(gammalib.GPythonTestSuite): @@ -79,16 +79,18 @@ class Test(gammalib.GPythonTestSuite):
79 try: 79 try:
80 select.run() 80 select.run()
81 self.test_try_success() 81 self.test_try_success()
82 - except:  
83 - self.test_try_failure("Exception occured in ctselect.") 82 + except Exception, e:
  83 + msg = "Exception occured in ctselect: %s." % (e,)
  84 + self.test_try_failure(msg)
84 85
85 # Save events 86 # Save events
86 self.test_try("Save events") 87 self.test_try("Save events")
87 try: 88 try:
88 select.save() 89 select.save()
89 self.test_try_success() 90 self.test_try_success()
90 - except:  
91 - self.test_try_failure("Exception occured in saving events.") 91 + except Exception, e:
  92 + msg = "Exception occured in saving events: %s." % (e,)
  93 + self.test_try_failure(msg)
92 94
93 # Return 95 # Return
94 return 96 return
test/test_ctskymap.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctskymap tool. 3 # This scripts performs unit tests for the ctskymap tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -81,16 +81,18 @@ class Test(gammalib.GPythonTestSuite): @@ -81,16 +81,18 @@ class Test(gammalib.GPythonTestSuite):
81 try: 81 try:
82 skymap.run() 82 skymap.run()
83 self.test_try_success() 83 self.test_try_success()
84 - except:  
85 - self.test_try_failure("Exception occured in ctskymap.") 84 + except Exception, e:
  85 + msg = "Exception occured in ctskymap: %s." % (e,)
  86 + self.test_try_failure(msg)
86 87
87 # Save counts cube 88 # Save counts cube
88 self.test_try("Save sky map") 89 self.test_try("Save sky map")
89 try: 90 try:
90 skymap.save() 91 skymap.save()
91 self.test_try_success() 92 self.test_try_success()
92 - except:  
93 - self.test_try_failure("Exception occured in saving sky map.") 93 + except Exception, e:
  94 + msg = "Exception occured in saving sky map: %s." % (e,)
  95 + self.test_try_failure(msg)
94 96
95 # Return 97 # Return
96 return 98 return
test/test_cttsmap.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the cttsmap tool. 3 # This scripts performs unit tests for the cttsmap tool.
4 # 4 #
5 -# Copyright (C) 2014 Juergen Knoedlseder 5 +# Copyright (C) 2014-2016 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -86,16 +86,18 @@ class Test(gammalib.GPythonTestSuite): @@ -86,16 +86,18 @@ class Test(gammalib.GPythonTestSuite):
86 try: 86 try:
87 tsmap.run() 87 tsmap.run()
88 self.test_try_success() 88 self.test_try_success()
89 - except:  
90 - self.test_try_failure("Exception occured in cttsmap.") 89 + except Exception, e:
  90 + msg = "Exception occured in cttsmap: %s." % (e,)
  91 + self.test_try_failure(msg)
91 92
92 # Save results 93 # Save results
93 self.test_try("Save results") 94 self.test_try("Save results")
94 try: 95 try:
95 tsmap.save() 96 tsmap.save()
96 self.test_try_success() 97 self.test_try_success()
97 - except:  
98 - self.test_try_failure("Exception occured in saving results.") 98 + except Exception, e:
  99 + msg = "Exception occured in saving results: %s." % (e,)
  100 + self.test_try_failure(msg)
99 101
100 # Return 102 # Return
101 return 103 return
test/test_ctulimit.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctulimit tool. 3 # This scripts performs unit tests for the ctulimit tool.
4 # 4 #
5 -# Copyright (C) 2015 Michael Mayer 5 +# Copyright (C) 2015-2016 Michael Mayer
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -78,16 +78,18 @@ class Test(gammalib.GPythonTestSuite): @@ -78,16 +78,18 @@ class Test(gammalib.GPythonTestSuite):
78 try: 78 try:
79 ulimit.run() 79 ulimit.run()
80 self.test_try_success() 80 self.test_try_success()
81 - except:  
82 - self.test_try_failure("Exception occured in ctulimit.") 81 + except Exception, e:
  82 + msg = "Exception occured in ctulimit: %s." % (e,)
  83 + self.test_try_failure(msg)
83 84
84 # Save results 85 # Save results
85 self.test_try("Save results") 86 self.test_try("Save results")
86 try: 87 try:
87 ulimit.save() 88 ulimit.save()
88 self.test_try_success() 89 self.test_try_success()
89 - except:  
90 - self.test_try_failure("Exception occured in saving results.") 90 + except Exception, e:
  91 + msg = "Exception occured in saving results: %s." % (e,)
  92 + self.test_try_failure(msg)
91 93
92 # Return 94 # Return
93 return 95 return