Commit 3f7bda51cc4a80968d9fa92fae2d1018b6196727
1 parent
39bdcd2a
Add kludge for backward compatibility with already existing DRW files
Showing
1 changed file
with
9 additions
and
5 deletions
modules/comscripts/comobsbin.py
... | ... | @@ -503,23 +503,27 @@ class comobsbin(ctools.csobservation): |
503 | 503 | drwnames = [] |
504 | 504 | engindex = [] |
505 | 505 | |
506 | - # Get DRW method and suffix in lower case | |
506 | + # Get DRW method and suffix in lower case. Add a kludge that avoids appending | |
507 | + # a suffix for the 'phibar' method with a timebin of 300 for backwards | |
508 | + # compatibility with already existing DRW files. | |
507 | 509 | drwmethod = gammalib.tolower(self['drwmethod'].string()) |
508 | - drwsuffix = drwmethod | |
509 | - if drwsuffix == 'phibar': | |
510 | + drwsuffix = '-%s' % (drwmethod) | |
511 | + if drwmethod == 'phibar': | |
510 | 512 | drwsuffix += '%d' % (self['timebin'].real()) |
513 | + if drwsuffix == '-phibar300': | |
514 | + drwsuffix = '' | |
511 | 515 | |
512 | 516 | # Generate one DRW for each energy boundary |
513 | 517 | for i in range(ebounds.size()): |
514 | 518 | |
515 | 519 | # Set DRW filename in output folder |
516 | - drwname = '%s/%s%s_drw-%s%s_%6.6d-%6.6dkeV.fits' % \ | |
520 | + drwname = '%s/%s%s_drw%s%s_%6.6d-%6.6dkeV.fits' % \ | |
517 | 521 | (self['outfolder'].string(), obs.id(), dri_prefix, drwsuffix, |
518 | 522 | self._drw_suffix, ebounds.emin(i).keV(), ebounds.emax(i).keV()) |
519 | 523 | drwfile = gammalib.GFilename(drwname) |
520 | 524 | |
521 | 525 | # Set DRW filename in global data store |
522 | - drwname_global = '%s/%s%s_drw-%s%s_%6.6d-%6.6dkeV.fits' % \ | |
526 | + drwname_global = '%s/%s%s_drw%s%s_%6.6d-%6.6dkeV.fits' % \ | |
523 | 527 | (self._global_datastore, obs.id(), dri_prefix, drwsuffix, |
524 | 528 | self._drw_suffix, ebounds.emin(i).keV(), ebounds.emax(i).keV()) |
525 | 529 | drwfile_global = gammalib.GFilename(drwname_global) | ... | ... |