Commit 0a9552e79495e7743cfc18175f2e533483802dd1
1 parent
84115ca3
Use GObservations::remove_response_cache() method to initialise test source (#2973)
Showing
4 changed files
with
11 additions
and
10 deletions
ChangeLog
| 1 | -2019-07-10 | 1 | +2019-07-23 |
| 2 | 2 | ||
| 3 | * Version 1.7.0 released | 3 | * Version 1.7.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Remove response cache before source testing in cttsmap (#2973) | ||
| 6 | Enabling running of example scripts from objects in memory (#2925) | 7 | Enabling running of example scripts from objects in memory (#2925) |
| 7 | 8 | ||
| 8 | 9 |
NEWS
| 1 | New Features and Important Changes in ctools 1.7.0 | 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 | Introduction | 6 | Introduction |
| @@ -123,7 +123,7 @@ writing a FITS file (#2925). | @@ -123,7 +123,7 @@ writing a FITS file (#2925). | ||
| 123 | 123 | ||
| 124 | cttsmap - Generation of Test Statistic map | 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 | ctulimit - Compute upper limit | 129 | ctulimit - Compute upper limit |
doc/source/admin/release_history/1.7.rst
| @@ -22,6 +22,8 @@ Bug fixes | @@ -22,6 +22,8 @@ Bug fixes | ||
| 22 | Improvements | 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 | * [`2925 <https://cta-redmine.irap.omp.eu/issues/2925>`_] - | 27 | * [`2925 <https://cta-redmine.irap.omp.eu/issues/2925>`_] - |
| 26 | Enabling running of example scripts from objects in memory | 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,19 +274,17 @@ void cttsmap::run(void) | ||
| 274 | log_header2(EXPLICIT, "Computing TS for bin number "+gammalib::str(i)+ | 274 | log_header2(EXPLICIT, "Computing TS for bin number "+gammalib::str(i)+ |
| 275 | " at "+bincentre.print()); | 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 | // Add test source at current bin position | 277 | // Add test source at current bin position |
| 282 | (*m_testsource)["RA"].value(bincentre.ra_deg()); | 278 | (*m_testsource)["RA"].value(bincentre.ra_deg()); |
| 283 | (*m_testsource)["DEC"].value(bincentre.dec_deg()); | 279 | (*m_testsource)["DEC"].value(bincentre.dec_deg()); |
| 284 | - m_testsource->name(srcname); | ||
| 285 | models.append(*m_testsource); | 280 | models.append(*m_testsource); |
| 286 | 281 | ||
| 287 | // Assign models to observations | 282 | // Assign models to observations |
| 288 | m_obs.models(models); | 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 | // Optimize observation container | 288 | // Optimize observation container |
| 291 | m_obs.optimize(m_opt); | 289 | m_obs.optimize(m_opt); |
| 292 | 290 | ||
| @@ -315,7 +313,7 @@ void cttsmap::run(void) | @@ -315,7 +313,7 @@ void cttsmap::run(void) | ||
| 315 | 313 | ||
| 316 | // Get test source model instance | 314 | // Get test source model instance |
| 317 | GModels best_fit_model = m_obs.models(); | 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 | // Assign values to the maps | 318 | // Assign values to the maps |
| 321 | m_tsmap(i) = ts; | 319 | m_tsmap(i) = ts; |
| @@ -345,7 +343,7 @@ void cttsmap::run(void) | @@ -345,7 +343,7 @@ void cttsmap::run(void) | ||
| 345 | m_statusmap(i) = status; | 343 | m_statusmap(i) = status; |
| 346 | 344 | ||
| 347 | // Remove model from container | 345 | // Remove model from container |
| 348 | - models.remove(srcname); | 346 | + models.remove(m_srcname); |
| 349 | 347 | ||
| 350 | } // endfor: looped over grid positions | 348 | } // endfor: looped over grid positions |
| 351 | 349 |