Commit 3814df1eab77f180a409b4515cb1bb115cf58aef
1 parent
992b421e
Use "BKG" instead of "BGD" for CTA background column (#2343)
Showing
8 changed files
with
97 additions
and
13 deletions
ChangeLog
NEWS
| 1 | -New Features and Important Changes in GammaLib 1.5.2 | 1 | +New Features and Important Changes in GammaLib 1.5.3 |
| 2 | 2 | ||
| 3 | -26 April 2018 | 3 | +23 April 2019 |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 1. Introduction | 6 | 1. Introduction |
| @@ -123,9 +123,7 @@ None | @@ -123,9 +123,7 @@ None | ||
| 123 | 123 | ||
| 124 | 20. CTA interface | 124 | 20. CTA interface |
| 125 | ----------------- | 125 | ----------------- |
| 126 | -The number of internal spectral nodes was not computed correctly in | ||
| 127 | -GCTABackground3D::init_mc_cache(), and hence energies could be simulated by the | ||
| 128 | -Monte Carlo method that fell outside the valid energy interval (#2462). | 126 | +Use "BKG" instead of "BGD" for CTA background column (#2343). |
| 129 | 127 | ||
| 130 | 128 | ||
| 131 | 21. COMPTEL interface | 129 | 21. COMPTEL interface |
doc/source/admin/release_history/1.5.3.rst
0 → 100644
| 1 | +.. _1.5.3: | ||
| 2 | + | ||
| 3 | +GammaLib 1.5.3 release (23 April 2019) | ||
| 4 | +====================================== | ||
| 5 | + | ||
| 6 | +Overview | ||
| 7 | +-------- | ||
| 8 | + | ||
| 9 | +GammaLib 1.5.3 is a bug fix release for GammaLib release 1.5. | ||
| 10 | + | ||
| 11 | +The following bugs were fixed: | ||
| 12 | + | ||
| 13 | +* [`2343 <https://cta-redmine.irap.omp.eu/issues/2343>`_] - | ||
| 14 | + Use ``BKG`` instead of ``BGD`` for CTA background column |
doc/source/admin/release_history/index.rst
| @@ -6,6 +6,7 @@ Release History | @@ -6,6 +6,7 @@ Release History | ||
| 6 | .. toctree:: | 6 | .. toctree:: |
| 7 | :maxdepth: 1 | 7 | :maxdepth: 1 |
| 8 | 8 | ||
| 9 | + GammaLib 1.5.3 <1.5.3> | ||
| 9 | GammaLib 1.5.2 <1.5.2> | 10 | GammaLib 1.5.2 <1.5.2> |
| 10 | GammaLib 1.5.1 <1.5.1> | 11 | GammaLib 1.5.1 <1.5.1> |
| 11 | GammaLib 1.5 <1.5> | 12 | GammaLib 1.5 <1.5> |
inst/cta/src/GCTABackground3D.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCTABackground3D.cpp - CTA 3D background class * | 2 | * GCTABackground3D.cpp - CTA 3D background class * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2017 by Juergen Knoedlseder * | 4 | + * copyright (C) 2014-2019 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 * |
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | #include "GFits.hpp" | 36 | #include "GFits.hpp" |
| 37 | #include "GFitsBinTable.hpp" | 37 | #include "GFitsBinTable.hpp" |
| 38 | #include "GCTABackground3D.hpp" | 38 | #include "GCTABackground3D.hpp" |
| 39 | +#include "GCTASupport.hpp" | ||
| 39 | 40 | ||
| 40 | /* __ Method name definitions ____________________________________________ */ | 41 | /* __ Method name definitions ____________________________________________ */ |
| 41 | #define G_READ "GCTABackground3D::read(GFitsTable&)" | 42 | #define G_READ "GCTABackground3D::read(GFitsTable&)" |
| @@ -321,7 +322,7 @@ GCTABackground3D* GCTABackground3D::clone(void) const | @@ -321,7 +322,7 @@ GCTABackground3D* GCTABackground3D::clone(void) const | ||
| 321 | * DETY_HI - DETY upper bin boundaries | 322 | * DETY_HI - DETY upper bin boundaries |
| 322 | * ENERG_LO - Energy lower bin boundaries | 323 | * ENERG_LO - Energy lower bin boundaries |
| 323 | * ENERG_HI - Energy upper bin boundaries | 324 | * ENERG_HI - Energy upper bin boundaries |
| 324 | - * BGD - Background template | 325 | + * BKG - Background template (or BGD as legacy column name) |
| 325 | * | 326 | * |
| 326 | * The data are stored in the m_background member. The DETX and DETY axes | 327 | * The data are stored in the m_background member. The DETX and DETY axes |
| 327 | * will be set to radians, the energy axis will be set to log10. | 328 | * will be set to radians, the energy axis will be set to log10. |
| @@ -348,7 +349,12 @@ void GCTABackground3D::read(const GFitsTable& table) | @@ -348,7 +349,12 @@ void GCTABackground3D::read(const GFitsTable& table) | ||
| 348 | m_inx_detx = m_background.axis("DETX"); | 349 | m_inx_detx = m_background.axis("DETX"); |
| 349 | m_inx_dety = m_background.axis("DETY"); | 350 | m_inx_dety = m_background.axis("DETY"); |
| 350 | m_inx_energy = m_background.axis("ENERG"); | 351 | m_inx_energy = m_background.axis("ENERG"); |
| 351 | - m_inx_bgd = m_background.table("BGD"); | 352 | + if (m_background.has_table("BKG")) { |
| 353 | + m_inx_bgd = m_background.table("BKG"); | ||
| 354 | + } | ||
| 355 | + else { | ||
| 356 | + m_inx_bgd = m_background.table("BGD"); // Old name, should not be used | ||
| 357 | + } | ||
| 352 | 358 | ||
| 353 | // Get axes dimensions | 359 | // Get axes dimensions |
| 354 | m_num_detx = m_background.axis_bins(m_inx_detx); | 360 | m_num_detx = m_background.axis_bins(m_inx_detx); |
| @@ -408,9 +414,15 @@ void GCTABackground3D::load(const GFilename& filename) | @@ -408,9 +414,15 @@ void GCTABackground3D::load(const GFilename& filename) | ||
| 408 | // Open FITS file | 414 | // Open FITS file |
| 409 | GFits fits(filename); | 415 | GFits fits(filename); |
| 410 | 416 | ||
| 417 | + // Get the default extension name. If no GADF compliant name was found | ||
| 418 | + // then set the default extension name to "BACKGROUND". | ||
| 419 | + std::string extname = gammalib::gadf_hduclas4(fits, "BKG_3D"); | ||
| 420 | + if (extname.empty()) { | ||
| 421 | + extname = gammalib::extname_cta_background3d; | ||
| 422 | + } | ||
| 423 | + | ||
| 411 | // Get background table | 424 | // Get background table |
| 412 | - const GFitsTable& table = | ||
| 413 | - *fits.table(filename.extname(gammalib::extname_cta_background3d)); | 425 | + const GFitsTable& table = *fits.table(filename.extname(extname)); |
| 414 | 426 | ||
| 415 | // Read effective area from table | 427 | // Read effective area from table |
| 416 | read(table); | 428 | read(table); |
inst/cta/src/GCTAResponseIrf.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCTAResponseIrf.cpp - CTA instrument response function class * | 2 | * GCTAResponseIrf.cpp - CTA instrument response function class * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2017 by Juergen Knoedlseder * | 4 | + * copyright (C) 2010-2019 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 * |
inst/cta/src/GCTASupport.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCTASupport.cpp - CTA support functions * | 2 | * GCTASupport.cpp - CTA support functions * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2017 by Juergen Knoedlseder * | 4 | + * copyright (C) 2011-2019 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 * |
| @@ -34,6 +34,7 @@ | @@ -34,6 +34,7 @@ | ||
| 34 | #include "GCTASupport.hpp" | 34 | #include "GCTASupport.hpp" |
| 35 | #include "GTools.hpp" | 35 | #include "GTools.hpp" |
| 36 | #include "GMath.hpp" | 36 | #include "GMath.hpp" |
| 37 | +#include "GFits.hpp" | ||
| 37 | #include "GFitsHDU.hpp" | 38 | #include "GFitsHDU.hpp" |
| 38 | #include "GEbounds.hpp" | 39 | #include "GEbounds.hpp" |
| 39 | #include "GPhases.hpp" | 40 | #include "GPhases.hpp" |
| @@ -394,3 +395,50 @@ std::string gammalib::read_ds_gti_extname(const GFitsHDU& hdu) | @@ -394,3 +395,50 @@ std::string gammalib::read_ds_gti_extname(const GFitsHDU& hdu) | ||
| 394 | // Return | 395 | // Return |
| 395 | return extname; | 396 | return extname; |
| 396 | } | 397 | } |
| 398 | + | ||
| 399 | + | ||
| 400 | +/***********************************************************************//** | ||
| 401 | + * @brief Return extension name for GADF response table of given HDU class 4 | ||
| 402 | + * | ||
| 403 | + * @param[in] fits FITS file. | ||
| 404 | + * @param[in] hduclas4 HDU class 4. | ||
| 405 | + * @return Extension name. | ||
| 406 | + * | ||
| 407 | + * Returns the extension name for GADF response table of given HDU class 4. | ||
| 408 | + * If the response table is not found, an empty extension name is returned. | ||
| 409 | + ***************************************************************************/ | ||
| 410 | +std::string gammalib::gadf_hduclas4(const GFits& fits, | ||
| 411 | + const std::string& hduclas4) | ||
| 412 | +{ | ||
| 413 | + // Initialise extension name | ||
| 414 | + std::string extname; | ||
| 415 | + | ||
| 416 | + // Loop over all FITS HDUs | ||
| 417 | + for (int i = 0; i < fits.size(); ++i) { | ||
| 418 | + | ||
| 419 | + // Get FITS HDU | ||
| 420 | + const GFitsHDU* hdu = fits[i]; | ||
| 421 | + | ||
| 422 | + // Skip HDU if it has no "HDUCLASS", "HDUCLAS1" and "HDUCLAS4" keywords | ||
| 423 | + if (!(hdu->has_card("HDUCLASS") && | ||
| 424 | + hdu->has_card("HDUCLAS1") && | ||
| 425 | + hdu->has_card("HDUCLAS4"))) { | ||
| 426 | + continue; | ||
| 427 | + } | ||
| 428 | + | ||
| 429 | + // Skip HDU if "HDUCLASS" is not "GADF", "HDUCLAS1" is not response | ||
| 430 | + // and "HDUCLAS4" is not hduclas4 | ||
| 431 | + if (!((gammalib::strip_whitespace(hdu->string("HDUCLASS")) == "GADF") && | ||
| 432 | + (gammalib::strip_whitespace(hdu->string("HDUCLAS1")) == "RESPONSE") && | ||
| 433 | + (gammalib::strip_whitespace(hdu->string("HDUCLAS4")) == hduclas4))) { | ||
| 434 | + continue; | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + // Extract extension name and break | ||
| 438 | + extname = hdu->extname(); | ||
| 439 | + | ||
| 440 | + } // endfor: loop over headers | ||
| 441 | + | ||
| 442 | + // Return | ||
| 443 | + return extname; | ||
| 444 | +} |
inst/cta/src/GCTASupport.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCTASupport.hpp - CTA support functions * | 2 | * GCTASupport.hpp - CTA support functions * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2017 by Juergen Knoedlseder * | 4 | + * copyright (C) 2011-2019 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 * |
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | /* __ Constants __________________________________________________________ */ | 36 | /* __ Constants __________________________________________________________ */ |
| 37 | 37 | ||
| 38 | /* __ Forward declarations _______________________________________________ */ | 38 | /* __ Forward declarations _______________________________________________ */ |
| 39 | +class GFits; | ||
| 39 | class GFitsHDU; | 40 | class GFitsHDU; |
| 40 | class GCTARoi; | 41 | class GCTARoi; |
| 41 | class GEbounds; | 42 | class GEbounds; |
| @@ -50,6 +51,8 @@ namespace gammalib { | @@ -50,6 +51,8 @@ namespace gammalib { | ||
| 50 | GEbounds read_ds_ebounds(const GFitsHDU& hdu); | 51 | GEbounds read_ds_ebounds(const GFitsHDU& hdu); |
| 51 | GPhases read_ds_phase(const GFitsHDU& hdu); | 52 | GPhases read_ds_phase(const GFitsHDU& hdu); |
| 52 | std::string read_ds_gti_extname(const GFitsHDU& hdu); | 53 | std::string read_ds_gti_extname(const GFitsHDU& hdu); |
| 54 | + std::string gadf_hduclas4(const GFits& fits, | ||
| 55 | + const std::string& hduclas4); | ||
| 53 | } | 56 | } |
| 54 | 57 | ||
| 55 | #endif /* GCTASUPPORT_HPP */ | 58 | #endif /* GCTASUPPORT_HPP */ |