Commit ca874e05a54cd295df18ea9e0436f9eabb1d2b94
1 parent
e7db1c12
added fix_spat_for_ts parameter to ctlike
Showing
3 changed files
with
24 additions
and
0 deletions
src/ctlike/ctlike.cpp
| ... | ... | @@ -262,6 +262,26 @@ void ctlike::run(void) |
| 262 | 262 | double logL_src = m_logL; |
| 263 | 263 | GModels models = m_obs.models(); |
| 264 | 264 | |
| 265 | + // Fix spatial parameters if requested | |
| 266 | + if (m_fix_spat_for_ts) { | |
| 267 | + for(int i = 0; i < models.size(); ++i) { | |
| 268 | + | |
| 269 | + // Continue only if model is skymodel | |
| 270 | + GModelSky* sky= dynamic_cast<GModelSky*>(models[i]); | |
| 271 | + if (sky != NULL) { | |
| 272 | + | |
| 273 | + // Fix spatial parameters | |
| 274 | + GModelSpatial* spat = sky->spatial(); | |
| 275 | + for (int j = 0; j < spat->size(); j++) { | |
| 276 | + (*spat)[j].fix(); | |
| 277 | + } // endfor: loop over spatial parameters | |
| 278 | + | |
| 279 | + } // endif: there was a sky model | |
| 280 | + | |
| 281 | + } // endfor: Loop over models | |
| 282 | + | |
| 283 | + } // endif: spatial parameter should be fixed | |
| 284 | + | |
| 265 | 285 | // Loop over stored models, remove source and refit |
| 266 | 286 | for (int i = 0; i < ts_srcs.size(); ++i) { |
| 267 | 287 | models.remove(ts_srcs[i]); |
| ... | ... | @@ -394,6 +414,7 @@ void ctlike::get_parameters(void) |
| 394 | 414 | // Get other parameters |
| 395 | 415 | m_refit = (*this)["refit"].boolean(); |
| 396 | 416 | m_apply_edisp = (*this)["edisp"].boolean(); |
| 417 | + m_fix_spat_for_ts = (*this)["fix_spat_for_ts"].boolean(); | |
| 397 | 418 | |
| 398 | 419 | // Optionally read ahead parameters so that they get correctly |
| 399 | 420 | // dumped into the log file | ... | ... |
src/ctlike/ctlike.hpp
| ... | ... | @@ -76,6 +76,7 @@ protected: |
| 76 | 76 | bool m_refit; //!< Refitting |
| 77 | 77 | std::string m_outmodel; //!< Source model output XML file |
| 78 | 78 | bool m_apply_edisp; //!< Apply energy dispersion? |
| 79 | + bool m_fix_spat_for_ts; //!< Fix spatial parameters for TS computation? | |
| 79 | 80 | |
| 80 | 81 | // Members |
| 81 | 82 | GObservations m_obs; //!< Observations | ... | ... |
src/ctlike/ctlike.par
| ... | ... | @@ -28,6 +28,8 @@ outmodel, f, a, "crab_results.xml",,, "Source model output file" |
| 28 | 28 | stat, s, h, "POISSON",,, "Optimization statistics" |
| 29 | 29 | edisp, b, h, no,,, "Apply energy dispersion?" |
| 30 | 30 | refit, b, h, no,,, "Do refitting?" |
| 31 | +fix_spat_for_ts,b,h,no,,,"Fix spatial parameters for TS computation?" | |
| 32 | + | |
| 31 | 33 | # |
| 32 | 34 | # Standard parameters |
| 33 | 35 | #==================== | ... | ... |