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
| 1 | Juergen Knoedlseder (jurgen.knodlseder@irap.omp.eu) | 1 | Juergen Knoedlseder (jurgen.knodlseder@irap.omp.eu) |
| 2 | Jean-Baptiste Cayrou (cayrou@etud.insa-toulouse.fr) | 2 | Jean-Baptiste Cayrou (cayrou@etud.insa-toulouse.fr) |
| 3 | Christoph Deil (Christoph.Deil@mpi-hd.mpg.de) | 3 | Christoph Deil (Christoph.Deil@mpi-hd.mpg.de) |
| 4 | - | 4 | +Michael Mayer (michael.mayer@desy.de) |
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 | * Version 0.7.0 released | 3 | * Version 0.7.0 released |
| 4 | ======================== | 4 | ======================== |
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | Adapt to GammaLib-00-08-00 interface | 6 | Adapt to GammaLib-00-08-00 interface |
| 7 | ctobssim now only simulates events within ROI and supports | 7 | ctobssim now only simulates events within ROI and supports |
| 8 | all kinds of data space models | 8 | all kinds of data space models |
| 9 | + ctbin now implements LIN and FILE binning algorithms | ||
| 9 | 10 | ||
| 10 | 2012-12-21 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | 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,7 +2,7 @@ New Features and Important Changes in ctools 00-07-00 | ||
| 2 | 2 | ||
| 3 | Author(s) : Juergen Knoedlseder | 3 | Author(s) : Juergen Knoedlseder |
| 4 | 4 | ||
| 5 | -19 November 2013 | 5 | +20 November 2013 |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 1. Introduction | 8 | 1. Introduction |
| @@ -45,7 +45,12 @@ None | @@ -45,7 +45,12 @@ None | ||
| 45 | 45 | ||
| 46 | 6. ctbin - CTA event binning | 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 | 7. ctlike - CTA maximum likelihood fitting | 56 | 7. ctlike - CTA maximum likelihood fitting |
src/ctbin/ctbin.cpp
| @@ -434,14 +434,12 @@ void ctbin::get_parameters(void) | @@ -434,14 +434,12 @@ void ctbin::get_parameters(void) | ||
| 434 | } | 434 | } |
| 435 | m_ebinalg = (*this)["ebinalg"].string(); | 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 | m_ebinfile = (*this)["ebinfile"].filename(); | 439 | m_ebinfile = (*this)["ebinfile"].filename(); |
| 443 | } | 440 | } |
| 444 | - // otherwise read emin, emax and nebins | 441 | + |
| 442 | + // ... otherwise read emin, emax and nebins | ||
| 445 | else{ | 443 | else{ |
| 446 | m_emin = (*this)["emin"].real(); | 444 | m_emin = (*this)["emin"].real(); |
| 447 | m_emax = (*this)["emax"].real(); | 445 | m_emax = (*this)["emax"].real(); |
| @@ -500,9 +498,9 @@ void ctbin::bin_events(GCTAObservation* obs) | @@ -500,9 +498,9 @@ void ctbin::bin_events(GCTAObservation* obs) | ||
| 500 | 498 | ||
| 501 | // First check wether we have FITS-file defining | 499 | // First check wether we have FITS-file defining |
| 502 | // the binning | 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 | GFits file(m_ebinfile); | 504 | GFits file(m_ebinfile); |
| 507 | 505 | ||
| 508 | if (file.hashdu("EBOUNDS")) { | 506 | if (file.hashdu("EBOUNDS")) { |
| @@ -523,17 +521,24 @@ void ctbin::bin_events(GCTAObservation* obs) | @@ -523,17 +521,24 @@ void ctbin::bin_events(GCTAObservation* obs) | ||
| 523 | 521 | ||
| 524 | else { | 522 | else { |
| 525 | 523 | ||
| 524 | + // Close file | ||
| 526 | file.close(); | 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 | // Set enumbins parameter to number of ebounds | 538 | // Set enumbins parameter to number of ebounds |
| 534 | m_enumbins = ebds.size(); | 539 | m_enumbins = ebds.size(); |
| 535 | 540 | ||
| 536 | - } //endif: ebinalg was "FILE" | 541 | + } // endif: ebinalg was "FILE" |
| 537 | 542 | ||
| 538 | else { | 543 | else { |
| 539 | 544 | ||
| @@ -713,7 +718,7 @@ void ctbin::copy_members(const ctbin& app) | @@ -713,7 +718,7 @@ void ctbin::copy_members(const ctbin& app) | ||
| 713 | m_prefix = app.m_prefix; | 718 | m_prefix = app.m_prefix; |
| 714 | m_proj = app.m_proj; | 719 | m_proj = app.m_proj; |
| 715 | m_coordsys = app.m_coordsys; | 720 | m_coordsys = app.m_coordsys; |
| 716 | - m_ebinalg = app.m_ebinalg; | 721 | + m_ebinalg = app.m_ebinalg; |
| 717 | m_ebinfile = app.m_ebinfile; | 722 | m_ebinfile = app.m_ebinfile; |
| 718 | m_usepnt = app.m_usepnt; | 723 | m_usepnt = app.m_usepnt; |
| 719 | m_emin = app.m_emin; | 724 | m_emin = app.m_emin; |
src/ctbin/ctbin.hpp
| @@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
| 33 | 33 | ||
| 34 | /* __Definitions _________________________________________________________ */ | 34 | /* __Definitions _________________________________________________________ */ |
| 35 | #define CTBIN_NAME "ctbin" | 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,8 +89,8 @@ protected: | ||
| 89 | int m_enumbins; //!< Number of energy bins | 89 | int m_enumbins; //!< Number of energy bins |
| 90 | std::string m_proj; //!< WCS projection | 90 | std::string m_proj; //!< WCS projection |
| 91 | std::string m_coordsys; //!< Coordinate system | 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 | double m_xref; //!< Longitude reference coordinate | 94 | double m_xref; //!< Longitude reference coordinate |
| 95 | double m_yref; //!< Latitude reference coordinate | 95 | double m_yref; //!< Latitude reference coordinate |
| 96 | double m_binsz; //!< Pixel size | 96 | double m_binsz; //!< Pixel size |
src/ctbin/ctbin.par
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | # ------------------------------------------------------------------------- # | 5 | # ------------------------------------------------------------------------- # |
| 6 | # # | 6 | # # |
| 7 | # File: ctbin.par # | 7 | # File: ctbin.par # |
| 8 | -# Version: 00-04-00 # | 8 | +# Version: 00-05-00 # |
| 9 | # # | 9 | # # |
| 10 | # Author: Jurgen Knodlseder # | 10 | # Author: Jurgen Knodlseder # |
| 11 | # Jurgen.Knodlseder@irap.omp.eu # | 11 | # Jurgen.Knodlseder@irap.omp.eu # |
test/test_ctools.sh
| @@ -143,6 +143,7 @@ $ctbin evfile="events.fits" \ | @@ -143,6 +143,7 @@ $ctbin evfile="events.fits" \ | ||
| 143 | emin=0.1 \ | 143 | emin=0.1 \ |
| 144 | emax=100.0 \ | 144 | emax=100.0 \ |
| 145 | enumbins=20 \ | 145 | enumbins=20 \ |
| 146 | + ebinalg="LOG" \ | ||
| 146 | nxpix=200 \ | 147 | nxpix=200 \ |
| 147 | nypix=200 \ | 148 | nypix=200 \ |
| 148 | binsz=0.02 \ | 149 | binsz=0.02 \ |
| @@ -165,6 +166,7 @@ $ctbin evfile="events2.fits" \ | @@ -165,6 +166,7 @@ $ctbin evfile="events2.fits" \ | ||
| 165 | emin=0.3 \ | 166 | emin=0.3 \ |
| 166 | emax=8.0 \ | 167 | emax=8.0 \ |
| 167 | enumbins=10 \ | 168 | enumbins=10 \ |
| 169 | + ebinalg="LOG" \ | ||
| 168 | nxpix=50 \ | 170 | nxpix=50 \ |
| 169 | nypix=50 \ | 171 | nypix=50 \ |
| 170 | binsz=0.02 \ | 172 | binsz=0.02 \ |