Commit 34730b4b1dc81fbd397e0ca7a08b5bc7980184c0
1 parent
9a08012a
Add "like_accuracy" parameter to likelihood tools and scripts (#2662)
Showing
21 changed files
with
99 additions
and
50 deletions
ChangeLog
| 1 | -2018-09-10 | 1 | +2018-09-11 |
| 2 | 2 | ||
| 3 | * Version 1.6.0 released | 3 | * Version 1.6.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Add "like_accuracy" parameter to likelihood tools and scripts (#2662) | ||
| 6 | Do not skip bins with zero counts in csspec (#2671) | 7 | Do not skip bins with zero counts in csspec (#2671) |
| 7 | Use "ENERG" instead of "ETRUE" in energy dispersion axis names in csroot2caldb (#2670) | 8 | Use "ENERG" instead of "ETRUE" in energy dispersion axis names in csroot2caldb (#2670) |
| 8 | Add hidden "use_irf_bkg" parameter to csphagen (#2659) | 9 | Add hidden "use_irf_bkg" parameter to csphagen (#2659) |
NEWS
| 1 | New Features and Important Changes in ctools 1.6.0 | 1 | New Features and Important Changes in ctools 1.6.0 |
| 2 | 2 | ||
| 3 | -10 September 2018 | 3 | +11 September 2018 |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | Introduction | 6 | Introduction |
| @@ -61,7 +61,8 @@ None | @@ -61,7 +61,8 @@ None | ||
| 61 | 61 | ||
| 62 | ctbutterfly - Generate butterfly diagrams | 62 | ctbutterfly - Generate butterfly diagrams |
| 63 | ----------------------------------------- | 63 | ----------------------------------------- |
| 64 | -None | 64 | +Add hidden "like_accuracy" parameter to allow control of the accuracy of |
| 65 | +the maximum log-likelikelihood value (#2662). | ||
| 65 | 66 | ||
| 66 | 67 | ||
| 67 | ctcubemask - CTA cube filtering | 68 | ctcubemask - CTA cube filtering |
| @@ -76,6 +77,9 @@ None | @@ -76,6 +77,9 @@ None | ||
| 76 | 77 | ||
| 77 | cterror - Likelihood profile error computation | 78 | cterror - Likelihood profile error computation |
| 78 | ---------------------------------------------- | 79 | ---------------------------------------------- |
| 80 | +Add hidden "like_accuracy" parameter to allow control of the accuracy of | ||
| 81 | +the maximum log-likelikelihood value (#2662). | ||
| 82 | + | ||
| 79 | Add hidden "nthreads" parameter to control parallel computations (#2421). | 83 | Add hidden "nthreads" parameter to control parallel computations (#2421). |
| 80 | 84 | ||
| 81 | 85 | ||
| @@ -86,6 +90,9 @@ None | @@ -86,6 +90,9 @@ None | ||
| 86 | 90 | ||
| 87 | ctlike - Maximum likelihood fitting | 91 | ctlike - Maximum likelihood fitting |
| 88 | ----------------------------------- | 92 | ----------------------------------- |
| 93 | +Add hidden "like_accuracy" parameter to allow control of the accuracy of | ||
| 94 | +the maximum log-likelikelihood value (#2662). | ||
| 95 | + | ||
| 89 | Add hidden "nthreads" parameter to control parallel computations (#2421). | 96 | Add hidden "nthreads" parameter to control parallel computations (#2421). |
| 90 | 97 | ||
| 91 | 98 | ||
| @@ -150,11 +157,15 @@ accurately computes the distances between sky map pixels (#2309). | @@ -150,11 +157,15 @@ accurately computes the distances between sky map pixels (#2309). | ||
| 150 | 157 | ||
| 151 | cttsmap - Generation of Test Statistic map | 158 | cttsmap - Generation of Test Statistic map |
| 152 | ------------------------------------------ | 159 | ------------------------------------------ |
| 153 | -None | 160 | +Add hidden "like_accuracy" parameter to allow control of the accuracy of |
| 161 | +the maximum log-likelikelihood value (#2662). | ||
| 154 | 162 | ||
| 155 | 163 | ||
| 156 | ctulimit - Compute upper limit | 164 | ctulimit - Compute upper limit |
| 157 | ------------------------------ | 165 | ------------------------------ |
| 166 | +Add hidden "like_accuracy" parameter to allow control of the accuracy of | ||
| 167 | +the maximum log-likelikelihood value (#2662). | ||
| 168 | + | ||
| 158 | Add "parname" parameter to allow upper limit computations also for a node | 169 | Add "parname" parameter to allow upper limit computations also for a node |
| 159 | function spectral model. In addition, it is now checked that the parameter | 170 | function spectral model. In addition, it is now checked that the parameter |
| 160 | values actually bracket the upper limit (#2233). | 171 | values actually bracket the upper limit (#2233). |
| @@ -356,7 +367,8 @@ None | @@ -356,7 +367,8 @@ None | ||
| 356 | 367 | ||
| 357 | cstsmapsplit - Prepare split Test Statistic computation | 368 | cstsmapsplit - Prepare split Test Statistic computation |
| 358 | ------------------------------------------------------- | 369 | ------------------------------------------------------- |
| 359 | -None | 370 | +Add hidden "like_accuracy" parameter to allow control of the accuracy of |
| 371 | +the maximum log-likelikelihood value (#2662). | ||
| 360 | 372 | ||
| 361 | 373 | ||
| 362 | csviscube - Generate visibility cube | 374 | csviscube - Generate visibility cube |
cscripts/cstsmapsplit.par
| @@ -28,6 +28,7 @@ irf, s, a, South_0.5h,,, "Instrument response function" | @@ -28,6 +28,7 @@ irf, s, a, South_0.5h,,, "Instrument response function" | ||
| 28 | edisp, b, h, no,,, "Apply energy dispersion?" | 28 | edisp, b, h, no,,, "Apply energy dispersion?" |
| 29 | errors, b, h, no,,, "Compute/store parameter errors?" | 29 | errors, b, h, no,,, "Compute/store parameter errors?" |
| 30 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | 30 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" |
| 31 | +like_accuracy, r, h, 0.005,1.0e-30,0.1, "Absolute accuracy of maximum likelihood value" | ||
| 31 | outmap, f, a, tsmap.fits,,, "Output Test Statistic map file" | 32 | outmap, f, a, tsmap.fits,,, "Output Test Statistic map file" |
| 32 | bins_per_job, i, a, 5,,, "Number of TS map bins per task" | 33 | bins_per_job, i, a, 5,,, "Number of TS map bins per task" |
| 33 | compute_null, b, a, yes,,,"Compute null hypothesis first?" | 34 | compute_null, b, a, yes,,,"Compute null hypothesis first?" |
doc/source/admin/release_history/1.6.rst
| @@ -37,6 +37,10 @@ Improvements | @@ -37,6 +37,10 @@ Improvements | ||
| 37 | * [`2670 <https://cta-redmine.irap.omp.eu/issues/2670>`_] - | 37 | * [`2670 <https://cta-redmine.irap.omp.eu/issues/2670>`_] - |
| 38 | Use ``ENERG`` instead of ``ETRUE`` in energy dispersion axis names in | 38 | Use ``ENERG`` instead of ``ETRUE`` in energy dispersion axis names in |
| 39 | :ref:`csroot2caldb` | 39 | :ref:`csroot2caldb` |
| 40 | +* [`2662 <https://cta-redmine.irap.omp.eu/issues/2662>`_] - | ||
| 41 | + Add ``like_accuracy`` parameter to :ref:`ctbutterfly`, :ref:`cterror`, | ||
| 42 | + :ref:`ctlike`, :ref:`cttsmap`, :ref:`ctulimit`, and :ref:`cstsmapsplit` | ||
| 43 | + to allow controlling the accuracy of the maximum likelihood computation | ||
| 40 | * [`2659 <https://cta-redmine.irap.omp.eu/issues/2659>`_] - | 44 | * [`2659 <https://cta-redmine.irap.omp.eu/issues/2659>`_] - |
| 41 | Add hidden ``use_irf_bkg`` parameter to :ref:`csphagen` | 45 | Add hidden ``use_irf_bkg`` parameter to :ref:`csphagen` |
| 42 | * [`2656 <https://cta-redmine.irap.omp.eu/issues/2656>`_] - | 46 | * [`2656 <https://cta-redmine.irap.omp.eu/issues/2656>`_] - |
doc/source/users/reference_manual/cstsmapsplit.rst
| @@ -61,6 +61,12 @@ General parameters | @@ -61,6 +61,12 @@ General parameters | ||
| 61 | observations, and ``CHI2`` uses the Chi squared statistic for all | 61 | observations, and ``CHI2`` uses the Chi squared statistic for all |
| 62 | binned or stacked observations. | 62 | binned or stacked observations. |
| 63 | 63 | ||
| 64 | +``(like_accuracy = 0.005) [real]`` | ||
| 65 | + Absolute accuracy of maximum likelihood value. Reducing this value will | ||
| 66 | + increase the number of iterations and provide a more accurate maximum | ||
| 67 | + log likelihood value. Converserly, decreasing the value will result in less | ||
| 68 | + iterations at the expense of a less accurate maximum likelihood value. | ||
| 69 | + | ||
| 64 | ``outmap [file]`` | 70 | ``outmap [file]`` |
| 65 | Output Test Statistic map file. | 71 | Output Test Statistic map file. |
| 66 | 72 |
doc/source/users/reference_manual/ctbutterfly.rst
| @@ -94,6 +94,12 @@ General parameters | @@ -94,6 +94,12 @@ General parameters | ||
| 94 | observations, and ``CHI2`` uses the Chi squared statistic for all | 94 | observations, and ``CHI2`` uses the Chi squared statistic for all |
| 95 | binned or stacked observations. | 95 | binned or stacked observations. |
| 96 | 96 | ||
| 97 | +``(like_accuracy = 0.005) [real]`` | ||
| 98 | + Absolute accuracy of maximum likelihood value. Reducing this value will | ||
| 99 | + increase the number of iterations and provide a more accurate maximum | ||
| 100 | + log likelihood value. Converserly, decreasing the value will result in less | ||
| 101 | + iterations at the expense of a less accurate maximum likelihood value. | ||
| 102 | + | ||
| 97 | ``(matrix = "NONE") [file]`` | 103 | ``(matrix = "NONE") [file]`` |
| 98 | Input covariance matrix file (not used) | 104 | Input covariance matrix file (not used) |
| 99 | 105 |
doc/source/users/reference_manual/cterror.rst
| @@ -75,9 +75,15 @@ General parameters | @@ -75,9 +75,15 @@ General parameters | ||
| 75 | observations, and ``CHI2`` uses the Chi squared statistic for all | 75 | observations, and ``CHI2`` uses the Chi squared statistic for all |
| 76 | binned or stacked observations. | 76 | binned or stacked observations. |
| 77 | 77 | ||
| 78 | +``(like_accuracy = 0.005) [real]`` | ||
| 79 | + Absolute accuracy of maximum likelihood value. Reducing this value will | ||
| 80 | + increase the number of iterations and provide a more accurate maximum | ||
| 81 | + log likelihood value. Converserly, decreasing the value will result in less | ||
| 82 | + iterations at the expense of a less accurate maximum likelihood value. | ||
| 83 | + | ||
| 78 | ``(max_iter = 50) [integer]`` | 84 | ``(max_iter = 50) [integer]`` |
| 79 | - Maximum number of iterations before stopping the likelihood | ||
| 80 | - profil computations. | 85 | + Maximum number of iterations before stopping the likelihood profile |
| 86 | + computations. | ||
| 81 | 87 | ||
| 82 | 88 | ||
| 83 | Standard parameters | 89 | Standard parameters |
doc/source/users/reference_manual/ctlike.rst
| @@ -105,6 +105,12 @@ General parameters | @@ -105,6 +105,12 @@ General parameters | ||
| 105 | ``(refit = no) [boolean]`` | 105 | ``(refit = no) [boolean]`` |
| 106 | Perform refitting of solution after initial fit. | 106 | Perform refitting of solution after initial fit. |
| 107 | 107 | ||
| 108 | +``(like_accuracy = 0.005) [real]`` | ||
| 109 | + Absolute accuracy of maximum likelihood value. Reducing this value will | ||
| 110 | + increase the number of iterations and provide a more accurate maximum | ||
| 111 | + log likelihood value. Converserly, decreasing the value will result in less | ||
| 112 | + iterations at the expense of a less accurate maximum likelihood value. | ||
| 113 | + | ||
| 108 | ``(fix_spat_for_ts = no) [boolean]`` | 114 | ``(fix_spat_for_ts = no) [boolean]`` |
| 109 | Fix spatial parameters for TS computation. | 115 | Fix spatial parameters for TS computation. |
| 110 | 116 |
doc/source/users/reference_manual/cttsmap.rst
| @@ -74,6 +74,12 @@ General parameters | @@ -74,6 +74,12 @@ General parameters | ||
| 74 | observations, and ``CHI2`` uses the Chi squared statistic for all | 74 | observations, and ``CHI2`` uses the Chi squared statistic for all |
| 75 | binned or stacked observations. | 75 | binned or stacked observations. |
| 76 | 76 | ||
| 77 | +``(like_accuracy = 0.005) [real]`` | ||
| 78 | + Absolute accuracy of maximum likelihood value. Reducing this value will | ||
| 79 | + increase the number of iterations and provide a more accurate maximum | ||
| 80 | + log likelihood value. Converserly, decreasing the value will result in less | ||
| 81 | + iterations at the expense of a less accurate maximum likelihood value. | ||
| 82 | + | ||
| 77 | ``(usepnt = no) [boolean]`` | 83 | ``(usepnt = no) [boolean]`` |
| 78 | Use CTA pointing direction for map centre instead of xref/yref parameters? | 84 | Use CTA pointing direction for map centre instead of xref/yref parameters? |
| 79 | 85 |
doc/source/users/reference_manual/ctulimit.rst
| @@ -87,6 +87,12 @@ General parameters | @@ -87,6 +87,12 @@ General parameters | ||
| 87 | observations, and ``CHI2`` uses the Chi squared statistic for all | 87 | observations, and ``CHI2`` uses the Chi squared statistic for all |
| 88 | binned or stacked observations. | 88 | binned or stacked observations. |
| 89 | 89 | ||
| 90 | +``(like_accuracy = 0.005) [real]`` | ||
| 91 | + Absolute accuracy of maximum likelihood value. Reducing this value will | ||
| 92 | + increase the number of iterations and provide a more accurate maximum | ||
| 93 | + log likelihood value. Converserly, decreasing the value will result in less | ||
| 94 | + iterations at the expense of a less accurate maximum likelihood value. | ||
| 95 | + | ||
| 90 | ``(max_iter = 50) [integer]`` | 96 | ``(max_iter = 50) [integer]`` |
| 91 | Maximum number of iterations before stopping the upper | 97 | Maximum number of iterations before stopping the upper |
| 92 | limit computations. | 98 | limit computations. |
src/ctbutterfly/ctbutterfly.cpp
| @@ -374,7 +374,6 @@ void ctbutterfly::init_members(void) | @@ -374,7 +374,6 @@ void ctbutterfly::init_members(void) | ||
| 374 | m_srcname.clear(); | 374 | m_srcname.clear(); |
| 375 | m_method.clear(); | 375 | m_method.clear(); |
| 376 | m_confidence = 0.68; | 376 | m_confidence = 0.68; |
| 377 | - m_max_iter = 50; | ||
| 378 | m_apply_edisp = false; | 377 | m_apply_edisp = false; |
| 379 | m_fit = false; | 378 | m_fit = false; |
| 380 | m_chatter = static_cast<GChatter>(2); | 379 | m_chatter = static_cast<GChatter>(2); |
| @@ -389,10 +388,6 @@ void ctbutterfly::init_members(void) | @@ -389,10 +388,6 @@ void ctbutterfly::init_members(void) | ||
| 389 | m_max_intensities.clear(); | 388 | m_max_intensities.clear(); |
| 390 | m_csv.clear(); | 389 | m_csv.clear(); |
| 391 | 390 | ||
| 392 | - // Set optimizer parameters | ||
| 393 | - m_opt.max_iter(m_max_iter); | ||
| 394 | - m_opt.max_stalls(10); | ||
| 395 | - | ||
| 396 | // Return | 391 | // Return |
| 397 | return; | 392 | return; |
| 398 | } | 393 | } |
src/ctbutterfly/ctbutterfly.par
| @@ -32,10 +32,11 @@ method, s, h, GAUSSIAN, GAUSSIAN|ENVELOPE,,"Butterfly computation method" | @@ -32,10 +32,11 @@ method, s, h, GAUSSIAN, GAUSSIAN|ENVELOPE,,"Butterfly computation method" | ||
| 32 | # | 32 | # |
| 33 | # Butterfly parameters | 33 | # Butterfly parameters |
| 34 | #===================== | 34 | #===================== |
| 35 | -fit, b, h, no,,, "Perform maximum likelihood fitting?" | ||
| 36 | -confidence, r, h, 0.68,0.0,1.0, "Confidence level" | ||
| 37 | -statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | ||
| 38 | -matrix, f, h, NONE,,, "Input covariance Matrix FITS file" | 35 | +fit, b, h, no,,, "Perform maximum likelihood fitting?" |
| 36 | +confidence, r, h, 0.68,0.0,1.0, "Confidence level" | ||
| 37 | +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | ||
| 38 | +like_accuracy, r, h, 0.005,1.0e-30,0.1, "Absolute accuracy of maximum likelihood value" | ||
| 39 | +matrix, f, h, NONE,,, "Input covariance Matrix FITS file" | ||
| 39 | 40 | ||
| 40 | # | 41 | # |
| 41 | # Energy binning parameters | 42 | # Energy binning parameters |
src/cterror/cterror.cpp
| @@ -399,10 +399,6 @@ void cterror::init_members(void) | @@ -399,10 +399,6 @@ void cterror::init_members(void) | ||
| 399 | m_best_logL = 0.0; | 399 | m_best_logL = 0.0; |
| 400 | m_model_par = NULL; | 400 | m_model_par = NULL; |
| 401 | 401 | ||
| 402 | - // Set optimizer parameters | ||
| 403 | - m_opt.max_iter(m_max_iter); | ||
| 404 | - m_opt.max_stalls(10); | ||
| 405 | - | ||
| 406 | // Return | 402 | // Return |
| 407 | return; | 403 | return; |
| 408 | } | 404 | } |
src/cterror/cterror.par
| @@ -32,10 +32,11 @@ outmodel, f, a, results.xml,,, "Output model definiton XML file" | @@ -32,10 +32,11 @@ outmodel, f, a, results.xml,,, "Output model definiton XML file" | ||
| 32 | # | 32 | # |
| 33 | # Error calculation parameters | 33 | # Error calculation parameters |
| 34 | #============================= | 34 | #============================= |
| 35 | -confidence, r, h, 0.68,0.0,1.0, "Confidence level" | ||
| 36 | -tol, r, h, 1e-3,,, "Computation tolerance" | ||
| 37 | -statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | ||
| 38 | -max_iter, i, h, 50,1,1000, "Maximum number of iterations" | 35 | +confidence, r, h, 0.68,0.0,1.0, "Confidence level" |
| 36 | +tol, r, h, 1e-3,,, "Computation tolerance" | ||
| 37 | +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | ||
| 38 | +like_accuracy, r, h, 0.005,1.0e-30,0.1, "Absolute accuracy of maximum likelihood value" | ||
| 39 | +max_iter, i, h, 50,1,1000, "Maximum number of iterations" | ||
| 39 | 40 | ||
| 40 | # | 41 | # |
| 41 | # Standard parameters | 42 | # Standard parameters |
src/ctlike/ctlike.cpp
| @@ -559,8 +559,6 @@ void ctlike::init_members(void) | @@ -559,8 +559,6 @@ void ctlike::init_members(void) | ||
| 559 | m_outmodel.clear(); | 559 | m_outmodel.clear(); |
| 560 | m_outcovmat.clear(); | 560 | m_outcovmat.clear(); |
| 561 | m_refit = false; | 561 | m_refit = false; |
| 562 | - m_max_iter = 100; // Set maximum number of iterations | ||
| 563 | - m_max_stall = 10; // Set maximum number of stalls | ||
| 564 | m_logL = 0.0; | 562 | m_logL = 0.0; |
| 565 | m_apply_edisp = false; | 563 | m_apply_edisp = false; |
| 566 | m_fix_spat_for_ts = false; | 564 | m_fix_spat_for_ts = false; |
| @@ -569,10 +567,6 @@ void ctlike::init_members(void) | @@ -569,10 +567,6 @@ void ctlike::init_members(void) | ||
| 569 | // Set logger properties | 567 | // Set logger properties |
| 570 | log.date(true); | 568 | log.date(true); |
| 571 | 569 | ||
| 572 | - // Set optimizer parameters | ||
| 573 | - m_opt.max_iter(m_max_iter); | ||
| 574 | - m_opt.max_stalls(m_max_stall); | ||
| 575 | - | ||
| 576 | // Return | 570 | // Return |
| 577 | return; | 571 | return; |
| 578 | } | 572 | } |
| @@ -589,8 +583,6 @@ void ctlike::copy_members(const ctlike& app) | @@ -589,8 +583,6 @@ void ctlike::copy_members(const ctlike& app) | ||
| 589 | m_refit = app.m_refit; | 583 | m_refit = app.m_refit; |
| 590 | m_outmodel = app.m_outmodel; | 584 | m_outmodel = app.m_outmodel; |
| 591 | m_outcovmat = app.m_outcovmat; | 585 | m_outcovmat = app.m_outcovmat; |
| 592 | - m_max_iter = app.m_max_iter; | ||
| 593 | - m_max_stall = app.m_max_stall; | ||
| 594 | m_logL = app.m_logL; | 586 | m_logL = app.m_logL; |
| 595 | m_apply_edisp = app.m_apply_edisp; | 587 | m_apply_edisp = app.m_apply_edisp; |
| 596 | m_fix_spat_for_ts = app.m_fix_spat_for_ts; | 588 | m_fix_spat_for_ts = app.m_fix_spat_for_ts; |
src/ctlike/ctlike.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctlike - Maximum likelihood fitting tool * | 2 | * ctlike - Maximum likelihood fitting tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2017 by Juergen Knoedlseder * | 4 | + * copyright (C) 2010-2018 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 * |
| @@ -75,8 +75,6 @@ protected: | @@ -75,8 +75,6 @@ protected: | ||
| 75 | GChatter m_chatter; //!< Chattiness | 75 | GChatter m_chatter; //!< Chattiness |
| 76 | 76 | ||
| 77 | // Members | 77 | // Members |
| 78 | - int m_max_iter; //!< Maximum number of iterations | ||
| 79 | - int m_max_stall; //!< Maximum number of stalls | ||
| 80 | double m_logL; //!< Maximum log likelihood | 78 | double m_logL; //!< Maximum log likelihood |
| 81 | }; | 79 | }; |
| 82 | 80 |
src/ctlike/ctlike.par
| @@ -33,6 +33,7 @@ outcovmat, f, h, NONE,,, "Output covariance matrix FITS file" | @@ -33,6 +33,7 @@ outcovmat, f, h, NONE,,, "Output covariance matrix FITS file" | ||
| 33 | #======================== | 33 | #======================== |
| 34 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | 34 | statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" |
| 35 | refit, b, h, no,,, "Do refitting?" | 35 | refit, b, h, no,,, "Do refitting?" |
| 36 | +like_accuracy, r, h, 0.005,1.0e-30,0.1, "Absolute accuracy of maximum likelihood value" | ||
| 36 | fix_spat_for_ts, b, h, no,,, "Fix spatial parameters for TS computation?" | 37 | fix_spat_for_ts, b, h, no,,, "Fix spatial parameters for TS computation?" |
| 37 | 38 | ||
| 38 | # | 39 | # |
src/cttsmap/cttsmap.par
| @@ -31,8 +31,9 @@ outmap, f, a, tsmap.fits,,, "Output Test Statistic map file" | @@ -31,8 +31,9 @@ outmap, f, a, tsmap.fits,,, "Output Test Statistic map file" | ||
| 31 | # | 31 | # |
| 32 | # TS map computation parameters | 32 | # TS map computation parameters |
| 33 | #============================== | 33 | #============================== |
| 34 | -errors, b, h, no,,, "Compute and store parameter errors?" | ||
| 35 | -statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | 34 | +errors, b, h, no,,, "Compute and store parameter errors?" |
| 35 | +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | ||
| 36 | +like_accuracy, r, h, 0.005,1.0e-30,0.1, "Absolute accuracy of maximum likelihood value" | ||
| 36 | 37 | ||
| 37 | # | 38 | # |
| 38 | # Spatial binning parameters | 39 | # Spatial binning parameters |
src/ctulimit/ctulimit.cpp
| @@ -372,10 +372,6 @@ void ctulimit::init_members(void) | @@ -372,10 +372,6 @@ void ctulimit::init_members(void) | ||
| 372 | m_diff_ulimit = 0.0; | 372 | m_diff_ulimit = 0.0; |
| 373 | m_eflux_ulimit = 0.0; | 373 | m_eflux_ulimit = 0.0; |
| 374 | 374 | ||
| 375 | - // Set optimizer parameters | ||
| 376 | - m_opt.max_iter(m_max_iter); | ||
| 377 | - m_opt.max_stalls(10); | ||
| 378 | - | ||
| 379 | // Return | 375 | // Return |
| 380 | return; | 376 | return; |
| 381 | } | 377 | } |
src/ctulimit/ctulimit.par
| @@ -31,15 +31,16 @@ edisp, b, h, no,,, "Apply energy dispersion?" | @@ -31,15 +31,16 @@ edisp, b, h, no,,, "Apply energy dispersion?" | ||
| 31 | # | 31 | # |
| 32 | # Upper limit calculation parameters | 32 | # Upper limit calculation parameters |
| 33 | #=================================== | 33 | #=================================== |
| 34 | -confidence, r, h, 0.95,0.0,1.0, "Confidence level" | ||
| 35 | -sigma_min, r, h, 0.0,,, "Start minimum value (multiple sigmas above fit value)" | ||
| 36 | -sigma_max, r, h, 10.0,,, "Start maximum value (multiple sigmas above fit value)" | ||
| 37 | -eref, r, h, 1.0,,, "Reference energy for differential limit (TeV)" | ||
| 38 | -emin, r, h, 1.0,,, "Minimum energy for integral flux limit (TeV)" | ||
| 39 | -emax, r, h, 100.0,,, "Maximum energy for integral flux limit (TeV)" | ||
| 40 | -tol, r, h, 1e-5,,, "Computation tolerance" | ||
| 41 | -statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | ||
| 42 | -max_iter, i, h, 50,1,1000, "Maximum number of iterations" | 34 | +confidence, r, h, 0.95,0.0,1.0, "Confidence level" |
| 35 | +sigma_min, r, h, 0.0,,, "Start minimum value (multiple sigmas above fit value)" | ||
| 36 | +sigma_max, r, h, 10.0,,, "Start maximum value (multiple sigmas above fit value)" | ||
| 37 | +eref, r, h, 1.0,,, "Reference energy for differential limit (TeV)" | ||
| 38 | +emin, r, h, 1.0,,, "Minimum energy for integral flux limit (TeV)" | ||
| 39 | +emax, r, h, 100.0,,, "Maximum energy for integral flux limit (TeV)" | ||
| 40 | +tol, r, h, 1e-5,,, "Computation tolerance" | ||
| 41 | +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" | ||
| 42 | +like_accuracy, r, h, 0.005,1.0e-30,0.1, "Absolute accuracy of maximum likelihood value" | ||
| 43 | +max_iter, i, h, 50,1,1000, "Maximum number of iterations" | ||
| 43 | 44 | ||
| 44 | # | 45 | # |
| 45 | # Standard parameters | 46 | # Standard parameters |
src/support/ctlikelihood.cpp
| @@ -290,6 +290,19 @@ void ctlikelihood::init_members(void) | @@ -290,6 +290,19 @@ void ctlikelihood::init_members(void) | ||
| 290 | // Initialise members | 290 | // Initialise members |
| 291 | m_opt.clear(); | 291 | m_opt.clear(); |
| 292 | 292 | ||
| 293 | + // Initialise optimizer characteristics | ||
| 294 | + m_opt.max_iter(50); // Maximum number of iterations | ||
| 295 | + m_opt.max_stalls(10); // Maximum number of stalls | ||
| 296 | + m_opt.eps(0.005); // Accuracy of maximum likelihood value | ||
| 297 | + | ||
| 298 | + // Set optimizer characteristics from optional user parameters | ||
| 299 | + if (has_par("like_accuracy")) { | ||
| 300 | + m_opt.eps((*this)["like_accuracy"].real()); | ||
| 301 | + } | ||
| 302 | + if (has_par("max_iter")) { | ||
| 303 | + m_opt.max_iter((*this)["max_iter"].integer()); | ||
| 304 | + } | ||
| 305 | + | ||
| 293 | // Return | 306 | // Return |
| 294 | return; | 307 | return; |
| 295 | } | 308 | } |