Commit 8346a5226c2b70ab1235fe1e7359ab3646f45c8d

Authored by Jürgen Knödlseder
1 parent f0bb0f8b

Correct handling of flux for diffuse cube models in csspec (#2954)

ChangeLog
... ... @@ -4,6 +4,7 @@
4 4 ================================
5 5  
6 6 Improve documentation and tutorials (#2962)
  7 + Correct handling of flux for diffuse cube models in csspec (#2954)
7 8 Fix OpenMP issue in ctbin when using energy bounds from file (#2912)
8 9 Fix multi-instrument handling in csbkgmodel (#2862)
9 10  
... ...
... ... @@ -255,7 +255,8 @@ None
255 255  
256 256 csspec - Generates Spectral Energy Distribution
257 257 -----------------------------------------------
258   -None
  258 +If a diffuse cube sky model is used the script now correctly multiplies the
  259 +result with the diffuse cube sky model spectrum (#2954).
259 260  
260 261  
261 262 cssrcdetect - Detects sources in sky map
... ...
cscripts/csspec.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Generates a spectrum.
4 4 #
5   -# Copyright (C) 2014-2018 Michael Mayer
  5 +# Copyright (C) 2014-2019 Michael Mayer
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -729,6 +729,15 @@ class csspec(ctools.csobservation):
729 729 else:
730 730 e_flux = 0.0
731 731  
  732 + # If the source model is a cube then multiply-in the cube
  733 + # spectrum
  734 + if source.spatial().classname() == 'GModelSpatialDiffuseCube':
  735 + dir = gammalib.GSkyDir()
  736 + source.spatial().set_mc_cone(dir, 180.0)
  737 + norm = source.spatial().spectrum().eval(elogmean)
  738 + fitted_flux *= norm
  739 + e_flux *= norm
  740 +
732 741 # Convert differential flux and flux error to nuFnu
733 742 elogmean2 = elogmean.MeV() * elogmean.MeV()
734 743 result['flux'] = fitted_flux * elogmean2 * gammalib.MeV2erg
... ...
doc/source/admin/release_history/1.6.2.rst
... ... @@ -12,6 +12,8 @@ The following bugs were fixed:
12 12  
13 13 * [`2962 <https://cta-redmine.irap.omp.eu/issues/2962>`_] -
14 14 Improve documentation and tutorials
  15 +* [`2954 <https://cta-redmine.irap.omp.eu/issues/2954>`_] -
  16 + Correct handling of flux for diffuse cube models in csspec
15 17 * [`2912 <https://cta-redmine.irap.omp.eu/issues/2912>`_] -
16 18 Fix OpenMP issue in ctbin when using energy bounds from file
17 19 * [`2862 <https://cta-redmine.irap.omp.eu/issues/2862>`_] -
... ...