diff --git a/ChangeLog b/ChangeLog index b02ca8f..f49d2e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2017-07-22 +2017-07-25 * Version 1.4.0 released ========================= + Write response information into simulated observation definition file (#2170) Normalise phase curves by default (#2154) Support Python list slicing for container classes (#2128) Add GSkyRegions::overlaps() and GSkyMap::overlaps() classes (#1980) diff --git a/NEWS b/NEWS index 01e69bf..2a1dd6d 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in GammaLib 1.4.0 -22 July 2017 +25 July 2017 1. Introduction @@ -149,6 +149,10 @@ GCTACubeEdisp::fill_cube(), and GCTACubeBackground::fill() methods now exclude any observations from the filling for which the RoI does not overlap with the cube definition (#1980). +The response information is now always written in the observation definition +XML file if it is available, and not only if it has been read in previously +from another XML file (#2170). + 21. COMPTEL interface --------------------- diff --git a/doc/source/admin/release_history/1.4.rst b/doc/source/admin/release_history/1.4.rst index 854e10e..bcff534 100644 --- a/doc/source/admin/release_history/1.4.rst +++ b/doc/source/admin/release_history/1.4.rst @@ -10,8 +10,7 @@ GammaLib 1.4 is a major release that adds significant functionality. In particular, this release provides: -* TBD -* TBD +* Support for Python list slicing for all container classes Bug fixes @@ -21,6 +20,10 @@ Bug fixes Improvements ------------ +* [`2170 `_] - + Write response information into simulated observation definition file +* [`2154 `_] - + Normalise phase curves by default * [`1980 `_] - Add ``GSkyRegions::overlaps()`` and ``GSkyMap::overlaps()`` classes @@ -28,6 +31,9 @@ Improvements New features ------------ +* [`2128 `_] - + Support Python list slicing for container classes + Clean up diff --git a/inst/cta/src/GCTAResponseIrf.cpp b/inst/cta/src/GCTAResponseIrf.cpp index 90fe11a..f05d372 100644 --- a/inst/cta/src/GCTAResponseIrf.cpp +++ b/inst/cta/src/GCTAResponseIrf.cpp @@ -756,11 +756,11 @@ void GCTAResponseIrf::read(const GXmlElement& xml) } // endif: sigma attribute specified - // Store database and response names (we do this now since the - // load() method results the object, except of the calibration - // database) - m_xml_caldb = xml_caldb; - m_xml_rspname = xml_rspname; + // Store database and response names for later writing into the XML + // file (we do this now since the load() method clears all + // GCTAResponseIrf data members) + //m_xml_caldb = xml_caldb; + //m_xml_rspname = xml_rspname; } // endif: "Calibration" parameter found @@ -1020,6 +1020,9 @@ void GCTAResponseIrf::write(GXmlElement& xml) const * appropriate response is found, the method takes the database root path * and response name to build the full path to the response file, and tries * to load the response from these paths. + * + * The method sets the calibration database and response names for writing + * of the response information into the XML file. ***************************************************************************/ void GCTAResponseIrf::load(const std::string& rspname) { @@ -1042,19 +1045,26 @@ void GCTAResponseIrf::load(const std::string& rspname) bgdname = m_caldb.filename("","","BGD","","",expr); } + // Signal usage of calibration database + bool use_caldb = true; + // If filenames are empty then build filenames from CALDB root path and // response name if (aeffname.is_empty()) { - aeffname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); + aeffname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); + use_caldb = false; } if (psfname.is_empty()) { - psfname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); + psfname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); + use_caldb = false; } if (edispname.is_empty()) { edispname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); + use_caldb = false; } if (bgdname.is_empty()) { - bgdname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); + bgdname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); + use_caldb = false; } // Load effective area @@ -1078,6 +1088,13 @@ void GCTAResponseIrf::load(const std::string& rspname) // Store response name m_rspname = rspname; + // If the calibration database has been used then store database and + // response names for later writing into the XML file + if (use_caldb) { + m_xml_caldb = caldb.instrument(); + m_xml_rspname = rspname; + } + // Return return; }