Commit 862f5bcb3911dc2317b7fba18f77bc13940e7cf4

Authored by Jürgen Knödlseder
1 parent 78d948d7

Stamp all output FITS files (#3662)

ChangeLog
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 ======================== 4 ========================
5 5
6 Add source counts constraints to cssens (#3668) 6 Add source counts constraints to cssens (#3668)
  7 + Stamp all output FITS files (#3662)
7 Add ASCL shields to "About" page (#3630) 8 Add ASCL shields to "About" page (#3630)
8 Use file function constructor in csspec (#3626) 9 Use file function constructor in csspec (#3626)
9 Add BINS method to csspec (#3606) 10 Add BINS method to csspec (#3606)
@@ -39,28 +39,31 @@ None @@ -39,28 +39,31 @@ None
39 39
40 ctbin - CTA event binning 40 ctbin - CTA event binning
41 ------------------------- 41 -------------------------
  42 +Stamp output counts cube (#3662).
  43 +
42 Removed implicit conversion warning during C++ compilation (#3324). 44 Removed implicit conversion warning during C++ compilation (#3324).
43 45
44 46
45 ctbkgcube - CTA background cube generation 47 ctbkgcube - CTA background cube generation
46 ------------------------------------------ 48 ------------------------------------------
47 -None 49 +Stamp output background cube (#3662).
48 50
49 51
50 ctbutterfly - Generate butterfly diagrams 52 ctbutterfly - Generate butterfly diagrams
51 ----------------------------------------- 53 -----------------------------------------
52 The ASCII output file was replaced by a FITS file, and the butterfly() method 54 The ASCII output file was replaced by a FITS file, and the butterfly() method
53 -now returns a GFits objects instead of a GCsv object (#1707). 55 +now returns a GFits objects instead of a GCsv object (#1707). The output FITS
  56 +file is also stamped (#3662).
54 57
55 58
56 ctcubemask - CTA cube filtering 59 ctcubemask - CTA cube filtering
57 ------------------------------- 60 -------------------------------
58 -None 61 +Stamp output masked cube (#3662).
59 62
60 63
61 ctedispcube - CTA energy dispersion cube generation 64 ctedispcube - CTA energy dispersion cube generation
62 --------------------------------------------------- 65 ---------------------------------------------------
63 -None 66 +Stamp output energy dispersion cube (#3662).
64 67
65 68
66 cterror - Likelihood profile error computation 69 cterror - Likelihood profile error computation
@@ -70,12 +73,12 @@ None @@ -70,12 +73,12 @@ None
70 73
71 ctexpcube - CTA exposure cube generation 74 ctexpcube - CTA exposure cube generation
72 ---------------------------------------- 75 ----------------------------------------
73 -None 76 +Stamp output exposure cube (#3662).
74 77
75 78
76 ctfindvar - Variability search 79 ctfindvar - Variability search
77 ------------------------------ 80 ------------------------------
78 -None 81 +Stamp output FITS files (#3662).
79 82
80 83
81 ctlike - Maximum likelihood fitting 84 ctlike - Maximum likelihood fitting
@@ -99,47 +102,53 @@ are fixed for all sky models (#3426). @@ -99,47 +102,53 @@ are fixed for all sky models (#3426).
99 102
100 ctmapcube - CTA map cube generation 103 ctmapcube - CTA map cube generation
101 ----------------------------------- 104 -----------------------------------
102 -None 105 +Stamp output map cube (#3662).
103 106
104 107
105 ctmodel - CTA counts cube modelling 108 ctmodel - CTA counts cube modelling
106 ----------------------------------- 109 -----------------------------------
107 -None 110 +Stamp output model cube (#3662).
108 111
109 112
110 ctobssim - CTA observation simulation 113 ctobssim - CTA observation simulation
111 ------------------------------------- 114 -------------------------------------
  115 +Stamp output event files (#3662).
  116 +
112 Added models() method allowing for a setting of the model container without 117 Added models() method allowing for a setting of the model container without
113 using the "inmodels" parameter (#3441). 118 using the "inmodels" parameter (#3441).
114 119
115 120
116 ctphase - Event phase computation 121 ctphase - Event phase computation
117 --------------------------------- 122 ---------------------------------
118 -None 123 +Stamp output event files (#3662).
119 124
120 125
121 ctprob - Event probability computation 126 ctprob - Event probability computation
122 -------------------------------------- 127 --------------------------------------
123 -None 128 +Stamp output event files (#3662).
124 129
125 130
126 ctpsfcube - CTA point spread function cube generation 131 ctpsfcube - CTA point spread function cube generation
127 ----------------------------------------------------- 132 -----------------------------------------------------
128 -None 133 +Stamp output point spread function cube (#3662).
129 134
130 135
131 ctselect - CTA event selection 136 ctselect - CTA event selection
132 ------------------------------ 137 ------------------------------
  138 +Stamp output event files (#3662).
  139 +
133 Replaced std::tmpnam() by gammalib::tmpnam() function in ctselect (#3324). 140 Replaced std::tmpnam() by gammalib::tmpnam() function in ctselect (#3324).
134 141
135 142
136 ctskymap - CTA sky mapping 143 ctskymap - CTA sky mapping
137 -------------------------- 144 --------------------------
138 -None 145 +Stamp output sky map (#3662).
139 146
140 147
141 cttsmap - Generation of Test Statistic map 148 cttsmap - Generation of Test Statistic map
142 ------------------------------------------ 149 ------------------------------------------
  150 +Stamp output TS map (#3662).
  151 +
143 Added hidden "fix_spat" parameter that instructs the tool to fix all spatial 152 Added hidden "fix_spat" parameter that instructs the tool to fix all spatial
144 model parameters (#3562). 153 model parameters (#3562).
145 154
@@ -151,7 +160,7 @@ None @@ -151,7 +160,7 @@ None
151 160
152 support - Support classes 161 support - Support classes
153 ------------------------- 162 -------------------------
154 -None 163 +Add stamping to ctool::save_event_list() method (#3662).
155 164
156 165
157 csbkgmodel - Generate background model for 3D analysis 166 csbkgmodel - Generate background model for 3D analysis
@@ -166,7 +175,7 @@ None @@ -166,7 +175,7 @@ None
166 175
167 csebins - Generate energy boundaries 176 csebins - Generate energy boundaries
168 ------------------------------------ 177 ------------------------------------
169 -None 178 +Stamp output energy boundaries file (#3662).
170 179
171 180
172 csfindobs - Find IACT observations 181 csfindobs - Find IACT observations
@@ -191,6 +200,8 @@ None @@ -191,6 +200,8 @@ None
191 200
192 cslightcrv - Generate light curve 201 cslightcrv - Generate light curve
193 --------------------------------- 202 ---------------------------------
  203 +Stamp output light curve file (#3662).
  204 +
194 Added support for rectangular On/Off regions. The "srcshape" parameter now 205 Added support for rectangular On/Off regions. The "srcshape" parameter now
195 can now be set to "RECT" to use rectangular sky regions. The parameter is now 206 can now be set to "RECT" to use rectangular sky regions. The parameter is now
196 automatic. The parameters "width", "height", and "posang" were added to specify 207 automatic. The parameters "width", "height", and "posang" were added to specify
@@ -214,12 +225,12 @@ None @@ -214,12 +225,12 @@ None
214 225
215 csmodelsois - Puts selected sources in diffuse model cube 226 csmodelsois - Puts selected sources in diffuse model cube
216 --------------------------------------------------------- 227 ---------------------------------------------------------
217 -None 228 +Stamp output diffuse model cube (#3662).
218 229
219 230
220 csobs2caldb - Generate calibration database entry for an IACT observation 231 csobs2caldb - Generate calibration database entry for an IACT observation
221 ------------------------------------------------------------------------- 232 -------------------------------------------------------------------------
222 -None 233 +Stamp output IRF files (#3662).
223 234
224 235
225 csobsdef - Generate observation definition XML file 236 csobsdef - Generate observation definition XML file
@@ -239,6 +250,8 @@ None @@ -239,6 +250,8 @@ None
239 250
240 csphagen - Generate On/Off observations 251 csphagen - Generate On/Off observations
241 --------------------------------------- 252 ---------------------------------------
  253 +Stamp output OGIP files (#3662).
  254 +
242 Added support for rectangular On/Off regions. The "srcshape" parameter now 255 Added support for rectangular On/Off regions. The "srcshape" parameter now
243 can now be set to "RECT" to use rectangular sky regions. The parameter is now 256 can now be set to "RECT" to use rectangular sky regions. The parameter is now
244 automatic. The parameters "width", "height", and "posang" were added to specify 257 automatic. The parameters "width", "height", and "posang" were added to specify
@@ -247,6 +260,8 @@ the width, height and position angle of the rectangular sky regions (#3248). @@ -247,6 +260,8 @@ the width, height and position angle of the rectangular sky regions (#3248).
247 260
248 csphasecrv - Generate phase curve 261 csphasecrv - Generate phase curve
249 --------------------------------- 262 ---------------------------------
  263 +Stamp output phase curve file (#3662).
  264 +
250 Added support for rectangular On/Off regions. The "srcshape" parameter now 265 Added support for rectangular On/Off regions. The "srcshape" parameter now
251 can now be set to "RECT" to use rectangular sky regions. The parameter is now 266 can now be set to "RECT" to use rectangular sky regions. The parameter is now
252 automatic. The parameters "width", "height", and "posang" were added to specify 267 automatic. The parameters "width", "height", and "posang" were added to specify
@@ -255,26 +270,29 @@ the width, height and position angle of the rectangular sky regions (#3248). @@ -255,26 +270,29 @@ the width, height and position angle of the rectangular sky regions (#3248).
255 270
256 cspull - Generate pull distributions 271 cspull - Generate pull distributions
257 ------------------------------------ 272 ------------------------------------
258 -The ASCII output file was replaced by a FITS file (#1707). 273 +The ASCII output file was replaced by a FITS file (#1707). The output FITS file
  274 +is stamped (#3662).
259 275
260 276
261 csresmap - Generate residual map 277 csresmap - Generate residual map
262 -------------------------------- 278 --------------------------------
263 -None 279 +Stamp output residual map (#3662).
264 280
265 281
266 csresspec - Generate residual spectrum 282 csresspec - Generate residual spectrum
267 -------------------------------------- 283 --------------------------------------
268 -None 284 +Stamp output residual spectrum (#3662).
269 285
270 286
271 csroot2caldb - Generates calibration database from ROOT file 287 csroot2caldb - Generates calibration database from ROOT file
272 ------------------------------------------------------------ 288 ------------------------------------------------------------
273 -None 289 +Stamp output IRF files (#3662).
274 290
275 291
276 csscs - Spectral component separation 292 csscs - Spectral component separation
277 ------------------------------------- 293 -------------------------------------
  294 +Stamp output FITS file (#3662).
  295 +
278 Added support for rectangular On/Off regions. The "srcshape" parameter now 296 Added support for rectangular On/Off regions. The "srcshape" parameter now
279 can now be set to "RECT" to use rectangular sky regions. The parameter is now 297 can now be set to "RECT" to use rectangular sky regions. The parameter is now
280 automatic. The parameters "width", "height", and "posang" were added to specify 298 automatic. The parameters "width", "height", and "posang" were added to specify
@@ -293,11 +311,14 @@ The test source position is now used as pointing direction, eventually offset @@ -293,11 +311,14 @@ The test source position is now used as pointing direction, eventually offset
293 in galactic latitude by a number of degrees specified using the "offset" 311 in galactic latitude by a number of degrees specified using the "offset"
294 parameter (#3555). 312 parameter (#3555).
295 313
296 -The ASCII output file was replaced by a FITS file (#1707). 314 +The ASCII output file was replaced by a FITS file (#1707). The output FITS file
  315 +is stamped (#3662).
297 316
298 317
299 csspec - Generates Spectral Energy Distribution 318 csspec - Generates Spectral Energy Distribution
300 ----------------------------------------------- 319 -----------------------------------------------
  320 +Stamp output spectrum (#3662).
  321 +
301 The GModelSpectralFunc spectral model constructor is now used to convert any 322 The GModelSpectralFunc spectral model constructor is now used to convert any
302 spectral model into a file function before spectral model fitting (#3626). 323 spectral model into a file function before spectral model fitting (#3626).
303 324
@@ -313,12 +334,13 @@ None @@ -313,12 +334,13 @@ None
313 334
314 cstsdist - Computes Test Statistic distribution 335 cstsdist - Computes Test Statistic distribution
315 ----------------------------------------------- 336 -----------------------------------------------
316 -The ASCII output file was replaced by a FITS file (#1707). 337 +The ASCII output file was replaced by a FITS file (#1707). The output FITS
  338 +file is stamped (#3662).
317 339
318 340
319 cstsmapmerge - Merge Test Statistic maps 341 cstsmapmerge - Merge Test Statistic maps
320 ---------------------------------------- 342 ----------------------------------------
321 -None 343 +Stamp output TS map (#3662).
322 344
323 345
324 cstsmapsplit - Prepare split Test Statistic computation 346 cstsmapsplit - Prepare split Test Statistic computation
@@ -328,7 +350,7 @@ None @@ -328,7 +350,7 @@ None
328 350
329 csviscube - Generate visibility cube 351 csviscube - Generate visibility cube
330 ------------------------------------ 352 ------------------------------------
331 -None 353 +Stamp output visibility cube (#3662).
332 354
333 355
334 csworkflow - Execute workflow 356 csworkflow - Execute workflow
cscripts/csebins.py
@@ -277,6 +277,9 @@ class csebins(ctools.csobservation): @@ -277,6 +277,9 @@ class csebins(ctools.csobservation):
277 # Save energy boundaries 277 # Save energy boundaries
278 self._ebounds.save(outfile, self._clobber()) 278 self._ebounds.save(outfile, self._clobber())
279 279
  280 + # Stamp energy boundaries
  281 + self._stamp(outfile)
  282 +
280 # Return 283 # Return
281 return 284 return
282 285
cscripts/cslightcrv.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Generates a lightcurve. 3 # Generates a lightcurve.
4 # 4 #
5 -# Copyright (C) 2014-2019 Michael Mayer 5 +# Copyright (C) 2014-2021 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
@@ -673,6 +673,9 @@ class cslightcrv(ctools.csobservation): @@ -673,6 +673,9 @@ class cslightcrv(ctools.csobservation):
673 self._fits = gammalib.GFits() 673 self._fits = gammalib.GFits()
674 self._fits.append(table) 674 self._fits.append(table)
675 675
  676 + # Stamp FITS file
  677 + self._stamp(self._fits)
  678 +
676 # Optionally publish light curve 679 # Optionally publish light curve
677 if self['publish'].boolean(): 680 if self['publish'].boolean():
678 self.publish() 681 self.publish()
cscripts/csmodelsois.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Puts subset of sources in diffuse model cube 3 # Puts subset of sources in diffuse model cube
4 # 4 #
5 -# Copyright (C) 2017-2018 Josh Cardenzana 5 +# Copyright (C) 2017-2021 Josh Cardenzana
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
@@ -40,11 +40,11 @@ class csmodelsois(ctools.cscript): @@ -40,11 +40,11 @@ class csmodelsois(ctools.cscript):
40 def __init__(self, *argv): 40 def __init__(self, *argv):
41 """ 41 """
42 Constructor 42 Constructor
43 - 43 +
44 Parameters 44 Parameters
45 ---------- 45 ----------
46 argv : list of parameters 46 argv : list of parameters
47 - 47 +
48 Raises 48 Raises
49 ------ 49 ------
50 TypeError 50 TypeError
@@ -52,12 +52,12 @@ class csmodelsois(ctools.cscript): @@ -52,12 +52,12 @@ class csmodelsois(ctools.cscript):
52 """ 52 """
53 # Initialise application by calling the base class constructor 53 # Initialise application by calling the base class constructor
54 self._init_cscript(self.__class__.__name__, ctools.__version__, argv) 54 self._init_cscript(self.__class__.__name__, ctools.__version__, argv)
55 - 55 +
56 # Initialize parameters 56 # Initialize parameters
57 self._cubegen = ctools.ctmapcube() 57 self._cubegen = ctools.ctmapcube()
58 self._models = gammalib.GModels() 58 self._models = gammalib.GModels()
59 self._cubemodels = gammalib.GModels() 59 self._cubemodels = gammalib.GModels()
60 - 60 +
61 # Return 61 # Return
62 return 62 return
63 63
@@ -186,15 +186,20 @@ class csmodelsois(ctools.cscript): @@ -186,15 +186,20 @@ class csmodelsois(ctools.cscript):
186 # Save the generated cube if the cube and filename are not empty 186 # Save the generated cube if the cube and filename are not empty
187 if ((not self._cubegen.mapcube().cube().is_empty()) and 187 if ((not self._cubegen.mapcube().cube().is_empty()) and
188 self['outcube'].is_valid()): 188 self['outcube'].is_valid()):
  189 +
  190 + # Save cube
189 self._cubegen.mapcube().save(self['outcube'].filename(), 191 self._cubegen.mapcube().save(self['outcube'].filename(),
190 self['clobber'].boolean()) 192 self['clobber'].boolean())
191 - 193 +
  194 + # Stamp cube
  195 + self._stamp(self['outcube'].filename())
  196 +
192 # If requested, save the updated list of models 197 # If requested, save the updated list of models
193 if self['outmodel'].is_valid(): 198 if self['outmodel'].is_valid():
194 199
195 # Generate a list of models that will be output to file 200 # Generate a list of models that will be output to file
196 outmodels = gammalib.GModels(self._models) 201 outmodels = gammalib.GModels(self._models)
197 - 202 +
198 # Remove all models used in the generated cube 203 # Remove all models used in the generated cube
199 for model in self._cubemodels: 204 for model in self._cubemodels:
200 outmodels.remove(model.name()) 205 outmodels.remove(model.name())
@@ -250,9 +255,9 @@ class csmodelsois(ctools.cscript): @@ -250,9 +255,9 @@ class csmodelsois(ctools.cscript):
250 # Main routine entry point # 255 # Main routine entry point #
251 # ======================== # 256 # ======================== #
252 if __name__ == '__main__': 257 if __name__ == '__main__':
253 - 258 +
254 # Create instance of application 259 # Create instance of application
255 app = csmodelsois(sys.argv) 260 app = csmodelsois(sys.argv)
256 - 261 +
257 # Execute application 262 # Execute application
258 app.execute() 263 app.execute()
cscripts/csobs2caldb.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Creates a calibration database entry for an IACT observation 3 # Creates a calibration database entry for an IACT observation
4 # 4 #
5 -# Copyright (C) 2015-2018 Michael Mayer 5 +# Copyright (C) 2015-2021 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
@@ -375,6 +375,9 @@ class csobs2caldb(ctools.csobservation): @@ -375,6 +375,9 @@ class csobs2caldb(ctools.csobservation):
375 # Save response file 375 # Save response file
376 self._irf_fits.saveto(filename, self._clobber()) 376 self._irf_fits.saveto(filename, self._clobber())
377 377
  378 + # Stamp response file
  379 + self._stamp(filename)
  380 +
378 # Return 381 # Return
379 return 382 return
380 383
cscripts/csphagen.py
@@ -1138,6 +1138,12 @@ class csphagen(ctools.csobservation): @@ -1138,6 +1138,12 @@ class csphagen(ctools.csobservation):
1138 obs.arf().save(arfname, clobber) 1138 obs.arf().save(arfname, clobber)
1139 obs.rmf().save(rmfname, clobber) 1139 obs.rmf().save(rmfname, clobber)
1140 1140
  1141 + # Stamp files
  1142 + self._stamp(onname)
  1143 + self._stamp(offname)
  1144 + self._stamp(arfname)
  1145 + self._stamp(rmfname)
  1146 +
1141 # Log file names 1147 # Log file names
1142 self._log_value(gammalib.NORMAL, 'PHA on file', onname) 1148 self._log_value(gammalib.NORMAL, 'PHA on file', onname)
1143 self._log_value(gammalib.NORMAL, 'PHA off file', offname) 1149 self._log_value(gammalib.NORMAL, 'PHA off file', offname)
cscripts/csphasecrv.py
@@ -318,6 +318,9 @@ class csphasecrv(ctools.csobservation): @@ -318,6 +318,9 @@ class csphasecrv(ctools.csobservation):
318 self._fits = gammalib.GFits() 318 self._fits = gammalib.GFits()
319 self._fits.append(table) 319 self._fits.append(table)
320 320
  321 + # Stamp FITS file
  322 + self._stamp(self._fits)
  323 +
321 # Return 324 # Return
322 return 325 return
323 326
cscripts/csresmap.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Generates a residual map. 3 # Generates a residual map.
4 # 4 #
5 -# Copyright (C) 2014-2020 Michael Mayer 5 +# Copyright (C) 2014-2021 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
@@ -213,7 +213,7 @@ class csresmap(ctools.csobservation): @@ -213,7 +213,7 @@ class csresmap(ctools.csobservation):
213 213
214 # Get outmap parameter 214 # Get outmap parameter
215 outmap = self['outmap'].filename() 215 outmap = self['outmap'].filename()
216 - 216 +
217 # Continue only filename and residual map are valid 217 # Continue only filename and residual map are valid
218 if self._resmap != None: 218 if self._resmap != None:
219 219
@@ -223,6 +223,9 @@ class csresmap(ctools.csobservation): @@ -223,6 +223,9 @@ class csresmap(ctools.csobservation):
223 # Save residual map 223 # Save residual map
224 self._resmap.save(outmap, self['clobber'].boolean()) 224 self._resmap.save(outmap, self['clobber'].boolean())
225 225
  226 + # Stamp residual map
  227 + self._stamp(outmap)
  228 +
226 # Return 229 # Return
227 return 230 return
228 231
@@ -240,7 +243,7 @@ class csresmap(ctools.csobservation): @@ -240,7 +243,7 @@ class csresmap(ctools.csobservation):
240 243
241 # Continue only if residual map is valid 244 # Continue only if residual map is valid
242 if self._resmap != None: 245 if self._resmap != None:
243 - 246 +
244 # Set default name is user name is empty 247 # Set default name is user name is empty
245 if not name: 248 if not name:
246 user_name = self._name() 249 user_name = self._name()
cscripts/csresspec.py
@@ -806,6 +806,9 @@ class csresspec(ctools.csobservation): @@ -806,6 +806,9 @@ class csresspec(ctools.csobservation):
806 table = self._results2table(results[0]) 806 table = self._results2table(results[0])
807 self._fits.append(table) 807 self._fits.append(table)
808 808
  809 + # Stamp FITS file
  810 + self._stamp(self._fits)
  811 +
809 # Return 812 # Return
810 return 813 return
811 814
cscripts/csroot2caldb.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Generate IRFs in CALDB format from a ROOT offaxis performance file 3 # Generate IRFs in CALDB format from a ROOT offaxis performance file
4 # 4 #
5 -# Copyright (C) 2016-2018 Juergen Knoedlseder 5 +# Copyright (C) 2016-2021 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
@@ -406,6 +406,9 @@ class csroot2caldb(ctools.cscript): @@ -406,6 +406,9 @@ class csroot2caldb(ctools.cscript):
406 hdu.card(key, item, 'HDU class') 406 hdu.card(key, item, 'HDU class')
407 hdu.card('HDUVERS', '0.2', 'HDU version') 407 hdu.card('HDUVERS', '0.2', 'HDU version')
408 408
  409 + # Stamp HDU
  410 + self._stamp(hdu)
  411 +
409 # Return 412 # Return
410 return 413 return
411 414
cscripts/csscs.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Spectral component separation script 3 # Spectral component separation script
4 # 4 #
5 -# Copyright (C) 2020 Luigi Tibaldo 5 +# Copyright (C) 2020-2021 Luigi Tibaldo
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
@@ -834,6 +834,9 @@ class csscs(ctools.csobservation): @@ -834,6 +834,9 @@ class csscs(ctools.csobservation):
834 # Fill output Fits 834 # Fill output Fits
835 self._fits = self._fill_fits(results) 835 self._fits = self._fill_fits(results)
836 836
  837 + # Stamp FITS file
  838 + self._stamp(self._fits)
  839 +
837 # Return 840 # Return
838 return 841 return
839 842
cscripts/csspec.py
@@ -1229,6 +1229,9 @@ class csspec(ctools.csobservation): @@ -1229,6 +1229,9 @@ class csspec(ctools.csobservation):
1229 table.append(norm_scan) 1229 table.append(norm_scan)
1230 table.append(dloglike_scan) 1230 table.append(dloglike_scan)
1231 1231
  1232 + # Stamp table
  1233 + self._stamp(table)
  1234 +
1232 # Create the FITS file now 1235 # Create the FITS file now
1233 self._fits = gammalib.GFits() 1236 self._fits = gammalib.GFits()
1234 self._fits.append(table) 1237 self._fits.append(table)
cscripts/cstsmapmerge.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Merge Test Statistic maps 3 # Merge Test Statistic maps
4 # 4 #
5 -# Copyright (C) 2015-2018 Michael Mayer 5 +# Copyright (C) 2015-2021 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
@@ -79,19 +79,19 @@ class cstsmapmerge(ctools.cscript): @@ -79,19 +79,19 @@ class cstsmapmerge(ctools.cscript):
79 fname = f 79 fname = f
80 files.append(fname) 80 files.append(fname)
81 self._files = files 81 self._files = files
82 - 82 +
83 # Handle wild card strings 83 # Handle wild card strings
84 elif '*' in inmaps: 84 elif '*' in inmaps:
85 self._files = glob.glob(inmaps) 85 self._files = glob.glob(inmaps)
86 - 86 +
87 # Handle space-separated list 87 # Handle space-separated list
88 elif ' ' in inmaps: 88 elif ' ' in inmaps:
89 self._files = inmaps.split(' ') 89 self._files = inmaps.split(' ')
90 - 90 +
91 # Handle semi-colon separated list 91 # Handle semi-colon separated list
92 elif ';' in inmaps: 92 elif ';' in inmaps:
93 self._files = inmaps.split(';') 93 self._files = inmaps.split(';')
94 - 94 +
95 # Throw exception if input models cannot be decoded 95 # Throw exception if input models cannot be decoded
96 else: 96 else:
97 msg = 'Parameter "inmaps" must contain either an @ASCII '\ 97 msg = 'Parameter "inmaps" must contain either an @ASCII '\
@@ -108,24 +108,24 @@ class cstsmapmerge(ctools.cscript): @@ -108,24 +108,24 @@ class cstsmapmerge(ctools.cscript):
108 # Get other parameters 108 # Get other parameters
109 self._overwrite = self['overwrite'].boolean() 109 self._overwrite = self['overwrite'].boolean()
110 self._delete = self['delete'].boolean() 110 self._delete = self['delete'].boolean()
111 - 111 +
112 # Read ahead output filename 112 # Read ahead output filename
113 if self._read_ahead(): 113 if self._read_ahead():
114 self['outmap'].filename() 114 self['outmap'].filename()
115 - 115 +
116 # Write input parameters into logger 116 # Write input parameters into logger
117 self._log_parameters(gammalib.TERSE) 117 self._log_parameters(gammalib.TERSE)
118 118
119 # Return 119 # Return
120 return 120 return
121 - 121 +
122 def _init_ts_map(self, fitsfile): 122 def _init_ts_map(self, fitsfile):
123 """ 123 """
124 Initialise Test Statistic map. 124 Initialise Test Statistic map.
125 """ 125 """
126 # Set filename 126 # Set filename
127 self._in_filename = fitsfile 127 self._in_filename = fitsfile
128 - 128 +
129 # Open FITS file 129 # Open FITS file
130 fits = gammalib.GFits(fitsfile) 130 fits = gammalib.GFits(fitsfile)
131 131
@@ -134,26 +134,26 @@ class cstsmapmerge(ctools.cscript): @@ -134,26 +134,26 @@ class cstsmapmerge(ctools.cscript):
134 self._tsmap.read(fits[0]) 134 self._tsmap.read(fits[0])
135 self._statusmap = gammalib.GSkyMap() 135 self._statusmap = gammalib.GSkyMap()
136 self._statusmap.read(fits['STATUS MAP']) 136 self._statusmap.read(fits['STATUS MAP'])
137 - 137 +
138 # Get other maps 138 # Get other maps
139 self._maps = [] 139 self._maps = []
140 self._mapnames = [] 140 self._mapnames = []
141 - 141 +
142 # Loop over extensions 142 # Loop over extensions
143 for hdu in fits: 143 for hdu in fits:
144 - 144 +
145 # Leave out primary and status extension 145 # Leave out primary and status extension
146 if hdu.extname() != 'IMAGE' and hdu.extname() != 'STATUS MAP': 146 if hdu.extname() != 'IMAGE' and hdu.extname() != 'STATUS MAP':
147 - 147 +
148 # Add present maps 148 # Add present maps
149 skymap = gammalib.GSkyMap() 149 skymap = gammalib.GSkyMap()
150 skymap.read(hdu) 150 skymap.read(hdu)
151 self._maps.append(skymap) 151 self._maps.append(skymap)
152 self._mapnames.append(hdu.extname()) 152 self._mapnames.append(hdu.extname())
153 -  
154 - # Close FITS file 153 +
  154 + # Close FITS file
155 fits.close() 155 fits.close()
156 - 156 +
157 # Return 157 # Return
158 return 158 return
159 159
@@ -172,24 +172,24 @@ class cstsmapmerge(ctools.cscript): @@ -172,24 +172,24 @@ class cstsmapmerge(ctools.cscript):
172 add_tsmap.read(fits[0]) 172 add_tsmap.read(fits[0])
173 add_statusmap = gammalib.GSkyMap() 173 add_statusmap = gammalib.GSkyMap()
174 add_statusmap.read(fits['STATUS MAP']) 174 add_statusmap.read(fits['STATUS MAP'])
175 - 175 +
176 # Get other maps 176 # Get other maps
177 add_maps = [] 177 add_maps = []
178 - 178 +
179 # Loop over extensions 179 # Loop over extensions
180 for hdu in fits: 180 for hdu in fits:
181 - 181 +
182 # Leave out primary and status extension 182 # Leave out primary and status extension
183 if hdu.extname() != 'IMAGE' and hdu.extname() != 'STATUS MAP': 183 if hdu.extname() != 'IMAGE' and hdu.extname() != 'STATUS MAP':
184 - 184 +
185 # Add present maps 185 # Add present maps
186 skymap = gammalib.GSkyMap() 186 skymap = gammalib.GSkyMap()
187 skymap.read(hdu) 187 skymap.read(hdu)
188 add_maps.append(skymap) 188 add_maps.append(skymap)
189 - 189 +
190 # Close FITS file 190 # Close FITS file
191 fits.close() 191 fits.close()
192 - 192 +
193 # Compare size of maps 193 # Compare size of maps
194 if not len(add_maps) == len(self._maps): 194 if not len(add_maps) == len(self._maps):
195 msg = 'Cannot merge map "'+fitsfile+'" into map "'+\ 195 msg = 'Cannot merge map "'+fitsfile+'" into map "'+\
@@ -197,12 +197,12 @@ class cstsmapmerge(ctools.cscript): @@ -197,12 +197,12 @@ class cstsmapmerge(ctools.cscript):
197 'between both maps is different.' 197 'between both maps is different.'
198 raise RuntimeError(msg) 198 raise RuntimeError(msg)
199 199
200 - # Loop over bins 200 + # Loop over bins
201 for i in range(self._tsmap.npix()): 201 for i in range(self._tsmap.npix()):
202 202
203 # Consider only bins that have been computed 203 # Consider only bins that have been computed
204 if add_statusmap[i] > -0.5: 204 if add_statusmap[i] > -0.5:
205 - 205 +
206 # Raise exception if this bin has already been computed 206 # Raise exception if this bin has already been computed
207 if self._statusmap[i] > -0.5 and not self._overwrite: 207 if self._statusmap[i] > -0.5 and not self._overwrite:
208 msg = 'Attempt to merge bin which apparently has '+\ 208 msg = 'Attempt to merge bin which apparently has '+\
@@ -210,17 +210,17 @@ class cstsmapmerge(ctools.cscript): @@ -210,17 +210,17 @@ class cstsmapmerge(ctools.cscript):
210 'contains already merged bins. Set hidden '+\ 210 'contains already merged bins. Set hidden '+\
211 'parameter "overwrite=yes" to avoid this error.' 211 'parameter "overwrite=yes" to avoid this error.'
212 raise RuntimeError(msg) 212 raise RuntimeError(msg)
213 - 213 +
214 # Copy TS values 214 # Copy TS values
215 self._tsmap[i] = add_tsmap[i] 215 self._tsmap[i] = add_tsmap[i]
216 -  
217 - # Copy status 216 +
  217 + # Copy status
218 self._statusmap[i] = add_statusmap[i] 218 self._statusmap[i] = add_statusmap[i]
219 - 219 +
220 # Loop over maps and copy entries 220 # Loop over maps and copy entries
221 for j in range(len(self._maps)): 221 for j in range(len(self._maps)):
222 self._maps[j][i] = add_maps[j][i] 222 self._maps[j][i] = add_maps[j][i]
223 - 223 +
224 # Return 224 # Return
225 return 225 return
226 226
@@ -258,21 +258,21 @@ class cstsmapmerge(ctools.cscript): @@ -258,21 +258,21 @@ class cstsmapmerge(ctools.cscript):
258 258
259 # Get parameters 259 # Get parameters
260 self._get_parameters() 260 self._get_parameters()
261 - 261 +
262 # Write header into logger 262 # Write header into logger
263 self._log_header1(gammalib.TERSE, 'Merge TS maps') 263 self._log_header1(gammalib.TERSE, 'Merge TS maps')
264 - 264 +
265 # Initialise file to start with 265 # Initialise file to start with
266 file0 = '' 266 file0 = ''
267 self._merged_files = [] 267 self._merged_files = []
268 - 268 +
269 # Test files for the entry status map. Use the first one to appear 269 # Test files for the entry status map. Use the first one to appear
270 # useful 270 # useful
271 for fitsfile in self._files: 271 for fitsfile in self._files:
272 272
273 # Skip file if it's not a FITS file 273 # Skip file if it's not a FITS file
274 if not gammalib.GFilename(fitsfile).is_fits(): 274 if not gammalib.GFilename(fitsfile).is_fits():
275 - 275 +
276 # Log message 276 # Log message
277 self._log_value(gammalib.EXPLICIT, 'Skip file', fitsfile + 277 self._log_value(gammalib.EXPLICIT, 'Skip file', fitsfile +
278 ' (not a FITS file)') 278 ' (not a FITS file)')
@@ -285,32 +285,32 @@ class cstsmapmerge(ctools.cscript): @@ -285,32 +285,32 @@ class cstsmapmerge(ctools.cscript):
285 285
286 # If file contains a status map then use it 286 # If file contains a status map then use it
287 if fits.contains('STATUS MAP'): 287 if fits.contains('STATUS MAP'):
288 - 288 +
289 # Close FITS file 289 # Close FITS file
290 fits.close() 290 fits.close()
291 - 291 +
292 # Set filename to initial filename 292 # Set filename to initial filename
293 file0 = fitsfile 293 file0 = fitsfile
294 - 294 +
295 # Log message 295 # Log message
296 pix_info = ' (%d TS pixels computed)' % \ 296 pix_info = ' (%d TS pixels computed)' % \
297 self._get_number_of_ts_pixels(fitsfile) 297 self._get_number_of_ts_pixels(fitsfile)
298 self._log_value(gammalib.TERSE, 'Initial TS map file', 298 self._log_value(gammalib.TERSE, 'Initial TS map file',
299 fitsfile + pix_info) 299 fitsfile + pix_info)
300 - 300 +
301 # Leave loop 301 # Leave loop
302 break 302 break
303 303
304 # ... otherwise signal that file is useless 304 # ... otherwise signal that file is useless
305 else: 305 else:
306 - 306 +
307 # Close fits file 307 # Close fits file
308 - fits.close()  
309 -  
310 - # Info message 308 + fits.close()
  309 +
  310 + # Info message
311 self._log_value(gammalib.EXPLICIT, 'Skip file', fitsfile + 311 self._log_value(gammalib.EXPLICIT, 'Skip file', fitsfile +
312 ' (no "STATUS MAP" extension)') 312 ' (no "STATUS MAP" extension)')
313 - 313 +
314 # Continue 314 # Continue
315 continue 315 continue
316 316
@@ -323,22 +323,22 @@ class cstsmapmerge(ctools.cscript): @@ -323,22 +323,22 @@ class cstsmapmerge(ctools.cscript):
323 323
324 # ... otherwise merge files 324 # ... otherwise merge files
325 else: 325 else:
326 - 326 +
327 # Copy file list 327 # Copy file list
328 workfiles = self._files 328 workfiles = self._files
329 - 329 +
330 # Remove entry which will be used to initalise the map 330 # Remove entry which will be used to initalise the map
331 workfiles.remove(file0) 331 workfiles.remove(file0)
332 - 332 +
333 # Initialise map from first file 333 # Initialise map from first file
334 self._init_ts_map(file0) 334 self._init_ts_map(file0)
335 - 335 +
336 # Append to added files 336 # Append to added files
337 self._merged_files.append(file0) 337 self._merged_files.append(file0)
338 - 338 +
339 # Loop over files 339 # Loop over files
340 for fitsfile in workfiles: 340 for fitsfile in workfiles:
341 - 341 +
342 # Skip if file is not FITS 342 # Skip if file is not FITS
343 if not gammalib.GFilename(fitsfile).is_fits(): 343 if not gammalib.GFilename(fitsfile).is_fits():
344 self._log_value(gammalib.EXPLICIT, 'Skip file', fitsfile + 344 self._log_value(gammalib.EXPLICIT, 'Skip file', fitsfile +
@@ -347,7 +347,7 @@ class cstsmapmerge(ctools.cscript): @@ -347,7 +347,7 @@ class cstsmapmerge(ctools.cscript):
347 347
348 # Open FITS file 348 # Open FITS file
349 fits = gammalib.GFits(fitsfile) 349 fits = gammalib.GFits(fitsfile)
350 - 350 +
351 # Skip if file does not contain status map 351 # Skip if file does not contain status map
352 if not fits.contains('STATUS MAP'): 352 if not fits.contains('STATUS MAP'):
353 fits.close() 353 fits.close()
@@ -357,19 +357,19 @@ class cstsmapmerge(ctools.cscript): @@ -357,19 +357,19 @@ class cstsmapmerge(ctools.cscript):
357 357
358 # Close FITS file 358 # Close FITS file
359 fits.close() 359 fits.close()
360 - 360 +
361 # Logging 361 # Logging
362 pix_info = ' (%d TS pixels computed)' % \ 362 pix_info = ' (%d TS pixels computed)' % \
363 self._get_number_of_ts_pixels(fitsfile) 363 self._get_number_of_ts_pixels(fitsfile)
364 self._log_value(gammalib.TERSE, 'Merge TS map file', 364 self._log_value(gammalib.TERSE, 'Merge TS map file',
365 fitsfile + pix_info) 365 fitsfile + pix_info)
366 - 366 +
367 # Merge TS map 367 # Merge TS map
368 self._merge_ts_map(fitsfile) 368 self._merge_ts_map(fitsfile)
369 - 369 +
370 # Append FITS file to merged files 370 # Append FITS file to merged files
371 self._merged_files.append(fitsfile) 371 self._merged_files.append(fitsfile)
372 - 372 +
373 # Return 373 # Return
374 return 374 return
375 375
@@ -380,17 +380,17 @@ class cstsmapmerge(ctools.cscript): @@ -380,17 +380,17 @@ class cstsmapmerge(ctools.cscript):
380 380
381 # Get output filename in case it was not read ahead 381 # Get output filename in case it was not read ahead
382 outmap = self['outmap'].filename() 382 outmap = self['outmap'].filename()
383 - 383 +
384 # Create FITS file 384 # Create FITS file
385 fits = gammalib.GFits() 385 fits = gammalib.GFits()
386 - 386 +
387 # Write TS map into primary 387 # Write TS map into primary
388 self._tsmap.write(fits) 388 self._tsmap.write(fits)
389 389
390 # Loop over maps and write them to fits 390 # Loop over maps and write them to fits
391 for i in range(len(self._maps)): 391 for i in range(len(self._maps)):
392 self._maps[i].write(fits) 392 self._maps[i].write(fits)
393 - 393 +
394 # Set map names as extensions 394 # Set map names as extensions
395 for i in range(len(self._mapnames)): 395 for i in range(len(self._mapnames)):
396 fits[i+1].extname(self._mapnames[i]) 396 fits[i+1].extname(self._mapnames[i])
@@ -398,7 +398,10 @@ class cstsmapmerge(ctools.cscript): @@ -398,7 +398,10 @@ class cstsmapmerge(ctools.cscript):
398 # Treat status map separately 398 # Treat status map separately
399 self._statusmap.write(fits) 399 self._statusmap.write(fits)
400 fits[fits.size()-1].extname('STATUS MAP') 400 fits[fits.size()-1].extname('STATUS MAP')
401 - 401 +
  402 + # Stamp FITS file
  403 + self._stamp(fits)
  404 +
402 # Check if map is fully done 405 # Check if map is fully done
403 bins_merged = 0 406 bins_merged = 0
404 for pix in self._statusmap: 407 for pix in self._statusmap:
@@ -407,50 +410,50 @@ class cstsmapmerge(ctools.cscript): @@ -407,50 +410,50 @@ class cstsmapmerge(ctools.cscript):
407 410
408 # Set boolean if map is fully done 411 # Set boolean if map is fully done
409 done = (bins_merged == self._tsmap.npix()) 412 done = (bins_merged == self._tsmap.npix())
410 - 413 +
411 # Log summary header 414 # Log summary header
412 self._log_header2(gammalib.TERSE, 'Merging Summary') 415 self._log_header2(gammalib.TERSE, 'Merging Summary')
413 - 416 +
414 # Write computing status if we are not done yet 417 # Write computing status if we are not done yet
415 if not done: 418 if not done:
416 - 419 +
417 # Log bins that were computed and those that were missing 420 # Log bins that were computed and those that were missing
418 self._log_value(gammalib.TERSE, 'TS map bins', self._tsmap.npix()) 421 self._log_value(gammalib.TERSE, 'TS map bins', self._tsmap.npix())
419 self._log_value(gammalib.TERSE, 'Bins computed and merged', bins_merged ) 422 self._log_value(gammalib.TERSE, 'Bins computed and merged', bins_merged )
420 self._log_value(gammalib.TERSE, 'Bins missing', self._tsmap.npix() - bins_merged) 423 self._log_value(gammalib.TERSE, 'Bins missing', self._tsmap.npix() - bins_merged)
421 - 424 +
422 else: 425 else:
423 - 426 +
424 # Write success message 427 # Write success message
425 self._log_string(gammalib.TERSE, 'TS map was fully computed and successfully merged') 428 self._log_string(gammalib.TERSE, 'TS map was fully computed and successfully merged')
426 - 429 +
427 # Write header 430 # Write header
428 self._log_header1(gammalib.TERSE, 'Save TS map') 431 self._log_header1(gammalib.TERSE, 'Save TS map')
429 - 432 +
430 # Log filename 433 # Log filename
431 self._log_value(gammalib.TERSE, 'TS map file', outmap.url()) 434 self._log_value(gammalib.TERSE, 'TS map file', outmap.url())
432 - 435 +
433 # Save FITS file 436 # Save FITS file
434 - fits.saveto(outmap, self._clobber()) 437 + fits.saveto(outmap, self._clobber())
435 438
436 # Delete TS input maps if requested and map is fully done 439 # Delete TS input maps if requested and map is fully done
437 if self._delete and done: 440 if self._delete and done:
438 - 441 +
439 # Log header 442 # Log header
440 self._log_header2(gammalib.TERSE, 'Delete slices TS map files') 443 self._log_header2(gammalib.TERSE, 'Delete slices TS map files')
441 - 444 +
442 # Loop over sliced files 445 # Loop over sliced files
443 for filename in self._merged_files: 446 for filename in self._merged_files:
444 - 447 +
445 # Remove file 448 # Remove file
446 os.remove(filename) 449 os.remove(filename)
447 - 450 +
448 # Log message about file 451 # Log message about file
449 self._log_value(gammalib.TERSE,'Deleted input file', filename) 452 self._log_value(gammalib.TERSE,'Deleted input file', filename)
450 - 453 +
451 # Return 454 # Return
452 return 455 return
453 - 456 +
454 457
455 # ======================== # 458 # ======================== #
456 # Main routine entry point # 459 # Main routine entry point #
@@ -459,6 +462,6 @@ if __name__ == '__main__': @@ -459,6 +462,6 @@ if __name__ == '__main__':
459 462
460 # Create instance of application 463 # Create instance of application
461 app = cstsmapmerge(sys.argv) 464 app = cstsmapmerge(sys.argv)
462 - 465 +
463 # Execute application 466 # Execute application
464 app.execute() 467 app.execute()
cscripts/csviscube.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Compute a visibility cube 3 # Compute a visibility cube
4 # 4 #
5 -# Copyright (C) 2016-2019 Juergen Knoedlseder 5 +# Copyright (C) 2016-2021 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
@@ -671,6 +671,9 @@ class csviscube(ctools.cscript): @@ -671,6 +671,9 @@ class csviscube(ctools.cscript):
671 # Save the results in VISIBILITY table extension 671 # Save the results in VISIBILITY table extension
672 self._save_results(outfile, self['clobber'].boolean()) 672 self._save_results(outfile, self['clobber'].boolean())
673 673
  674 + # Stamp visibility cube
  675 + self._stamp(outfile)
  676 +
674 # Return 677 # Return
675 return 678 return
676 679
doc/source/admin/release_history/2.0.rst
@@ -24,6 +24,8 @@ Bug fixes @@ -24,6 +24,8 @@ Bug fixes
24 Improvements 24 Improvements
25 ------------ 25 ------------
26 26
  27 +* [`3662 <https://cta-redmine.irap.omp.eu/issues/3662>`_] -
  28 + Stamp all output FITS files
27 * [`3668 <https://cta-redmine.irap.omp.eu/issues/3668>`_] - 29 * [`3668 <https://cta-redmine.irap.omp.eu/issues/3668>`_] -
28 Add source counts constraints to :ref:`cssens` 30 Add source counts constraints to :ref:`cssens`
29 * [`3630 <https://cta-redmine.irap.omp.eu/issues/3630>`_] - 31 * [`3630 <https://cta-redmine.irap.omp.eu/issues/3630>`_] -
src/ctbin/ctbin.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbin - Event binning tool * 2 * ctbin - Event binning tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2020 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2021 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 *
@@ -509,6 +509,9 @@ void ctbin::save(void) @@ -509,6 +509,9 @@ void ctbin::save(void)
509 // Save cube 509 // Save cube
510 obs->save(outobs, clobber()); 510 obs->save(outobs, clobber());
511 511
  512 + // Stamp counts cube
  513 + stamp(outobs);
  514 +
512 } // endif: observation was valid 515 } // endif: observation was valid
513 516
514 } // endif: outobs file was valid 517 } // endif: outobs file was valid
@@ -534,6 +537,9 @@ void ctbin::save(void) @@ -534,6 +537,9 @@ void ctbin::save(void)
534 // Save counts cube 537 // Save counts cube
535 obs->save(filename, clobber()); 538 obs->save(filename, clobber());
536 539
  540 + // Stamp counts cube
  541 + stamp(filename);
  542 +
537 } // endif: observation was valid 543 } // endif: observation was valid
538 544
539 } // endfor: looped over all observations 545 } // endfor: looped over all observations
src/ctbkgcube/ctbkgcube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctbkgcube - Background cube generation tool * 2 * ctbkgcube - Background cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2018 by Chia-Chun Lu * 4 + * copyright (C) 2014-2021 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 *
@@ -365,11 +365,13 @@ void ctbkgcube::save(void) @@ -365,11 +365,13 @@ void ctbkgcube::save(void)
365 if ((*this)["outcube"].is_valid() && !m_background.cube().is_empty()) { 365 if ((*this)["outcube"].is_valid() && !m_background.cube().is_empty()) {
366 366
367 // Get background cube file name 367 // Get background cube file name
368 - m_outcube = (*this)["outcube"].filename(); 368 + m_outcube = (*this)["outcube"].filename();
369 369
370 // Save background cube 370 // Save background cube
371 m_background.save(m_outcube, clobber()); 371 m_background.save(m_outcube, clobber());
372 372
  373 + // Stamp background cube
  374 + stamp(m_outcube);
373 } 375 }
374 376
375 // Save model definition file if requested 377 // Save model definition file if requested
src/ctcubemask/ctcubemask.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctcubemask - Cube filter tool * 2 * ctcubemask - Cube filter tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2018 by Chia-Chun Lu * 4 + * copyright (C) 2014-2021 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 *
@@ -690,7 +690,10 @@ void ctcubemask::save_fits(void) @@ -690,7 +690,10 @@ void ctcubemask::save_fits(void)
690 690
691 // Save counts cube 691 // Save counts cube
692 obs->save(m_outcube, clobber()); 692 obs->save(m_outcube, clobber());
693 - 693 +
  694 + // Stamp counts cube
  695 + stamp(m_outcube);
  696 +
694 } // endif: observation was a CTA observation 697 } // endif: observation was a CTA observation
695 698
696 } 699 }
@@ -737,6 +740,9 @@ void ctcubemask::save_xml(void) @@ -737,6 +740,9 @@ void ctcubemask::save_xml(void)
737 // Save counts cube 740 // Save counts cube
738 obs->save(outfile, clobber()); 741 obs->save(outfile, clobber());
739 742
  743 + // Stamp counts cube
  744 + stamp(outfile);
  745 +
740 } // endif: observation was a CTA observations 746 } // endif: observation was a CTA observations
741 747
742 } // endfor: looped over observations 748 } // endfor: looped over observations
src/ctedispcube/ctedispcube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctedispcube - Energy dispersion cube generation tool * 2 * ctedispcube - Energy dispersion cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2016-2018 by Maria Haupt * 4 + * copyright (C) 2016-2021 by Maria Haupt *
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 *
@@ -270,6 +270,9 @@ void ctedispcube::save(void) @@ -270,6 +270,9 @@ void ctedispcube::save(void)
270 // Save energy dispersion cube 270 // Save energy dispersion cube
271 m_edispcube.save(m_outcube, clobber()); 271 m_edispcube.save(m_outcube, clobber());
272 272
  273 + // Stamp energy dispersion cube
  274 + stamp(m_outcube);
  275 +
273 } 276 }
274 277
275 // Write into logger what has been done 278 // Write into logger what has been done
src/ctexpcube/ctexpcube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctexpcube - Exposure cube generation tool * 2 * ctexpcube - Exposure cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2018 by Juergen Knoedlseder * 4 + * copyright (C) 2014-2021 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 *
@@ -266,6 +266,9 @@ void ctexpcube::save(void) @@ -266,6 +266,9 @@ void ctexpcube::save(void)
266 // Save exposure cube 266 // Save exposure cube
267 m_expcube.save(m_outcube, clobber()); 267 m_expcube.save(m_outcube, clobber());
268 268
  269 + // Stamp exposure cube
  270 + stamp(m_outcube);
  271 +
269 } 272 }
270 273
271 // Write into logger what has been done 274 // Write into logger what has been done
src/ctfindvar/ctfindvar.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctfindvar - Time variability search tool * 2 * ctfindvar - Time variability search tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2018-2020 by Simon Bonnefoy * 4 + * copyright (C) 2018-2021 by Simon Bonnefoy *
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 *
@@ -273,6 +273,7 @@ void ctfindvar::save(void) @@ -273,6 +273,7 @@ void ctfindvar::save(void)
273 // counts cube was saved. 273 // counts cube was saved.
274 if (!m_counts.is_empty()) { 274 if (!m_counts.is_empty()) {
275 m_counts.save(outcube, (*this)["clobber"].boolean()); 275 m_counts.save(outcube, (*this)["clobber"].boolean());
  276 + stamp(outcube);
276 log_value(TERSE, "Counts cube file", outcube.url()); 277 log_value(TERSE, "Counts cube file", outcube.url());
277 } 278 }
278 else { 279 else {
@@ -298,6 +299,9 @@ void ctfindvar::save(void) @@ -298,6 +299,9 @@ void ctfindvar::save(void)
298 // Write source histograms 299 // Write source histograms
299 write_source_histograms(fits); 300 write_source_histograms(fits);
300 301
  302 + // Stamp FITS file
  303 + stamp(fits);
  304 +
301 // Save significance map 305 // Save significance map
302 fits.saveto(outmap, (*this)["clobber"].boolean()); 306 fits.saveto(outmap, (*this)["clobber"].boolean());
303 307
src/ctmapcube/ctmapcube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctmapcube - Map cube generation tool * 2 * ctmapcube - Map cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2016-2018 by Juergen Knoedlseder * 4 + * copyright (C) 2016-2021 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 *
@@ -231,6 +231,8 @@ void ctmapcube::save(void) @@ -231,6 +231,8 @@ void ctmapcube::save(void)
231 // Save map cube 231 // Save map cube
232 m_cube.save(m_outcube, clobber()); 232 m_cube.save(m_outcube, clobber());
233 233
  234 + // Stamp map cube
  235 + stamp(m_outcube);
234 } 236 }
235 237
236 // Write into logger what has been done 238 // Write into logger what has been done
src/ctmodel/ctmodel.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctmodel - Model cube generation tool * 2 * ctmodel - Model cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2019 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2021 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 *
@@ -326,6 +326,10 @@ void ctmodel::save(void) @@ -326,6 +326,10 @@ void ctmodel::save(void)
326 326
327 // Save cube 327 // Save cube
328 m_cube.save(m_outcube, clobber()); 328 m_cube.save(m_outcube, clobber());
  329 +
  330 + // Stamp model cube
  331 + stamp(m_outcube);
  332 +
329 } 333 }
330 334
331 // Write into logger what has been done 335 // Write into logger what has been done
src/ctobssim/ctobssim.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctobssim - Observation simulator tool * 2 * ctobssim - Observation simulator tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2011-2020 by Juergen Knoedlseder * 4 + * copyright (C) 2011-2021 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 *
@@ -1712,6 +1712,9 @@ void ctobssim::save_fits(void) @@ -1712,6 +1712,9 @@ void ctobssim::save_fits(void)
1712 // Save observation into FITS file 1712 // Save observation into FITS file
1713 obs->save(m_outevents, clobber()); 1713 obs->save(m_outevents, clobber());
1714 1714
  1715 + // Stamp FITS file
  1716 + stamp(m_outevents);
  1717 +
1715 } // endif: event list has not yet been saved and disposed 1718 } // endif: event list has not yet been saved and disposed
1716 1719
1717 // Return 1720 // Return
@@ -1764,6 +1767,9 @@ void ctobssim::save_xml(void) @@ -1764,6 +1767,9 @@ void ctobssim::save_xml(void)
1764 // Save observation into FITS file 1767 // Save observation into FITS file
1765 obs->save(outfile, clobber()); 1768 obs->save(outfile, clobber());
1766 1769
  1770 + // Stamp FITS file
  1771 + stamp(outfile);
  1772 +
1767 } 1773 }
1768 1774
1769 } // endif: observation was a CTA observations 1775 } // endif: observation was a CTA observations
src/ctpsfcube/ctpsfcube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctpsfcube - PSF cube generation tool * 2 * ctpsfcube - PSF cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2018 by Chia-Chun Lu * 4 + * copyright (C) 2014-2021 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 *
@@ -257,6 +257,9 @@ void ctpsfcube::save(void) @@ -257,6 +257,9 @@ void ctpsfcube::save(void)
257 // Save PSF cube 257 // Save PSF cube
258 m_psfcube.save(m_outcube, clobber()); 258 m_psfcube.save(m_outcube, clobber());
259 259
  260 + // Stamp PSF cube
  261 + stamp(m_outcube);
  262 +
260 } 263 }
261 264
262 // Write into logger what has been done 265 // Write into logger what has been done
src/ctskymap/ctskymap.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctskymap - Sky mapping tool * 2 * ctskymap - Sky mapping tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2011-2019 by Juergen Knoedlseder * 4 + * copyright (C) 2011-2021 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 *
@@ -322,6 +322,10 @@ void ctskymap::construct_fits(void) @@ -322,6 +322,10 @@ void ctskymap::construct_fits(void)
322 322
323 } // endif: background subtraction was requested 323 } // endif: background subtraction was requested
324 324
  325 + // Stamp FITS file
  326 + stamp(m_fits);
  327 +
  328 + // Return
325 return; 329 return;
326 } 330 }
327 331
src/cttsmap/cttsmap.cpp
@@ -419,6 +419,9 @@ void cttsmap::save(void) @@ -419,6 +419,9 @@ void cttsmap::save(void)
419 m_statusmap.write(fits); 419 m_statusmap.write(fits);
420 fits[fits.size()-1]->extname("STATUS MAP"); 420 fits[fits.size()-1]->extname("STATUS MAP");
421 421
  422 + // Stamp FITS file
  423 + stamp(fits);
  424 +
422 // Save FITS file 425 // Save FITS file
423 fits.saveto(m_outmap, clobber()); 426 fits.saveto(m_outmap, clobber());
424 427
src/support/ctool.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctool - ctool base class * 2 * ctool - ctool base class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2020 by Juergen Knoedlseder * 4 + * copyright (C) 2014-2021 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 *
@@ -2266,6 +2266,9 @@ void ctool::save_event_list(const GCTAObservation* obs, @@ -2266,6 +2266,9 @@ void ctool::save_event_list(const GCTAObservation* obs,
2266 // Close input file 2266 // Close input file
2267 infits.close(); 2267 infits.close();
2268 2268
  2269 + // Stamp FITS file
  2270 + stamp(outfits);
  2271 +
2269 // Save file to disk and close it (we need both operations) 2272 // Save file to disk and close it (we need both operations)
2270 outfits.saveto(outname.url(), clobber()); 2273 outfits.saveto(outname.url(), clobber());
2271 outfits.close(); 2274 outfits.close();