Commit 342c1007fdd302022520dcf822a60b7f9400d0b4

Authored by Jürgen Knödlseder
1 parent bb0bddad

Write response information into simulated observation definition file (#2170)

ChangeLog
1 -2017-07-22 1 +2017-07-25
2 2
3 * Version 1.4.0 released 3 * Version 1.4.0 released
4 ========================= 4 =========================
5 5
  6 + Write response information into simulated observation definition file (#2170)
6 Normalise phase curves by default (#2154) 7 Normalise phase curves by default (#2154)
7 Support Python list slicing for container classes (#2128) 8 Support Python list slicing for container classes (#2128)
8 Add GSkyRegions::overlaps() and GSkyMap::overlaps() classes (#1980) 9 Add GSkyRegions::overlaps() and GSkyMap::overlaps() classes (#1980)
1 New Features and Important Changes in GammaLib 1.4.0 1 New Features and Important Changes in GammaLib 1.4.0
2 2
3 -22 July 2017 3 +25 July 2017
4 4
5 5
6 1. Introduction 6 1. Introduction
@@ -149,6 +149,10 @@ GCTACubeEdisp::fill_cube(), and GCTACubeBackground::fill() methods now @@ -149,6 +149,10 @@ GCTACubeEdisp::fill_cube(), and GCTACubeBackground::fill() methods now
149 exclude any observations from the filling for which the RoI does not 149 exclude any observations from the filling for which the RoI does not
150 overlap with the cube definition (#1980). 150 overlap with the cube definition (#1980).
151 151
  152 +The response information is now always written in the observation definition
  153 +XML file if it is available, and not only if it has been read in previously
  154 +from another XML file (#2170).
  155 +
152 156
153 21. COMPTEL interface 157 21. COMPTEL interface
154 --------------------- 158 ---------------------
doc/source/admin/release_history/1.4.rst
@@ -10,8 +10,7 @@ GammaLib 1.4 is a major release that adds significant functionality. @@ -10,8 +10,7 @@ GammaLib 1.4 is a major release that adds significant functionality.
10 10
11 In particular, this release provides: 11 In particular, this release provides:
12 12
13 -* TBD  
14 -* TBD 13 +* Support for Python list slicing for all container classes
15 14
16 15
17 Bug fixes 16 Bug fixes
@@ -21,6 +20,10 @@ Bug fixes @@ -21,6 +20,10 @@ Bug fixes
21 Improvements 20 Improvements
22 ------------ 21 ------------
23 22
  23 +* [`2170 <https://cta-redmine.irap.omp.eu/issues/2170>`_] -
  24 + Write response information into simulated observation definition file
  25 +* [`2154 <https://cta-redmine.irap.omp.eu/issues/2154>`_] -
  26 + Normalise phase curves by default
24 * [`1980 <https://cta-redmine.irap.omp.eu/issues/1980>`_] - 27 * [`1980 <https://cta-redmine.irap.omp.eu/issues/1980>`_] -
25 Add ``GSkyRegions::overlaps()`` and ``GSkyMap::overlaps()`` classes 28 Add ``GSkyRegions::overlaps()`` and ``GSkyMap::overlaps()`` classes
26 29
@@ -28,6 +31,9 @@ Improvements @@ -28,6 +31,9 @@ Improvements
28 New features 31 New features
29 ------------ 32 ------------
30 33
  34 +* [`2128 <https://cta-redmine.irap.omp.eu/issues/2128>`_] -
  35 + Support Python list slicing for container classes
  36 +
31 37
32 38
33 Clean up 39 Clean up
inst/cta/src/GCTAResponseIrf.cpp
@@ -756,11 +756,11 @@ void GCTAResponseIrf::read(const GXmlElement&amp; xml) @@ -756,11 +756,11 @@ void GCTAResponseIrf::read(const GXmlElement&amp; xml)
756 756
757 } // endif: sigma attribute specified 757 } // endif: sigma attribute specified
758 758
759 - // Store database and response names (we do this now since the  
760 - // load() method results the object, except of the calibration  
761 - // database)  
762 - m_xml_caldb = xml_caldb;  
763 - m_xml_rspname = xml_rspname; 759 + // Store database and response names for later writing into the XML
  760 + // file (we do this now since the load() method clears all
  761 + // GCTAResponseIrf data members)
  762 + //m_xml_caldb = xml_caldb;
  763 + //m_xml_rspname = xml_rspname;
764 764
765 } // endif: "Calibration" parameter found 765 } // endif: "Calibration" parameter found
766 766
@@ -1020,6 +1020,9 @@ void GCTAResponseIrf::write(GXmlElement&amp; xml) const @@ -1020,6 +1020,9 @@ void GCTAResponseIrf::write(GXmlElement&amp; xml) const
1020 * appropriate response is found, the method takes the database root path 1020 * appropriate response is found, the method takes the database root path
1021 * and response name to build the full path to the response file, and tries 1021 * and response name to build the full path to the response file, and tries
1022 * to load the response from these paths. 1022 * to load the response from these paths.
  1023 + *
  1024 + * The method sets the calibration database and response names for writing
  1025 + * of the response information into the XML file.
1023 ***************************************************************************/ 1026 ***************************************************************************/
1024 void GCTAResponseIrf::load(const std::string& rspname) 1027 void GCTAResponseIrf::load(const std::string& rspname)
1025 { 1028 {
@@ -1042,19 +1045,26 @@ void GCTAResponseIrf::load(const std::string&amp; rspname) @@ -1042,19 +1045,26 @@ void GCTAResponseIrf::load(const std::string&amp; rspname)
1042 bgdname = m_caldb.filename("","","BGD","","",expr); 1045 bgdname = m_caldb.filename("","","BGD","","",expr);
1043 } 1046 }
1044 1047
  1048 + // Signal usage of calibration database
  1049 + bool use_caldb = true;
  1050 +
1045 // If filenames are empty then build filenames from CALDB root path and 1051 // If filenames are empty then build filenames from CALDB root path and
1046 // response name 1052 // response name
1047 if (aeffname.is_empty()) { 1053 if (aeffname.is_empty()) {
1048 - aeffname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); 1054 + aeffname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname));
  1055 + use_caldb = false;
1049 } 1056 }
1050 if (psfname.is_empty()) { 1057 if (psfname.is_empty()) {
1051 - psfname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); 1058 + psfname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname));
  1059 + use_caldb = false;
1052 } 1060 }
1053 if (edispname.is_empty()) { 1061 if (edispname.is_empty()) {
1054 edispname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); 1062 edispname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname));
  1063 + use_caldb = false;
1055 } 1064 }
1056 if (bgdname.is_empty()) { 1065 if (bgdname.is_empty()) {
1057 - bgdname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); 1066 + bgdname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname));
  1067 + use_caldb = false;
1058 } 1068 }
1059 1069
1060 // Load effective area 1070 // Load effective area
@@ -1078,6 +1088,13 @@ void GCTAResponseIrf::load(const std::string&amp; rspname) @@ -1078,6 +1088,13 @@ void GCTAResponseIrf::load(const std::string&amp; rspname)
1078 // Store response name 1088 // Store response name
1079 m_rspname = rspname; 1089 m_rspname = rspname;
1080 1090
  1091 + // If the calibration database has been used then store database and
  1092 + // response names for later writing into the XML file
  1093 + if (use_caldb) {
  1094 + m_xml_caldb = caldb.instrument();
  1095 + m_xml_rspname = rspname;
  1096 + }
  1097 +
1081 // Return 1098 // Return
1082 return; 1099 return;
1083 } 1100 }