Commit 701aef535050d189e0fe0ba7a0604c8ba020bbcf
1 parent
bbd08db3
Use gammalib.parformat for output filename logging.
Showing
2 changed files
with
14 additions
and
12 deletions
cscripts/csresmap.py
| @@ -49,7 +49,6 @@ class csresmap(ctools.cscript): | @@ -49,7 +49,6 @@ class csresmap(ctools.cscript): | ||
| 49 | self._algorithm = "SUB" | 49 | self._algorithm = "SUB" |
| 50 | self._resmap = None | 50 | self._resmap = None |
| 51 | self._modcube = "NONE" | 51 | self._modcube = "NONE" |
| 52 | - self._outmap = "NONE" | ||
| 53 | self._use_maps = False | 52 | self._use_maps = False |
| 54 | self._skip_binning = False | 53 | self._skip_binning = False |
| 55 | self._publish = False | 54 | self._publish = False |
| @@ -158,7 +157,7 @@ class csresmap(ctools.cscript): | @@ -158,7 +157,7 @@ class csresmap(ctools.cscript): | ||
| 158 | 157 | ||
| 159 | # Read ahead output parameters | 158 | # Read ahead output parameters |
| 160 | if (self._read_ahead()): | 159 | if (self._read_ahead()): |
| 161 | - self._outmap = self["outmap"].filename() | 160 | + self["outmap"].filename() |
| 162 | 161 | ||
| 163 | # Write input parameters into logger | 162 | # Write input parameters into logger |
| 164 | if self._logTerse(): | 163 | if self._logTerse(): |
| @@ -324,17 +323,19 @@ class csresmap(ctools.cscript): | @@ -324,17 +323,19 @@ class csresmap(ctools.cscript): | ||
| 324 | self._log.header1("Save residual map") | 323 | self._log.header1("Save residual map") |
| 325 | 324 | ||
| 326 | # Get outmap parameter | 325 | # Get outmap parameter |
| 327 | - self._outmap = self["outmap"].filename() | 326 | + outmap = self["outmap"].filename() |
| 328 | 327 | ||
| 329 | # Continue only filename and residual map are valid | 328 | # Continue only filename and residual map are valid |
| 330 | - if self._outmap != "NONE" and self._resmap != None: | 329 | + if self._resmap != None: |
| 331 | 330 | ||
| 332 | # Log file name | 331 | # Log file name |
| 333 | if self._logTerse(): | 332 | if self._logTerse(): |
| 334 | - self._log("Save residual map into \""+self._outmap+"\".\n") | 333 | + self._log(gammalib.parformat("Residual map file")) |
| 334 | + self._log(outmap.url()) | ||
| 335 | + self._log("\n") | ||
| 335 | 336 | ||
| 336 | # Save residual map | 337 | # Save residual map |
| 337 | - self._resmap.save(self._outmap, self._clobber) | 338 | + self._resmap.save(outmap, self._clobber) |
| 338 | 339 | ||
| 339 | # Return | 340 | # Return |
| 340 | return | 341 | return |
cscripts/csspec.py
| @@ -51,7 +51,6 @@ class csspec(ctools.cscript): | @@ -51,7 +51,6 @@ class csspec(ctools.cscript): | ||
| 51 | self._binned_mode = False | 51 | self._binned_mode = False |
| 52 | self._srcname = "" | 52 | self._srcname = "" |
| 53 | self._edisp = False | 53 | self._edisp = False |
| 54 | - self._outfile = "NONE" | ||
| 55 | self._calc_ulimit = True | 54 | self._calc_ulimit = True |
| 56 | self._calc_ts = True | 55 | self._calc_ts = True |
| 57 | self._fix_bkg = False | 56 | self._fix_bkg = False |
| @@ -121,7 +120,7 @@ class csspec(ctools.cscript): | @@ -121,7 +120,7 @@ class csspec(ctools.cscript): | ||
| 121 | 120 | ||
| 122 | # Read ahead output parameters | 121 | # Read ahead output parameters |
| 123 | if self._read_ahead(): | 122 | if self._read_ahead(): |
| 124 | - self._outfile = self["outfile"].filename() | 123 | + self["outfile"].filename() |
| 125 | 124 | ||
| 126 | # Write input parameters into logger | 125 | # Write input parameters into logger |
| 127 | if self._logTerse(): | 126 | if self._logTerse(): |
| @@ -507,17 +506,19 @@ class csspec(ctools.cscript): | @@ -507,17 +506,19 @@ class csspec(ctools.cscript): | ||
| 507 | self._log.header1("Save spectrum") | 506 | self._log.header1("Save spectrum") |
| 508 | 507 | ||
| 509 | # Get outmap parameter | 508 | # Get outmap parameter |
| 510 | - self._outfile = self["outfile"].filename() | 509 | + outfile = self["outfile"].filename() |
| 511 | 510 | ||
| 512 | # Continue only filename and residual map are valid | 511 | # Continue only filename and residual map are valid |
| 513 | - if self._outfile != "NONE" and self._fits != None: | 512 | + if self._fits != None: |
| 514 | 513 | ||
| 515 | # Log file name | 514 | # Log file name |
| 516 | if self._logTerse(): | 515 | if self._logTerse(): |
| 517 | - self._log("Save spectrum into \""+self._outfile+"\".\n") | 516 | + self._log(gammalib.parformat("Spectrum file")) |
| 517 | + self._log(outfile.url()) | ||
| 518 | + self._log("\n") | ||
| 518 | 519 | ||
| 519 | # Save spectrum | 520 | # Save spectrum |
| 520 | - self._fits.saveto(self._outfile, self._clobber) | 521 | + self._fits.saveto(outfile, self._clobber) |
| 521 | 522 | ||
| 522 | # Return | 523 | # Return |
| 523 | return | 524 | return |