Commit 11742474402a9654792bbefcef17cc68ab302be8
1 parent
cd8e36fc
Code revision before merging and updated ctbin version number and change information.
Showing
7 changed files
with
36 additions
and
23 deletions
AUTHORS
ChangeLog
| 1 | -2013-11-19 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 1 | +2013-11-20 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 2 | 2 | |
| 3 | 3 | * Version 0.7.0 released |
| 4 | 4 | ======================== |
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | Adapt to GammaLib-00-08-00 interface |
| 7 | 7 | ctobssim now only simulates events within ROI and supports |
| 8 | 8 | all kinds of data space models |
| 9 | + ctbin now implements LIN and FILE binning algorithms | |
| 9 | 10 | |
| 10 | 11 | 2012-12-21 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> |
| 11 | 12 | ... | ... |
NEWS
| ... | ... | @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 00-07-00 |
| 2 | 2 | |
| 3 | 3 | Author(s) : Juergen Knoedlseder |
| 4 | 4 | |
| 5 | -19 November 2013 | |
| 5 | +20 November 2013 | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | 1. Introduction |
| ... | ... | @@ -45,7 +45,12 @@ None |
| 45 | 45 | |
| 46 | 46 | 6. ctbin - CTA event binning |
| 47 | 47 | ---------------------------- |
| 48 | -None | |
| 48 | +The ebinalg parameter is now used to specify the type of binning. | |
| 49 | +Linear (LIN) binning and binning retrieved from a FITS file (FILE) | |
| 50 | +is now supported. For the latter, an extension named EBOUNDS or | |
| 51 | +ENERGYBINS is expected. | |
| 52 | + | |
| 53 | +The ebinalg and ebinfile parameters are now automatic. | |
| 49 | 54 | |
| 50 | 55 | |
| 51 | 56 | 7. ctlike - CTA maximum likelihood fitting | ... | ... |
src/ctbin/ctbin.cpp
| ... | ... | @@ -434,14 +434,12 @@ void ctbin::get_parameters(void) |
| 434 | 434 | } |
| 435 | 435 | m_ebinalg = (*this)["ebinalg"].string(); |
| 436 | 436 | |
| 437 | - // if we have the binning given by a file | |
| 438 | - // read in filename next | |
| 439 | - if (m_ebinalg=="FILE") { | |
| 440 | - | |
| 441 | - // get binning filename | |
| 437 | + // If we have the binning given by a file then read filename | |
| 438 | + if (m_ebinalg == "FILE") { | |
| 442 | 439 | m_ebinfile = (*this)["ebinfile"].filename(); |
| 443 | 440 | } |
| 444 | - // otherwise read emin, emax and nebins | |
| 441 | + | |
| 442 | + // ... otherwise read emin, emax and nebins | |
| 445 | 443 | else{ |
| 446 | 444 | m_emin = (*this)["emin"].real(); |
| 447 | 445 | m_emax = (*this)["emax"].real(); |
| ... | ... | @@ -500,9 +498,9 @@ void ctbin::bin_events(GCTAObservation* obs) |
| 500 | 498 | |
| 501 | 499 | // First check wether we have FITS-file defining |
| 502 | 500 | // the binning |
| 503 | - if (m_ebinalg=="FILE") { | |
| 501 | + if (m_ebinalg == "FILE") { | |
| 504 | 502 | |
| 505 | - // open fits file to check which extension is given | |
| 503 | + // Open fits file to check which extension is given | |
| 506 | 504 | GFits file(m_ebinfile); |
| 507 | 505 | |
| 508 | 506 | if (file.hashdu("EBOUNDS")) { |
| ... | ... | @@ -523,17 +521,24 @@ void ctbin::bin_events(GCTAObservation* obs) |
| 523 | 521 | |
| 524 | 522 | else { |
| 525 | 523 | |
| 524 | + // Close file | |
| 526 | 525 | file.close(); |
| 527 | - // throw an exception todo: get the right status | |
| 528 | - int status=0; | |
| 529 | - throw GException::fits_hdu_not_found(G_BIN_EVENTS, "\'EBOUNDS\' or \'ENERGYBINS\'", status); | |
| 530 | - | |
| 531 | - } // endelse: no suited extension | |
| 526 | + | |
| 527 | + // Signal that no energy boundaries have been found | |
| 528 | + std::string msg = "No extension with name \"EBOUNDS\" or" | |
| 529 | + " \"ENERGYBINS\" found in FITS file" | |
| 530 | + " \""+m_ebinfile+"\".\n" | |
| 531 | + "An \"EBOUNDS\" or \"ENERGYBINS\" extension" | |
| 532 | + " is required if the parameter \"ebinalg\"" | |
| 533 | + " is set to \"FILE\"."; | |
| 534 | + throw GException::invalid_value(G_BIN_EVENTS, msg); | |
| 535 | + | |
| 536 | + } // endelse: no suited extension found | |
| 532 | 537 | |
| 533 | 538 | // Set enumbins parameter to number of ebounds |
| 534 | 539 | m_enumbins = ebds.size(); |
| 535 | 540 | |
| 536 | - } //endif: ebinalg was "FILE" | |
| 541 | + } // endif: ebinalg was "FILE" | |
| 537 | 542 | |
| 538 | 543 | else { |
| 539 | 544 | |
| ... | ... | @@ -713,7 +718,7 @@ void ctbin::copy_members(const ctbin& app) |
| 713 | 718 | m_prefix = app.m_prefix; |
| 714 | 719 | m_proj = app.m_proj; |
| 715 | 720 | m_coordsys = app.m_coordsys; |
| 716 | - m_ebinalg = app.m_ebinalg; | |
| 721 | + m_ebinalg = app.m_ebinalg; | |
| 717 | 722 | m_ebinfile = app.m_ebinfile; |
| 718 | 723 | m_usepnt = app.m_usepnt; |
| 719 | 724 | m_emin = app.m_emin; | ... | ... |
src/ctbin/ctbin.hpp
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | |
| 34 | 34 | /* __Definitions _________________________________________________________ */ |
| 35 | 35 | #define CTBIN_NAME "ctbin" |
| 36 | -#define CTBIN_VERSION "00-04-00" | |
| 36 | +#define CTBIN_VERSION "00-05-00" | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | /***********************************************************************//** |
| ... | ... | @@ -89,8 +89,8 @@ protected: |
| 89 | 89 | int m_enumbins; //!< Number of energy bins |
| 90 | 90 | std::string m_proj; //!< WCS projection |
| 91 | 91 | std::string m_coordsys; //!< Coordinate system |
| 92 | - std::string m_ebinalg; //!< Algorithm for energy binning | |
| 93 | - std::string m_ebinfile; //!< FITS-file containing energy binning | |
| 92 | + std::string m_ebinalg; //!< Algorithm for energy binning | |
| 93 | + std::string m_ebinfile; //!< FITS-file containing energy binning | |
| 94 | 94 | double m_xref; //!< Longitude reference coordinate |
| 95 | 95 | double m_yref; //!< Latitude reference coordinate |
| 96 | 96 | double m_binsz; //!< Pixel size | ... | ... |
src/ctbin/ctbin.par
test/test_ctools.sh
| ... | ... | @@ -143,6 +143,7 @@ $ctbin evfile="events.fits" \ |
| 143 | 143 | emin=0.1 \ |
| 144 | 144 | emax=100.0 \ |
| 145 | 145 | enumbins=20 \ |
| 146 | + ebinalg="LOG" \ | |
| 146 | 147 | nxpix=200 \ |
| 147 | 148 | nypix=200 \ |
| 148 | 149 | binsz=0.02 \ |
| ... | ... | @@ -165,6 +166,7 @@ $ctbin evfile="events2.fits" \ |
| 165 | 166 | emin=0.3 \ |
| 166 | 167 | emax=8.0 \ |
| 167 | 168 | enumbins=10 \ |
| 169 | + ebinalg="LOG" \ | |
| 168 | 170 | nxpix=50 \ |
| 169 | 171 | nypix=50 \ |
| 170 | 172 | binsz=0.02 \ | ... | ... |