Commit 1cbb566316fa8b5126ac61ef0ce3ecc143a3ac2e
1 parent
f4c8e23d
Add hidden "fix_spat" parameter to cttsmap (#3562)
Showing
9 changed files
with
41 additions
and
7 deletions
ChangeLog
| 1 | -2020-03-04 | 1 | +2021-03-05 |
| 2 | 2 | ||
| 3 | * Version 2.0.0 released | 3 | * Version 2.0.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Add hidden "fix_spat" parameter to cttsmap (#3562) | ||
| 6 | Add optimizer setter to ctlikelihood base class | 7 | Add optimizer setter to ctlikelihood base class |
| 7 | Add Sphinx tutorials test script (#3510) | 8 | Add Sphinx tutorials test script (#3510) |
| 8 | Add "refit_if_failed" parameter to ctlike | 9 | Add "refit_if_failed" parameter to ctlike |
NEWS
| 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 | -4 March 2021 | 3 | +5 March 2021 |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | Introduction | 6 | Introduction |
| @@ -137,7 +137,8 @@ None | @@ -137,7 +137,8 @@ None | ||
| 137 | 137 | ||
| 138 | cttsmap - Generation of Test Statistic map | 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 | ctulimit - Compute upper limit | 144 | ctulimit - Compute upper limit |
README.md
| 1 | ctools information | 1 | ctools information |
| 2 | ================== | 2 | ================== |
| 3 | -* Version: 2.0.0.dev (4 March 2021) | 3 | +* Version: 2.0.0.dev (5 March 2021) |
| 4 | * GammaLib dependency: 2.0.0.dev | 4 | * GammaLib dependency: 2.0.0.dev |
| 5 | 5 | ||
| 6 | [](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/) | 6 | [](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,6 +30,7 @@ errors, b, h, no,,, "Compute/store parameter errors?" | ||
| 30 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | 30 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" |
| 31 | like_accuracy, r, h, 0.005,1.0e-30,1.0, "Absolute accuracy of maximum likelihood value" | 31 | like_accuracy, r, h, 0.005,1.0e-30,1.0, "Absolute accuracy of maximum likelihood value" |
| 32 | max_iter, i, h, 50,1,1000, "Maximum number of fit iterations" | 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 | outmap, f, a, tsmap.fits,,, "Output Test Statistic map file" | 34 | outmap, f, a, tsmap.fits,,, "Output Test Statistic map file" |
| 34 | bins_per_job, i, a, 5,,, "Number of TS map bins per task" | 35 | bins_per_job, i, a, 5,,, "Number of TS map bins per task" |
| 35 | compute_null, b, a, yes,,,"Compute null hypothesis first?" | 36 | compute_null, b, a, yes,,,"Compute null hypothesis first?" |
doc/source/admin/release_history/2.0.rst
| 1 | .. _2.0: | 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 | Overview | 6 | Overview |
| @@ -24,6 +24,8 @@ Bug fixes | @@ -24,6 +24,8 @@ Bug fixes | ||
| 24 | Improvements | 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 | * Add optimizer setter to ``ctlikelihood`` base class. | 29 | * Add optimizer setter to ``ctlikelihood`` base class. |
| 28 | * Add ``refit_if_failed`` parameter to :ref:`ctlike` | 30 | * Add ``refit_if_failed`` parameter to :ref:`ctlike` |
| 29 | * [`3441 <https://cta-redmine.irap.omp.eu/issues/3441>`_] - | 31 | * [`3441 <https://cta-redmine.irap.omp.eu/issues/3441>`_] - |
doc/source/users/reference_manual/cttsmap.rst
| @@ -83,6 +83,9 @@ General parameters | @@ -83,6 +83,9 @@ General parameters | ||
| 83 | ``(max_iter = 50) [integer]`` | 83 | ``(max_iter = 50) [integer]`` |
| 84 | Maximum number of fit iterations. | 84 | Maximum number of fit iterations. |
| 85 | 85 | ||
| 86 | +``(fix_spat = no) [boolean]`` | ||
| 87 | + Fix spatial parameters for TS map computation. | ||
| 88 | + | ||
| 86 | ``(usepnt = no) [boolean]`` | 89 | ``(usepnt = no) [boolean]`` |
| 87 | Use CTA pointing direction for map centre instead of xref/yref parameters? | 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,7 +715,7 @@ GXml ctlike::xml_result(void) const | ||
| 715 | 715 | ||
| 716 | // Set flag strings | 716 | // Set flag strings |
| 717 | std::string refit = (m_refit) ? "yes" : "no"; | 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 | std::string fix_spat_for_ts = (m_fix_spat_for_ts) ? "yes" : "no"; | 719 | std::string fix_spat_for_ts = (m_fix_spat_for_ts) ? "yes" : "no"; |
| 720 | 720 | ||
| 721 | // Write ctlike results into XML instance | 721 | // Write ctlike results into XML instance |
src/cttsmap/cttsmap.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * cttsmap - TS map calculation tool * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -248,6 +248,28 @@ void cttsmap::run(void) | @@ -248,6 +248,28 @@ void cttsmap::run(void) | ||
| 248 | // Remove test source | 248 | // Remove test source |
| 249 | models.remove(m_srcname); | 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 | // Get likelihood of null hypothesis if not given before | 273 | // Get likelihood of null hypothesis if not given before |
| 252 | if (m_logL0 == 0.0) { | 274 | if (m_logL0 == 0.0) { |
| 253 | 275 | ||
| @@ -581,6 +603,9 @@ void cttsmap::get_parameters(void) | @@ -581,6 +603,9 @@ void cttsmap::get_parameters(void) | ||
| 581 | m_logL0 = (*this)["logL0"].real(); | 603 | m_logL0 = (*this)["logL0"].real(); |
| 582 | m_publish = (*this)["publish"].boolean(); | 604 | m_publish = (*this)["publish"].boolean(); |
| 583 | 605 | ||
| 606 | + // Query other parameters | ||
| 607 | + (*this)["fix_spat"].boolean(); | ||
| 608 | + | ||
| 584 | // If needed later, query output filename now | 609 | // If needed later, query output filename now |
| 585 | if (read_ahead()) { | 610 | if (read_ahead()) { |
| 586 | (*this)["outmap"].query(); | 611 | (*this)["outmap"].query(); |
src/cttsmap/cttsmap.par
| @@ -35,6 +35,7 @@ errors, b, h, no,,, "Compute and store parameter errors?" | @@ -35,6 +35,7 @@ errors, b, h, no,,, "Compute and store parameter errors?" | ||
| 35 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | 35 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" |
| 36 | like_accuracy, r, h, 0.005,1.0e-30,1.0, "Absolute accuracy of maximum likelihood value" | 36 | like_accuracy, r, h, 0.005,1.0e-30,1.0, "Absolute accuracy of maximum likelihood value" |
| 37 | max_iter, i, h, 50,1,1000, "Maximum number of fit iterations" | 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 | # Spatial binning parameters | 41 | # Spatial binning parameters |