Action #2973

Improve COMPTEL classes

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

Status:ClosedStart date:07/22/2019
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:2.0.0
Duration:

Description

Several minor issues arose when analysing the full COMPTEL database that are tracked under this issue.


Recurrence

No recurrence.

History

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

  • Assigned To set to Knödlseder Jürgen
  • Target version set to 1.7.0

The ontime in GCOMObservation::load(GFilename&, GFilename&, std::vector<GFilename>&) is now extracted from the ontime of the associated TIM datasets. Before it was computed from the start and stop time, yet this neglects the cut-out of time intervals in the TIM due to the SAA passage.

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

  • % Done changed from 0 to 10

The default usage when loading TIM files is now set to YES and the default mode to NORMAL. Before, both strings were blank by default.

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

  • % Done changed from 10 to 20

In GCOMEventList::read(GFits&) the Good Time Intervals are now set on the basis of the times of the first and last events. The reason is that the VISDAY, VISTIM, VIEDAY and VIETIM keywords that were used before do not seem to related to the GTI of the events but rather relate to the full time period of the observation.

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

  • % Done changed from 20 to 30

In GCOMOads::print(GChatter&) only print the number of superpackets for higher than default chatter levels.

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

Disable geocentre warning in GCOMOads::read() since this quite pollutes the console.

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

  • % Done changed from 30 to 40

Put COMPTEL support functions in gammalib namespace.

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

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

I added remove_response_cache methods to the classes GObservations, GObservation, GCOMObservation, GCTAObservation and GCTAResponse to allow the controlled removal of one or all models from an observation container. For this purpose, the GCOMResponseCache::remove() method was also implemented.

The verification of parameter changes was removed in the COMPTEL response caching, and a call to GObservations ::remove_response_cache was added in cttsmap so that cached values for the test source are removed before computation of the TS for the test source.

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

  • % Done changed from 50 to 60

I added a GCOMObservation::drm(GModels&) method that computes a model DRM cube for all applicable models in a model container.

I also added a GCOMDri::cone_content() method to compute the DRI content within an event cube.

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

  • Target version changed from 1.7.0 to 2.0.0

Moved issue to next release.

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

  • % Done changed from 60 to 70

The response caching is now dealt with at the level of the GResponse base class, I therefore removed the COMPTEL specific response caching. Specifically the GCOMObservation::drm(GModelSky&) and GCOMResponse::irf_spatial() methods were removed.

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

  • % Done changed from 70 to 80

In finally implemented support for extended model in the COMPTEL response, completing response handling.

Here is a test case of a SRCLIX analysis of the Crab v1.0 in the 4 standard energy bands. The run gives the following result for a point source

