Commit d95c652ef817bfb7091a941f350d75c975307dee

Authored by Jürgen Knödlseder
1 parent 41fcf69c

GCaldb::filename() now returns GFilename (#1745)

ChangeLog
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 * Version 1.1.0 released 3 * Version 1.1.0 released
4 ========================= 4 =========================
5 5
  6 + GCaldb::filename() method now returns GFilename (#1745)
6 GSkyMap::save() now overwrites files (#1787) 7 GSkyMap::save() now overwrites files (#1787)
7 Add GCTAPsfTable class (#1786) 8 Add GCTAPsfTable class (#1786)
8 Use std::vector for naxes argument in GFitsImage (#1779) 9 Use std::vector for naxes argument in GFitsImage (#1779)
@@ -109,6 +109,7 @@ of std::string: @@ -109,6 +109,7 @@ of std::string:
109 The return value has been changed for the following methods: 109 The return value has been changed for the following methods:
110 - GFits::filename() returns now GFilename instead of std::string 110 - GFits::filename() returns now GFilename instead of std::string
111 - GCTAObservation::eventtype() returns now std::string instead of const std::string& 111 - GCTAObservation::eventtype() returns now std::string instead of const std::string&
  112 +- GCaldb::filename() returns now GFilename instead of std::string
112 113
113 The interface for the following methods has been changed: 114 The interface for the following methods has been changed:
114 - GFitsImage naxes constructor 115 - GFitsImage naxes constructor
include/GCaldb.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCaldb.hpp - Calibration database class * 2 * GCaldb.hpp - Calibration database class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2011-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2011-2016 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 *
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 #include "GBase.hpp" 32 #include "GBase.hpp"
33 #include "GFits.hpp" 33 #include "GFits.hpp"
34 #include "GFitsTable.hpp" 34 #include "GFitsTable.hpp"
  35 +#include "GFilename.hpp"
35 36
36 37
37 /***********************************************************************//** 38 /***********************************************************************//**
@@ -89,7 +90,7 @@ public: @@ -89,7 +90,7 @@ public:
89 void open(const std::string& mission, 90 void open(const std::string& mission,
90 const std::string& instrument = ""); 91 const std::string& instrument = "");
91 void close(void); 92 void close(void);
92 - std::string filename(const std::string& detector, 93 + GFilename filename(const std::string& detector,
93 const std::string& filter, 94 const std::string& filter,
94 const std::string& codename, 95 const std::string& codename,
95 const std::string& date, 96 const std::string& date,
inst/cta/include/GCTAResponseIrf.hpp
@@ -160,46 +160,46 @@ public: @@ -160,46 +160,46 @@ public:
160 160
161 private: 161 private:
162 // Private methods 162 // Private methods
163 - void init_members(void);  
164 - void copy_members(const GCTAResponseIrf& rsp);  
165 - void free_members(void);  
166 - std::string irf_filename(const std::string& filename) const;  
167 - double irf_ptsrc(const GEvent& event, 163 + void init_members(void);
  164 + void copy_members(const GCTAResponseIrf& rsp);
  165 + void free_members(void);
  166 + GFilename irf_filename(const std::string& filename) const;
  167 + double irf_ptsrc(const GEvent& event,
  168 + const GSource& source,
  169 + const GObservation& obs) const;
  170 + double irf_radial(const GEvent& event,
  171 + const GSource& source,
  172 + const GObservation& obs) const;
  173 + double irf_elliptical(const GEvent& event,
  174 + const GSource& source,
  175 + const GObservation& obs) const;
  176 + double irf_diffuse(const GEvent& event,
168 const GSource& source, 177 const GSource& source,
169 const GObservation& obs) const; 178 const GObservation& obs) const;
170 - double irf_radial(const GEvent& event,  
171 - const GSource& source,  
172 - const GObservation& obs) const;  
173 - double irf_elliptical(const GEvent& event,  
174 - const GSource& source,  
175 - const GObservation& obs) const;  
176 - double irf_diffuse(const GEvent& event,  
177 - const GSource& source,  
178 - const GObservation& obs) const;  
179 - double nroi_ptsrc(const GModelSky& model, 179 + double nroi_ptsrc(const GModelSky& model,
  180 + const GEnergy& srcEng,
  181 + const GTime& srcTime,
  182 + const GEnergy& obsEng,
  183 + const GTime& obsTime,
  184 + const GObservation& obs) const;
  185 + double nroi_radial(const GModelSky& model,
  186 + const GEnergy& srcEng,
  187 + const GTime& srcTime,
  188 + const GEnergy& obsEng,
  189 + const GTime& obsTime,
  190 + const GObservation& obs) const;
  191 + double nroi_elliptical(const GModelSky& model,
  192 + const GEnergy& srcEng,
  193 + const GTime& srcTime,
  194 + const GEnergy& obsEng,
  195 + const GTime& obsTime,
  196 + const GObservation& obs) const;
  197 + double nroi_diffuse(const GModelSky& model,
180 const GEnergy& srcEng, 198 const GEnergy& srcEng,
181 const GTime& srcTime, 199 const GTime& srcTime,
182 const GEnergy& obsEng, 200 const GEnergy& obsEng,
183 const GTime& obsTime, 201 const GTime& obsTime,
184 const GObservation& obs) const; 202 const GObservation& obs) const;
185 - double nroi_radial(const GModelSky& model,  
186 - const GEnergy& srcEng,  
187 - const GTime& srcTime,  
188 - const GEnergy& obsEng,  
189 - const GTime& obsTime,  
190 - const GObservation& obs) const;  
191 - double nroi_elliptical(const GModelSky& model,  
192 - const GEnergy& srcEng,  
193 - const GTime& srcTime,  
194 - const GEnergy& obsEng,  
195 - const GTime& obsTime,  
196 - const GObservation& obs) const;  
197 - double nroi_diffuse(const GModelSky& model,  
198 - const GEnergy& srcEng,  
199 - const GTime& srcTime,  
200 - const GEnergy& obsEng,  
201 - const GTime& obsTime,  
202 - const GObservation& obs) const;  
203 203
204 // Private data members 204 // Private data members
205 GCaldb m_caldb; //!< Calibration database 205 GCaldb m_caldb; //!< Calibration database
inst/cta/src/GCTAResponseIrf.cpp
@@ -1021,23 +1021,23 @@ void GCTAResponseIrf::load(const std::string&amp; rspname) @@ -1021,23 +1021,23 @@ void GCTAResponseIrf::load(const std::string&amp; rspname)
1021 1021
1022 // First attempt reading the response using the GCaldb interface 1022 // First attempt reading the response using the GCaldb interface
1023 std::string expr = "NAME("+rspname+")"; 1023 std::string expr = "NAME("+rspname+")";
1024 - std::string aeffname = m_caldb.filename("","","EFF_AREA","","",expr);  
1025 - std::string psfname = m_caldb.filename("","","RPSF","","",expr);  
1026 - std::string edispname = m_caldb.filename("","","EDISP","","",expr);  
1027 - std::string bgdname = m_caldb.filename("","","BGD","","",expr); 1024 + GFilename aeffname = m_caldb.filename("","","EFF_AREA","","",expr);
  1025 + GFilename psfname = m_caldb.filename("","","RPSF","","",expr);
  1026 + GFilename edispname = m_caldb.filename("","","EDISP","","",expr);
  1027 + GFilename bgdname = m_caldb.filename("","","BGD","","",expr);
1028 1028
1029 // If filenames are empty then build filenames from CALDB root path and 1029 // If filenames are empty then build filenames from CALDB root path and
1030 // response name 1030 // response name
1031 - if (aeffname.length() < 1) { 1031 + if (aeffname.is_empty()) {
1032 aeffname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); 1032 aeffname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname));
1033 } 1033 }
1034 - if (psfname.length() < 1) { 1034 + if (psfname.is_empty()) {
1035 psfname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); 1035 psfname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname));
1036 } 1036 }
1037 - if (edispname.length() < 1) { 1037 + if (edispname.is_empty()) {
1038 edispname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); 1038 edispname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname));
1039 } 1039 }
1040 - if (bgdname.length() < 1) { 1040 + if (bgdname.is_empty()) {
1041 bgdname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); 1041 bgdname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname));
1042 } 1042 }
1043 1043
@@ -2185,7 +2185,7 @@ void GCTAResponseIrf::free_members(void) @@ -2185,7 +2185,7 @@ void GCTAResponseIrf::free_members(void)
2185 * file with the added suffix .dat exists. Returns the file name with the 2185 * file with the added suffix .dat exists. Returns the file name with the
2186 * appropriate extension. 2186 * appropriate extension.
2187 ***************************************************************************/ 2187 ***************************************************************************/
2188 -std::string GCTAResponseIrf::irf_filename(const std::string& filename) const 2188 +GFilename GCTAResponseIrf::irf_filename(const std::string& filename) const
2189 { 2189 {
2190 // Set input filename as result filename 2190 // Set input filename as result filename
2191 GFilename result = filename; 2191 GFilename result = filename;
@@ -2199,7 +2199,7 @@ std::string GCTAResponseIrf::irf_filename(const std::string&amp; filename) const @@ -2199,7 +2199,7 @@ std::string GCTAResponseIrf::irf_filename(const std::string&amp; filename) const
2199 } 2199 }
2200 2200
2201 // Return result 2201 // Return result
2202 - return (result.url()); 2202 + return result;
2203 } 2203 }
2204 2204
2205 2205
inst/lat/src/GLATResponse.cpp
@@ -626,9 +626,9 @@ void GLATResponse::load(const std::string&amp; rspname) @@ -626,9 +626,9 @@ void GLATResponse::load(const std::string&amp; rspname)
626 626
627 // Get response using the GCaldb interface 627 // Get response using the GCaldb interface
628 std::string expr = "VERSION("+gammalib::toupper(m_rspname)+")"; 628 std::string expr = "VERSION("+gammalib::toupper(m_rspname)+")";
629 - std::string aeffname = caldb.filename(type_names[i],"","EFF_AREA","","",expr);  
630 - std::string psfname = caldb.filename(type_names[i],"","RPSF","","",expr);  
631 - std::string edispname = caldb.filename(type_names[i],"","EDISP","","",expr); 629 + GFilename aeffname = caldb.filename(type_names[i],"","EFF_AREA","","",expr);
  630 + GFilename psfname = caldb.filename(type_names[i],"","RPSF","","",expr);
  631 + GFilename edispname = caldb.filename(type_names[i],"","EDISP","","",expr);
632 632
633 // Load IRF components 633 // Load IRF components
634 GLATAeff* aeff = new GLATAeff(aeffname, type_names[i]); 634 GLATAeff* aeff = new GLATAeff(aeffname, type_names[i]);
pyext/GCaldb.i
1 /*************************************************************************** 1 /***************************************************************************
2 * GCaldb.i - Calibration database class * 2 * GCaldb.i - Calibration database class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2011-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2011-2016 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 *
@@ -57,7 +57,7 @@ public: @@ -57,7 +57,7 @@ public:
57 void open(const std::string& mission, 57 void open(const std::string& mission,
58 const std::string& instrument = ""); 58 const std::string& instrument = "");
59 void close(void); 59 void close(void);
60 - std::string filename(const std::string& detector, 60 + GFilename filename(const std::string& detector,
61 const std::string& filter, 61 const std::string& filter,
62 const std::string& codename, 62 const std::string& codename,
63 const std::string& date, 63 const std::string& date,
src/obs/GCaldb.cpp
@@ -504,15 +504,15 @@ void GCaldb::close(void) @@ -504,15 +504,15 @@ void GCaldb::close(void)
504 * @todo time should support "now" and probably be implemented using < condition. 504 * @todo time should support "now" and probably be implemented using < condition.
505 * @todo expr should support arbitrary Boolean expressions. 505 * @todo expr should support arbitrary Boolean expressions.
506 ***************************************************************************/ 506 ***************************************************************************/
507 -std::string GCaldb::filename(const std::string& detector,  
508 - const std::string& filter,  
509 - const std::string& codename,  
510 - const std::string& date,  
511 - const std::string& time,  
512 - const std::string& expr) 507 +GFilename GCaldb::filename(const std::string& detector,
  508 + const std::string& filter,
  509 + const std::string& codename,
  510 + const std::string& date,
  511 + const std::string& time,
  512 + const std::string& expr)
513 { 513 {
514 // Initialise empty filename 514 // Initialise empty filename
515 - std::string filename; 515 + GFilename filename;
516 516
517 // Continue only if CIF is opened 517 // Continue only if CIF is opened
518 if (m_cif != NULL) { 518 if (m_cif != NULL) {