Commit 79f16c8eb7d51855bb0164b635910632cdb8e75d

Authored by Jürgen Knödlseder
1 parent 8d9ce025

Add phi_first and phi_last parameters to comlixfit and comlixmap (#3912)

ChangeLog
1 -2021-09-30 1 +2021-11-29
2 2
3 * Version 2.0.0 released 3 * Version 2.0.0 released
4 ======================== 4 ========================
5 5
  6 + Add phi_first and phi_last parameters to comlixfit and comlixmap (#3912)
6 Add csadd2caldb script 7 Add csadd2caldb script
7 Add restart of bisection in case of bad convergence in ctulimit 8 Add restart of bisection in case of bad convergence in ctulimit
8 Add COMPTEL analysis scripts (#3738) 9 Add COMPTEL analysis scripts (#3738)
1 New Features and Important Changes in ctools 2.0.0 1 New Features and Important Changes in ctools 2.0.0
2 2
3 -30 September 2021 3 +29 November 2021
4 4
5 5
6 Introduction 6 Introduction
@@ -399,52 +399,58 @@ regions (#3248). @@ -399,52 +399,58 @@ regions (#3248).
399 399
400 comlixfit - COMPTEL maximum likelihood fitting using SRCLIX algorithm 400 comlixfit - COMPTEL maximum likelihood fitting using SRCLIX algorithm
401 --------------------------------------------------------------------- 401 ---------------------------------------------------------------------
402 -Added script (#3738) 402 +Added phi_first and phi_last parameters to allow selection of the Phibar layers
  403 +during the maximum likelihood fit (#3912).
  404 +
  405 +Added script (#3738).
403 406
404 407
405 comlixmap - Generation of COMPTEL Test Statistic map using SRCLIX algorithm 408 comlixmap - Generation of COMPTEL Test Statistic map using SRCLIX algorithm
406 --------------------------------------------------------------------------- 409 ---------------------------------------------------------------------------
407 -Added script (#3738) 410 +Added phi_first and phi_last parameters to allow selection of the Phibar layers
  411 +during the maximum likelihood fit (#3912).
  412 +
  413 +Added script (#3738).
408 414
409 415
410 comobsadd - Combine COMPTEL observations 416 comobsadd - Combine COMPTEL observations
411 ---------------------------------------- 417 ----------------------------------------
412 -Added script (#3738) 418 +Added script (#3738).
413 419
414 420
415 comobsback - Generate background model for COMPTEL observations 421 comobsback - Generate background model for COMPTEL observations
416 --------------------------------------------------------------- 422 ---------------------------------------------------------------
417 -Added script (#3738) 423 +Added script (#3738).
418 424
419 425
420 comobsbin - Bin COMPTEL observations 426 comobsbin - Bin COMPTEL observations
421 ------------------------------------ 427 ------------------------------------
422 -Added script (#3738) 428 +Added script (#3738).
423 429
424 430
425 comobsmodel - Generate model for binned COMPTEL observations 431 comobsmodel - Generate model for binned COMPTEL observations
426 ------------------------------------------------------------ 432 ------------------------------------------------------------
427 -Added script (#3738) 433 +Added script (#3738).
428 434
429 435
430 comobsres - Generate residuals of COMPTEL observations 436 comobsres - Generate residuals of COMPTEL observations
431 ------------------------------------------------------ 437 ------------------------------------------------------
432 -Added script (#3738) 438 +Added script (#3738).
433 439
434 440
435 comobsselect - Select observations from COMPTEL database 441 comobsselect - Select observations from COMPTEL database
436 -------------------------------------------------------- 442 --------------------------------------------------------
437 -Added script (#3738) 443 +Added script (#3738).
438 444
439 445
440 comobssim - Simulate COMPTEL observations 446 comobssim - Simulate COMPTEL observations
441 ----------------------------------------- 447 -----------------------------------------
442 -Added script (#3738) 448 +Added script (#3738).
443 449
444 450
445 comsrcdetect - Detect source in Test Statistic map 451 comsrcdetect - Detect source in Test Statistic map
446 -------------------------------------------------- 452 --------------------------------------------------
447 -Added script (#3738) 453 +Added script (#3738).
448 454
449 455
450 Examples 456 Examples
README.md
1 ctools information 1 ctools information
2 ================== 2 ==================
3 -* Version: 2.0.0.dev (30 September 2021) 3 +* Version: 2.0.0.dev (29 November 2021)
4 * GammaLib dependency: 2.0.0.dev 4 * GammaLib dependency: 2.0.0.dev
5 5
6 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/) 6 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/)
doc/source/users/reference_manual/comlixfit.rst
@@ -59,6 +59,14 @@ General parameters @@ -59,6 +59,14 @@ General parameters
59 Number of Phibar layers to exclude (relevant for ``BGDLIXA`` and ``BGDLIXE`` 59 Number of Phibar layers to exclude (relevant for ``BGDLIXA`` and ``BGDLIXE``
60 methods). 60 methods).
61 61
  62 +``(phi_first = -1) [integer]``
  63 + First Phibar layer for likelihood fitting, starting from 0. If -1 is specified
  64 + there is no first Phibar layer selection.
  65 +
  66 +``(phi_last = -1) [integer]``
  67 + Last Phibar layer for likelihood fitting, starting from 0. If -1 is specified
  68 + there is no last Phibar layer selection.
  69 +
62 70
63 Standard parameters 71 Standard parameters
64 ------------------- 72 -------------------
doc/source/users/reference_manual/comlixmap.rst
@@ -73,6 +73,14 @@ General parameters @@ -73,6 +73,14 @@ General parameters
73 Number of Phibar layers to exclude (relevant for ``BGDLIXA`` and ``BGDLIXE`` 73 Number of Phibar layers to exclude (relevant for ``BGDLIXA`` and ``BGDLIXE``
74 methods). 74 methods).
75 75
  76 +``(phi_first = -1) [integer]``
  77 + First Phibar layer for likelihood fitting, starting from 0. If -1 is specified
  78 + there is no first Phibar layer selection.
  79 +
  80 +``(phi_last = -1) [integer]``
  81 + Last Phibar layer for likelihood fitting, starting from 0. If -1 is specified
  82 + there is no last Phibar layer selection.
  83 +
76 84
77 Standard parameters 85 Standard parameters
78 ------------------- 86 -------------------
modules/comscripts/comlixfit.par
@@ -35,6 +35,8 @@ nrunav, i, h, 3,,, "Number of Chi/Psi bins used for running average @@ -35,6 +35,8 @@ nrunav, i, h, 3,,, "Number of Chi/Psi bins used for running average
35 navgr, i, h, 5,,, "Number of Chi/Psi bins used for averaging" 35 navgr, i, h, 5,,, "Number of Chi/Psi bins used for averaging"
36 nincl, i, h, 5,,, "Number of Phibar layers to include" 36 nincl, i, h, 5,,, "Number of Phibar layers to include"
37 nexcl, i, h, 0,,, "Number of Phibar layers to exclude" 37 nexcl, i, h, 0,,, "Number of Phibar layers to exclude"
  38 +phi_first, i, h, -1,,, "First Phibar layer for fitting (starting from 0; -1: no selection)"
  39 +phi_last, i, h, -1,,, "Last Phibar layer for fitting (starting from 0;-1: no selection)"
38 40
39 # 41 #
40 # Standard parameters 42 # Standard parameters
modules/comscripts/comlixfit.py
@@ -70,6 +70,8 @@ class comlixfit(ctools.cslikelihood): @@ -70,6 +70,8 @@ class comlixfit(ctools.cslikelihood):
70 navgr = self['navgr'].integer() 70 navgr = self['navgr'].integer()
71 nincl = self['nincl'].integer() 71 nincl = self['nincl'].integer()
72 nexcl = self['nexcl'].integer() 72 nexcl = self['nexcl'].integer()
  73 + phi_first = self['phi_first'].integer()
  74 + phi_last = self['phi_last'].integer()
73 75
74 # Check for incorrect parameters 76 # Check for incorrect parameters
75 if nexcl < 0 or nexcl >= nincl: 77 if nexcl < 0 or nexcl >= nincl:
@@ -92,6 +94,14 @@ class comlixfit(ctools.cslikelihood): @@ -92,6 +94,14 @@ class comlixfit(ctools.cslikelihood):
92 self['outobs'].filename() 94 self['outobs'].filename()
93 self['outmodel'].filename() 95 self['outmodel'].filename()
94 96
  97 + # Set Phibar layers for fitting
  98 + for obs in self.obs():
  99 + if obs.classname() == 'GCOMObservation':
  100 + if phi_first >= 0:
  101 + obs.phi_first(phi_first)
  102 + if phi_last >= 0:
  103 + obs.phi_last(phi_last)
  104 +
95 # Write input parameters into logger 105 # Write input parameters into logger
96 self._log_parameters(gammalib.TERSE) 106 self._log_parameters(gammalib.TERSE)
97 107
modules/comscripts/comlixmap.par
@@ -43,6 +43,8 @@ nrunav, i, h, 3,,, &quot;Number of Chi/Psi bins used for running average&quot; @@ -43,6 +43,8 @@ nrunav, i, h, 3,,, &quot;Number of Chi/Psi bins used for running average&quot;
43 navgr, i, h, 9,,, "Number of Chi/Psi bins used for averaging" 43 navgr, i, h, 9,,, "Number of Chi/Psi bins used for averaging"
44 nincl, i, h, 5,,, "Number of Phibar layers to include" 44 nincl, i, h, 5,,, "Number of Phibar layers to include"
45 nexcl, i, h, 0,,, "Number of Phibar layers to exclude" 45 nexcl, i, h, 0,,, "Number of Phibar layers to exclude"
  46 +phi_first, i, h, -1,,, "First Phibar layer for fitting (starting from 0; -1: no selection)"
  47 +phi_last, i, h, -1,,, "Last Phibar layer for fitting (starting from 0;-1: no selection)"
46 48
47 # 49 #
48 # Standard parameters 50 # Standard parameters
modules/comscripts/comlixmap.py
@@ -84,6 +84,8 @@ class comlixmap(ctools.cslikelihood): @@ -84,6 +84,8 @@ class comlixmap(ctools.cslikelihood):
84 navgr = self['navgr'].integer() 84 navgr = self['navgr'].integer()
85 nincl = self['nincl'].integer() 85 nincl = self['nincl'].integer()
86 nexcl = self['nexcl'].integer() 86 nexcl = self['nexcl'].integer()
  87 + phi_first = self['phi_first'].integer()
  88 + phi_last = self['phi_last'].integer()
87 89
88 # Check for incorrect parameters 90 # Check for incorrect parameters
89 if nexcl < 0 or nexcl >= nincl: 91 if nexcl < 0 or nexcl >= nincl:
@@ -103,6 +105,14 @@ class comlixmap(ctools.cslikelihood): @@ -103,6 +105,14 @@ class comlixmap(ctools.cslikelihood):
103 if self._read_ahead(): 105 if self._read_ahead():
104 self['outmap'].filename() 106 self['outmap'].filename()
105 107
  108 + # Set Phibar layers for fitting
  109 + for obs in self.obs():
  110 + if obs.classname() == 'GCOMObservation':
  111 + if phi_first >= 0:
  112 + obs.phi_first(phi_first)
  113 + if phi_last >= 0:
  114 + obs.phi_last(phi_last)
  115 +
106 # Write input parameters into logger 116 # Write input parameters into logger
107 self._log_parameters(gammalib.TERSE) 117 self._log_parameters(gammalib.TERSE)
108 118