Commit 5ff7129bffd7e80ad38efb5a3879a9007d7b4047

Authored by Alexander Ziegler
1 parent 67f4d26e

Adapt covariance matrix function call and write out to correct position

Showing 1 changed file with 14 additions and 7 deletions
src/ctlike/ctlike.cpp
@@ -228,6 +228,20 @@ void ctlike::run(void) @@ -228,6 +228,20 @@ void ctlike::run(void)
228 // Optimize model parameters using LM optimizer 228 // Optimize model parameters using LM optimizer
229 optimize_lm(); 229 optimize_lm();
230 230
  231 + // Save covarianve matrix if valid filename is passed
  232 + if (is_valid_filename(m_covmat)) {
  233 +
  234 + // Write header
  235 + log_header1(TERSE, "Saving covariance matrix");
  236 +
  237 + // Log filename
  238 + log_value(NORMAL, "Covariance matrix file", m_covmat.url());
  239 +
  240 + // Save covarianve matrix
  241 + m_obs.save_covmat(m_covmat);
  242 + }
  243 +
  244 +
231 // Store Npred 245 // Store Npred
232 double npred = m_obs.npred(); 246 double npred = m_obs.npred();
233 247
@@ -333,13 +347,6 @@ void ctlike::save(void) @@ -333,13 +347,6 @@ void ctlike::save(void)
333 m_obs.models().save(m_outmodel); 347 m_obs.models().save(m_outmodel);
334 } 348 }
335 349
336 - // Save covarianve matrix only if filename is valid  
337 - if (is_valid_filename(m_covmat)) {  
338 -  
339 - // Save covarianve matrix  
340 - m_obs.save_covmat(m_covmat);  
341 - }  
342 -  
343 // ... otherwise signal that file was not saved 350 // ... otherwise signal that file was not saved
344 else { 351 else {
345 log_value(NORMAL, "Model definition file", "NONE"); 352 log_value(NORMAL, "Model definition file", "NONE");