Commit 620377cbded2e4e7a6e6c51ae14e22cecc0ab4e9

Authored by Jürgen Knödlseder
1 parent 0152831e

csphagen now first tries using model container in observation container before q…

…uerying user parameters (#2721)
Showing 1 changed file with 4 additions and 5 deletions
cscripts/csphagen.py
... ... @@ -228,15 +228,14 @@ class csphagen(ctools.csobservation):
228 228 self._setup_observations(self.obs(), True, True, False)
229 229  
230 230 # Get spatial component of source model if an input model is defined
231   - if self['inmodel'].is_valid():
  231 + if self.obs().models().size() > 0:
  232 + name = self['srcname'].string()
  233 + self._src_model = self.obs().models()[name].spatial().clone()
  234 + elif self['inmodel'].is_valid():
232 235 inmodel = self['inmodel'].filename()
233 236 models = gammalib.GModels(inmodel)
234 237 name = self['srcname'].string()
235 238 self._src_model = models[name].spatial().clone()
236   - elif self.obs().models().size() > 0:
237   - name = self['srcname'].string()
238   - if self.obs().models().contains(name):
239   - self._src_model = self.obs().models()[name].spatial()
240 239  
241 240 # Set energy bounds
242 241 self._ebounds = self._create_ebounds()
... ...