diff --git a/ChangeLog b/ChangeLog index d8c8317..57ad70b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2020-03-04 +2021-03-05 * Version 2.0.0 released ======================== + Add hidden "fix_spat" parameter to cttsmap (#3562) Add optimizer setter to ctlikelihood base class Add Sphinx tutorials test script (#3510) Add "refit_if_failed" parameter to ctlike diff --git a/NEWS b/NEWS index 78e83d5..1f43670 100755 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in ctools 2.0.0 -4 March 2021 +5 March 2021 Introduction @@ -137,7 +137,8 @@ None cttsmap - Generation of Test Statistic map ------------------------------------------ -None +Added hidden "fix_spat" parameter that instructs the tool to fix all spatial +model parameters (#3562). ctulimit - Compute upper limit diff --git a/README.md b/README.md index 8a57a2f..5a87f6a 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ctools information ================== -* Version: 2.0.0.dev (4 March 2021) +* Version: 2.0.0.dev (5 March 2021) * GammaLib dependency: 2.0.0.dev [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/) diff --git a/cscripts/cstsmapsplit.par b/cscripts/cstsmapsplit.par index b1bef14..b437179 100755 --- a/cscripts/cstsmapsplit.par +++ b/cscripts/cstsmapsplit.par @@ -30,6 +30,7 @@ errors, b, h, no,,, "Compute/store parameter errors?" statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" like_accuracy, r, h, 0.005,1.0e-30,1.0, "Absolute accuracy of maximum likelihood value" max_iter, i, h, 50,1,1000, "Maximum number of fit iterations" +fix_spat, b, h, no,,, "Fix spatial parameters for TS map computation?" outmap, f, a, tsmap.fits,,, "Output Test Statistic map file" bins_per_job, i, a, 5,,, "Number of TS map bins per task" compute_null, b, a, yes,,,"Compute null hypothesis first?" diff --git a/doc/source/admin/release_history/2.0.rst b/doc/source/admin/release_history/2.0.rst index 41d82d5..5c1ab24 100644 --- a/doc/source/admin/release_history/2.0.rst +++ b/doc/source/admin/release_history/2.0.rst @@ -1,6 +1,6 @@ .. _2.0: -ctools 2.0 release (4 March 2021) +ctools 2.0 release (5 March 2021) ================================= Overview @@ -24,6 +24,8 @@ Bug fixes Improvements ------------ +* [`3562 `_] - + Add hidden ``fix_spat`` parameter to :ref:`cttsmap` * Add optimizer setter to ``ctlikelihood`` base class. * Add ``refit_if_failed`` parameter to :ref:`ctlike` * [`3441 `_] - diff --git a/doc/source/users/reference_manual/cttsmap.rst b/doc/source/users/reference_manual/cttsmap.rst index f2e1c07..3d50603 100755 --- a/doc/source/users/reference_manual/cttsmap.rst +++ b/doc/source/users/reference_manual/cttsmap.rst @@ -83,6 +83,9 @@ General parameters ``(max_iter = 50) [integer]`` Maximum number of fit iterations. +``(fix_spat = no) [boolean]`` + Fix spatial parameters for TS map computation. + ``(usepnt = no) [boolean]`` Use CTA pointing direction for map centre instead of xref/yref parameters? diff --git a/src/ctlike/ctlike.cpp b/src/ctlike/ctlike.cpp index 47ee73b..190b010 100755 --- a/src/ctlike/ctlike.cpp +++ b/src/ctlike/ctlike.cpp @@ -715,7 +715,7 @@ GXml ctlike::xml_result(void) const // Set flag strings std::string refit = (m_refit) ? "yes" : "no"; - std::string edisp = (m_apply_edisp) ? "yes" : "no"; + std::string edisp = (m_apply_edisp) ? "yes" : "no"; std::string fix_spat_for_ts = (m_fix_spat_for_ts) ? "yes" : "no"; // Write ctlike results into XML instance diff --git a/src/cttsmap/cttsmap.cpp b/src/cttsmap/cttsmap.cpp index 467c312..565d280 100755 --- a/src/cttsmap/cttsmap.cpp +++ b/src/cttsmap/cttsmap.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * cttsmap - TS map calculation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2019 by Michael Mayer * + * copyright (C) 2014-2021 by Michael Mayer * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -248,6 +248,28 @@ void cttsmap::run(void) // Remove test source models.remove(m_srcname); + // Fix spatial parameters if requested + if ((*this)["fix_spat"].boolean()) { + + // Loop over all models + for (int i = 0; i < models.size(); ++i) { + + // Continue only if model is skymodel + GModelSky* sky= dynamic_cast(models[i]); + if (sky != NULL) { + + // Fix all spatial parameters + GModelSpatial* spatial = sky->spatial(); + for (int j = 0; j < spatial->size(); j++) { + (*spatial)[j].fix(); + } + + } // endif: there was a sky model + + } // endfor: looped over models + + } // endif: spatial parameter should be fixed + // Get likelihood of null hypothesis if not given before if (m_logL0 == 0.0) { @@ -581,6 +603,9 @@ void cttsmap::get_parameters(void) m_logL0 = (*this)["logL0"].real(); m_publish = (*this)["publish"].boolean(); + // Query other parameters + (*this)["fix_spat"].boolean(); + // If needed later, query output filename now if (read_ahead()) { (*this)["outmap"].query(); diff --git a/src/cttsmap/cttsmap.par b/src/cttsmap/cttsmap.par index 8e8787b..ece023b 100755 --- a/src/cttsmap/cttsmap.par +++ b/src/cttsmap/cttsmap.par @@ -35,6 +35,7 @@ errors, b, h, no,,, "Compute and store parameter errors?" statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" like_accuracy, r, h, 0.005,1.0e-30,1.0, "Absolute accuracy of maximum likelihood value" max_iter, i, h, 50,1,1000, "Maximum number of fit iterations" +fix_spat, b, h, no,,, "Fix spatial parameters for TS map computation?" # # Spatial binning parameters