Commit 0a9552e79495e7743cfc18175f2e533483802dd1

Authored by Jürgen Knödlseder
1 parent 84115ca3

Use GObservations::remove_response_cache() method to initialise test source (#2973)

ChangeLog
1   -2019-07-10
  1 +2019-07-23
2 2  
3 3 * Version 1.7.0 released
4 4 ========================
5 5  
  6 + Remove response cache before source testing in cttsmap (#2973)
6 7 Enabling running of example scripts from objects in memory (#2925)
7 8  
8 9  
... ...
1 1 New Features and Important Changes in ctools 1.7.0
2 2  
3   -10 July 2019
  3 +23 July 2019
4 4  
5 5  
6 6 Introduction
... ... @@ -123,7 +123,7 @@ writing a FITS file (#2925).
123 123  
124 124 cttsmap - Generation of Test Statistic map
125 125 ------------------------------------------
126   -None
  126 +Remove response cache for test source before fitting the source (#2973).
127 127  
128 128  
129 129 ctulimit - Compute upper limit
... ...
doc/source/admin/release_history/1.7.rst
... ... @@ -22,6 +22,8 @@ Bug fixes
22 22 Improvements
23 23 ------------
24 24  
  25 +* [`2973 <https://cta-redmine.irap.omp.eu/issues/2973>`_] -
  26 + Remove response cache before source testing in cttsmap
25 27 * [`2925 <https://cta-redmine.irap.omp.eu/issues/2925>`_] -
26 28 Enabling running of example scripts from objects in memory
27 29  
... ...
src/cttsmap/cttsmap.cpp
... ... @@ -274,19 +274,17 @@ void cttsmap::run(void)
274 274 log_header2(EXPLICIT, "Computing TS for bin number "+gammalib::str(i)+
275 275 " at "+bincentre.print());
276 276  
277   - // Sets unique test source name. This avoids caching of response
278   - // values
279   - std::string srcname = m_srcname + "_" + gammalib::str(i);
280   -
281 277 // Add test source at current bin position
282 278 (*m_testsource)["RA"].value(bincentre.ra_deg());
283 279 (*m_testsource)["DEC"].value(bincentre.dec_deg());
284   - m_testsource->name(srcname);
285 280 models.append(*m_testsource);
286 281  
287 282 // Assign models to observations
288 283 m_obs.models(models);
289 284  
  285 + // Make sure that no values are cached for test source
  286 + m_obs.remove_response_cache(m_srcname);
  287 +
290 288 // Optimize observation container
291 289 m_obs.optimize(m_opt);
292 290  
... ... @@ -315,7 +313,7 @@ void cttsmap::run(void)
315 313  
316 314 // Get test source model instance
317 315 GModels best_fit_model = m_obs.models();
318   - GModel* testsource = best_fit_model[srcname];
  316 + GModel* testsource = best_fit_model[m_srcname];
319 317  
320 318 // Assign values to the maps
321 319 m_tsmap(i) = ts;
... ... @@ -345,7 +343,7 @@ void cttsmap::run(void)
345 343 m_statusmap(i) = status;
346 344  
347 345 // Remove model from container
348   - models.remove(srcname);
  346 + models.remove(m_srcname);
349 347  
350 348 } // endfor: looped over grid positions
351 349  
... ...