Commit 297614c4dc0c3d06f500b2e5cf8245063e6b360b

Authored by Jürgen Knödlseder
1 parent 620377cb

Correct test for the existence of parameters in obsutils.get_onoff_obs()

Showing 1 changed file with 4 additions and 4 deletions
cscripts/obsutils.py
@@ -815,13 +815,13 @@ def get_onoff_obs(cls, obs, nthreads=0): @@ -815,13 +815,13 @@ def get_onoff_obs(cls, obs, nthreads=0):
815 inexclusion = 'NONE' 815 inexclusion = 'NONE'
816 use_irf_bkg = True 816 use_irf_bkg = True
817 817
818 - # Set inmodel, srcname, inexclusion and use_irf_bkg if possible  
819 - if 'inmodel' in cls: 818 + # Set inmodel, srcname, inexclusion and use_irf_bkg if they are available
  819 + if cls.has_par('inmodel'):
820 if cls['inmodel'].is_valid(): 820 if cls['inmodel'].is_valid():
821 inmodel = cls['inmodel'].value() 821 inmodel = cls['inmodel'].value()
822 - if 'srcname' in cls: 822 + if cls.has_par('srcname'):
823 srcname = cls['srcname'].value() 823 srcname = cls['srcname'].value()
824 - if 'inexclusion' in cls: 824 + if cls.has_par('inexclusion'):
825 if cls['inexclusion'].is_valid(): 825 if cls['inexclusion'].is_valid():
826 inexclusion = cls['inexclusion'].value() 826 inexclusion = cls['inexclusion'].value()
827 if cls.has_par('use_irf_bkg'): 827 if cls.has_par('use_irf_bkg'):