Commit 9baf2d5e0b77b605ff63cfaf4cbd48e8c3a8d4e6
1 parent
4e47b21b
Improve ctlike output
ctlike now computes the observed number of events and dumps the information just before the predicted number of events into the log file. The difference between the observed and predicted number of events is also given so that one knows immediately if the fit behaved as it should. This commit closes actions #87 and #88 and the feature #54.
Showing
4 changed files
with
24 additions
and
9 deletions
ChangeLog
| ... | ... | @@ -4,18 +4,20 @@ |
| 4 | 4 | ======================== |
| 5 | 5 | |
| 6 | 6 | Add observation definition XML files support to ctobssim |
| 7 | + Improve logging information for ctlike | |
| 7 | 8 | |
| 8 | 9 | 2012-03-08 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> |
| 9 | 10 | |
| 10 | 11 | * Version 0.4.0 released |
| 11 | 12 | ======================== |
| 12 | 13 | |
| 13 | - Add handling of observation definition XML files to ctselect, ctbin | |
| 14 | - and ctlike | |
| 14 | + Add handling of observation definition XML files to ctselect | |
| 15 | + Add handling of observation definition XML files to ctbin | |
| 16 | + Add handling of observation definition XML files to ctlike | |
| 15 | 17 | Add deadtime correction factor to ctobssim |
| 16 | 18 | No longer query output parameters first |
| 17 | - Remove method parameter from ctlike and replace evfile and cntmap | |
| 18 | - parameters by infile parameter | |
| 19 | + Remove method parameter from ctlike | |
| 20 | + Replace evfile and cntmap parameters by infile parameter in ctlike | |
| 19 | 21 | Add configure options for Mac OSX universal builds |
| 20 | 22 | Remove automake dependency tracking |
| 21 | 23 | Improve building of Python bindings | ... | ... |
NEWS
| ... | ... | @@ -41,7 +41,11 @@ None |
| 41 | 41 | |
| 42 | 42 | 7. ctlike - CTA maximum likelihood fitting |
| 43 | 43 | ------------------------------------------ |
| 44 | -None | |
| 44 | +ctlike computes now the total number of observed events and dumps | |
| 45 | +them in the log file just before it dumps the number of predicted | |
| 46 | +events. It also computes the difference between observed and | |
| 47 | +predicted events so that the difference is immediately visible. | |
| 48 | + | |
| 45 | 49 | |
| 46 | 50 | 8. ctskymap - CTA sky mapping |
| 47 | 51 | ----------------------------- | ... | ... |
src/ctlike/ctlike.cpp
| ... | ... | @@ -256,10 +256,19 @@ void ctlike::run(void) |
| 256 | 256 | // Optimize model parameters using LM optimizer |
| 257 | 257 | optimize_lm(); |
| 258 | 258 | |
| 259 | + // Compute number of observed events in all observations | |
| 260 | + double num_events = 0.0; | |
| 261 | + for (int i = 0; i < m_obs.size(); ++i) { | |
| 262 | + num_events += m_obs[i].events()->number(); | |
| 263 | + } | |
| 264 | + | |
| 259 | 265 | // Write results into logger |
| 260 | 266 | if (logTerse()) { |
| 261 | - log << " Maximum log likelihood ....: " << m_logL << std::endl; | |
| 262 | - log << " Npred .....................: " << m_obs.npred() << std::endl; | |
| 267 | + log << parformat("Maximum log likelihood") << m_logL << std::endl; | |
| 268 | + log << parformat("Observed events (Nobs)") << num_events << std::endl; | |
| 269 | + log << parformat("Predicted events (Npred)") << m_obs.npred(); | |
| 270 | + log << " (Nobs - Npred = " << num_events-m_obs.npred(); | |
| 271 | + log << ")" << std::endl; | |
| 263 | 272 | log << m_obs.models() << std::endl; |
| 264 | 273 | } |
| 265 | 274 | |
| ... | ... | @@ -282,7 +291,7 @@ void ctlike::save(void) |
| 282 | 291 | } |
| 283 | 292 | |
| 284 | 293 | // Get output filename |
| 285 | - m_outmdl = (*this)["outmdl"].value(); | |
| 294 | + m_outmdl = (*this)["outmdl"].filename(); | |
| 286 | 295 | |
| 287 | 296 | // Write results out as XML model |
| 288 | 297 | if (toupper(m_outmdl) != "NONE") { | ... | ... |
src/ctlike/ctlike.hpp
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | |
| 35 | 35 | /* __Definitions _________________________________________________________ */ |
| 36 | 36 | #define CTLIKE_NAME "ctlike" |
| 37 | -#define CTLIKE_VERSION "00-03-00" | |
| 37 | +#define CTLIKE_VERSION "00-04-00" | |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | /***********************************************************************//** | ... | ... |