Commit 06f921042f57295e82a2f9fdb9170121cb99dfa1
1 parent
c78029ad
Correctly read and set max_iter and eps parameters in likelihood tools
Showing
4 changed files
with
20 additions
and
4 deletions
src/ctbutterfly/ctbutterfly.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctbutterfly - butterfly calculation tool * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -468,6 +468,10 @@ void ctbutterfly::get_parameters(void) | @@ -468,6 +468,10 @@ void ctbutterfly::get_parameters(void) | ||
| 468 | // m_covariance.load(matrixfilename); | 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 | // Get remaining parameters | 475 | // Get remaining parameters |
| 472 | m_apply_edisp = (*this)["edisp"].boolean(); | 476 | m_apply_edisp = (*this)["edisp"].boolean(); |
| 473 | m_method = (*this)["method"].string(); | 477 | m_method = (*this)["method"].string(); |
src/cterror/cterror.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * cterror - Parameter error calculation tool * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -468,6 +468,10 @@ void cterror::get_parameters(void) | @@ -468,6 +468,10 @@ void cterror::get_parameters(void) | ||
| 468 | double sigma = gammalib::erfinv(m_confidence) * gammalib::sqrt_two; | 468 | double sigma = gammalib::erfinv(m_confidence) * gammalib::sqrt_two; |
| 469 | m_dlogL = (sigma*sigma) / 2.0; | 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 | // Read other parameters | 475 | // Read other parameters |
| 472 | m_tol = (*this)["tol"].real(); | 476 | m_tol = (*this)["tol"].real(); |
| 473 | m_max_iter = (*this)["max_iter"].integer(); | 477 | m_max_iter = (*this)["max_iter"].integer(); |
src/ctlike/ctlike.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctlike - Maximum likelihood fitting tool * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -407,6 +407,10 @@ void ctlike::get_parameters(void) | @@ -407,6 +407,10 @@ void ctlike::get_parameters(void) | ||
| 407 | 407 | ||
| 408 | } // endif: no models were associated with observations | 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 | // Get other parameters | 414 | // Get other parameters |
| 411 | m_refit = (*this)["refit"].boolean(); | 415 | m_refit = (*this)["refit"].boolean(); |
| 412 | m_apply_edisp = (*this)["edisp"].boolean(); | 416 | m_apply_edisp = (*this)["edisp"].boolean(); |
src/ctulimit/ctulimit.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctulimit - Upper limit calculation tool * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -463,6 +463,10 @@ void ctulimit::get_parameters(void) | @@ -463,6 +463,10 @@ void ctulimit::get_parameters(void) | ||
| 463 | m_emin = (*this)["emin"].real(); | 463 | m_emin = (*this)["emin"].real(); |
| 464 | m_emax = (*this)["emax"].real(); | 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 | // Read precision | 470 | // Read precision |
| 467 | m_tol = (*this)["tol"].real(); | 471 | m_tol = (*this)["tol"].real(); |
| 468 | m_max_iter = (*this)["max_iter"].integer(); | 472 | m_max_iter = (*this)["max_iter"].integer(); |