Commit 1cbb566316fa8b5126ac61ef0ce3ecc143a3ac2e

Authored by Jürgen Knödlseder
1 parent f4c8e23d

Add hidden "fix_spat" parameter to cttsmap (#3562)

ChangeLog
1   -2020-03-04
  1 +2021-03-05
2 2  
3 3 * Version 2.0.0 released
4 4 ========================
5 5  
  6 + Add hidden "fix_spat" parameter to cttsmap (#3562)
6 7 Add optimizer setter to ctlikelihood base class
7 8 Add Sphinx tutorials test script (#3510)
8 9 Add "refit_if_failed" parameter to ctlike
... ...
1 1 New Features and Important Changes in ctools 2.0.0
2 2  
3   -4 March 2021
  3 +5 March 2021
4 4  
5 5  
6 6 Introduction
... ... @@ -137,7 +137,8 @@ None
137 137  
138 138 cttsmap - Generation of Test Statistic map
139 139 ------------------------------------------
140   -None
  140 +Added hidden "fix_spat" parameter that instructs the tool to fix all spatial
  141 +model parameters (#3562).
141 142  
142 143  
143 144 ctulimit - Compute upper limit
... ...
README.md
1 1 ctools information
2 2 ==================
3   -* Version: 2.0.0.dev (4 March 2021)
  3 +* Version: 2.0.0.dev (5 March 2021)
4 4 * GammaLib dependency: 2.0.0.dev
5 5  
6 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/)
... ...
cscripts/cstsmapsplit.par
... ... @@ -30,6 +30,7 @@ errors, b, h, no,,, "Compute/store parameter errors?"
30 30 statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
31 31 like_accuracy, r, h, 0.005,1.0e-30,1.0, "Absolute accuracy of maximum likelihood value"
32 32 max_iter, i, h, 50,1,1000, "Maximum number of fit iterations"
  33 +fix_spat, b, h, no,,, "Fix spatial parameters for TS map computation?"
33 34 outmap, f, a, tsmap.fits,,, "Output Test Statistic map file"
34 35 bins_per_job, i, a, 5,,, "Number of TS map bins per task"
35 36 compute_null, b, a, yes,,,"Compute null hypothesis first?"
... ...
doc/source/admin/release_history/2.0.rst
1 1 .. _2.0:
2 2  
3   -ctools 2.0 release (4 March 2021)
  3 +ctools 2.0 release (5 March 2021)
4 4 =================================
5 5  
6 6 Overview
... ... @@ -24,6 +24,8 @@ Bug fixes
24 24 Improvements
25 25 ------------
26 26  
  27 +* [`3562 <https://cta-redmine.irap.omp.eu/issues/3562>`_] -
  28 + Add hidden ``fix_spat`` parameter to :ref:`cttsmap`
27 29 * Add optimizer setter to ``ctlikelihood`` base class.
28 30 * Add ``refit_if_failed`` parameter to :ref:`ctlike`
29 31 * [`3441 <https://cta-redmine.irap.omp.eu/issues/3441>`_] -
... ...
doc/source/users/reference_manual/cttsmap.rst
... ... @@ -83,6 +83,9 @@ General parameters
83 83 ``(max_iter = 50) [integer]``
84 84 Maximum number of fit iterations.
85 85  
  86 +``(fix_spat = no) [boolean]``
  87 + Fix spatial parameters for TS map computation.
  88 +
86 89 ``(usepnt = no) [boolean]``
87 90 Use CTA pointing direction for map centre instead of xref/yref parameters?
88 91  
... ...
src/ctlike/ctlike.cpp
... ... @@ -715,7 +715,7 @@ GXml ctlike::xml_result(void) const
715 715  
716 716 // Set flag strings
717 717 std::string refit = (m_refit) ? "yes" : "no";
718   - std::string edisp = (m_apply_edisp) ? "yes" : "no";
  718 + std::string edisp = (m_apply_edisp) ? "yes" : "no";
719 719 std::string fix_spat_for_ts = (m_fix_spat_for_ts) ? "yes" : "no";
720 720  
721 721 // Write ctlike results into XML instance
... ...
src/cttsmap/cttsmap.cpp
1 1 /***************************************************************************
2 2 * cttsmap - TS map calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2019 by Michael Mayer *
  4 + * copyright (C) 2014-2021 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -248,6 +248,28 @@ void cttsmap::run(void)
248 248 // Remove test source
249 249 models.remove(m_srcname);
250 250  
  251 + // Fix spatial parameters if requested
  252 + if ((*this)["fix_spat"].boolean()) {
  253 +
  254 + // Loop over all models
  255 + for (int i = 0; i < models.size(); ++i) {
  256 +
  257 + // Continue only if model is skymodel
  258 + GModelSky* sky= dynamic_cast<GModelSky*>(models[i]);
  259 + if (sky != NULL) {
  260 +
  261 + // Fix all spatial parameters
  262 + GModelSpatial* spatial = sky->spatial();
  263 + for (int j = 0; j < spatial->size(); j++) {
  264 + (*spatial)[j].fix();
  265 + }
  266 +
  267 + } // endif: there was a sky model
  268 +
  269 + } // endfor: looped over models
  270 +
  271 + } // endif: spatial parameter should be fixed
  272 +
251 273 // Get likelihood of null hypothesis if not given before
252 274 if (m_logL0 == 0.0) {
253 275  
... ... @@ -581,6 +603,9 @@ void cttsmap::get_parameters(void)
581 603 m_logL0 = (*this)["logL0"].real();
582 604 m_publish = (*this)["publish"].boolean();
583 605  
  606 + // Query other parameters
  607 + (*this)["fix_spat"].boolean();
  608 +
584 609 // If needed later, query output filename now
585 610 if (read_ahead()) {
586 611 (*this)["outmap"].query();
... ...
src/cttsmap/cttsmap.par
... ... @@ -35,6 +35,7 @@ errors, b, h, no,,, &quot;Compute and store parameter errors?&quot;
35 35 statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic"
36 36 like_accuracy, r, h, 0.005,1.0e-30,1.0, "Absolute accuracy of maximum likelihood value"
37 37 max_iter, i, h, 50,1,1000, "Maximum number of fit iterations"
  38 +fix_spat, b, h, no,,, "Fix spatial parameters for TS map computation?"
38 39  
39 40 #
40 41 # Spatial binning parameters
... ...