Commit 67f4d26e4ebab67f5dcf351ca23316622164c550

Authored by Alexander Ziegler
1 parent e6c67ef2

Adaptions to ctlike to enable covariance matrix output

src/ctlike/ctlike.cpp
... ... @@ -331,7 +331,13 @@ void ctlike::save(void)
331 331  
332 332 // Write results out as XML model
333 333 m_obs.models().save(m_outmodel);
  334 + }
  335 +
  336 + // Save covarianve matrix only if filename is valid
  337 + if (is_valid_filename(m_covmat)) {
334 338  
  339 + // Save covarianve matrix
  340 + m_obs.save_covmat(m_covmat);
335 341 }
336 342  
337 343 // ... otherwise signal that file was not saved
... ... @@ -393,6 +399,7 @@ void ctlike::get_parameters(void)
393 399 m_apply_edisp = (*this)["edisp"].boolean();
394 400 m_fix_spat_for_ts = (*this)["fix_spat_for_ts"].boolean();
395 401 m_chatter = static_cast<GChatter>((*this)["chatter"].integer());
  402 + m_covmat = (*this)["covmat"].filename();
396 403  
397 404 // Optionally read ahead parameters so that they get correctly
398 405 // dumped into the log file
... ... @@ -530,6 +537,7 @@ void ctlike::init_members(void)
530 537 {
531 538 // Initialise members
532 539 m_outmodel.clear();
  540 + m_covmat.clear();
533 541 m_refit = false;
534 542 m_max_iter = 100; // Set maximum number of iterations
535 543 m_max_stall = 10; // Set maximum number of stalls
... ... @@ -560,6 +568,7 @@ void ctlike::copy_members(const ctlike&amp; app)
560 568 // Copy attributes
561 569 m_refit = app.m_refit;
562 570 m_outmodel = app.m_outmodel;
  571 + m_covmat = app.m_covmat;
563 572 m_max_iter = app.m_max_iter;
564 573 m_max_stall = app.m_max_stall;
565 574 m_logL = app.m_logL;
... ...
src/ctlike/ctlike.hpp
... ... @@ -73,6 +73,7 @@ protected:
73 73 bool m_apply_edisp; //!< Apply energy dispersion?
74 74 bool m_fix_spat_for_ts; //!< Fix spatial parameters for TS computation?
75 75 GChatter m_chatter; //!< Chattiness
  76 + GFilename m_covmat; //!< Covariance matrix output FITS file name
76 77  
77 78 // Members
78 79 int m_max_iter; //!< Maximum number of iterations
... ...
src/ctlike/ctlike.par
... ... @@ -27,6 +27,7 @@ caldb, s, a, &quot;prod2&quot;,,, &quot;Calibration database&quot;
27 27 irf, s, a, "South_0.5h",,, "Instrument response function"
28 28 edisp, b, h, no,,, "Apply energy dispersion?"
29 29 outmodel, f, a, "crab_results.xml",,, "Output model XML file"
  30 +covmat, f, h, "NONE",,, "Output covariance matrix FITS file"
30 31  
31 32 #
32 33 # Maximisation parameters
... ...