Action #3988

Implement support of Galactic coordinates in spatial models

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

Status:ClosedStart date:02/11/2022
Priority:HighDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:2.0.0
Duration:

Description

So far the spatial models do not really support Galactic coordinates, they only support reading GLON and GLAT from the XML file which they translate then into celestial coordinates. Fitting in Galactic coordinates should be supported so that also errors in Galactic coordinates can be derived directly.


Recurrence

No recurrence.

History

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

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

I implemented the support of Galactic coordinates in the GModelSpatialPointSource class. The ra() and dec() methods were removed and everything is now handled via the dir() method. A coordsys parameter was added to the constructors so that spatial point sources can be constructed either for celestial or Galactic coordinates. The XML read() and write() methods support reading and writing of models in both formats. A coordsys() method was added to return the coordinate system (either “CEL” or “GAL”).

The unit tests were adapted.

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

  • % Done changed from 10 to 50

I also implemented the same logic for the radial spatial models.

Note that I needed to adapt the vector IRF computation for the CTA response cube since they preset the longitude and latitude gradients for the analytical gradient computation. I did not verify whether the radial model still work for CTA for a response cube. This needs to be verified before merging in the code.

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

  • % Done changed from 50 to 70

Here a verification of the CTA Gaussian fitting. I did a simulation of a short run with the Crab modelled using a Gaussian.

An unbinned ctlike analysis gives

2022-02-11T14:10:03: === GModelSky ===
2022-02-11T14:10:03:  Name ......................: Crab(gauss)
2022-02-11T14:10:03:  Instruments ...............: all
2022-02-11T14:10:03:  Observation identifiers ...: all
2022-02-11T14:10:03:  Model type ................: ExtendedSource
2022-02-11T14:10:03:  Model components ..........: "RadialGaussian" * "PowerLaw" * "Constant" 
2022-02-11T14:10:03:  Number of parameters ......: 7
2022-02-11T14:10:03:  Number of spatial par's ...: 3
2022-02-11T14:10:03:   RA .......................: 83.6299869083885 +/- 0.00328488361252953 [-360,360] deg (free,scale=1,gradient)
2022-02-11T14:10:03:   DEC ......................: 22.0173896271789 +/- 0.00308515134809287 [-90,90] deg (free,scale=1,gradient)
2022-02-11T14:10:03:   Sigma ....................: 0.203480569716262 +/- 0.00207014994880326 [0.01,10] deg (free,scale=1,gradient)
2022-02-11T14:10:03:  Number of spectral par's ..: 3
2022-02-11T14:10:03:   Prefactor ................: 5.77140471417774e-16 +/- 7.7137759382583e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
2022-02-11T14:10:03:   Index ....................: -2.47526109025108 +/- 0.00917658930436079 [-5,-0]  (free,scale=-1,gradient)
2022-02-11T14:10:03:   PivotEnergy ..............: 300000 [10000,1000000000] MeV (fixed,scale=1000000,gradient)
2022-02-11T14:10:03:  Number of temporal par's ..: 1
2022-02-11T14:10:03:   Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
2022-02-11T14:10:03:  Number of scale par's .....: 0
2022-02-11T14:10:03: 
2022-02-11T14:10:03: Application "ctlike" terminated after 1966 wall clock seconds, consuming 1937.16 seconds of CPU time and generating a carbon footprint of 2.51831 g eCO2.
while a stacked ctlike analysis gives
2022-02-11T17:42:17: === GModelSky ===
2022-02-11T17:42:17:  Name ......................: Crab(gauss)
2022-02-11T17:42:17:  Instruments ...............: all
2022-02-11T17:42:17:  Observation identifiers ...: all
2022-02-11T17:42:17:  Model type ................: ExtendedSource
2022-02-11T17:42:17:  Model components ..........: "RadialGaussian" * "PowerLaw" * "Constant" 
2022-02-11T17:42:17:  Number of parameters ......: 7
2022-02-11T17:42:17:  Number of spatial par's ...: 3
2022-02-11T17:42:17:   RA .......................: 83.6348171390305 +/- 0.00361401243640746 [-360,360] deg (free,scale=1,gradient)
2022-02-11T17:42:17:   DEC ......................: 22.0187857002778 +/- 0.0034037032606802 [-90,90] deg (free,scale=1,gradient)
2022-02-11T17:42:17:   Sigma ....................: 0.203652873670136 +/- 0.00222687707982709 [0.01,10] deg (free,scale=1,gradient)
2022-02-11T17:42:17:  Number of spectral par's ..: 3
2022-02-11T17:42:17:   Prefactor ................: 5.82247924314491e-16 +/- 9.31586424094408e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
2022-02-11T17:42:17:   Index ....................: -2.4916135685806 +/- 0.0121500519851846 [-5,-0]  (free,scale=-1,gradient)
2022-02-11T17:42:17:   PivotEnergy ..............: 300000 [10000,1000000000] MeV (fixed,scale=1000000,gradient)
2022-02-11T17:42:17:  Number of temporal par's ..: 1
2022-02-11T17:42:17:   Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
2022-02-11T17:42:17:  Number of scale par's .....: 0
2022-02-11T17:42:17: 
2022-02-11T17:42:17: Application "ctlike" terminated after 43 wall clock seconds, consuming 24.7518 seconds of CPU time and generating a carbon footprint of 0.0321773 g eCO2.
which are equivalent spatial parameters.

Also using galactic coordinates works:

2022-02-11T17:48:35: === GModelSky ===
2022-02-11T17:48:35:  Name ......................: Crab(gauss)
2022-02-11T17:48:35:  Instruments ...............: all
2022-02-11T17:48:35:  Observation identifiers ...: all
2022-02-11T17:48:35:  Model type ................: ExtendedSource
2022-02-11T17:48:35:  Model components ..........: "RadialGaussian" * "PowerLaw" * "Constant" 
2022-02-11T17:48:35:  Number of parameters ......: 7
2022-02-11T17:48:35:  Number of spatial par's ...: 3
2022-02-11T17:48:35:   GLON .....................: 184.554678201013 +/- 0.00340841083645764 [-360,360] deg (free,scale=1,gradient)
2022-02-11T17:48:35:   GLAT .....................: -5.7807075777309 +/- 0.00336318681732812 [-90,90] deg (free,scale=1,gradient)
2022-02-11T17:48:35:   Sigma ....................: 0.203652849059719 +/- 0.00222687673719375 [0.01,10] deg (free,scale=1,gradient)
2022-02-11T17:48:35:  Number of spectral par's ..: 3
2022-02-11T17:48:35:   Prefactor ................: 5.8224792164502e-16 +/- 9.31586360327606e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
2022-02-11T17:48:35:   Index ....................: -2.49161370620237 +/- 0.0121500521861935 [-5,-0]  (free,scale=-1,gradient)
2022-02-11T17:48:35:   PivotEnergy ..............: 300000 [10000,1000000000] MeV (fixed,scale=1000000,gradient)
2022-02-11T17:48:35:  Number of temporal par's ..: 1
2022-02-11T17:48:35:   Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
2022-02-11T17:48:35:  Number of scale par's .....: 0
2022-02-11T17:48:35: 
2022-02-11T17:48:35: Application "ctlike" terminated after 43 wall clock seconds, consuming 24.9629 seconds of CPU time and generating a carbon footprint of 0.0324518 g eCO2.

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

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

I also implemented support for Galactic coordinates in the elliptical spatial models. Full support is now available.

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

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

Code was merged into devel.

Also available in: Atom PDF