2021-10-13T14:07:00: +============================================+
2021-10-13T14:07:00: | Iterative maximum likelihood model fitting |
2021-10-13T14:07:00: +============================================+
2021-10-13T14:07:05:  logL after iteration 1 ....: -67027.48666
2021-10-13T14:07:10:  logL after iteration 2 ....: -67041.94875 (14.46210)
2021-10-13T14:07:15:  logL after iteration 3 ....: -67044.96521 (3.01646)
2021-10-13T14:07:19:  logL after iteration 4 ....: -67045.57367 (0.60846)
2021-10-13T14:07:25:  logL after iteration 5 ....: -67045.63165 (0.05797)
2021-10-13T14:07:29:  logL after iteration 6 ....: -67045.59895 (-0.03270)
2021-10-13T14:07:37:  logL after final iteration : -67045.59894 (-0.00001)
2021-10-13T14:07:37: === GModelSky ===
2021-10-13T14:07:37:  Name ......................: Crab
2021-10-13T14:07:37:  Instruments ...............: all
2021-10-13T14:07:37:  Test Statistic ............: 1004.16178071871
2021-10-13T14:07:37:  Observation identifiers ...: all
2021-10-13T14:07:37:  Model type ................: PointSource
2021-10-13T14:07:37:  Model components ..........: "PointSource" * "PowerLaw" * "Constant" 
2021-10-13T14:07:37:  Number of parameters ......: 6
2021-10-13T14:07:37:  Number of spatial par's ...: 2
2021-10-13T14:07:37:   RA .......................: 83.7860667134836 +/- 0.111312108719039 deg (free,scale=1)
2021-10-13T14:07:37:   DEC ......................: 21.6291010912198 +/- 0.101021895111379 deg (free,scale=1)
2021-10-13T14:07:37:  Number of spectral par's ..: 3
2021-10-13T14:07:37:   Prefactor ................: 0.0016763606983258 +/- 8.56368715168633e-05 [1e-25,infty[ ph/cm2/s/MeV (free,scale=0.002,gradient)
2021-10-13T14:07:37:   Index ....................: -2.14913178754043 +/- 0.0382371945279881 [-10,10]  (free,scale=-2,gradient)
2021-10-13T14:07:37:   PivotEnergy ..............: 1 MeV (fixed,scale=1,gradient)
2021-10-13T14:07:37:  Number of temporal par's ..: 1
2021-10-13T14:07:37:   Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
2021-10-13T14:07:37:  Number of scale par's .....: 0
and the following result for a disk source
2021-10-14T12:50:58: +============================================+
2021-10-14T12:50:58: | Iterative maximum likelihood model fitting |
2021-10-14T12:50:58: +============================================+
2021-10-14T12:53:01:  logL after iteration 1 ....: -67037.18725
2021-10-14T12:54:10:  logL after iteration 2 ....: -67043.74861 (6.56136)
2021-10-14T12:55:46:  logL after iteration 3 ....: -67046.41870 (2.67009)
2021-10-14T12:56:50:  logL after iteration 4 ....: -67047.15837 (0.73967)
2021-10-14T12:57:38:  logL after iteration 5 ....: -67047.24089 (0.08252)
2021-10-14T12:59:12:  logL after iteration 6 ....: -67047.11076 (-0.13013)
2021-10-14T13:00:00:  logL after final iteration : -67047.11374 (0.00298)
2021-10-14T13:00:00: === GModelSky ===
2021-10-14T13:00:00:  Name ......................: Crab
2021-10-14T13:00:00:  Instruments ...............: all
2021-10-14T13:00:00:  Test Statistic ............: 1101.97154647962
2021-10-14T13:00:00:  Observation identifiers ...: all
2021-10-14T13:00:00:  Model type ................: ExtendedSource
2021-10-14T13:00:00:  Model components ..........: "RadialDisk" * "PowerLaw" * "Constant" 
2021-10-14T13:00:00:  Number of parameters ......: 7
2021-10-14T13:00:00:  Number of spatial par's ...: 3
2021-10-14T13:00:00:   RA .......................: 83.7858226805196 +/- 0.116796678591813 deg (free,scale=1)
2021-10-14T13:00:00:   DEC ......................: 21.6527349414119 +/- 0.105916502256037 deg (free,scale=1)
2021-10-14T13:00:00:   Radius ...................: 1.31224708888018 +/- 0.415734840183593 [0.05,10] deg (free,scale=1)
2021-10-14T13:00:00:  Number of spectral par's ..: 3
2021-10-14T13:00:00:   Prefactor ................: 0.00170719506442216 +/- 8.76326119024385e-05 [1e-25,infty[ ph/cm2/s/MeV (free,scale=0.002,gradient)
2021-10-14T13:00:00:   Index ....................: -2.15088249332866 +/- 0.0366685007302425 [-10,10]  (free,scale=-2,gradient)
2021-10-14T13:00:00:   PivotEnergy ..............: 1 MeV (fixed,scale=1,gradient)
2021-10-14T13:00:00:  Number of temporal par's ..: 1
2021-10-14T13:00:00:   Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
2021-10-14T13:00:00:  Number of scale par's .....: 0

Here the summary for various extended models:

Model logL TS RA Dec Extension Prefactor (1e-5) Index
Point source -67045.599 1004.162 83.79 ± 0.11 21.63 ± 0.10 167.64 ± 8.56 -2.149 ± 0.038
Disk -67047.212 1110.294 83.78 ± 0.12 21.65 ± 0.11 1.24 ± 0.41 182.32 ± 9.34 -2.147 ± 0.036
Gauss -67047.334 1125.538 83.78 ± 0.12 21.66 ± 0.10 0.63 ± 0.21 181.91 ± 9.30 -2.147 ± 0.036
Elliptical disk -67046.386 1043.938 83.76 ± 0.05 21.69 ± 0.09 1.00 ± 0.006, 0.49 ± 0.004, 93.31 ± 0.20 174.04 ± 8.72 -2.147 ± 0.038
Elliptical Gauss -67048.461 1128.269 83.78 ± 0.11 21.65 ± 0.11 1.01 ± 0.07, 0.38 ± 0.04, 331.10 ± 0.57 184.20 ± 8.90 -2.146 ± 0.036

While the disk and gauss model seem to give reasonable results, the elliptical disk model does not seem to adjust the spatial parameters, the elliptical gaussian model looks kind of ok.

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

I changed the step size for numerical gradient computation to 0.01 deg for COMPTEL. This gave the following results:

Model logL TS RA Dec Extension Prefactor (1e-5) Index
Point source -67045.600 1004.180 83.79 ± 0.11 21.63 ± 0.10 167.64 ± 8.56 -2.149 ± 0.038
Disk -67047.201 1108.352 83.79 ± 0.12 21.65 ± 0.11 1.28 ± 0.39 182.61 ± 9.37 -2.147 ± 0.037
Gauss -67047.341 1127.352 83.76 ± 0.12 21.65 ± 0.11 0.68 ± 0.20 182.81 ± 9.35 -2.147 ± 0.036
Elliptical disk -67044.650 1027.074 83.75 ± 0.09 21.72 ± 0.09 1.16 ± 0.05, 0.56 ± 0.04, 90.60 ± 0.21 173.17 ± 8.76 -2.145 ± 0.038
Elliptical Gauss -67047.869 1087.553 83.78 ± 0.11 21.67 ± 0.11 0.17 ± 0.06, 0.80 ± 0.23, 86.06 ± 1.84 182.06 ± 9.38 -2.150 ± 0.037

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

And here the results for a step size of 0.05 degrees.

Model logL TS RA Dec Extension Prefactor (1e-5) Index
Point source -67045.600 1004.167 83.79 ± 0.11 21.63 ± 0.10 167.64 ± 8.56 -2.149 ± 0.038
Disk -67047.203 1109.582 83.79 ± 0.12 21.65 ± 0.11 1.25 ± 0.40 182.45 ± 9.35 -2.147 ± 0.036
Gauss -67047.336 1125.941 83.77 ± 0.12 21.66 ± 0.11 0.67 ± 0.20 182.48 ± 9.34 -2.147 ± 0.036
Elliptical disk -67046.433 1024.404 83.78 ± 0.12 21.66 ± 0.11 1.20 ± 0.23, 1.03 ± 0.29, 86.66 ± 1.65 173.49 ± 10.06 -2.143 ± 0.038
Elliptical Gauss -67048.159 1101.335 83.80 ± 0.11 21.67 ± 0.11 0.20 ± 0.07, 0.88 ± 0.24, 85.03 ± 3.90 183.11 ± 9.48 -2.150 ± 0.037

Now, the location uncertainties are consistent for all model types and also the extension uncertainties look reasonable, except for the elliptical disk model that still gives relatively small uncertainties.

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

I added some logic to comlixfit that fixes spatial extension parameters for the initial fit iteration and then free’s the fixed parameters for the subsequent iterations. The goal is to stabilise the iterative fitting procedure. Here the results for a disk model as function of the initial radial extent:

Initial extent logL TS RA Dec Extension Prefactor (1e-5) Index
0.1 -67047.065 1083.671 83.79 ± 0.12 21.66 ± 0.11 1.13 ± 0.44 179.17 ± 9.30 -2.146 ± 0.037
1.0 -67047.095 1089.352 83.78 ± 0.12 21.66 ± 0.11 1.16 ± 0.43 179.85 ± 9.31 -2.146 ± 0.037
5.0 -67046.970 1078.175 83.78 ± 0.12 21.66 ± 0.11 1.12 ± 0.45 177.99 ± 9.28 -2.143 ± 0.037

And below the same analysis results for a gradient step size of 0.005 instead of 0.05 that was used for the table above:

Initial extent logL TS RA Dec Extension Prefactor (1e-5) Index
0.1 -67047.046 1081.959 83.78 ± 0.12 21.66 ± 0.11 1.10 ± 0.45 178.83 ± 9.29 -2.147 ± 0.037
1.0 -67047.089 1088.232 83.78 ± 0.12 21.66 ± 0.10 1.11 ± 0.45 179.43 ± 9.29 -2.147 ± 0.037
5.0 -67046.957 1076.793 83.79 ± 0.12 21.66 ± 0.11 1.11 ± 0.45 177.80 ± 9.27 -2.143 ± 0.037

With the smaller step size the resulting extensions are less dependent on the initial extension value, hence I prefer keeping that smaller value. Note that the TS value surprisingly depends on the initial extension value, while the logL is much less sensitive. Not clear why the TS values show such a scatter.

I recognised that some DRB bins were negative, so I added some code that sets all negative bins to zero. Here the results for the new code:

Initial extent logL TS RA Dec Extension Prefactor (1e-5) Index
0.1 -67047.046 1081.959 83.78 ± 0.12 21.66 ± 0.11 1.10 ± 0.45 178.83 ± 9.29 -2.147 ± 0.037
5.0 -67046.957 1076.793 83.79 ± 0.12 21.66 ± 0.11 1.11 ± 0.45 177.80 ± 9.27 -2.143 ± 0.037

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

I created issue #3889 to follow-up on the fit of extended disk models.

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

  • Status changed from In Progress to Closed
  • % Done changed from 80 to 100

The COMPTEL interface is now settled.

Also available in: Atom PDF