Commit 06f921042f57295e82a2f9fdb9170121cb99dfa1

Authored by Jürgen Knödlseder
1 parent c78029ad

Correctly read and set max_iter and eps parameters in likelihood tools

src/ctbutterfly/ctbutterfly.cpp
1 1 /***************************************************************************
2 2 * ctbutterfly - butterfly calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2018 by Michael Mayer *
  4 + * copyright (C) 2014-2019 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -468,6 +468,10 @@ void ctbutterfly::get_parameters(void)
468 468 // m_covariance.load(matrixfilename);
469 469 }
470 470  
  471 + // Set optimizer characteristics from user parameters
  472 + m_opt.eps((*this)["like_accuracy"].real());
  473 + m_opt.max_iter((*this)["max_iter"].integer());
  474 +
471 475 // Get remaining parameters
472 476 m_apply_edisp = (*this)["edisp"].boolean();
473 477 m_method = (*this)["method"].string();
... ...
src/cterror/cterror.cpp
1 1 /***************************************************************************
2 2 * cterror - Parameter error calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2015-2018 by Florent Forest *
  4 + * copyright (C) 2015-2019 by Florent Forest *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -468,6 +468,10 @@ void cterror::get_parameters(void)
468 468 double sigma = gammalib::erfinv(m_confidence) * gammalib::sqrt_two;
469 469 m_dlogL = (sigma*sigma) / 2.0;
470 470  
  471 + // Set optimizer characteristics from user parameters
  472 + m_opt.eps((*this)["like_accuracy"].real());
  473 + m_opt.max_iter((*this)["max_iter"].integer());
  474 +
471 475 // Read other parameters
472 476 m_tol = (*this)["tol"].real();
473 477 m_max_iter = (*this)["max_iter"].integer();
... ...
src/ctlike/ctlike.cpp
1 1 /***************************************************************************
2 2 * ctlike - Maximum likelihood fitting tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2018 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2019 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -407,6 +407,10 @@ void ctlike::get_parameters(void)
407 407  
408 408 } // endif: no models were associated with observations
409 409  
  410 + // Set optimizer characteristics from user parameters
  411 + m_opt.eps((*this)["like_accuracy"].real());
  412 + m_opt.max_iter((*this)["max_iter"].integer());
  413 +
410 414 // Get other parameters
411 415 m_refit = (*this)["refit"].boolean();
412 416 m_apply_edisp = (*this)["edisp"].boolean();
... ...
src/ctulimit/ctulimit.cpp
1 1 /***************************************************************************
2 2 * ctulimit - Upper limit calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2015-2018 by Michael Mayer *
  4 + * copyright (C) 2015-2019 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -463,6 +463,10 @@ void ctulimit::get_parameters(void)
463 463 m_emin = (*this)["emin"].real();
464 464 m_emax = (*this)["emax"].real();
465 465  
  466 + // Set optimizer characteristics from user parameters
  467 + m_opt.eps((*this)["like_accuracy"].real());
  468 + m_opt.max_iter((*this)["max_iter"].integer());
  469 +
466 470 // Read precision
467 471 m_tol = (*this)["tol"].real();
468 472 m_max_iter = (*this)["max_iter"].integer();
... ...