Commit f29ec62ff174604896215ac44f9a4f92c4f788ee
1 parent
c213634c
Add CONSTFIX option
Showing
2 changed files
with
18 additions
and
9 deletions
modules/comscripts/comobsmodel.par
| @@ -27,7 +27,7 @@ dec, r, a, NONE,,, "Declinaison of point source (deg)" | @@ -27,7 +27,7 @@ dec, r, a, NONE,,, "Declinaison of point source (deg)" | ||
| 27 | srcname, s, a, NONE,,, "Name of point source" | 27 | srcname, s, a, NONE,,, "Name of point source" |
| 28 | brems, s, a, NONE,NONE|MAP|CUBE,, "Bremsstrahlung component" | 28 | brems, s, a, NONE,NONE|MAP|CUBE,, "Bremsstrahlung component" |
| 29 | ic, s, a, NONE,NONE|MAP|CUBE,, "Inverse Compton component" | 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 | modeltype, s, h, BINS,NODES|BINS,, "Diffuse model type" | 31 | modeltype, s, h, BINS,NODES|BINS,, "Diffuse model type" |
| 32 | ebinfile, f, h, NONE,,, "Name of the file containing the diffuse model energy bin definition" | 32 | ebinfile, f, h, NONE,,, "Name of the file containing the diffuse model energy bin definition" |
| 33 | bremsmap, f, h, $COMDATA/../skymaps/galprop/map_comptel_bremsstrahlung.fits,,, "Bremsstrahlungs map" | 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,7 +199,7 @@ class comobsmodel(ctools.csobservation): | ||
| 199 | # Return source model | 199 | # Return source model |
| 200 | return source | 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 | Re-cast model | 204 | Re-cast model |
| 205 | 205 | ||
| @@ -215,6 +215,8 @@ class comobsmodel(ctools.csobservation): | @@ -215,6 +215,8 @@ class comobsmodel(ctools.csobservation): | ||
| 215 | Minimum intensities | 215 | Minimum intensities |
| 216 | max : float | 216 | max : float |
| 217 | Maximum intensities | 217 | Maximum intensities |
| 218 | + fix : boolean | ||
| 219 | + Fix intensity values | ||
| 218 | 220 | ||
| 219 | Returns | 221 | Returns |
| 220 | ------- | 222 | ------- |
| @@ -248,6 +250,8 @@ class comobsmodel(ctools.csobservation): | @@ -248,6 +250,8 @@ class comobsmodel(ctools.csobservation): | ||
| 248 | parname = 'Intensity%d' % i | 250 | parname = 'Intensity%d' % i |
| 249 | spectral[parname].min(min) | 251 | spectral[parname].min(min) |
| 250 | spectral[parname].max(max) | 252 | spectral[parname].max(max) |
| 253 | + if fix: | ||
| 254 | + spectral[parname].fix() | ||
| 251 | 255 | ||
| 252 | # Return spectral model | 256 | # Return spectral model |
| 253 | return spectral | 257 | return spectral |
| @@ -385,21 +389,26 @@ class comobsmodel(ctools.csobservation): | @@ -385,21 +389,26 @@ class comobsmodel(ctools.csobservation): | ||
| 385 | Isotropic model | 389 | Isotropic model |
| 386 | """ | 390 | """ |
| 387 | # Append model if CONST is selected ... | 391 | # Append model if CONST is selected ... |
| 388 | - if self['iso'].string() == 'CONST': | 392 | + if 'CONST' in self['iso'].string(): |
| 389 | 393 | ||
| 390 | # Set spatial model | 394 | # Set spatial model |
| 391 | spatial = gammalib.GModelSpatialDiffuseConst() | 395 | spatial = gammalib.GModelSpatialDiffuseConst() |
| 392 | 396 | ||
| 393 | # Set spectral model using initial scaling factors that correspond | 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 | spectral = gammalib.GModelSpectralNodes() | 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 | # Recast model | 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 | # Autoscale spectral coefficients | 413 | # Autoscale spectral coefficients |
| 405 | spectral.autoscale() | 414 | spectral.autoscale() |