Commit 654219f9d547c31d214bf78cea34862bcad8154c
1 parent
780713c2
Check for Value parameter name and remove outfile parameter from parfile.
Showing
6 changed files
with
16 additions
and
24 deletions
doc/source/reference_manual/ctulimit.rst
| ... | ... | @@ -9,8 +9,7 @@ Computes upper limit for a specific sky model component. |
| 9 | 9 | Synopsis |
| 10 | 10 | -------- |
| 11 | 11 | |
| 12 | -Computes the upper limit flux of a given source and stores the value | |
| 13 | -in an ASCII file. | |
| 12 | +Computes the upper limit flux of a given source. | |
| 14 | 13 | |
| 15 | 14 | |
| 16 | 15 | General parameters |
| ... | ... | @@ -37,9 +36,6 @@ General parameters |
| 37 | 36 | ``irf [string]`` |
| 38 | 37 | Instrumental response function. |
| 39 | 38 | |
| 40 | -``outfile [file]`` | |
| 41 | - Output ASCII file name. | |
| 42 | - | |
| 43 | 39 | ``(confidence = 0.95) [real]`` |
| 44 | 40 | Confidence Level of upper limit. |
| 45 | 41 | ... | ... |
src/ctulimit/ctulimit.cpp
| ... | ... | @@ -337,7 +337,10 @@ void ctulimit::run(void) |
| 337 | 337 | /***********************************************************************//** |
| 338 | 338 | * @brief Save maps |
| 339 | 339 | * |
| 340 | - * This method saves the upper limit to an ascii file | |
| 340 | + * This method saves the upper limit to an ascii file. | |
| 341 | + * | |
| 342 | + * @todo No yet implemented as we have no clear use case yet for saving | |
| 343 | + * the result. | |
| 341 | 344 | ***************************************************************************/ |
| 342 | 345 | void ctulimit::save(void) |
| 343 | 346 | { |
| ... | ... | @@ -347,6 +350,7 @@ void ctulimit::save(void) |
| 347 | 350 | log.header1("Save upper limit"); |
| 348 | 351 | } |
| 349 | 352 | |
| 353 | + /* | |
| 350 | 354 | // Get output filename |
| 351 | 355 | m_outfile = (*this)["outfile"].filename(); |
| 352 | 356 | |
| ... | ... | @@ -359,7 +363,8 @@ void ctulimit::save(void) |
| 359 | 363 | |
| 360 | 364 | // Save CSV table |
| 361 | 365 | table.save(m_outfile, " ", clobber()); |
| 362 | - | |
| 366 | + */ | |
| 367 | + | |
| 363 | 368 | // Return |
| 364 | 369 | return; |
| 365 | 370 | } |
| ... | ... | @@ -377,7 +382,6 @@ void ctulimit::save(void) |
| 377 | 382 | void ctulimit::init_members(void) |
| 378 | 383 | { |
| 379 | 384 | // Initialise user parameters |
| 380 | - m_outfile.clear(); | |
| 381 | 385 | m_srcname.clear(); |
| 382 | 386 | m_confidence = 0.95; |
| 383 | 387 | m_sigma_min = 0.0; |
| ... | ... | @@ -411,7 +415,6 @@ void ctulimit::init_members(void) |
| 411 | 415 | void ctulimit::copy_members(const ctulimit& app) |
| 412 | 416 | { |
| 413 | 417 | // Copy user parameters |
| 414 | - m_outfile = app.m_outfile; | |
| 415 | 418 | m_srcname = app.m_srcname; |
| 416 | 419 | m_confidence = app.m_confidence; |
| 417 | 420 | m_sigma_min = app.m_sigma_min; |
| ... | ... | @@ -515,12 +518,6 @@ void ctulimit::get_parameters(void) |
| 515 | 518 | m_tol = (*this)["tol"].real(); |
| 516 | 519 | m_max_iter = (*this)["max_iter"].integer(); |
| 517 | 520 | |
| 518 | - // Optionally read ahead parameters so that they get correctly | |
| 519 | - // dumped into the log file | |
| 520 | - if (read_ahead()) { | |
| 521 | - m_outfile = (*this)["outfile"].filename(); | |
| 522 | - } | |
| 523 | - | |
| 524 | 521 | // Return |
| 525 | 522 | return; |
| 526 | 523 | } |
| ... | ... | @@ -558,11 +555,14 @@ void ctulimit::get_model_parameter(void) |
| 558 | 555 | else if (m_skymodel->spectral()->has_par("Integral")) { |
| 559 | 556 | m_model_par = &(m_skymodel->spectral()->operator[]("Integral")); |
| 560 | 557 | } |
| 558 | + else if (m_skymodel->spectral()->has_par("Value")) { | |
| 559 | + m_model_par = &(m_skymodel->spectral()->operator[]("Value")); | |
| 560 | + } | |
| 561 | 561 | else { |
| 562 | 562 | std::string msg = "Require spectral parameter \"Normalization\", " |
| 563 | - "\"Prefactor\" or \"Integral\" for upper limit " | |
| 564 | - "computation. The specified source \""+m_srcname+ | |
| 565 | - "\" does not have such a parameter."; | |
| 563 | + "\"Prefactor\", \"Integral\" or \"Value\" for " | |
| 564 | + "upper limit computation. The specified source " | |
| 565 | + "\""+m_srcname+"\" does not have such a parameter."; | |
| 566 | 566 | throw GException::invalid_value(G_GET_MODEL_PARAMETER, msg); |
| 567 | 567 | } |
| 568 | 568 | ... | ... |
src/ctulimit/ctulimit.hpp
| ... | ... | @@ -84,7 +84,6 @@ protected: |
| 84 | 84 | |
| 85 | 85 | // User parameters |
| 86 | 86 | std::string m_srcname; //!< Name of source which is moved around |
| 87 | - std::string m_outfile; //!< Output ascii file | |
| 88 | 87 | double m_confidence; //!< Confidence level |
| 89 | 88 | double m_sigma_min; //!< Starting value minimum (multiple fit errors above fit values) |
| 90 | 89 | double m_sigma_max; //!< Starting value maximum (multiple fit errors above fit values) | ... | ... |
src/ctulimit/ctulimit.par
| ... | ... | @@ -24,7 +24,6 @@ expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis) |
| 24 | 24 | psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" |
| 25 | 25 | caldb, s, a, "dummy",,, "Calibration database" |
| 26 | 26 | irf, s, a, "cta_dummy_irf",,, "Instrument response function" |
| 27 | -outfile, f, a, "upperlimit.txt",,, "Output ASCII file" | |
| 28 | 27 | |
| 29 | 28 | # |
| 30 | 29 | # Upper limit calculation parameters | ... | ... |
test/test_ctools.sh
| ... | ... | @@ -608,15 +608,14 @@ $ECHO -n "Test ctulimit: " |
| 608 | 608 | $ctulimit inobs="data/crab_events.fits.gz" \ |
| 609 | 609 | inmodel="data/crab.xml" \ |
| 610 | 610 | srcname="Crab" \ |
| 611 | - outfile="ulimit.dat" \ | |
| 612 | 611 | caldb="irf" \ |
| 613 | 612 | irf="cta_dummy_irf" |
| 614 | 613 | $ECHO -n "." |
| 615 | -if [ -s "ulimit.dat" ] | |
| 614 | +if [ -s "ctulimit.log" ] | |
| 616 | 615 | then |
| 617 | 616 | $ECHO -n "." |
| 618 | 617 | else |
| 619 | - $ECHO " ulimit.dat file is not found" | |
| 618 | + $ECHO " ctulimit.log file is not found" | |
| 620 | 619 | exit 1 |
| 621 | 620 | fi |
| 622 | 621 | $ECHO " ok" | ... | ... |
test/test_ctulimit.py