Commit d0096357fbb019cd3d8874d392b8c32a2ee6b8e1
1 parent
8e173661
Fix implementation of fix_spat_for_ts parameter in ctlike (#3426)
Showing
5 changed files
with
32 additions
and
22 deletions
ChangeLog
NEWS
| 1 | 1 | New Features and Important Changes in ctools 2.0.0 |
| 2 | 2 | |
| 3 | -19 October 2020 | |
| 3 | +3 November 2020 | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | Introduction |
| ... | ... | @@ -76,7 +76,10 @@ None |
| 76 | 76 | |
| 77 | 77 | ctlike - Maximum likelihood fitting |
| 78 | 78 | ----------------------------------- |
| 79 | -None | |
| 79 | +A bug was fixed in the implementation of the fix_spat_for_ts parameter that | |
| 80 | +only fixed the spatial parameters for the first of the sky models but left | |
| 81 | +the spatial parameters free for all additional sky models. Now the parameters | |
| 82 | +are fixed for all sky models (#3426). | |
| 80 | 83 | |
| 81 | 84 | |
| 82 | 85 | ctmapcube - CTA map cube generation | ... | ... |
README.md
| 1 | 1 | ctools information |
| 2 | 2 | ================== |
| 3 | -* Version: 2.0.0.dev (19 October 2020) | |
| 3 | +* Version: 2.0.0.dev (3 November 2020) | |
| 4 | 4 | * GammaLib dependency: 2.0.0.dev |
| 5 | 5 | |
| 6 | 6 | [](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/) | ... | ... |
doc/source/admin/release_history/2.0.rst
| 1 | 1 | .. _2.0: |
| 2 | 2 | |
| 3 | -ctools 2.0 release (19 October 2020) | |
| 3 | +ctools 2.0 release (3 November 2020) | |
| 4 | 4 | ==================================== |
| 5 | 5 | |
| 6 | 6 | Overview |
| ... | ... | @@ -17,26 +17,17 @@ In particular, this release provides: |
| 17 | 17 | Bug fixes |
| 18 | 18 | --------- |
| 19 | 19 | |
| 20 | -* [`2883 <https://cta-redmine.irap.omp.eu/issues/2883>`_] - | |
| 21 | - ... | |
| 20 | +* [`3426 <https://cta-redmine.irap.omp.eu/issues/3426>`_] - | |
| 21 | + Fix implementation of ``fix_spat_for_ts`` parameter in :ref:`ctlike` | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | Improvements |
| 25 | 25 | ------------ |
| 26 | 26 | |
| 27 | -* [`2883 <https://cta-redmine.irap.omp.eu/issues/2883>`_] - | |
| 28 | - ... | |
| 29 | - | |
| 30 | 27 | |
| 31 | 28 | New features |
| 32 | 29 | ------------ |
| 33 | 30 | |
| 34 | -* [`2883 <https://cta-redmine.irap.omp.eu/issues/2883>`_] - | |
| 35 | - ... | |
| 36 | - | |
| 37 | 31 | |
| 38 | 32 | Clean up |
| 39 | 33 | -------- |
| 40 | - | |
| 41 | -* [`2883 <https://cta-redmine.irap.omp.eu/issues/2883>`_] - | |
| 42 | - ... | ... | ... |
src/ctlike/ctlike.cpp
| ... | ... | @@ -281,17 +281,31 @@ void ctlike::run(void) |
| 281 | 281 | |
| 282 | 282 | // Loop over stored models, remove source and refit |
| 283 | 283 | for (int i = 0; i < ts_srcs.size(); ++i) { |
| 284 | - models.remove(ts_srcs[i]); | |
| 285 | - m_obs.models(models); | |
| 284 | + | |
| 285 | + // Create copy of models | |
| 286 | + GModels models_copy = models; | |
| 287 | + | |
| 288 | + // Remove source of interest | |
| 289 | + models_copy.remove(ts_srcs[i]); | |
| 290 | + | |
| 291 | + // Set models for fitting | |
| 292 | + m_obs.models(models_copy); | |
| 293 | + | |
| 294 | + // Re-optimise log-likelihood for the source removed | |
| 286 | 295 | double logL_nosrc = reoptimize_lm(); |
| 287 | - double ts = 2.0 * (logL_src-logL_nosrc); | |
| 296 | + | |
| 297 | + // Compute source TS value | |
| 298 | + double ts = 2.0 * (logL_src-logL_nosrc); | |
| 299 | + | |
| 300 | + // Store TS value in original model | |
| 288 | 301 | models_orig[ts_srcs[i]]->ts(ts); |
| 289 | - models = models_orig; | |
| 290 | - } | |
| 302 | + | |
| 303 | + } // endfor: looped over sources | |
| 291 | 304 | |
| 292 | 305 | // Restore best fit values |
| 293 | 306 | m_obs.models(models_orig); |
| 294 | - } | |
| 307 | + | |
| 308 | + } // endif: requested TS computation | |
| 295 | 309 | |
| 296 | 310 | // Compute number of observed events in all observations |
| 297 | 311 | double num_events = 0.0; | ... | ... |