Bug #1548

ctobssim fails for non-nomalized sky maps

Added by Knödlseder Jürgen over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:10/13/2015
Priority:HighDue date:
Assigned To:Knödlseder Jürgen% Done:


Target version:1.0.0


Using the following model

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<source_library title="source library">
  <source name="Pion decay" type="DiffuseSource">
    <spectrum type="PowerLaw">
      <parameter name="Prefactor" value="1" error="0" scale="1" min="1e-07" max="1000" free="1" />
      <parameter name="Index" value="2.7" error="0" scale="-1" min="0" max="5" free="1" />
      <parameter name="Scale" value="0.868" scale="1e+06" min="0.01" max="1000" free="0" />
    <spatialModel type="SpatialMap" file="map_ics.fits" normalize="0">
      <parameter name="Prefactor" value="1" scale="1" min="0.001" max="1000" free="0" />

ctobssim complains about a too high photon rate:
*** ERROR encounterted in the execution of ctobssim. Run aborted ...
*** ERROR in ctobssim::simulate_source(GCTAObservation*, GModels&, GRan&, GLog*): Invalid value. Photon rate 7.87792e+16 photons/sec for model "Pion decay" exceeds maximum allowed photon rate of 1e+06 photons/sec. Please check the model parameters for model "Pion decay" or increase the value of the hidden "maxrate" parameter.

It turned out that this comes from the fact that ctobssim assumes that the flux in the spatial model is unity (method ctobssim::get_model_flux. In other words, ctobssim only works for normalized sky maps.

This should be corrected.

prefactor.png (51 KB) Knödlseder Jürgen, 10/14/2015 07:25 AM

index.png (49.4 KB) Knödlseder Jürgen, 10/14/2015 07:25 AM

Prefactor Index


No recurrence.


#1 Updated by Knödlseder Jürgen over 7 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 80

I changed gammalib and ctools so that non-normalized diffuse maps are handled correctly.

I introduced a GModelSpatialDiffuseMap::set_mc_cone method that pre-computes the Monte Carlo cache for a given simulation cone. The GModelSpatialDiffuseMap::set_mc_cone method is called from GModelSpatialDiffuseMap::mc_norm which returns the normalization of the spatial component (I renamed the norm() method to mc_norm() to make explicit that this method is for the MC normalization). The mc_norm() is used in GModelSky::mc to determine the normalization of the expected count rate.

The mc_norm() is now also used in ctobssim::get_model_flux so that the flux is correctly computed in ctobssim.

A quick test has been done to make sure that ctobssim now runs as expected.

#2 Updated by Knödlseder Jürgen over 7 years ago

  • File prefactor.png added
  • File index.png added
  • Status changed from In Progress to Pull request
  • % Done changed from 80 to 100

Here are pull distributions for the corrected code. Everything looks ok.

#3 Updated by Knödlseder Jürgen over 7 years ago

  • Status changed from Pull request to Closed

Merged into devel.

Also available in: Atom PDF