Commit 05d113a16cb2108f4265ef83735c86e253d128c5
1 parent
452c7462
Use GFilename for filename arguments.
Showing
30 changed files
with
290 additions
and
193 deletions
NEWS
| ... | ... | @@ -24,13 +24,15 @@ The following methods have been renamed: |
| 24 | 24 | - GCTAResponseTable::tables(), was formerly GCTAResponseTable::size() |
| 25 | 25 | - GCTAResponseTable::axis_bins(), was formerly GCTAResponseTable::axis() |
| 26 | 26 | |
| 27 | -The following methods now take a GFilename argument instead of std::string: | |
| 28 | -- GEbounds(const GFilename&) | |
| 29 | -- GEbounds::load() | |
| 30 | -- GEbounds::save() | |
| 31 | -- GGti(const GFilename&) | |
| 32 | -- GGti::load() | |
| 33 | -- GGti::save() | |
| 27 | +The following classes now use for filenames a GFilename argument instead | |
| 28 | +of std::string: | |
| 29 | +- GEbounds | |
| 30 | +- GGti | |
| 31 | +- GEnergies | |
| 32 | +- GEvents | |
| 33 | +- GEventCube, GCOMEventCube, GCTAEventCube, GLATEventCube, GMWLSpectrum | |
| 34 | +- GEventList, GCTAEventList, GLATEventList | |
| 35 | + | |
| 34 | 36 | |
| 35 | 37 | The return value has been changed for the following methods: |
| 36 | 38 | - GFits::filename() returns now GFilename instead of std::string | ... | ... |
include/GEnergies.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEnergies.hpp - Energy container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -35,6 +35,9 @@ |
| 35 | 35 | #include "GFits.hpp" |
| 36 | 36 | #include "GFitsTable.hpp" |
| 37 | 37 | |
| 38 | +/* __ Forward declarations _______________________________________________ */ | |
| 39 | +class GFilename; | |
| 40 | + | |
| 38 | 41 | |
| 39 | 42 | /***********************************************************************//** |
| 40 | 43 | * @class GEnergies |
| ... | ... | @@ -43,13 +46,17 @@ |
| 43 | 46 | * |
| 44 | 47 | * This class is a container for energies. Energies are implemented by the |
| 45 | 48 | * GEnergy class which stores energies in a unit independent way. |
| 49 | + * | |
| 50 | + * An energy container can be constructed from a FITS file or by defining | |
| 51 | + * a number of energies within a given interval, spaced either linearly or | |
| 52 | + * logarithmically. | |
| 46 | 53 | ***************************************************************************/ |
| 47 | 54 | class GEnergies : public GContainer { |
| 48 | 55 | |
| 49 | 56 | public: |
| 50 | 57 | // Constructors and destructors |
| 51 | 58 | GEnergies(void); |
| 52 | - explicit GEnergies(const std::string& filename); | |
| 59 | + explicit GEnergies(const GFilename& filename); | |
| 53 | 60 | GEnergies(const GEnergies& energies); |
| 54 | 61 | GEnergies(const int& num, const GEnergy& emin, const GEnergy& emax, |
| 55 | 62 | const bool& log = true); |
| ... | ... | @@ -77,9 +84,9 @@ public: |
| 77 | 84 | const GEnergy& emax); |
| 78 | 85 | void set_log(const int& num, const GEnergy& emin, |
| 79 | 86 | const GEnergy& emax); |
| 80 | - void load(const std::string& filename); | |
| 81 | - void save(const std::string& filename, | |
| 82 | - const bool& clobber = false) const; | |
| 87 | + void load(const GFilename& filename); | |
| 88 | + void save(const GFilename& filename, | |
| 89 | + const bool& clobber = false) const; | |
| 83 | 90 | void read(const GFitsTable& table); |
| 84 | 91 | void write(GFits& file, |
| 85 | 92 | const std::string& extname = "ENERGIES") const; | ... | ... |
include/GEventCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEventCube.hpp - Abstract event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2014 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -32,6 +32,9 @@ |
| 32 | 32 | #include "GEvents.hpp" |
| 33 | 33 | #include "GEventBin.hpp" |
| 34 | 34 | |
| 35 | +/* __ Forward declarations _______________________________________________ */ | |
| 36 | +class GFilename; | |
| 37 | + | |
| 35 | 38 | |
| 36 | 39 | /***********************************************************************//** |
| 37 | 40 | * @class GEventCube |
| ... | ... | @@ -60,9 +63,9 @@ public: |
| 60 | 63 | virtual int size(void) const = 0; |
| 61 | 64 | virtual int dim(void) const = 0; |
| 62 | 65 | virtual int naxis(const int& axis) const = 0; |
| 63 | - virtual void load(const std::string& filename) = 0; | |
| 64 | - virtual void save(const std::string& filename, | |
| 65 | - const bool& clobber = false) const = 0; | |
| 66 | + virtual void load(const GFilename& filename) = 0; | |
| 67 | + virtual void save(const GFilename& filename, | |
| 68 | + const bool& clobber = false) const = 0; | |
| 66 | 69 | virtual void read(const GFits& file) = 0; |
| 67 | 70 | virtual void write(GFits& file) const = 0; |
| 68 | 71 | virtual int number(void) const = 0; | ... | ... |
include/GEventList.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEventList.hpp - Abstract event atom container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2014 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -31,6 +31,9 @@ |
| 31 | 31 | #include "GEvents.hpp" |
| 32 | 32 | #include "GEventAtom.hpp" |
| 33 | 33 | |
| 34 | +/* __ Forward declarations _______________________________________________ */ | |
| 35 | +class GFilename; | |
| 36 | + | |
| 34 | 37 | |
| 35 | 38 | /***********************************************************************//** |
| 36 | 39 | * @class GEventList |
| ... | ... | @@ -61,9 +64,9 @@ public: |
| 61 | 64 | virtual GEventList* clone(void) const = 0; |
| 62 | 65 | virtual std::string classname(void) const = 0; |
| 63 | 66 | virtual int size(void) const = 0; |
| 64 | - virtual void load(const std::string& filename) = 0; | |
| 65 | - virtual void save(const std::string& filename, | |
| 66 | - const bool& clobber = false) const = 0; | |
| 67 | + virtual void load(const GFilename& filename) = 0; | |
| 68 | + virtual void save(const GFilename& filename, | |
| 69 | + const bool& clobber = false) const = 0; | |
| 67 | 70 | virtual void read(const GFits& file) = 0; |
| 68 | 71 | virtual void write(GFits& file) const = 0; |
| 69 | 72 | virtual int number(void) const = 0; | ... | ... |
include/GEvents.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEvents.hpp - Abstract event container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2014 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -36,6 +36,9 @@ |
| 36 | 36 | #include "GGti.hpp" |
| 37 | 37 | #include "GRoi.hpp" |
| 38 | 38 | |
| 39 | +/* __ Forward declarations _______________________________________________ */ | |
| 40 | +class GFilename; | |
| 41 | + | |
| 39 | 42 | |
| 40 | 43 | /***********************************************************************//** |
| 41 | 44 | * @class GEvents |
| ... | ... | @@ -78,9 +81,9 @@ public: |
| 78 | 81 | virtual GEvents* clone(void) const = 0; |
| 79 | 82 | virtual std::string classname(void) const = 0; |
| 80 | 83 | virtual int size(void) const = 0; |
| 81 | - virtual void load(const std::string& filename) = 0; | |
| 82 | - virtual void save(const std::string& filename, | |
| 83 | - const bool& clobber = false) const = 0; | |
| 84 | + virtual void load(const GFilename& filename) = 0; | |
| 85 | + virtual void save(const GFilename& filename, | |
| 86 | + const bool& clobber = false) const = 0; | |
| 84 | 87 | virtual void read(const GFits& file) = 0; |
| 85 | 88 | virtual void write(GFits& file) const = 0; |
| 86 | 89 | virtual int number(void) const = 0; |
| ... | ... | @@ -107,7 +110,6 @@ protected: |
| 107 | 110 | // Protected members |
| 108 | 111 | GEbounds m_ebounds; //!< Energy boundaries covered by events |
| 109 | 112 | GGti m_gti; //!< Good time intervals covered by events |
| 110 | - | |
| 111 | 113 | }; |
| 112 | 114 | |
| 113 | 115 | ... | ... |
inst/com/include/GCOMEventCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCOMEventCube.hpp - COMPTEL event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -35,11 +35,14 @@ |
| 35 | 35 | #include "GCOMInstDir.hpp" |
| 36 | 36 | #include "GSkyDir.hpp" |
| 37 | 37 | #include "GSkyMap.hpp" |
| 38 | -#include "GEbounds.hpp" | |
| 39 | -#include "GGti.hpp" | |
| 40 | 38 | #include "GEnergy.hpp" |
| 41 | 39 | #include "GTime.hpp" |
| 42 | 40 | |
| 41 | +/* __ Forward declarations _______________________________________________ */ | |
| 42 | +class GFilename; | |
| 43 | +class GEbounds; | |
| 44 | +class GGti; | |
| 45 | + | |
| 43 | 46 | |
| 44 | 47 | /***********************************************************************//** |
| 45 | 48 | * @class GCOMEventCube |
| ... | ... | @@ -53,7 +56,7 @@ class GCOMEventCube : public GEventCube { |
| 53 | 56 | public: |
| 54 | 57 | // Constructors and destructors |
| 55 | 58 | GCOMEventCube(void); |
| 56 | - explicit GCOMEventCube(const std::string& filename); | |
| 59 | + explicit GCOMEventCube(const GFilename& filename); | |
| 57 | 60 | explicit GCOMEventCube(const GSkyMap& map, const GEbounds& ebds, |
| 58 | 61 | const GGti& gti, const double& phimin, |
| 59 | 62 | const double& dphi); |
| ... | ... | @@ -72,9 +75,9 @@ public: |
| 72 | 75 | virtual int size(void) const; |
| 73 | 76 | virtual int dim(void) const; |
| 74 | 77 | virtual int naxis(const int& axis) const; |
| 75 | - virtual void load(const std::string& filename); | |
| 76 | - virtual void save(const std::string& filename, | |
| 77 | - const bool& clobber = false) const; | |
| 78 | + virtual void load(const GFilename& filename); | |
| 79 | + virtual void save(const GFilename& filename, | |
| 80 | + const bool& clobber = false) const; | |
| 78 | 81 | virtual void read(const GFits& file); |
| 79 | 82 | virtual void write(GFits& file) const; |
| 80 | 83 | virtual int number(void) const; |
| ... | ... | @@ -83,11 +86,11 @@ public: |
| 83 | 86 | // Other methods |
| 84 | 87 | void map(const GSkyMap& map, const double& phimin, |
| 85 | 88 | const double& dphi); |
| 86 | - const GSkyMap& map(void) const { return m_map; } | |
| 87 | - int nchi(void) const { return m_map.nx(); } | |
| 88 | - int npsi(void) const { return m_map.ny(); } | |
| 89 | - int nphi(void) const { return m_map.nmaps(); } | |
| 90 | - int npix(void) const { return m_map.npix(); } | |
| 89 | + const GSkyMap& map(void) const; | |
| 90 | + int nchi(void) const; | |
| 91 | + int npsi(void) const; | |
| 92 | + int nphi(void) const; | |
| 93 | + int npix(void) const; | |
| 91 | 94 | |
| 92 | 95 | protected: |
| 93 | 96 | // Protected methods |
| ... | ... | @@ -127,4 +130,64 @@ std::string GCOMEventCube::classname(void) const |
| 127 | 130 | return ("GCOMEventCube"); |
| 128 | 131 | } |
| 129 | 132 | |
| 133 | + | |
| 134 | +/***********************************************************************//** | |
| 135 | + * @brief Return event cube sky map | |
| 136 | + * | |
| 137 | + * @return Sky map containing event cube. | |
| 138 | + ***************************************************************************/ | |
| 139 | +inline | |
| 140 | +const GSkyMap& GCOMEventCube::map(void) const | |
| 141 | +{ | |
| 142 | + return (m_map); | |
| 143 | +} | |
| 144 | + | |
| 145 | + | |
| 146 | +/***********************************************************************//** | |
| 147 | + * @brief Return number of Chi bins | |
| 148 | + * | |
| 149 | + * @return Number of Chi bins. | |
| 150 | + ***************************************************************************/ | |
| 151 | +inline | |
| 152 | +int GCOMEventCube::nchi(void) const | |
| 153 | +{ | |
| 154 | + return (m_map.nx()); | |
| 155 | +} | |
| 156 | + | |
| 157 | + | |
| 158 | +/***********************************************************************//** | |
| 159 | + * @brief Return number of Psi bins | |
| 160 | + * | |
| 161 | + * @return Number of Psi bins. | |
| 162 | + ***************************************************************************/ | |
| 163 | +inline | |
| 164 | +int GCOMEventCube::npsi(void) const | |
| 165 | +{ | |
| 166 | + return (m_map.ny()); | |
| 167 | +} | |
| 168 | + | |
| 169 | + | |
| 170 | +/***********************************************************************//** | |
| 171 | + * @brief Return number of Phibar bins | |
| 172 | + * | |
| 173 | + * @return Number of Phibar bins. | |
| 174 | + ***************************************************************************/ | |
| 175 | +inline | |
| 176 | +int GCOMEventCube::nphi(void) const | |
| 177 | +{ | |
| 178 | + return (m_map.nmaps()); | |
| 179 | +} | |
| 180 | + | |
| 181 | + | |
| 182 | +/***********************************************************************//** | |
| 183 | + * @brief Return number of pixels | |
| 184 | + * | |
| 185 | + * @return Number of pixels. | |
| 186 | + ***************************************************************************/ | |
| 187 | +inline | |
| 188 | +int GCOMEventCube::npix(void) const | |
| 189 | +{ | |
| 190 | + return (m_map.npix()); | |
| 191 | +} | |
| 192 | + | |
| 130 | 193 | #endif /* GCOMEVENTCUBE_HPP */ | ... | ... |
inst/com/pyext/GCOMEventCube.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCOMEventCube.i - COMPTEL event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | /** |
| 22 | 22 | * @file GCOMEventCube.hpp |
| 23 | 23 | * @brief COMPTEL event bin container class interface definition |
| 24 | - * @author J. Knoedlseder | |
| 24 | + * @author Juergen Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | %{ |
| 27 | 27 | /* Put headers and other declarations here that are needed for compilation */ |
| ... | ... | @@ -38,7 +38,7 @@ class GCOMEventCube : public GEventCube { |
| 38 | 38 | public: |
| 39 | 39 | // Constructors and destructors |
| 40 | 40 | GCOMEventCube(void); |
| 41 | - explicit GCOMEventCube(const std::string& filename); | |
| 41 | + explicit GCOMEventCube(const GFilename& filename); | |
| 42 | 42 | explicit GCOMEventCube(const GSkyMap& map, const GEbounds& ebds, |
| 43 | 43 | const GGti& gti, const double& phimin, |
| 44 | 44 | const double& dphi); |
| ... | ... | @@ -52,9 +52,9 @@ public: |
| 52 | 52 | virtual int size(void) const; |
| 53 | 53 | virtual int dim(void) const; |
| 54 | 54 | virtual int naxis(const int& axis) const; |
| 55 | - virtual void load(const std::string& filename); | |
| 56 | - virtual void save(const std::string& filename, | |
| 57 | - const bool& clobber = false) const; | |
| 55 | + virtual void load(const GFilename& filename); | |
| 56 | + virtual void save(const GFilename& filename, | |
| 57 | + const bool& clobber = false) const; | |
| 58 | 58 | virtual void read(const GFits& file); |
| 59 | 59 | virtual void write(GFits& file) const; |
| 60 | 60 | virtual int number(void) const; | ... | ... |
inst/com/src/GCOMEventCube.cpp
| ... | ... | @@ -31,6 +31,7 @@ |
| 31 | 31 | #include "GException.hpp" |
| 32 | 32 | #include "GTools.hpp" |
| 33 | 33 | #include "GFits.hpp" |
| 34 | +#include "GFilename.hpp" | |
| 34 | 35 | #include "GCOMSupport.hpp" |
| 35 | 36 | #include "GCOMEventCube.hpp" |
| 36 | 37 | |
| ... | ... | @@ -77,7 +78,7 @@ GCOMEventCube::GCOMEventCube(void) : GEventCube() |
| 77 | 78 | * |
| 78 | 79 | * Construct an event cube by loading information from a FITS file. |
| 79 | 80 | ***************************************************************************/ |
| 80 | -GCOMEventCube::GCOMEventCube(const std::string& filename) : GEventCube() | |
| 81 | +GCOMEventCube::GCOMEventCube(const GFilename& filename) : GEventCube() | |
| 81 | 82 | { |
| 82 | 83 | // Initialise members |
| 83 | 84 | init_members(); |
| ... | ... | @@ -362,13 +363,13 @@ int GCOMEventCube::naxis(const int& axis) const |
| 362 | 363 | * The method clears the object before loading, thus any events residing in |
| 363 | 364 | * the object before loading will be lost. |
| 364 | 365 | ***************************************************************************/ |
| 365 | -void GCOMEventCube::load(const std::string& filename) | |
| 366 | +void GCOMEventCube::load(const GFilename& filename) | |
| 366 | 367 | { |
| 367 | 368 | // Clear object |
| 368 | 369 | clear(); |
| 369 | 370 | |
| 370 | 371 | // Open DRE FITS file |
| 371 | - GFits file(filename); | |
| 372 | + GFits file(filename.filename()); | |
| 372 | 373 | |
| 373 | 374 | // Load DRE cube |
| 374 | 375 | read(file); |
| ... | ... | @@ -389,7 +390,7 @@ void GCOMEventCube::load(const std::string& filename) |
| 389 | 390 | * |
| 390 | 391 | * Save the COMPTEL event cube into FITS file. |
| 391 | 392 | ***************************************************************************/ |
| 392 | -void GCOMEventCube::save(const std::string& filename, const bool& clobber) const | |
| 393 | +void GCOMEventCube::save(const GFilename& filename, const bool& clobber) const | |
| 393 | 394 | { |
| 394 | 395 | // Create empty FITS file |
| 395 | 396 | GFits fits; |
| ... | ... | @@ -398,7 +399,7 @@ void GCOMEventCube::save(const std::string& filename, const bool& clobber) const |
| 398 | 399 | write(fits); |
| 399 | 400 | |
| 400 | 401 | // Save FITS file |
| 401 | - fits.saveto(filename, clobber); | |
| 402 | + fits.saveto(filename.filename(), clobber); | |
| 402 | 403 | |
| 403 | 404 | // Return |
| 404 | 405 | return; | ... | ... |
inst/cta/include/GCTAEventCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAEventCube.hpp - CTA event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -41,6 +41,9 @@ |
| 41 | 41 | #include "GFitsTable.hpp" |
| 42 | 42 | #include "GFitsImage.hpp" |
| 43 | 43 | |
| 44 | +/* __ Forward declarations _______________________________________________ */ | |
| 45 | +class GFilename; | |
| 46 | + | |
| 44 | 47 | |
| 45 | 48 | /***********************************************************************//** |
| 46 | 49 | * @class GCTAEventCube |
| ... | ... | @@ -54,7 +57,7 @@ class GCTAEventCube : public GEventCube { |
| 54 | 57 | public: |
| 55 | 58 | // Constructors and destructors |
| 56 | 59 | GCTAEventCube(void); |
| 57 | - explicit GCTAEventCube(const std::string& filename); | |
| 60 | + explicit GCTAEventCube(const GFilename& filename); | |
| 58 | 61 | GCTAEventCube(const GSkyMap& map, const GEbounds& ebds, const GGti& gti); |
| 59 | 62 | GCTAEventCube(const GCTAEventCube& cube); |
| 60 | 63 | virtual ~GCTAEventCube(void); |
| ... | ... | @@ -71,9 +74,9 @@ public: |
| 71 | 74 | virtual int size(void) const; |
| 72 | 75 | virtual int dim(void) const; |
| 73 | 76 | virtual int naxis(const int& axis) const; |
| 74 | - virtual void load(const std::string& filename); | |
| 75 | - virtual void save(const std::string& filename, | |
| 76 | - const bool& clobber = false) const; | |
| 77 | + virtual void load(const GFilename& filename); | |
| 78 | + virtual void save(const GFilename& filename, | |
| 79 | + const bool& clobber = false) const; | |
| 77 | 80 | virtual void read(const GFits& file); |
| 78 | 81 | virtual void write(GFits& file) const; |
| 79 | 82 | virtual int number(void) const; | ... | ... |
inst/cta/include/GCTAEventList.hpp
| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | #include "GCTARoi.hpp" |
| 37 | 37 | |
| 38 | 38 | /* __ Forward declarations _______________________________________________ */ |
| 39 | +class GFilename; | |
| 39 | 40 | class GFitsHDU; |
| 40 | 41 | class GFitsTable; |
| 41 | 42 | class GFitsBinTable; |
| ... | ... | @@ -53,7 +54,7 @@ class GCTAEventList : public GEventList { |
| 53 | 54 | public: |
| 54 | 55 | // Constructors and destructors |
| 55 | 56 | GCTAEventList(void); |
| 56 | - explicit GCTAEventList(const std::string& filename); | |
| 57 | + explicit GCTAEventList(const GFilename& filename); | |
| 57 | 58 | GCTAEventList(const GCTAEventList& list); |
| 58 | 59 | virtual ~GCTAEventList(void); |
| 59 | 60 | |
| ... | ... | @@ -67,9 +68,9 @@ public: |
| 67 | 68 | virtual GCTAEventList* clone(void) const; |
| 68 | 69 | virtual std::string classname(void) const; |
| 69 | 70 | virtual int size(void) const; |
| 70 | - virtual void load(const std::string& filename); | |
| 71 | - virtual void save(const std::string& filename, | |
| 72 | - const bool& clobber = false) const; | |
| 71 | + virtual void load(const GFilename& filename); | |
| 72 | + virtual void save(const GFilename& filename, | |
| 73 | + const bool& clobber = false) const; | |
| 73 | 74 | virtual void read(const GFits& fits); |
| 74 | 75 | virtual void write(GFits& fits) const; |
| 75 | 76 | virtual int number(void) const; | ... | ... |
inst/cta/pyext/GCTAEventCube.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAEventCube.i - CTA event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -38,7 +38,7 @@ class GCTAEventCube : public GEventCube { |
| 38 | 38 | public: |
| 39 | 39 | // Constructors and destructors |
| 40 | 40 | GCTAEventCube(void); |
| 41 | - explicit GCTAEventCube(const std::string& filename); | |
| 41 | + explicit GCTAEventCube(const GFilename& filename); | |
| 42 | 42 | GCTAEventCube(const GSkyMap& map, const GEbounds& ebds, const GGti& gti); |
| 43 | 43 | GCTAEventCube(const GCTAEventCube& cube); |
| 44 | 44 | virtual ~GCTAEventCube(void); |
| ... | ... | @@ -50,9 +50,9 @@ public: |
| 50 | 50 | virtual int size(void) const; |
| 51 | 51 | virtual int dim(void) const; |
| 52 | 52 | virtual int naxis(const int& axis) const; |
| 53 | - virtual void load(const std::string& filename); | |
| 54 | - virtual void save(const std::string& filename, | |
| 55 | - const bool& clobber = false) const; | |
| 53 | + virtual void load(const GFilename& filename); | |
| 54 | + virtual void save(const GFilename& filename, | |
| 55 | + const bool& clobber = false) const; | |
| 56 | 56 | virtual void read(const GFits& file); |
| 57 | 57 | virtual void write(GFits& file) const; |
| 58 | 58 | virtual int number(void) const; | ... | ... |
inst/cta/pyext/GCTAEventList.i
| ... | ... | @@ -39,7 +39,7 @@ class GCTAEventList : public GEventList { |
| 39 | 39 | public: |
| 40 | 40 | // Constructors and destructors |
| 41 | 41 | GCTAEventList(void); |
| 42 | - explicit GCTAEventList(const std::string& filename); | |
| 42 | + explicit GCTAEventList(const GFilename& filename); | |
| 43 | 43 | GCTAEventList(const GCTAEventList& list); |
| 44 | 44 | virtual ~GCTAEventList(void); |
| 45 | 45 | |
| ... | ... | @@ -48,9 +48,9 @@ public: |
| 48 | 48 | virtual GCTAEventList* clone(void) const; |
| 49 | 49 | virtual std::string classname(void) const; |
| 50 | 50 | virtual int size(void) const; |
| 51 | - virtual void load(const std::string& filename); | |
| 52 | - virtual void save(const std::string& filename, | |
| 53 | - const bool& clobber = false) const; | |
| 51 | + virtual void load(const GFilename& filename); | |
| 52 | + virtual void save(const GFilename& filename, | |
| 53 | + const bool& clobber = false) const; | |
| 54 | 54 | virtual void read(const GFits& fits); |
| 55 | 55 | virtual void write(GFits& fits) const; |
| 56 | 56 | virtual int number(void) const; | ... | ... |
inst/cta/src/GCTAEventCube.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAEventCube.cpp - CTA event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -75,7 +75,7 @@ GCTAEventCube::GCTAEventCube(void) : GEventCube() |
| 75 | 75 | * |
| 76 | 76 | * Construct instance of events cube a counts cube file. |
| 77 | 77 | ***************************************************************************/ |
| 78 | -GCTAEventCube::GCTAEventCube(const std::string& filename) : GEventCube() | |
| 78 | +GCTAEventCube::GCTAEventCube(const GFilename& filename) : GEventCube() | |
| 79 | 79 | { |
| 80 | 80 | // Initialise members |
| 81 | 81 | init_members(); |
| ... | ... | @@ -321,13 +321,13 @@ int GCTAEventCube::naxis(const int& axis) const |
| 321 | 321 | * The method clears the object before loading, thus any events residing in |
| 322 | 322 | * the object before loading will be lost. |
| 323 | 323 | ***************************************************************************/ |
| 324 | -void GCTAEventCube::load(const std::string& filename) | |
| 324 | +void GCTAEventCube::load(const GFilename& filename) | |
| 325 | 325 | { |
| 326 | 326 | // Clear object |
| 327 | 327 | clear(); |
| 328 | 328 | |
| 329 | 329 | // Open counts map FITS file |
| 330 | - GFits fits(filename); | |
| 330 | + GFits fits(filename.filename()); | |
| 331 | 331 | |
| 332 | 332 | // Load counts map |
| 333 | 333 | read(fits); |
| ... | ... | @@ -348,8 +348,8 @@ void GCTAEventCube::load(const std::string& filename) |
| 348 | 348 | * |
| 349 | 349 | * Save the CTA event cube into FITS file. |
| 350 | 350 | ***************************************************************************/ |
| 351 | -void GCTAEventCube::save(const std::string& filename, | |
| 352 | - const bool& clobber) const | |
| 351 | +void GCTAEventCube::save(const GFilename& filename, | |
| 352 | + const bool& clobber) const | |
| 353 | 353 | { |
| 354 | 354 | // Create empty FITS file |
| 355 | 355 | GFits fits; |
| ... | ... | @@ -358,7 +358,7 @@ void GCTAEventCube::save(const std::string& filename, |
| 358 | 358 | write(fits); |
| 359 | 359 | |
| 360 | 360 | // Save FITS file |
| 361 | - fits.saveto(filename, clobber); | |
| 361 | + fits.saveto(filename.filename(), clobber); | |
| 362 | 362 | |
| 363 | 363 | // Return |
| 364 | 364 | return; | ... | ... |
inst/cta/src/GCTAEventList.cpp
| ... | ... | @@ -83,7 +83,7 @@ GCTAEventList::GCTAEventList(void) : GEventList() |
| 83 | 83 | * |
| 84 | 84 | * Constructs event list by loading the events from a FITS file. |
| 85 | 85 | ***************************************************************************/ |
| 86 | -GCTAEventList::GCTAEventList(const std::string& filename) : GEventList() | |
| 86 | +GCTAEventList::GCTAEventList(const GFilename& filename) : GEventList() | |
| 87 | 87 | { |
| 88 | 88 | // Initialise members |
| 89 | 89 | init_members(); |
| ... | ... | @@ -276,10 +276,10 @@ GCTAEventList* GCTAEventList::clone(void) const |
| 276 | 276 | * |
| 277 | 277 | * Loads the event list from a FITS file. See the read() method for details. |
| 278 | 278 | ***************************************************************************/ |
| 279 | -void GCTAEventList::load(const std::string& filename) | |
| 279 | +void GCTAEventList::load(const GFilename& filename) | |
| 280 | 280 | { |
| 281 | 281 | // Open FITS file |
| 282 | - GFits fits(filename); | |
| 282 | + GFits fits(filename.filename()); | |
| 283 | 283 | |
| 284 | 284 | // Read event list |
| 285 | 285 | read(fits); |
| ... | ... | @@ -300,11 +300,11 @@ void GCTAEventList::load(const std::string& filename) |
| 300 | 300 | * |
| 301 | 301 | * Saves the event list into a FITS file. See the write() method for details. |
| 302 | 302 | ***************************************************************************/ |
| 303 | -void GCTAEventList::save(const std::string& filename, | |
| 304 | - const bool& clobber) const | |
| 303 | +void GCTAEventList::save(const GFilename& filename, | |
| 304 | + const bool& clobber) const | |
| 305 | 305 | { |
| 306 | 306 | // Open or create FITS file |
| 307 | - GFits fits(filename, true); | |
| 307 | + GFits fits(filename.filename(), true); | |
| 308 | 308 | |
| 309 | 309 | // Write event list |
| 310 | 310 | write(fits); | ... | ... |
inst/lat/include/GLATEventCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventCube.hpp - Fermi/LAT event cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -41,6 +41,9 @@ |
| 41 | 41 | #include "GSkyMap.hpp" |
| 42 | 42 | #include "GNodeArray.hpp" |
| 43 | 43 | |
| 44 | +/* __ Forward declarations _______________________________________________ */ | |
| 45 | +class GFilename; | |
| 46 | + | |
| 44 | 47 | |
| 45 | 48 | /***********************************************************************//** |
| 46 | 49 | * @class GLATEventCube |
| ... | ... | @@ -52,7 +55,7 @@ class GLATEventCube : public GEventCube { |
| 52 | 55 | public: |
| 53 | 56 | // Constructors and destructors |
| 54 | 57 | GLATEventCube(void); |
| 55 | - explicit GLATEventCube(const std::string& filename); | |
| 58 | + explicit GLATEventCube(const GFilename& filename); | |
| 56 | 59 | GLATEventCube(const GLATEventCube& cube); |
| 57 | 60 | virtual ~GLATEventCube(void); |
| 58 | 61 | |
| ... | ... | @@ -68,9 +71,9 @@ public: |
| 68 | 71 | virtual int size(void) const; |
| 69 | 72 | virtual int dim(void) const; |
| 70 | 73 | virtual int naxis(const int& axis) const; |
| 71 | - virtual void load(const std::string& filename); | |
| 72 | - virtual void save(const std::string& filename, | |
| 73 | - const bool& clobber = false) const; | |
| 74 | + virtual void load(const GFilename& filename); | |
| 75 | + virtual void save(const GFilename& filename, | |
| 76 | + const bool& clobber = false) const; | |
| 74 | 77 | virtual void read(const GFits& file); |
| 75 | 78 | virtual void write(GFits& file) const; |
| 76 | 79 | virtual int number(void) const; | ... | ... |
inst/lat/include/GLATEventList.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventList.hpp - Fermi/LAT event list class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -37,6 +37,9 @@ |
| 37 | 37 | #include "GFitsHDU.hpp" |
| 38 | 38 | #include "GFitsTable.hpp" |
| 39 | 39 | |
| 40 | +/* __ Forward declarations _______________________________________________ */ | |
| 41 | +class GFilename; | |
| 42 | + | |
| 40 | 43 | |
| 41 | 44 | /***********************************************************************//** |
| 42 | 45 | * @class GLATEventList |
| ... | ... | @@ -48,7 +51,7 @@ class GLATEventList : public GEventList { |
| 48 | 51 | public: |
| 49 | 52 | // Constructors and destructors |
| 50 | 53 | GLATEventList(void); |
| 51 | - explicit GLATEventList(const std::string& filename); | |
| 54 | + explicit GLATEventList(const GFilename& filename); | |
| 52 | 55 | GLATEventList(const GLATEventList& list); |
| 53 | 56 | virtual ~GLATEventList(void); |
| 54 | 57 | |
| ... | ... | @@ -62,9 +65,9 @@ public: |
| 62 | 65 | virtual GLATEventList* clone(void) const; |
| 63 | 66 | virtual std::string classname(void) const; |
| 64 | 67 | virtual int size(void) const; |
| 65 | - virtual void load(const std::string& filename); | |
| 66 | - virtual void save(const std::string& filename, | |
| 67 | - const bool& clobber = false) const; | |
| 68 | + virtual void load(const GFilename& filename); | |
| 69 | + virtual void save(const GFilename& filename, | |
| 70 | + const bool& clobber = false) const; | |
| 68 | 71 | virtual void read(const GFits& file); |
| 69 | 72 | virtual void write(GFits& file) const; |
| 70 | 73 | virtual int number(void) const; | ... | ... |
inst/lat/pyext/GLATEventCube.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventCube.i - Fermi/LAT event cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -39,7 +39,7 @@ class GLATEventCube : public GEventCube { |
| 39 | 39 | public: |
| 40 | 40 | // Constructors and destructors |
| 41 | 41 | GLATEventCube(void); |
| 42 | - explicit GLATEventCube(const std::string& filename); | |
| 42 | + explicit GLATEventCube(const GFilename& filename); | |
| 43 | 43 | GLATEventCube(const GLATEventCube& cube); |
| 44 | 44 | virtual ~GLATEventCube(void); |
| 45 | 45 | |
| ... | ... | @@ -50,9 +50,9 @@ public: |
| 50 | 50 | virtual int size(void) const; |
| 51 | 51 | virtual int dim(void) const; |
| 52 | 52 | virtual int naxis(const int& axis) const; |
| 53 | - virtual void load(const std::string& filename); | |
| 54 | - virtual void save(const std::string& filename, | |
| 55 | - const bool& clobber = false) const; | |
| 53 | + virtual void load(const GFilename& filename); | |
| 54 | + virtual void save(const GFilename& filename, | |
| 55 | + const bool& clobber = false) const; | |
| 56 | 56 | virtual void read(const GFits& file); |
| 57 | 57 | virtual void write(GFits& file) const; |
| 58 | 58 | virtual int number(void) const; | ... | ... |
inst/lat/pyext/GLATEventList.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventList.i - Fermi/LAT event list class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -39,7 +39,7 @@ class GLATEventList : public GEventList { |
| 39 | 39 | public: |
| 40 | 40 | // Constructors and destructors |
| 41 | 41 | GLATEventList(void); |
| 42 | - explicit GLATEventList(const std::string& filename); | |
| 42 | + explicit GLATEventList(const GFilename& filename); | |
| 43 | 43 | GLATEventList(const GLATEventList& list); |
| 44 | 44 | virtual ~GLATEventList(void); |
| 45 | 45 | |
| ... | ... | @@ -48,9 +48,9 @@ public: |
| 48 | 48 | virtual GLATEventList* clone(void) const; |
| 49 | 49 | virtual std::string classname(void) const; |
| 50 | 50 | virtual int size(void) const; |
| 51 | - virtual void load(const std::string& filename); | |
| 52 | - virtual void save(const std::string& filename, | |
| 53 | - const bool& clobber = false) const; | |
| 51 | + virtual void load(const GFilename& filename); | |
| 52 | + virtual void save(const GFilename& filename, | |
| 53 | + const bool& clobber = false) const; | |
| 54 | 54 | virtual void read(const GFits& file); |
| 55 | 55 | virtual void write(GFits& file) const; |
| 56 | 56 | virtual int number(void) const; | ... | ... |
inst/lat/src/GLATEventCube.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventCube.cpp - Fermi/LAT event cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -28,11 +28,12 @@ |
| 28 | 28 | #ifdef HAVE_CONFIG_H |
| 29 | 29 | #include <config.h> |
| 30 | 30 | #endif |
| 31 | -#include "GLATEventCube.hpp" | |
| 32 | -#include "GLATException.hpp" | |
| 33 | 31 | #include "GTools.hpp" |
| 32 | +#include "GFilename.hpp" | |
| 34 | 33 | #include "GFitsImage.hpp" |
| 35 | 34 | #include "GFitsTable.hpp" |
| 35 | +#include "GLATEventCube.hpp" | |
| 36 | +#include "GLATException.hpp" | |
| 36 | 37 | |
| 37 | 38 | /* __ Method name definitions ____________________________________________ */ |
| 38 | 39 | #define G_NAXIS "GLATEventCube::naxis(int)" |
| ... | ... | @@ -77,7 +78,7 @@ GLATEventCube::GLATEventCube(void) : GEventCube() |
| 77 | 78 | * |
| 78 | 79 | * Construct event cube object by loading the events from a FITS file. |
| 79 | 80 | ***************************************************************************/ |
| 80 | -GLATEventCube::GLATEventCube(const std::string& filename) : GEventCube() | |
| 81 | +GLATEventCube::GLATEventCube(const GFilename& filename) : GEventCube() | |
| 81 | 82 | { |
| 82 | 83 | // Initialise members |
| 83 | 84 | init_members(); |
| ... | ... | @@ -306,13 +307,13 @@ int GLATEventCube::naxis(const int& axis) const |
| 306 | 307 | * |
| 307 | 308 | * @param[in] filename FITS file name. |
| 308 | 309 | ***************************************************************************/ |
| 309 | -void GLATEventCube::load(const std::string& filename) | |
| 310 | +void GLATEventCube::load(const GFilename& filename) | |
| 310 | 311 | { |
| 311 | 312 | // Clear object |
| 312 | 313 | clear(); |
| 313 | 314 | |
| 314 | 315 | // Open FITS file |
| 315 | - GFits file(filename); | |
| 316 | + GFits file(filename.filename()); | |
| 316 | 317 | |
| 317 | 318 | // Read counts map |
| 318 | 319 | read(file); |
| ... | ... | @@ -329,12 +330,12 @@ void GLATEventCube::load(const std::string& filename) |
| 329 | 330 | * @brief Save LAT event cube into FITS file |
| 330 | 331 | * |
| 331 | 332 | * @param[in] filename FITS file name. |
| 332 | - * @param[in] clobber Overwrite existing FITS file? (default=false) | |
| 333 | + * @param[in] clobber Overwrite existing FITS file? (default: false) | |
| 333 | 334 | * |
| 334 | 335 | * Save the LAT event cube into FITS file. |
| 335 | 336 | ***************************************************************************/ |
| 336 | -void GLATEventCube::save(const std::string& filename, | |
| 337 | - const bool& clobber) const | |
| 337 | +void GLATEventCube::save(const GFilename& filename, | |
| 338 | + const bool& clobber) const | |
| 338 | 339 | { |
| 339 | 340 | // Create empty FITS file |
| 340 | 341 | GFits fits; |
| ... | ... | @@ -343,7 +344,7 @@ void GLATEventCube::save(const std::string& filename, |
| 343 | 344 | write(fits); |
| 344 | 345 | |
| 345 | 346 | // Save FITS file |
| 346 | - fits.saveto(filename, clobber); | |
| 347 | + fits.saveto(filename.filename(), clobber); | |
| 347 | 348 | |
| 348 | 349 | // Return |
| 349 | 350 | return; | ... | ... |
inst/lat/src/GLATEventList.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventList.cpp - Fermi/LAT event list class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -31,13 +31,14 @@ |
| 31 | 31 | #include <cstdio> // std::sprintf |
| 32 | 32 | #include "GException.hpp" |
| 33 | 33 | #include "GTools.hpp" |
| 34 | -#include "GLATEventList.hpp" | |
| 35 | -#include "GLATException.hpp" | |
| 34 | +#include "GFilename.hpp" | |
| 36 | 35 | #include "GFitsTable.hpp" |
| 37 | 36 | #include "GFitsTableFloatCol.hpp" |
| 38 | 37 | #include "GFitsTableDoubleCol.hpp" |
| 39 | 38 | #include "GFitsTableLongCol.hpp" |
| 40 | 39 | #include "GFitsTableShortCol.hpp" |
| 40 | +#include "GLATEventList.hpp" | |
| 41 | +#include "GLATException.hpp" | |
| 41 | 42 | |
| 42 | 43 | /* __ Method name definitions ____________________________________________ */ |
| 43 | 44 | #define G_OPERATOR "GLATEventList::operator[](int&)" |
| ... | ... | @@ -76,7 +77,7 @@ GLATEventList::GLATEventList(void) : GEventList() |
| 76 | 77 | * |
| 77 | 78 | * Construct event list object by loading the events from a FITS file. |
| 78 | 79 | ***************************************************************************/ |
| 79 | -GLATEventList::GLATEventList(const std::string& filename) : GEventList() | |
| 80 | +GLATEventList::GLATEventList(const GFilename& filename) : GEventList() | |
| 80 | 81 | { |
| 81 | 82 | // Initialise members |
| 82 | 83 | init_members(); |
| ... | ... | @@ -248,13 +249,13 @@ GLATEventList* GLATEventList::clone(void) const |
| 248 | 249 | * |
| 249 | 250 | * This method loads LAT events from a FT1 file. |
| 250 | 251 | ***************************************************************************/ |
| 251 | -void GLATEventList::load(const std::string& filename) | |
| 252 | +void GLATEventList::load(const GFilename& filename) | |
| 252 | 253 | { |
| 253 | 254 | // Clear object |
| 254 | 255 | clear(); |
| 255 | 256 | |
| 256 | 257 | // Open FITS file |
| 257 | - GFits file(filename); | |
| 258 | + GFits file(filename.filename()); | |
| 258 | 259 | |
| 259 | 260 | // Read event list |
| 260 | 261 | read(file); |
| ... | ... | @@ -277,8 +278,8 @@ void GLATEventList::load(const std::string& filename) |
| 277 | 278 | * |
| 278 | 279 | * @todo To be implemented. |
| 279 | 280 | ***************************************************************************/ |
| 280 | -void GLATEventList::save(const std::string& filename, | |
| 281 | - const bool& clobber) const | |
| 281 | +void GLATEventList::save(const GFilename& filename, | |
| 282 | + const bool& clobber) const | |
| 282 | 283 | { |
| 283 | 284 | // Return |
| 284 | 285 | return; | ... | ... |
inst/mwl/include/GMWLSpectrum.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GMWLSpectrum.hpp - Multi-wavelength spectrum class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -34,6 +34,9 @@ |
| 34 | 34 | #include "GFitsTable.hpp" |
| 35 | 35 | #include "GEnergy.hpp" |
| 36 | 36 | |
| 37 | +/* __ Forward declarations _______________________________________________ */ | |
| 38 | +class GFilename; | |
| 39 | + | |
| 37 | 40 | |
| 38 | 41 | /***********************************************************************//** |
| 39 | 42 | * @class GMWLSpectrum |
| ... | ... | @@ -49,7 +52,7 @@ class GMWLSpectrum : public GEventCube { |
| 49 | 52 | public: |
| 50 | 53 | // Constructors and destructors |
| 51 | 54 | GMWLSpectrum(void); |
| 52 | - explicit GMWLSpectrum(const std::string& filename); | |
| 55 | + explicit GMWLSpectrum(const GFilename& filename); | |
| 53 | 56 | GMWLSpectrum(const GMWLSpectrum& spec); |
| 54 | 57 | virtual ~GMWLSpectrum(void); |
| 55 | 58 | |
| ... | ... | @@ -65,9 +68,9 @@ public: |
| 65 | 68 | virtual int size(void) const; |
| 66 | 69 | virtual int dim(void) const; |
| 67 | 70 | virtual int naxis(const int& axis) const; |
| 68 | - virtual void load(const std::string& filename); | |
| 69 | - virtual void save(const std::string& filename, | |
| 70 | - const bool& clobber = false) const; | |
| 71 | + virtual void load(const GFilename& filename); | |
| 72 | + virtual void save(const GFilename& filename, | |
| 73 | + const bool& clobber = false) const; | |
| 71 | 74 | virtual void read(const GFits& file); |
| 72 | 75 | virtual void write(GFits& file) const; |
| 73 | 76 | virtual int number(void) const; | ... | ... |
inst/mwl/pyext/GMWLSpectrum.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GMWLSpectrum.i - Multi-wavelength spectrum class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -38,7 +38,7 @@ class GMWLSpectrum : public GEventCube { |
| 38 | 38 | public: |
| 39 | 39 | // Constructors and destructors |
| 40 | 40 | GMWLSpectrum(void); |
| 41 | - explicit GMWLSpectrum(const std::string& filename); | |
| 41 | + explicit GMWLSpectrum(const GFilename& filename); | |
| 42 | 42 | GMWLSpectrum(const GMWLSpectrum& spec); |
| 43 | 43 | virtual ~GMWLSpectrum(void); |
| 44 | 44 | |
| ... | ... | @@ -49,9 +49,9 @@ public: |
| 49 | 49 | virtual int size(void) const; |
| 50 | 50 | virtual int dim(void) const; |
| 51 | 51 | virtual int naxis(const int& axis) const; |
| 52 | - virtual void load(const std::string& filename); | |
| 53 | - virtual void save(const std::string& filename, | |
| 54 | - const bool& clobber = false) const; | |
| 52 | + virtual void load(const GFilename& filename); | |
| 53 | + virtual void save(const GFilename& filename, | |
| 54 | + const bool& clobber = false) const; | |
| 55 | 55 | virtual void read(const GFits& file); |
| 56 | 56 | virtual void write(GFits& file) const; |
| 57 | 57 | virtual int number(void) const; | ... | ... |
inst/mwl/src/GMWLSpectrum.cpp
| ... | ... | @@ -81,7 +81,7 @@ GMWLSpectrum::GMWLSpectrum(void) : GEventCube() |
| 81 | 81 | * |
| 82 | 82 | * Creates instance from file. |
| 83 | 83 | ***************************************************************************/ |
| 84 | -GMWLSpectrum::GMWLSpectrum(const std::string& filename) : GEventCube() | |
| 84 | +GMWLSpectrum::GMWLSpectrum(const GFilename& filename) : GEventCube() | |
| 85 | 85 | { |
| 86 | 86 | // Initialise members |
| 87 | 87 | init_members(); |
| ... | ... | @@ -258,23 +258,20 @@ GMWLSpectrum* GMWLSpectrum::clone(void) const |
| 258 | 258 | * |
| 259 | 259 | * @todo So far only FITS file support is implemented. |
| 260 | 260 | ***************************************************************************/ |
| 261 | -void GMWLSpectrum::load(const std::string& filename) | |
| 261 | +void GMWLSpectrum::load(const GFilename& filename) | |
| 262 | 262 | { |
| 263 | - // Create file name | |
| 264 | - GFilename fname(filename); | |
| 265 | - | |
| 266 | 263 | // Clear object |
| 267 | 264 | clear(); |
| 268 | 265 | |
| 269 | 266 | // Open FITS file |
| 270 | - GFits file(fname.filename()); | |
| 267 | + GFits file(filename.filename()); | |
| 271 | 268 | |
| 272 | 269 | // Read spectrum |
| 273 | - if (fname.has_extno()) { | |
| 274 | - read(file, fname.extno()); | |
| 270 | + if (filename.has_extno()) { | |
| 271 | + read(file, filename.extno()); | |
| 275 | 272 | } |
| 276 | - else if (fname.has_extname()) { | |
| 277 | - read(file, fname.extname()); | |
| 273 | + else if (filename.has_extname()) { | |
| 274 | + read(file, filename.extname()); | |
| 278 | 275 | } |
| 279 | 276 | else { |
| 280 | 277 | read(file); |
| ... | ... | @@ -296,8 +293,8 @@ void GMWLSpectrum::load(const std::string& filename) |
| 296 | 293 | * |
| 297 | 294 | * @todo To be implemented. |
| 298 | 295 | ***************************************************************************/ |
| 299 | -void GMWLSpectrum::save(const std::string& filename, | |
| 300 | - const bool& clobber) const | |
| 296 | +void GMWLSpectrum::save(const GFilename& filename, | |
| 297 | + const bool& clobber) const | |
| 301 | 298 | { |
| 302 | 299 | // Return |
| 303 | 300 | return; | ... | ... |
pyext/GEnergies.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEnergies.i - Energy container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -41,7 +41,7 @@ class GEnergies : public GContainer { |
| 41 | 41 | public: |
| 42 | 42 | // Constructors and destructors |
| 43 | 43 | GEnergies(void); |
| 44 | - explicit GEnergies(const std::string& filename); | |
| 44 | + explicit GEnergies(const GFilename& filename); | |
| 45 | 45 | GEnergies(const GEnergies& energies); |
| 46 | 46 | GEnergies(const int& num, const GEnergy& emin, const GEnergy& emax, |
| 47 | 47 | const bool& log = true); |
| ... | ... | @@ -63,9 +63,9 @@ public: |
| 63 | 63 | const GEnergy& emax); |
| 64 | 64 | void set_log(const int& num, const GEnergy& emin, |
| 65 | 65 | const GEnergy& emax); |
| 66 | - void load(const std::string& filename); | |
| 67 | - void save(const std::string& filename, | |
| 68 | - const bool& clobber = false) const; | |
| 66 | + void load(const GFilename& filename); | |
| 67 | + void save(const GFilename& filename, | |
| 68 | + const bool& clobber = false) const; | |
| 69 | 69 | void read(const GFitsTable& table); |
| 70 | 70 | void write(GFits& file, |
| 71 | 71 | const std::string& extname = "ENERGIES") const; | ... | ... |
pyext/GEventCube.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEventCube.i - Abstract event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2010-2016 by Jurgen Knodlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -48,9 +48,9 @@ public: |
| 48 | 48 | virtual int size(void) const = 0; |
| 49 | 49 | virtual int dim(void) const = 0; |
| 50 | 50 | virtual int naxis(const int& axis) const = 0; |
| 51 | - virtual void load(const std::string& filename) = 0; | |
| 52 | - virtual void save(const std::string& filename, | |
| 53 | - const bool& clobber = false) const = 0; | |
| 51 | + virtual void load(const GFilename& filename) = 0; | |
| 52 | + virtual void save(const GFilename& filename, | |
| 53 | + const bool& clobber = false) const = 0; | |
| 54 | 54 | virtual void read(const GFits& file) = 0; |
| 55 | 55 | virtual void write(GFits& file) const = 0; |
| 56 | 56 | virtual int number(void) const = 0; | ... | ... |
pyext/GEventList.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEventList.i - Abstract event atom container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -46,9 +46,9 @@ public: |
| 46 | 46 | virtual GEventList* clone(void) const = 0; |
| 47 | 47 | virtual std::string classname(void) const = 0; |
| 48 | 48 | virtual int size(void) const = 0; |
| 49 | - virtual void load(const std::string& filename) = 0; | |
| 50 | - virtual void save(const std::string& filename, | |
| 51 | - const bool& clobber = false) const = 0; | |
| 49 | + virtual void load(const GFilename& filename) = 0; | |
| 50 | + virtual void save(const GFilename& filename, | |
| 51 | + const bool& clobber = false) const = 0; | |
| 52 | 52 | virtual void read(const GFits& file) = 0; |
| 53 | 53 | virtual void write(GFits& file) const = 0; |
| 54 | 54 | virtual int number(void) const = 0; | ... | ... |
pyext/GEvents.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEvents.i - Abstract event container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -50,9 +50,9 @@ public: |
| 50 | 50 | virtual GEvents* clone(void) const = 0; |
| 51 | 51 | virtual std::string classname(void) const = 0; |
| 52 | 52 | virtual int size(void) const = 0; |
| 53 | - virtual void load(const std::string& filename) = 0; | |
| 54 | - virtual void save(const std::string& filename, | |
| 55 | - const bool& clobber = false) const = 0; | |
| 53 | + virtual void load(const GFilename& filename) = 0; | |
| 54 | + virtual void save(const GFilename& filename, | |
| 55 | + const bool& clobber = false) const = 0; | |
| 56 | 56 | virtual void read(const GFits& file) = 0; |
| 57 | 57 | virtual void write(GFits& file) const = 0; |
| 58 | 58 | virtual int number(void) const = 0; | ... | ... |
src/obs/GEnergies.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEnergies.cpp - Energy container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -60,6 +60,8 @@ |
| 60 | 60 | |
| 61 | 61 | /***********************************************************************//** |
| 62 | 62 | * @brief Void constructor |
| 63 | + * | |
| 64 | + * Constructs empty energy container. | |
| 63 | 65 | ***************************************************************************/ |
| 64 | 66 | GEnergies::GEnergies(void) |
| 65 | 67 | { |
| ... | ... | @@ -78,7 +80,7 @@ GEnergies::GEnergies(void) |
| 78 | 80 | * |
| 79 | 81 | * Constructs energy container from a FITS file. |
| 80 | 82 | ***************************************************************************/ |
| 81 | -GEnergies::GEnergies(const std::string& filename) | |
| 83 | +GEnergies::GEnergies(const GFilename& filename) | |
| 82 | 84 | { |
| 83 | 85 | // Initialise members |
| 84 | 86 | init_members(); |
| ... | ... | @@ -95,6 +97,8 @@ GEnergies::GEnergies(const std::string& filename) |
| 95 | 97 | * @brief Copy constructor |
| 96 | 98 | * |
| 97 | 99 | * @param energies Energy container. |
| 100 | + * | |
| 101 | + * Construct energy container by copying from another energy container. | |
| 98 | 102 | ***************************************************************************/ |
| 99 | 103 | GEnergies::GEnergies(const GEnergies& energies) |
| 100 | 104 | { |
| ... | ... | @@ -193,7 +197,7 @@ GEnergies& GEnergies::operator=(const GEnergies& energies) |
| 193 | 197 | ==========================================================================*/ |
| 194 | 198 | |
| 195 | 199 | /***********************************************************************//** |
| 196 | - * @brief Clear container | |
| 200 | + * @brief Clear energy container | |
| 197 | 201 | * |
| 198 | 202 | * Removes all energies from the container. |
| 199 | 203 | ***************************************************************************/ |
| ... | ... | @@ -211,7 +215,7 @@ void GEnergies::clear(void) |
| 211 | 215 | |
| 212 | 216 | |
| 213 | 217 | /***********************************************************************//** |
| 214 | - * @brief Clone instance | |
| 218 | + * @brief Clone energy container | |
| 215 | 219 | * |
| 216 | 220 | * @return Pointer to deep copy of energy container |
| 217 | 221 | * |
| ... | ... | @@ -541,19 +545,16 @@ void GEnergies::set_log(const int& num, |
| 541 | 545 | * If no extension name is provided, the energies are loaded from the |
| 542 | 546 | * "ENERGIES" extension. |
| 543 | 547 | ***************************************************************************/ |
| 544 | -void GEnergies::load(const std::string& filename) | |
| 548 | +void GEnergies::load(const GFilename& filename) | |
| 545 | 549 | { |
| 546 | - // Create file name | |
| 547 | - GFilename fname(filename); | |
| 548 | - | |
| 549 | 550 | // Allocate FITS file |
| 550 | 551 | GFits file; |
| 551 | 552 | |
| 552 | 553 | // Open FITS file |
| 553 | - file.open(fname.filename()); | |
| 554 | + file.open(filename.filename()); | |
| 554 | 555 | |
| 555 | 556 | // Get energies table |
| 556 | - const GFitsTable& table = *file.table(fname.extname("ENERGIES")); | |
| 557 | + const GFitsTable& table = *file.table(filename.extname("ENERGIES")); | |
| 557 | 558 | |
| 558 | 559 | // Read energies from table |
| 559 | 560 | read(table); |
| ... | ... | @@ -577,19 +578,16 @@ void GEnergies::load(const std::string& filename) |
| 577 | 578 | * If no extension name is provided, the energies are saved into an |
| 578 | 579 | * "ENERGIES" extension. |
| 579 | 580 | ***************************************************************************/ |
| 580 | -void GEnergies::save(const std::string& filename, const bool& clobber) const | |
| 581 | +void GEnergies::save(const GFilename& filename, const bool& clobber) const | |
| 581 | 582 | { |
| 582 | - // Create file name | |
| 583 | - GFilename fname(filename); | |
| 584 | - | |
| 585 | 583 | // Allocate FITS file |
| 586 | 584 | GFits file; |
| 587 | 585 | |
| 588 | 586 | // Write energies to FITS file |
| 589 | - write(file, fname.extname("ENERGIES")); | |
| 587 | + write(file, filename.extname("ENERGIES")); | |
| 590 | 588 | |
| 591 | 589 | // Save to file |
| 592 | - file.saveto(fname.filename(), clobber); | |
| 590 | + file.saveto(filename.filename(), clobber); | |
| 593 | 591 | |
| 594 | 592 | // Return |
| 595 | 593 | return; | ... | ... |
test/testinst/GTestEventCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GTestEventCube.hpp - Test event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2015 by Jean-Baptiste Cayrou * | |
| 4 | + * copyright (C) 2013-2016 by Jean-Baptiste Cayrou * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -40,6 +40,9 @@ |
| 40 | 40 | #include "GFitsTable.hpp" |
| 41 | 41 | #include "GFitsImage.hpp" |
| 42 | 42 | |
| 43 | +/* __ Forward declarations _______________________________________________ */ | |
| 44 | +class GFilename; | |
| 45 | + | |
| 43 | 46 | |
| 44 | 47 | /***********************************************************************//** |
| 45 | 48 | * @class GTestEventCube |
| ... | ... | @@ -97,16 +100,16 @@ public: |
| 97 | 100 | } |
| 98 | 101 | virtual GTestEventCube* clone(void) const { return new GTestEventCube(*this);} |
| 99 | 102 | virtual std::string classname(void) const { return "GTestEventCube"; } |
| 100 | - virtual int size(void) const { return m_bins.size(); } | |
| 101 | - virtual int dim(void) const { return 1; } | |
| 102 | - virtual int naxis(const int& axis) const { return 1;} | |
| 103 | - virtual void load(const std::string& filename) { } | |
| 104 | - virtual void save(const std::string& filename, | |
| 105 | - const bool& clobber = false) const { } | |
| 106 | - virtual void read(const GFits& file) { } | |
| 107 | - virtual void write(GFits& file) const { } | |
| 108 | - virtual int number(void) const { return m_counts; } | |
| 109 | - virtual std::string print(const GChatter& chatter = NORMAL) const { | |
| 103 | + virtual int size(void) const { return m_bins.size(); } | |
| 104 | + virtual int dim(void) const { return 1; } | |
| 105 | + virtual int naxis(const int& axis) const { return 1;} | |
| 106 | + virtual void load(const GFilename& filename) { } | |
| 107 | + virtual void save(const GFilename& filename, | |
| 108 | + const bool& clobber = false) const { } | |
| 109 | + virtual void read(const GFits& file) { } | |
| 110 | + virtual void write(GFits& file) const { } | |
| 111 | + virtual int number(void) const { return m_counts; } | |
| 112 | + virtual std::string print(const GChatter& chatter = NORMAL) const { | |
| 110 | 113 | std::string result; |
| 111 | 114 | result.append("=== GTestEventCube ==="); |
| 112 | 115 | result.append("\n"+gammalib::parformat("Number of events")+gammalib::str(number())); | ... | ... |
test/testinst/GTestEventList.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GTestEventList.hpp - Test event atom container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2014 by Jean-Baptiste Cayrou * | |
| 4 | + * copyright (C) 2012-2016 by Jean-Baptiste Cayrou * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -34,6 +34,9 @@ |
| 34 | 34 | #include "GTestEventAtom.hpp" |
| 35 | 35 | #include "GTestRoi.hpp" |
| 36 | 36 | |
| 37 | +/* __ Forward declarations _______________________________________________ */ | |
| 38 | +class GFilename; | |
| 39 | + | |
| 37 | 40 | |
| 38 | 41 | /***********************************************************************//** |
| 39 | 42 | * @class GTestEventList |
| ... | ... | @@ -93,15 +96,15 @@ public: |
| 93 | 96 | virtual GTestEventList* clone(void) const{ |
| 94 | 97 | return new GTestEventList(*this); |
| 95 | 98 | } |
| 96 | - virtual std::string classname(void) const { return "GTestEventList"; } | |
| 97 | - virtual int size(void) const { return m_events.size(); } | |
| 98 | - virtual void load(const std::string& filename) {} | |
| 99 | - virtual void save(const std::string& filename, | |
| 100 | - const bool& clobber = false) const {} | |
| 101 | - virtual void read(const GFits& file) {} | |
| 102 | - virtual void write(GFits& file) const {} | |
| 103 | - virtual int number(void) const { return m_events.size(); } | |
| 104 | - virtual void roi(const GRoi& roi) { | |
| 99 | + virtual std::string classname(void) const { return "GTestEventList"; } | |
| 100 | + virtual int size(void) const { return m_events.size(); } | |
| 101 | + virtual void load(const GFilename& filename) {} | |
| 102 | + virtual void save(const GFilename& filename, | |
| 103 | + const bool& clobber = false) const {} | |
| 104 | + virtual void read(const GFits& file) {} | |
| 105 | + virtual void write(GFits& file) const {} | |
| 106 | + virtual int number(void) const { return m_events.size(); } | |
| 107 | + virtual void roi(const GRoi& roi) { | |
| 105 | 108 | const GTestRoi* ptr = dynamic_cast<const GTestRoi*>(&roi); |
| 106 | 109 | if (ptr == NULL) { |
| 107 | 110 | throw; | ... | ... |