Commit 333841e5c137c5968af171bbb433dda40e43e045

Authored by Jürgen Knödlseder
1 parent e2683a70

Add suffix to IAQ filenames if no standard binning is used

Showing 1 changed file with 22 additions and 5 deletions
modules/comscripts/comobsbin.py
@@ -582,6 +582,7 @@ class comobsbin(ctools.csobservation): @@ -582,6 +582,7 @@ class comobsbin(ctools.csobservation):
582 dchi = self['dchi'].real() 582 dchi = self['dchi'].real()
583 dpsi = self['dpsi'].real() 583 dpsi = self['dpsi'].real()
584 dphibar = self['dphibar'].real() 584 dphibar = self['dphibar'].real()
  585 + nphibar = self['nphibar'].integer()
585 586
586 # Get calibration database and response type 587 # Get calibration database and response type
587 caldb = gammalib.GCaldb('cgro', 'comptel') 588 caldb = gammalib.GCaldb('cgro', 'comptel')
@@ -622,16 +623,29 @@ class comobsbin(ctools.csobservation): @@ -622,16 +623,29 @@ class comobsbin(ctools.csobservation):
622 # ... otherwise handle modeled response 623 # ... otherwise handle modeled response
623 else: 624 else:
624 625
  626 + # Set IAQ suffix in case that the DRI definition deviates from the
  627 + # standard
  628 + iaq_suffix = ''
  629 + filler = '_'
  630 + if dphibar != 2.0:
  631 + iaq_suffix += '%s%.1fdeg' % (filler, dphibar)
  632 + filler = '-'
  633 + if nphibar != 25:
  634 + iaq_suffix += '%s%dbins' % (filler, nphibar)
  635 + filler = '-'
  636 +
625 # Set IAQ filename 637 # Set IAQ filename
626 - iaqname = '%s/iaq_%6.6d-%6.6dkeV.fits' % \ 638 + iaqname = '%s/iaq_%6.6d-%6.6dkeV%s.fits' % \
627 (self['outfolder'].string(), 639 (self['outfolder'].string(),
628 - ebounds.emin(i).keV(), ebounds.emax(i).keV()) 640 + ebounds.emin(i).keV(), ebounds.emax(i).keV(),
  641 + iaq_suffix)
629 iaqfile = gammalib.GFilename(iaqname) 642 iaqfile = gammalib.GFilename(iaqname)
630 643
631 # Set global IAQ filename 644 # Set global IAQ filename
632 - iaqname_global = '%s/iaq_%6.6d-%6.6dkeV.fits' % \ 645 + iaqname_global = '%s/iaq_%6.6d-%6.6dkeV%s.fits' % \
633 (self._global_datastore, 646 (self._global_datastore,
634 - ebounds.emin(i).keV(), ebounds.emax(i).keV()) 647 + ebounds.emin(i).keV(), ebounds.emax(i).keV(),
  648 + iaq_suffix)
635 iaqfile_global = gammalib.GFilename(iaqname_global) 649 iaqfile_global = gammalib.GFilename(iaqname_global)
636 650
637 # Write header 651 # Write header
@@ -653,8 +667,11 @@ class comobsbin(ctools.csobservation): @@ -653,8 +667,11 @@ class comobsbin(ctools.csobservation):
653 # ... otherwise compute and save it 667 # ... otherwise compute and save it
654 else: 668 else:
655 669
  670 + # Set Phibar maximum
  671 + phimax = float(int(nphibar * dphibar + 0.5))
  672 +
656 # Initialise IAQ 673 # Initialise IAQ
657 - iaq = gammalib.GCOMIaq(55.0, dchi, 50.0, dphibar) 674 + iaq = gammalib.GCOMIaq(55.0, dchi, phimax, dphibar)
658 675
659 # Set IAQ energy range 676 # Set IAQ energy range
660 ebds = gammalib.GEbounds(ebounds.emin(i), ebounds.emax(i)) 677 ebds = gammalib.GEbounds(ebounds.emin(i), ebounds.emax(i))