Commit 4cf9b3ba40bb49f25db80c74335b84113dd951c0

Authored by Jürgen Knödlseder
1 parent bd02e31c

Integrate code.

Showing 1 changed file with 42 additions and 29 deletions
src/ctulimit/ctulimit.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctulimit - Upper limit calculation tool * 2 * ctulimit - Upper limit calculation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2015 by Michael Mayer * 4 + * copyright (C) 2015-2016 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 *
@@ -52,6 +52,8 @@ @@ -52,6 +52,8 @@
52 52
53 /***********************************************************************//** 53 /***********************************************************************//**
54 * @brief Void constructor 54 * @brief Void constructor
  55 + *
  56 + * Constructs an empty ctulimit tool.
55 ***************************************************************************/ 57 ***************************************************************************/
56 ctulimit::ctulimit(void) : ctool(CTULIMIT_NAME, CTULIMIT_VERSION) 58 ctulimit::ctulimit(void) : ctool(CTULIMIT_NAME, CTULIMIT_VERSION)
57 { 59 {
@@ -68,8 +70,8 @@ ctulimit::ctulimit(void) : ctool(CTULIMIT_NAME, CTULIMIT_VERSION) @@ -68,8 +70,8 @@ ctulimit::ctulimit(void) : ctool(CTULIMIT_NAME, CTULIMIT_VERSION)
68 * 70 *
69 * param[in] obs Observation container. 71 * param[in] obs Observation container.
70 * 72 *
71 - * This method creates an instance of the class by copying an existing  
72 - * observations container. 73 + * Constructs an instance of the ctulimit tool that will operate on the
  74 + * provided observation container.
73 ***************************************************************************/ 75 ***************************************************************************/
74 ctulimit::ctulimit(const GObservations& obs) : 76 ctulimit::ctulimit(const GObservations& obs) :
75 ctool(CTULIMIT_NAME, CTULIMIT_VERSION) 77 ctool(CTULIMIT_NAME, CTULIMIT_VERSION)
@@ -91,6 +93,9 @@ ctulimit::ctulimit(const GObservations& obs) : @@ -91,6 +93,9 @@ ctulimit::ctulimit(const GObservations& obs) :
91 * 93 *
92 * @param[in] argc Number of arguments in command line. 94 * @param[in] argc Number of arguments in command line.
93 * @param[in] argv Array of command line arguments. 95 * @param[in] argv Array of command line arguments.
  96 + *
  97 + * Constructs an instance of the ctulimit tool that will parse user
  98 + * parameters that are provided as command line arguments.
94 ***************************************************************************/ 99 ***************************************************************************/
95 ctulimit::ctulimit(int argc, char *argv[]) : 100 ctulimit::ctulimit(int argc, char *argv[]) :
96 ctool(CTULIMIT_NAME, CTULIMIT_VERSION, argc, argv) 101 ctool(CTULIMIT_NAME, CTULIMIT_VERSION, argc, argv)
@@ -107,6 +112,9 @@ ctulimit::ctulimit(int argc, char *argv[]) : @@ -107,6 +112,9 @@ ctulimit::ctulimit(int argc, char *argv[]) :
107 * @brief Copy constructor 112 * @brief Copy constructor
108 * 113 *
109 * @param[in] app Application. 114 * @param[in] app Application.
  115 + *
  116 + * Constructs an instance of the ctulimit tool by copying information from
  117 + * another ctulimit tool.
110 ***************************************************************************/ 118 ***************************************************************************/
111 ctulimit::ctulimit(const ctulimit& app) : ctool(app) 119 ctulimit::ctulimit(const ctulimit& app) : ctool(app)
112 { 120 {
@@ -123,6 +131,8 @@ ctulimit::ctulimit(const ctulimit& app) : ctool(app) @@ -123,6 +131,8 @@ ctulimit::ctulimit(const ctulimit& app) : ctool(app)
123 131
124 /***********************************************************************//** 132 /***********************************************************************//**
125 * @brief Destructor 133 * @brief Destructor
  134 + *
  135 + * Destructs the ctulimit tool.
126 ***************************************************************************/ 136 ***************************************************************************/
127 ctulimit::~ctulimit(void) 137 ctulimit::~ctulimit(void)
128 { 138 {
@@ -145,6 +155,8 @@ ctulimit::~ctulimit(void) @@ -145,6 +155,8 @@ ctulimit::~ctulimit(void)
145 * 155 *
146 * @param[in] app Application. 156 * @param[in] app Application.
147 * @return Application. 157 * @return Application.
  158 + *
  159 + * Assigns a ctulimit tool.
148 ***************************************************************************/ 160 ***************************************************************************/
149 ctulimit& ctulimit::operator=(const ctulimit& app) 161 ctulimit& ctulimit::operator=(const ctulimit& app)
150 { 162 {
@@ -177,7 +189,9 @@ ctulimit& ctulimit::operator=(const ctulimit& app) @@ -177,7 +189,9 @@ ctulimit& ctulimit::operator=(const ctulimit& app)
177 ==========================================================================*/ 189 ==========================================================================*/
178 190
179 /***********************************************************************//** 191 /***********************************************************************//**
180 - * @brief Clear instance 192 + * @brief Clear ctulimit tool
  193 + *
  194 + * Resets the ctulimit tool to a clean initial state.
181 ***************************************************************************/ 195 ***************************************************************************/
182 void ctulimit::clear(void) 196 void ctulimit::clear(void)
183 { 197 {
@@ -197,9 +211,9 @@ void ctulimit::clear(void) @@ -197,9 +211,9 @@ void ctulimit::clear(void)
197 211
198 212
199 /***********************************************************************//** 213 /***********************************************************************//**
200 - * @brief Computes the upper limit 214 + * @brief Compute upper limit
201 * 215 *
202 - * This method calculates the upper limit depending on the given algorithm 216 + * Computes the upper limit depending on the given algorithm
203 ***************************************************************************/ 217 ***************************************************************************/
204 void ctulimit::run(void) 218 void ctulimit::run(void)
205 { 219 {
@@ -369,9 +383,9 @@ void ctulimit::run(void) @@ -369,9 +383,9 @@ void ctulimit::run(void)
369 383
370 384
371 /***********************************************************************//** 385 /***********************************************************************//**
372 - * @brief Save maps 386 + * @brief Save upper limits
373 * 387 *
374 - * This method saves the upper limit to an ascii file. 388 + * Saves the upper limit to an ASCII file in comma-separated value format.
375 * 389 *
376 * @todo No yet implemented as we have no clear use case yet for saving 390 * @todo No yet implemented as we have no clear use case yet for saving
377 * the result. 391 * the result.
@@ -417,14 +431,14 @@ void ctulimit::init_members(void) @@ -417,14 +431,14 @@ void ctulimit::init_members(void)
417 { 431 {
418 // Initialise user parameters 432 // Initialise user parameters
419 m_srcname.clear(); 433 m_srcname.clear();
420 - m_confidence = 0.95;  
421 - m_sigma_min = 0.0;  
422 - m_sigma_max = 0.0;  
423 - m_eref = 0.0;  
424 - m_emin = 0.0;  
425 - m_emax = 0.0;  
426 - m_tol = 1.0e-6;  
427 - m_max_iter = 50; 434 + m_confidence = 0.95;
  435 + m_sigma_min = 0.0;
  436 + m_sigma_max = 0.0;
  437 + m_eref = 0.0;
  438 + m_emin = 0.0;
  439 + m_emax = 0.0;
  440 + m_tol = 1.0e-6;
  441 + m_max_iter = 50;
428 m_apply_edisp = false; 442 m_apply_edisp = false;
429 443
430 // Initialise protected members 444 // Initialise protected members
@@ -455,15 +469,15 @@ void ctulimit::init_members(void) @@ -455,15 +469,15 @@ void ctulimit::init_members(void)
455 void ctulimit::copy_members(const ctulimit& app) 469 void ctulimit::copy_members(const ctulimit& app)
456 { 470 {
457 // Copy user parameters 471 // Copy user parameters
458 - m_srcname = app.m_srcname;  
459 - m_confidence = app.m_confidence;  
460 - m_sigma_min = app.m_sigma_min;  
461 - m_sigma_max = app.m_sigma_max;  
462 - m_eref = app.m_eref;  
463 - m_emin = app.m_emin;  
464 - m_emax = app.m_emax;  
465 - m_tol = app.m_tol;  
466 - m_max_iter = app.m_max_iter; 472 + m_srcname = app.m_srcname;
  473 + m_confidence = app.m_confidence;
  474 + m_sigma_min = app.m_sigma_min;
  475 + m_sigma_max = app.m_sigma_max;
  476 + m_eref = app.m_eref;
  477 + m_emin = app.m_emin;
  478 + m_emax = app.m_emax;
  479 + m_tol = app.m_tol;
  480 + m_max_iter = app.m_max_iter;
467 m_apply_edisp = app.m_apply_edisp; 481 m_apply_edisp = app.m_apply_edisp;
468 482
469 // Copy protected members 483 // Copy protected members
@@ -624,12 +638,12 @@ void ctulimit::get_model_parameter(void) @@ -624,12 +638,12 @@ void ctulimit::get_model_parameter(void)
624 638
625 639
626 /***********************************************************************//** 640 /***********************************************************************//**
627 - * @brief Performs upper limit computation by using a bisection method 641 + * @brief Calculate upper limit using a bisection method
628 * 642 *
629 * @param[in] min Minimum parameter value 643 * @param[in] min Minimum parameter value
630 * @param[in] max Maximum parameter value 644 * @param[in] max Maximum parameter value
631 * 645 *
632 - * This method calculates the upper limit using a bisection method. 646 + * Calculates the upper limit using a bisection method.
633 ***************************************************************************/ 647 ***************************************************************************/
634 void ctulimit::ulimit_bisection(const double& min, const double& max) 648 void ctulimit::ulimit_bisection(const double& min, const double& max)
635 { 649 {
@@ -697,8 +711,7 @@ void ctulimit::ulimit_bisection(const double& min, const double& max) @@ -697,8 +711,7 @@ void ctulimit::ulimit_bisection(const double& min, const double& max)
697 * @param[in] value Parameter factor value 711 * @param[in] value Parameter factor value
698 * @return Log-likelihood value 712 * @return Log-likelihood value
699 * 713 *
700 - * This method evaluates the log-likelihood as a function of the parameter  
701 - * of interest. 714 + * Evaluates the log-likelihood as a function of the parameter of interest.
702 ***************************************************************************/ 715 ***************************************************************************/
703 double ctulimit::evaluate(const double& value) 716 double ctulimit::evaluate(const double& value)
704 { 717 {