Feature #3442

Add GCTAModelCubeSky class

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

Status:ClosedStart date:11/09/2020
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:2.0.0
Duration:

Description

The GCTAModelCubeSky is the analogy of GCTAModelCubeBackground but for sky models. Using this class allows to precompute sky models using ctmodel and using such models in a model fit.


Recurrence

No recurrence.

History

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

Renamed to GCTAModelSkyCube (which is more logical).

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

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

I implemented the class and defined corresponding XML file format that is very similar to typical sky models:

<?xml version="1.0" standalone="no"?>
<source_library title="source library">
  <source name="CTA sky cube" type="CTASkyCube" instrument="CTA">
    <spatialModel type="ModelCube" file="crab_modcube.fits">
      <parameter name="Normalization" scale="1" value="1" min="0.1" max="10" free="0"/>
    </spatialModel>
    <spectrum type="PowerLaw">
       <parameter name="Prefactor"   scale="1e-16" value="5.7"  min="1e-07" max="1000.0" free="1"/>
       <parameter name="Index"       scale="-1"    value="2.48" min="0.0"   max="+5.0"   free="1"/>
       <parameter name="PivotEnergy" scale="1e6"   value="0.3"  min="0.01"  max="1000.0" free="0"/>
    </spectrum>
  </source>
</source_library>

I then generated a sky model cube for the Crab nebula where I used a constant spectral model with normalisation 1, so that when fitting the sky cube I should get the same spectra as fitting the crab directly.

Fitting the Crab directly I got:

2020-11-09T10:21:40: === GModelSky ===
2020-11-09T10:21:40:  Name ......................: Crab
2020-11-09T10:21:40:  Instruments ...............: all
2020-11-09T10:21:40:  Observation identifiers ...: all
2020-11-09T10:21:40:  Model type ................: PointSource
2020-11-09T10:21:40:  Model components ..........: "PointSource" * "PowerLaw" * "Constant" 
2020-11-09T10:21:40:  Number of parameters ......: 6
2020-11-09T10:21:40:  Number of spatial par's ...: 2
2020-11-09T10:21:40:   RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
2020-11-09T10:21:40:   DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
2020-11-09T10:21:40:  Number of spectral par's ..: 3
2020-11-09T10:21:40:   Prefactor ................: 1.53831332825568e-16 +/- 5.11840122058421e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
2020-11-09T10:21:40:   Index ....................: -2.41186783653758 +/- 0.0250296097002891 [-5,-0]  (free,scale=-1,gradient)
2020-11-09T10:21:40:   PivotEnergy ..............: 300000 [10000,1000000000] MeV (fixed,scale=1000000,gradient)
2020-11-09T10:21:40:  Number of temporal par's ..: 1
2020-11-09T10:21:40:   Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
2020-11-09T10:21:40:  Number of scale par's .....: 0
while fitting the Crab using a sky model cube I got
2020-11-09T10:21:07: === GCTAModelSkyCube ===
2020-11-09T10:21:07:  Name ......................: CTA sky cube
2020-11-09T10:21:07:  Instruments ...............: CTA
2020-11-09T10:21:07:  Observation identifiers ...: all
2020-11-09T10:21:07:  Model type ................: "PowerLaw" * "Constant" 
2020-11-09T10:21:07:  Number of parameters ......: 5
2020-11-09T10:21:07:  Number of spectral par's ..: 3
2020-11-09T10:21:07:   Prefactor ................: 1.53831332825558e-16 +/- 5.11840122058387e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
2020-11-09T10:21:07:   Index ....................: -2.41186783653759 +/- 0.0250296097002891 [-5,-0]  (free,scale=-1,gradient)
2020-11-09T10:21:07:   PivotEnergy ..............: 300000 [10000,1000000000] MeV (fixed,scale=1000000,gradient)
2020-11-09T10:21:07:  Number of temporal par's ..: 1
2020-11-09T10:21:07:   Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
Within the numerical precision the results are identical.

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

  • Status changed from In Progress to Pull request
  • % Done changed from 50 to 90

I added unit tests, fixed a number of minor issues, and started the integration check.

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

  • Status changed from Pull request to Closed
  • % Done changed from 90 to 100

Merged into devel.

Also available in: Atom PDF