Commit f29ec62ff174604896215ac44f9a4f92c4f788ee

Authored by Jürgen Knödlseder
1 parent c213634c

Add CONSTFIX option

modules/comscripts/comobsmodel.par
... ... @@ -27,7 +27,7 @@ dec, r, a, NONE,,, "Declinaison of point source (deg)"
27 27 srcname, s, a, NONE,,, "Name of point source"
28 28 brems, s, a, NONE,NONE|MAP|CUBE,, "Bremsstrahlung component"
29 29 ic, s, a, NONE,NONE|MAP|CUBE,, "Inverse Compton component"
30   -iso, s, a, NONE,NONE|CONST,, "Isotropic component"
  30 +iso, s, a, NONE,NONE|CONST|CONSTFIX,, "Isotropic component"
31 31 modeltype, s, h, BINS,NODES|BINS,, "Diffuse model type"
32 32 ebinfile, f, h, NONE,,, "Name of the file containing the diffuse model energy bin definition"
33 33 bremsmap, f, h, $COMDATA/../skymaps/galprop/map_comptel_bremsstrahlung.fits,,, "Bremsstrahlungs map"
... ...
modules/comscripts/comobsmodel.py
... ... @@ -199,7 +199,7 @@ class comobsmodel(ctools.csobservation):
199 199 # Return source model
200 200 return source
201 201  
202   - def _recast_model(self, model, ebounds, index, min, max):
  202 + def _recast_model(self, model, ebounds, index, min, max, fix=False):
203 203 """
204 204 Re-cast model
205 205  
... ... @@ -215,6 +215,8 @@ class comobsmodel(ctools.csobservation):
215 215 Minimum intensities
216 216 max : float
217 217 Maximum intensities
  218 + fix : boolean
  219 + Fix intensity values
218 220  
219 221 Returns
220 222 -------
... ... @@ -248,6 +250,8 @@ class comobsmodel(ctools.csobservation):
248 250 parname = 'Intensity%d' % i
249 251 spectral[parname].min(min)
250 252 spectral[parname].max(max)
  253 + if fix:
  254 + spectral[parname].fix()
251 255  
252 256 # Return spectral model
253 257 return spectral
... ... @@ -385,21 +389,26 @@ class comobsmodel(ctools.csobservation):
385 389 Isotropic model
386 390 """
387 391 # Append model if CONST is selected ...
388   - if self['iso'].string() == 'CONST':
  392 + if 'CONST' in self['iso'].string():
389 393  
390 394 # Set spatial model
391 395 spatial = gammalib.GModelSpatialDiffuseConst()
392 396  
393 397 # Set spectral model using initial scaling factors that correspond
394   - # to the intensity in R-MIS-001985
  398 + # to Georg Weidenspointers extragalactic spectrum. Values integrated
  399 + # over the standard energy bands communicated by Werner Collmar and
  400 + # divided by width of standard energy bands.
395 401 spectral = gammalib.GModelSpectralNodes()
396   - spectral.append(gammalib.GEnergy(0.87, 'MeV'), 1.0e-5)
397   - spectral.append(gammalib.GEnergy(1.73, 'MeV'), 1.0e-5)
398   - spectral.append(gammalib.GEnergy(5.48, 'MeV'), 1.0e-5)
399   - spectral.append(gammalib.GEnergy(17.32, 'MeV'), 1.0e-5)
  402 + spectral.append(gammalib.GEnergy(0.87, 'MeV'), 1.327e-3/0.25)
  403 + spectral.append(gammalib.GEnergy(1.73, 'MeV'), 2.358e-3/2.0)
  404 + spectral.append(gammalib.GEnergy(5.48, 'MeV'), 0.658e-3/7.0)
  405 + spectral.append(gammalib.GEnergy(17.32, 'MeV'), 0.148e-3/20.0)
  406 +
  407 + # Set fix
  408 + fix = (self['iso'].string() == 'CONSTFIX')
400 409  
401 410 # Recast model
402   - spectral = self._recast_model(spectral, ebounds, -2.0, 1.0e-20, 1.0)
  411 + spectral = self._recast_model(spectral, ebounds, -2.0, 1.0e-20, 1.0, fix=fix)
403 412  
404 413 # Autoscale spectral coefficients
405 414 spectral.autoscale()
... ...