Commit f6f8d305cda6d7cd04e297e8d4d2f5f5b4211d24

Authored by Jürgen Knödlseder
1 parent 75214e63

Adjust TS computation code to avoid re-optimization after TS computation.

Showing 1 changed file with 8 additions and 2 deletions
src/ctlike/ctlike.cpp
... ... @@ -271,6 +271,9 @@ void ctlike::run(void)
271 271 // Optimize model parameters using LM optimizer
272 272 optimize_lm();
273 273  
  274 + // Store Npred
  275 + double npred = m_obs.npred();
  276 +
274 277 // Optionally perform TS computation
275 278 if (m_tscalc) {
276 279  
... ... @@ -315,14 +318,17 @@ void ctlike::run(void)
315 318  
316 319 // Write results into logger
317 320 if (logTerse()) {
  321 + log << std::endl;
  322 + log.header1("Maximum likelihood optimization results");
  323 + log << *m_opt << std::endl;
318 324 log << gammalib::parformat("Maximum log likelihood");
319 325 log << gammalib::str(m_logL,3) << std::endl;
320 326 log << gammalib::parformat("Observed events (Nobs)");
321 327 log << gammalib::str(num_events, 3) << std::endl;
322 328 log << gammalib::parformat("Predicted events (Npred)");
323   - log << gammalib::str(m_obs.npred(), 3);
  329 + log << gammalib::str(npred, 3);
324 330 log << " (Nobs - Npred = ";
325   - log << gammalib::str(num_events-m_obs.npred());
  331 + log << gammalib::str(num_events-npred);
326 332 log << ")" << std::endl;
327 333 log << m_obs.models() << std::endl;
328 334 }
... ...