Commit f16e62339a036455703b596d338988dd42708451

Authored by IftachSadeh
1 parent 1cbb5663

update _set_obs

Showing 1 changed file with 11 additions and 1 deletions
cscripts/cssens.py
... ... @@ -163,7 +163,7 @@ class cssens(ctools.csobservation):
163 163 # Return
164 164 return
165 165  
166   - def _set_obs(self, emin, emax, lpnt=0.0, bpnt=0.0):
  166 + def _set_obs(self, emin, emax, lpnt=None, bpnt=None):
167 167 """
168 168 Set an observation container
169 169  
... ... @@ -189,6 +189,16 @@ class cssens(ctools.csobservation):
189 189  
190 190 # ... otherwise allocate a single observation
191 191 else:
  192 + # set the coordinates of the test source model
  193 + if lpnt is None and bpnt is None:
  194 + container = gammalib.GModels(self['inmodel'].filename())
  195 + src_model = container[self['srcname'].string()]
  196 +
  197 + pntdir = gammalib.GSkyDir()
  198 + pntdir.radec_deg(src_model['RA'].value(), src_model['DEC'].value())
  199 +
  200 + lpnt = pntdir.l_deg()
  201 + bpnt = pntdir.b_deg()
192 202  
193 203 # Read relevant user parameters
194 204 caldb = self['caldb'].string()
... ...