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,13 +24,15 @@ The following methods have been renamed: | ||
| 24 | - GCTAResponseTable::tables(), was formerly GCTAResponseTable::size() | 24 | - GCTAResponseTable::tables(), was formerly GCTAResponseTable::size() |
| 25 | - GCTAResponseTable::axis_bins(), was formerly GCTAResponseTable::axis() | 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 | The return value has been changed for the following methods: | 37 | The return value has been changed for the following methods: |
| 36 | - GFits::filename() returns now GFilename instead of std::string | 38 | - GFits::filename() returns now GFilename instead of std::string |
include/GEnergies.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEnergies.hpp - Energy container class * | 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 | * 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 * |
| @@ -35,6 +35,9 @@ | @@ -35,6 +35,9 @@ | ||
| 35 | #include "GFits.hpp" | 35 | #include "GFits.hpp" |
| 36 | #include "GFitsTable.hpp" | 36 | #include "GFitsTable.hpp" |
| 37 | 37 | ||
| 38 | +/* __ Forward declarations _______________________________________________ */ | ||
| 39 | +class GFilename; | ||
| 40 | + | ||
| 38 | 41 | ||
| 39 | /***********************************************************************//** | 42 | /***********************************************************************//** |
| 40 | * @class GEnergies | 43 | * @class GEnergies |
| @@ -43,13 +46,17 @@ | @@ -43,13 +46,17 @@ | ||
| 43 | * | 46 | * |
| 44 | * This class is a container for energies. Energies are implemented by the | 47 | * This class is a container for energies. Energies are implemented by the |
| 45 | * GEnergy class which stores energies in a unit independent way. | 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 | class GEnergies : public GContainer { | 54 | class GEnergies : public GContainer { |
| 48 | 55 | ||
| 49 | public: | 56 | public: |
| 50 | // Constructors and destructors | 57 | // Constructors and destructors |
| 51 | GEnergies(void); | 58 | GEnergies(void); |
| 52 | - explicit GEnergies(const std::string& filename); | 59 | + explicit GEnergies(const GFilename& filename); |
| 53 | GEnergies(const GEnergies& energies); | 60 | GEnergies(const GEnergies& energies); |
| 54 | GEnergies(const int& num, const GEnergy& emin, const GEnergy& emax, | 61 | GEnergies(const int& num, const GEnergy& emin, const GEnergy& emax, |
| 55 | const bool& log = true); | 62 | const bool& log = true); |
| @@ -77,9 +84,9 @@ public: | @@ -77,9 +84,9 @@ public: | ||
| 77 | const GEnergy& emax); | 84 | const GEnergy& emax); |
| 78 | void set_log(const int& num, const GEnergy& emin, | 85 | void set_log(const int& num, const GEnergy& emin, |
| 79 | const GEnergy& emax); | 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 | void read(const GFitsTable& table); | 90 | void read(const GFitsTable& table); |
| 84 | void write(GFits& file, | 91 | void write(GFits& file, |
| 85 | const std::string& extname = "ENERGIES") const; | 92 | const std::string& extname = "ENERGIES") const; |
include/GEventCube.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEventCube.hpp - Abstract event bin container class * | 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 | * 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,9 @@ | @@ -32,6 +32,9 @@ | ||
| 32 | #include "GEvents.hpp" | 32 | #include "GEvents.hpp" |
| 33 | #include "GEventBin.hpp" | 33 | #include "GEventBin.hpp" |
| 34 | 34 | ||
| 35 | +/* __ Forward declarations _______________________________________________ */ | ||
| 36 | +class GFilename; | ||
| 37 | + | ||
| 35 | 38 | ||
| 36 | /***********************************************************************//** | 39 | /***********************************************************************//** |
| 37 | * @class GEventCube | 40 | * @class GEventCube |
| @@ -60,9 +63,9 @@ public: | @@ -60,9 +63,9 @@ public: | ||
| 60 | virtual int size(void) const = 0; | 63 | virtual int size(void) const = 0; |
| 61 | virtual int dim(void) const = 0; | 64 | virtual int dim(void) const = 0; |
| 62 | virtual int naxis(const int& axis) const = 0; | 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 | virtual void read(const GFits& file) = 0; | 69 | virtual void read(const GFits& file) = 0; |
| 67 | virtual void write(GFits& file) const = 0; | 70 | virtual void write(GFits& file) const = 0; |
| 68 | virtual int number(void) const = 0; | 71 | virtual int number(void) const = 0; |
include/GEventList.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEventList.hpp - Abstract event atom container class * | 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 | * 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 * |
| @@ -31,6 +31,9 @@ | @@ -31,6 +31,9 @@ | ||
| 31 | #include "GEvents.hpp" | 31 | #include "GEvents.hpp" |
| 32 | #include "GEventAtom.hpp" | 32 | #include "GEventAtom.hpp" |
| 33 | 33 | ||
| 34 | +/* __ Forward declarations _______________________________________________ */ | ||
| 35 | +class GFilename; | ||
| 36 | + | ||
| 34 | 37 | ||
| 35 | /***********************************************************************//** | 38 | /***********************************************************************//** |
| 36 | * @class GEventList | 39 | * @class GEventList |
| @@ -61,9 +64,9 @@ public: | @@ -61,9 +64,9 @@ public: | ||
| 61 | virtual GEventList* clone(void) const = 0; | 64 | virtual GEventList* clone(void) const = 0; |
| 62 | virtual std::string classname(void) const = 0; | 65 | virtual std::string classname(void) const = 0; |
| 63 | virtual int size(void) const = 0; | 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 | virtual void read(const GFits& file) = 0; | 70 | virtual void read(const GFits& file) = 0; |
| 68 | virtual void write(GFits& file) const = 0; | 71 | virtual void write(GFits& file) const = 0; |
| 69 | virtual int number(void) const = 0; | 72 | virtual int number(void) const = 0; |
include/GEvents.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEvents.hpp - Abstract event container class * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -36,6 +36,9 @@ | @@ -36,6 +36,9 @@ | ||
| 36 | #include "GGti.hpp" | 36 | #include "GGti.hpp" |
| 37 | #include "GRoi.hpp" | 37 | #include "GRoi.hpp" |
| 38 | 38 | ||
| 39 | +/* __ Forward declarations _______________________________________________ */ | ||
| 40 | +class GFilename; | ||
| 41 | + | ||
| 39 | 42 | ||
| 40 | /***********************************************************************//** | 43 | /***********************************************************************//** |
| 41 | * @class GEvents | 44 | * @class GEvents |
| @@ -78,9 +81,9 @@ public: | @@ -78,9 +81,9 @@ public: | ||
| 78 | virtual GEvents* clone(void) const = 0; | 81 | virtual GEvents* clone(void) const = 0; |
| 79 | virtual std::string classname(void) const = 0; | 82 | virtual std::string classname(void) const = 0; |
| 80 | virtual int size(void) const = 0; | 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 | virtual void read(const GFits& file) = 0; | 87 | virtual void read(const GFits& file) = 0; |
| 85 | virtual void write(GFits& file) const = 0; | 88 | virtual void write(GFits& file) const = 0; |
| 86 | virtual int number(void) const = 0; | 89 | virtual int number(void) const = 0; |
| @@ -107,7 +110,6 @@ protected: | @@ -107,7 +110,6 @@ protected: | ||
| 107 | // Protected members | 110 | // Protected members |
| 108 | GEbounds m_ebounds; //!< Energy boundaries covered by events | 111 | GEbounds m_ebounds; //!< Energy boundaries covered by events |
| 109 | GGti m_gti; //!< Good time intervals covered by events | 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 | * GCOMEventCube.hpp - COMPTEL event bin container class * | 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 | * 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 * |
| @@ -35,11 +35,14 @@ | @@ -35,11 +35,14 @@ | ||
| 35 | #include "GCOMInstDir.hpp" | 35 | #include "GCOMInstDir.hpp" |
| 36 | #include "GSkyDir.hpp" | 36 | #include "GSkyDir.hpp" |
| 37 | #include "GSkyMap.hpp" | 37 | #include "GSkyMap.hpp" |
| 38 | -#include "GEbounds.hpp" | ||
| 39 | -#include "GGti.hpp" | ||
| 40 | #include "GEnergy.hpp" | 38 | #include "GEnergy.hpp" |
| 41 | #include "GTime.hpp" | 39 | #include "GTime.hpp" |
| 42 | 40 | ||
| 41 | +/* __ Forward declarations _______________________________________________ */ | ||
| 42 | +class GFilename; | ||
| 43 | +class GEbounds; | ||
| 44 | +class GGti; | ||
| 45 | + | ||
| 43 | 46 | ||
| 44 | /***********************************************************************//** | 47 | /***********************************************************************//** |
| 45 | * @class GCOMEventCube | 48 | * @class GCOMEventCube |
| @@ -53,7 +56,7 @@ class GCOMEventCube : public GEventCube { | @@ -53,7 +56,7 @@ class GCOMEventCube : public GEventCube { | ||
| 53 | public: | 56 | public: |
| 54 | // Constructors and destructors | 57 | // Constructors and destructors |
| 55 | GCOMEventCube(void); | 58 | GCOMEventCube(void); |
| 56 | - explicit GCOMEventCube(const std::string& filename); | 59 | + explicit GCOMEventCube(const GFilename& filename); |
| 57 | explicit GCOMEventCube(const GSkyMap& map, const GEbounds& ebds, | 60 | explicit GCOMEventCube(const GSkyMap& map, const GEbounds& ebds, |
| 58 | const GGti& gti, const double& phimin, | 61 | const GGti& gti, const double& phimin, |
| 59 | const double& dphi); | 62 | const double& dphi); |
| @@ -72,9 +75,9 @@ public: | @@ -72,9 +75,9 @@ public: | ||
| 72 | virtual int size(void) const; | 75 | virtual int size(void) const; |
| 73 | virtual int dim(void) const; | 76 | virtual int dim(void) const; |
| 74 | virtual int naxis(const int& axis) const; | 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 | virtual void read(const GFits& file); | 81 | virtual void read(const GFits& file); |
| 79 | virtual void write(GFits& file) const; | 82 | virtual void write(GFits& file) const; |
| 80 | virtual int number(void) const; | 83 | virtual int number(void) const; |
| @@ -83,11 +86,11 @@ public: | @@ -83,11 +86,11 @@ public: | ||
| 83 | // Other methods | 86 | // Other methods |
| 84 | void map(const GSkyMap& map, const double& phimin, | 87 | void map(const GSkyMap& map, const double& phimin, |
| 85 | const double& dphi); | 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 | protected: | 95 | protected: |
| 93 | // Protected methods | 96 | // Protected methods |
| @@ -127,4 +130,64 @@ std::string GCOMEventCube::classname(void) const | @@ -127,4 +130,64 @@ std::string GCOMEventCube::classname(void) const | ||
| 127 | return ("GCOMEventCube"); | 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 | #endif /* GCOMEVENTCUBE_HPP */ | 193 | #endif /* GCOMEVENTCUBE_HPP */ |
inst/com/pyext/GCOMEventCube.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCOMEventCube.i - COMPTEL event bin container class * | 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 | * 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 * |
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | /** | 21 | /** |
| 22 | * @file GCOMEventCube.hpp | 22 | * @file GCOMEventCube.hpp |
| 23 | * @brief COMPTEL event bin container class interface definition | 23 | * @brief COMPTEL event bin container class interface definition |
| 24 | - * @author J. Knoedlseder | 24 | + * @author Juergen Knoedlseder |
| 25 | */ | 25 | */ |
| 26 | %{ | 26 | %{ |
| 27 | /* Put headers and other declarations here that are needed for compilation */ | 27 | /* Put headers and other declarations here that are needed for compilation */ |
| @@ -38,7 +38,7 @@ class GCOMEventCube : public GEventCube { | @@ -38,7 +38,7 @@ class GCOMEventCube : public GEventCube { | ||
| 38 | public: | 38 | public: |
| 39 | // Constructors and destructors | 39 | // Constructors and destructors |
| 40 | GCOMEventCube(void); | 40 | GCOMEventCube(void); |
| 41 | - explicit GCOMEventCube(const std::string& filename); | 41 | + explicit GCOMEventCube(const GFilename& filename); |
| 42 | explicit GCOMEventCube(const GSkyMap& map, const GEbounds& ebds, | 42 | explicit GCOMEventCube(const GSkyMap& map, const GEbounds& ebds, |
| 43 | const GGti& gti, const double& phimin, | 43 | const GGti& gti, const double& phimin, |
| 44 | const double& dphi); | 44 | const double& dphi); |
| @@ -52,9 +52,9 @@ public: | @@ -52,9 +52,9 @@ public: | ||
| 52 | virtual int size(void) const; | 52 | virtual int size(void) const; |
| 53 | virtual int dim(void) const; | 53 | virtual int dim(void) const; |
| 54 | virtual int naxis(const int& axis) const; | 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 | virtual void read(const GFits& file); | 58 | virtual void read(const GFits& file); |
| 59 | virtual void write(GFits& file) const; | 59 | virtual void write(GFits& file) const; |
| 60 | virtual int number(void) const; | 60 | virtual int number(void) const; |
inst/com/src/GCOMEventCube.cpp
| @@ -31,6 +31,7 @@ | @@ -31,6 +31,7 @@ | ||
| 31 | #include "GException.hpp" | 31 | #include "GException.hpp" |
| 32 | #include "GTools.hpp" | 32 | #include "GTools.hpp" |
| 33 | #include "GFits.hpp" | 33 | #include "GFits.hpp" |
| 34 | +#include "GFilename.hpp" | ||
| 34 | #include "GCOMSupport.hpp" | 35 | #include "GCOMSupport.hpp" |
| 35 | #include "GCOMEventCube.hpp" | 36 | #include "GCOMEventCube.hpp" |
| 36 | 37 | ||
| @@ -77,7 +78,7 @@ GCOMEventCube::GCOMEventCube(void) : GEventCube() | @@ -77,7 +78,7 @@ GCOMEventCube::GCOMEventCube(void) : GEventCube() | ||
| 77 | * | 78 | * |
| 78 | * Construct an event cube by loading information from a FITS file. | 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 | // Initialise members | 83 | // Initialise members |
| 83 | init_members(); | 84 | init_members(); |
| @@ -362,13 +363,13 @@ int GCOMEventCube::naxis(const int& axis) const | @@ -362,13 +363,13 @@ int GCOMEventCube::naxis(const int& axis) const | ||
| 362 | * The method clears the object before loading, thus any events residing in | 363 | * The method clears the object before loading, thus any events residing in |
| 363 | * the object before loading will be lost. | 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 | // Clear object | 368 | // Clear object |
| 368 | clear(); | 369 | clear(); |
| 369 | 370 | ||
| 370 | // Open DRE FITS file | 371 | // Open DRE FITS file |
| 371 | - GFits file(filename); | 372 | + GFits file(filename.filename()); |
| 372 | 373 | ||
| 373 | // Load DRE cube | 374 | // Load DRE cube |
| 374 | read(file); | 375 | read(file); |
| @@ -389,7 +390,7 @@ void GCOMEventCube::load(const std::string& filename) | @@ -389,7 +390,7 @@ void GCOMEventCube::load(const std::string& filename) | ||
| 389 | * | 390 | * |
| 390 | * Save the COMPTEL event cube into FITS file. | 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 | // Create empty FITS file | 395 | // Create empty FITS file |
| 395 | GFits fits; | 396 | GFits fits; |
| @@ -398,7 +399,7 @@ void GCOMEventCube::save(const std::string& filename, const bool& clobber) const | @@ -398,7 +399,7 @@ void GCOMEventCube::save(const std::string& filename, const bool& clobber) const | ||
| 398 | write(fits); | 399 | write(fits); |
| 399 | 400 | ||
| 400 | // Save FITS file | 401 | // Save FITS file |
| 401 | - fits.saveto(filename, clobber); | 402 | + fits.saveto(filename.filename(), clobber); |
| 402 | 403 | ||
| 403 | // Return | 404 | // Return |
| 404 | return; | 405 | return; |
inst/cta/include/GCTAEventCube.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCTAEventCube.hpp - CTA event bin container class * | 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 | * 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 * |
| @@ -41,6 +41,9 @@ | @@ -41,6 +41,9 @@ | ||
| 41 | #include "GFitsTable.hpp" | 41 | #include "GFitsTable.hpp" |
| 42 | #include "GFitsImage.hpp" | 42 | #include "GFitsImage.hpp" |
| 43 | 43 | ||
| 44 | +/* __ Forward declarations _______________________________________________ */ | ||
| 45 | +class GFilename; | ||
| 46 | + | ||
| 44 | 47 | ||
| 45 | /***********************************************************************//** | 48 | /***********************************************************************//** |
| 46 | * @class GCTAEventCube | 49 | * @class GCTAEventCube |
| @@ -54,7 +57,7 @@ class GCTAEventCube : public GEventCube { | @@ -54,7 +57,7 @@ class GCTAEventCube : public GEventCube { | ||
| 54 | public: | 57 | public: |
| 55 | // Constructors and destructors | 58 | // Constructors and destructors |
| 56 | GCTAEventCube(void); | 59 | GCTAEventCube(void); |
| 57 | - explicit GCTAEventCube(const std::string& filename); | 60 | + explicit GCTAEventCube(const GFilename& filename); |
| 58 | GCTAEventCube(const GSkyMap& map, const GEbounds& ebds, const GGti& gti); | 61 | GCTAEventCube(const GSkyMap& map, const GEbounds& ebds, const GGti& gti); |
| 59 | GCTAEventCube(const GCTAEventCube& cube); | 62 | GCTAEventCube(const GCTAEventCube& cube); |
| 60 | virtual ~GCTAEventCube(void); | 63 | virtual ~GCTAEventCube(void); |
| @@ -71,9 +74,9 @@ public: | @@ -71,9 +74,9 @@ public: | ||
| 71 | virtual int size(void) const; | 74 | virtual int size(void) const; |
| 72 | virtual int dim(void) const; | 75 | virtual int dim(void) const; |
| 73 | virtual int naxis(const int& axis) const; | 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 | virtual void read(const GFits& file); | 80 | virtual void read(const GFits& file); |
| 78 | virtual void write(GFits& file) const; | 81 | virtual void write(GFits& file) const; |
| 79 | virtual int number(void) const; | 82 | virtual int number(void) const; |
inst/cta/include/GCTAEventList.hpp
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | #include "GCTARoi.hpp" | 36 | #include "GCTARoi.hpp" |
| 37 | 37 | ||
| 38 | /* __ Forward declarations _______________________________________________ */ | 38 | /* __ Forward declarations _______________________________________________ */ |
| 39 | +class GFilename; | ||
| 39 | class GFitsHDU; | 40 | class GFitsHDU; |
| 40 | class GFitsTable; | 41 | class GFitsTable; |
| 41 | class GFitsBinTable; | 42 | class GFitsBinTable; |
| @@ -53,7 +54,7 @@ class GCTAEventList : public GEventList { | @@ -53,7 +54,7 @@ class GCTAEventList : public GEventList { | ||
| 53 | public: | 54 | public: |
| 54 | // Constructors and destructors | 55 | // Constructors and destructors |
| 55 | GCTAEventList(void); | 56 | GCTAEventList(void); |
| 56 | - explicit GCTAEventList(const std::string& filename); | 57 | + explicit GCTAEventList(const GFilename& filename); |
| 57 | GCTAEventList(const GCTAEventList& list); | 58 | GCTAEventList(const GCTAEventList& list); |
| 58 | virtual ~GCTAEventList(void); | 59 | virtual ~GCTAEventList(void); |
| 59 | 60 | ||
| @@ -67,9 +68,9 @@ public: | @@ -67,9 +68,9 @@ public: | ||
| 67 | virtual GCTAEventList* clone(void) const; | 68 | virtual GCTAEventList* clone(void) const; |
| 68 | virtual std::string classname(void) const; | 69 | virtual std::string classname(void) const; |
| 69 | virtual int size(void) const; | 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 | virtual void read(const GFits& fits); | 74 | virtual void read(const GFits& fits); |
| 74 | virtual void write(GFits& fits) const; | 75 | virtual void write(GFits& fits) const; |
| 75 | virtual int number(void) const; | 76 | virtual int number(void) const; |
inst/cta/pyext/GCTAEventCube.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCTAEventCube.i - CTA event bin container class * | 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 | * 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 * |
| @@ -38,7 +38,7 @@ class GCTAEventCube : public GEventCube { | @@ -38,7 +38,7 @@ class GCTAEventCube : public GEventCube { | ||
| 38 | public: | 38 | public: |
| 39 | // Constructors and destructors | 39 | // Constructors and destructors |
| 40 | GCTAEventCube(void); | 40 | GCTAEventCube(void); |
| 41 | - explicit GCTAEventCube(const std::string& filename); | 41 | + explicit GCTAEventCube(const GFilename& filename); |
| 42 | GCTAEventCube(const GSkyMap& map, const GEbounds& ebds, const GGti& gti); | 42 | GCTAEventCube(const GSkyMap& map, const GEbounds& ebds, const GGti& gti); |
| 43 | GCTAEventCube(const GCTAEventCube& cube); | 43 | GCTAEventCube(const GCTAEventCube& cube); |
| 44 | virtual ~GCTAEventCube(void); | 44 | virtual ~GCTAEventCube(void); |
| @@ -50,9 +50,9 @@ public: | @@ -50,9 +50,9 @@ public: | ||
| 50 | virtual int size(void) const; | 50 | virtual int size(void) const; |
| 51 | virtual int dim(void) const; | 51 | virtual int dim(void) const; |
| 52 | virtual int naxis(const int& axis) const; | 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 | virtual void read(const GFits& file); | 56 | virtual void read(const GFits& file); |
| 57 | virtual void write(GFits& file) const; | 57 | virtual void write(GFits& file) const; |
| 58 | virtual int number(void) const; | 58 | virtual int number(void) const; |
inst/cta/pyext/GCTAEventList.i
| @@ -39,7 +39,7 @@ class GCTAEventList : public GEventList { | @@ -39,7 +39,7 @@ class GCTAEventList : public GEventList { | ||
| 39 | public: | 39 | public: |
| 40 | // Constructors and destructors | 40 | // Constructors and destructors |
| 41 | GCTAEventList(void); | 41 | GCTAEventList(void); |
| 42 | - explicit GCTAEventList(const std::string& filename); | 42 | + explicit GCTAEventList(const GFilename& filename); |
| 43 | GCTAEventList(const GCTAEventList& list); | 43 | GCTAEventList(const GCTAEventList& list); |
| 44 | virtual ~GCTAEventList(void); | 44 | virtual ~GCTAEventList(void); |
| 45 | 45 | ||
| @@ -48,9 +48,9 @@ public: | @@ -48,9 +48,9 @@ public: | ||
| 48 | virtual GCTAEventList* clone(void) const; | 48 | virtual GCTAEventList* clone(void) const; |
| 49 | virtual std::string classname(void) const; | 49 | virtual std::string classname(void) const; |
| 50 | virtual int size(void) const; | 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 | virtual void read(const GFits& fits); | 54 | virtual void read(const GFits& fits); |
| 55 | virtual void write(GFits& fits) const; | 55 | virtual void write(GFits& fits) const; |
| 56 | virtual int number(void) const; | 56 | virtual int number(void) const; |
inst/cta/src/GCTAEventCube.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GCTAEventCube.cpp - CTA event bin container class * | 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 | * 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 * |
| @@ -75,7 +75,7 @@ GCTAEventCube::GCTAEventCube(void) : GEventCube() | @@ -75,7 +75,7 @@ GCTAEventCube::GCTAEventCube(void) : GEventCube() | ||
| 75 | * | 75 | * |
| 76 | * Construct instance of events cube a counts cube file. | 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 | // Initialise members | 80 | // Initialise members |
| 81 | init_members(); | 81 | init_members(); |
| @@ -321,13 +321,13 @@ int GCTAEventCube::naxis(const int& axis) const | @@ -321,13 +321,13 @@ int GCTAEventCube::naxis(const int& axis) const | ||
| 321 | * The method clears the object before loading, thus any events residing in | 321 | * The method clears the object before loading, thus any events residing in |
| 322 | * the object before loading will be lost. | 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 | // Clear object | 326 | // Clear object |
| 327 | clear(); | 327 | clear(); |
| 328 | 328 | ||
| 329 | // Open counts map FITS file | 329 | // Open counts map FITS file |
| 330 | - GFits fits(filename); | 330 | + GFits fits(filename.filename()); |
| 331 | 331 | ||
| 332 | // Load counts map | 332 | // Load counts map |
| 333 | read(fits); | 333 | read(fits); |
| @@ -348,8 +348,8 @@ void GCTAEventCube::load(const std::string& filename) | @@ -348,8 +348,8 @@ void GCTAEventCube::load(const std::string& filename) | ||
| 348 | * | 348 | * |
| 349 | * Save the CTA event cube into FITS file. | 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 | // Create empty FITS file | 354 | // Create empty FITS file |
| 355 | GFits fits; | 355 | GFits fits; |
| @@ -358,7 +358,7 @@ void GCTAEventCube::save(const std::string& filename, | @@ -358,7 +358,7 @@ void GCTAEventCube::save(const std::string& filename, | ||
| 358 | write(fits); | 358 | write(fits); |
| 359 | 359 | ||
| 360 | // Save FITS file | 360 | // Save FITS file |
| 361 | - fits.saveto(filename, clobber); | 361 | + fits.saveto(filename.filename(), clobber); |
| 362 | 362 | ||
| 363 | // Return | 363 | // Return |
| 364 | return; | 364 | return; |
inst/cta/src/GCTAEventList.cpp
| @@ -83,7 +83,7 @@ GCTAEventList::GCTAEventList(void) : GEventList() | @@ -83,7 +83,7 @@ GCTAEventList::GCTAEventList(void) : GEventList() | ||
| 83 | * | 83 | * |
| 84 | * Constructs event list by loading the events from a FITS file. | 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 | // Initialise members | 88 | // Initialise members |
| 89 | init_members(); | 89 | init_members(); |
| @@ -276,10 +276,10 @@ GCTAEventList* GCTAEventList::clone(void) const | @@ -276,10 +276,10 @@ GCTAEventList* GCTAEventList::clone(void) const | ||
| 276 | * | 276 | * |
| 277 | * Loads the event list from a FITS file. See the read() method for details. | 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 | // Open FITS file | 281 | // Open FITS file |
| 282 | - GFits fits(filename); | 282 | + GFits fits(filename.filename()); |
| 283 | 283 | ||
| 284 | // Read event list | 284 | // Read event list |
| 285 | read(fits); | 285 | read(fits); |
| @@ -300,11 +300,11 @@ void GCTAEventList::load(const std::string& filename) | @@ -300,11 +300,11 @@ void GCTAEventList::load(const std::string& filename) | ||
| 300 | * | 300 | * |
| 301 | * Saves the event list into a FITS file. See the write() method for details. | 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 | // Open or create FITS file | 306 | // Open or create FITS file |
| 307 | - GFits fits(filename, true); | 307 | + GFits fits(filename.filename(), true); |
| 308 | 308 | ||
| 309 | // Write event list | 309 | // Write event list |
| 310 | write(fits); | 310 | write(fits); |
inst/lat/include/GLATEventCube.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GLATEventCube.hpp - Fermi/LAT event cube class * | 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 | * 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 * |
| @@ -41,6 +41,9 @@ | @@ -41,6 +41,9 @@ | ||
| 41 | #include "GSkyMap.hpp" | 41 | #include "GSkyMap.hpp" |
| 42 | #include "GNodeArray.hpp" | 42 | #include "GNodeArray.hpp" |
| 43 | 43 | ||
| 44 | +/* __ Forward declarations _______________________________________________ */ | ||
| 45 | +class GFilename; | ||
| 46 | + | ||
| 44 | 47 | ||
| 45 | /***********************************************************************//** | 48 | /***********************************************************************//** |
| 46 | * @class GLATEventCube | 49 | * @class GLATEventCube |
| @@ -52,7 +55,7 @@ class GLATEventCube : public GEventCube { | @@ -52,7 +55,7 @@ class GLATEventCube : public GEventCube { | ||
| 52 | public: | 55 | public: |
| 53 | // Constructors and destructors | 56 | // Constructors and destructors |
| 54 | GLATEventCube(void); | 57 | GLATEventCube(void); |
| 55 | - explicit GLATEventCube(const std::string& filename); | 58 | + explicit GLATEventCube(const GFilename& filename); |
| 56 | GLATEventCube(const GLATEventCube& cube); | 59 | GLATEventCube(const GLATEventCube& cube); |
| 57 | virtual ~GLATEventCube(void); | 60 | virtual ~GLATEventCube(void); |
| 58 | 61 | ||
| @@ -68,9 +71,9 @@ public: | @@ -68,9 +71,9 @@ public: | ||
| 68 | virtual int size(void) const; | 71 | virtual int size(void) const; |
| 69 | virtual int dim(void) const; | 72 | virtual int dim(void) const; |
| 70 | virtual int naxis(const int& axis) const; | 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 | virtual void read(const GFits& file); | 77 | virtual void read(const GFits& file); |
| 75 | virtual void write(GFits& file) const; | 78 | virtual void write(GFits& file) const; |
| 76 | virtual int number(void) const; | 79 | virtual int number(void) const; |
inst/lat/include/GLATEventList.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GLATEventList.hpp - Fermi/LAT event list class * | 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 | * 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 * |
| @@ -37,6 +37,9 @@ | @@ -37,6 +37,9 @@ | ||
| 37 | #include "GFitsHDU.hpp" | 37 | #include "GFitsHDU.hpp" |
| 38 | #include "GFitsTable.hpp" | 38 | #include "GFitsTable.hpp" |
| 39 | 39 | ||
| 40 | +/* __ Forward declarations _______________________________________________ */ | ||
| 41 | +class GFilename; | ||
| 42 | + | ||
| 40 | 43 | ||
| 41 | /***********************************************************************//** | 44 | /***********************************************************************//** |
| 42 | * @class GLATEventList | 45 | * @class GLATEventList |
| @@ -48,7 +51,7 @@ class GLATEventList : public GEventList { | @@ -48,7 +51,7 @@ class GLATEventList : public GEventList { | ||
| 48 | public: | 51 | public: |
| 49 | // Constructors and destructors | 52 | // Constructors and destructors |
| 50 | GLATEventList(void); | 53 | GLATEventList(void); |
| 51 | - explicit GLATEventList(const std::string& filename); | 54 | + explicit GLATEventList(const GFilename& filename); |
| 52 | GLATEventList(const GLATEventList& list); | 55 | GLATEventList(const GLATEventList& list); |
| 53 | virtual ~GLATEventList(void); | 56 | virtual ~GLATEventList(void); |
| 54 | 57 | ||
| @@ -62,9 +65,9 @@ public: | @@ -62,9 +65,9 @@ public: | ||
| 62 | virtual GLATEventList* clone(void) const; | 65 | virtual GLATEventList* clone(void) const; |
| 63 | virtual std::string classname(void) const; | 66 | virtual std::string classname(void) const; |
| 64 | virtual int size(void) const; | 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 | virtual void read(const GFits& file); | 71 | virtual void read(const GFits& file); |
| 69 | virtual void write(GFits& file) const; | 72 | virtual void write(GFits& file) const; |
| 70 | virtual int number(void) const; | 73 | virtual int number(void) const; |
inst/lat/pyext/GLATEventCube.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GLATEventCube.i - Fermi/LAT event cube class * | 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 | * 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 * |
| @@ -39,7 +39,7 @@ class GLATEventCube : public GEventCube { | @@ -39,7 +39,7 @@ class GLATEventCube : public GEventCube { | ||
| 39 | public: | 39 | public: |
| 40 | // Constructors and destructors | 40 | // Constructors and destructors |
| 41 | GLATEventCube(void); | 41 | GLATEventCube(void); |
| 42 | - explicit GLATEventCube(const std::string& filename); | 42 | + explicit GLATEventCube(const GFilename& filename); |
| 43 | GLATEventCube(const GLATEventCube& cube); | 43 | GLATEventCube(const GLATEventCube& cube); |
| 44 | virtual ~GLATEventCube(void); | 44 | virtual ~GLATEventCube(void); |
| 45 | 45 | ||
| @@ -50,9 +50,9 @@ public: | @@ -50,9 +50,9 @@ public: | ||
| 50 | virtual int size(void) const; | 50 | virtual int size(void) const; |
| 51 | virtual int dim(void) const; | 51 | virtual int dim(void) const; |
| 52 | virtual int naxis(const int& axis) const; | 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 | virtual void read(const GFits& file); | 56 | virtual void read(const GFits& file); |
| 57 | virtual void write(GFits& file) const; | 57 | virtual void write(GFits& file) const; |
| 58 | virtual int number(void) const; | 58 | virtual int number(void) const; |
inst/lat/pyext/GLATEventList.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GLATEventList.i - Fermi/LAT event list class * | 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 | * 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 * |
| @@ -39,7 +39,7 @@ class GLATEventList : public GEventList { | @@ -39,7 +39,7 @@ class GLATEventList : public GEventList { | ||
| 39 | public: | 39 | public: |
| 40 | // Constructors and destructors | 40 | // Constructors and destructors |
| 41 | GLATEventList(void); | 41 | GLATEventList(void); |
| 42 | - explicit GLATEventList(const std::string& filename); | 42 | + explicit GLATEventList(const GFilename& filename); |
| 43 | GLATEventList(const GLATEventList& list); | 43 | GLATEventList(const GLATEventList& list); |
| 44 | virtual ~GLATEventList(void); | 44 | virtual ~GLATEventList(void); |
| 45 | 45 | ||
| @@ -48,9 +48,9 @@ public: | @@ -48,9 +48,9 @@ public: | ||
| 48 | virtual GLATEventList* clone(void) const; | 48 | virtual GLATEventList* clone(void) const; |
| 49 | virtual std::string classname(void) const; | 49 | virtual std::string classname(void) const; |
| 50 | virtual int size(void) const; | 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 | virtual void read(const GFits& file); | 54 | virtual void read(const GFits& file); |
| 55 | virtual void write(GFits& file) const; | 55 | virtual void write(GFits& file) const; |
| 56 | virtual int number(void) const; | 56 | virtual int number(void) const; |
inst/lat/src/GLATEventCube.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GLATEventCube.cpp - Fermi/LAT event cube class * | 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 | * 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 * |
| @@ -28,11 +28,12 @@ | @@ -28,11 +28,12 @@ | ||
| 28 | #ifdef HAVE_CONFIG_H | 28 | #ifdef HAVE_CONFIG_H |
| 29 | #include <config.h> | 29 | #include <config.h> |
| 30 | #endif | 30 | #endif |
| 31 | -#include "GLATEventCube.hpp" | ||
| 32 | -#include "GLATException.hpp" | ||
| 33 | #include "GTools.hpp" | 31 | #include "GTools.hpp" |
| 32 | +#include "GFilename.hpp" | ||
| 34 | #include "GFitsImage.hpp" | 33 | #include "GFitsImage.hpp" |
| 35 | #include "GFitsTable.hpp" | 34 | #include "GFitsTable.hpp" |
| 35 | +#include "GLATEventCube.hpp" | ||
| 36 | +#include "GLATException.hpp" | ||
| 36 | 37 | ||
| 37 | /* __ Method name definitions ____________________________________________ */ | 38 | /* __ Method name definitions ____________________________________________ */ |
| 38 | #define G_NAXIS "GLATEventCube::naxis(int)" | 39 | #define G_NAXIS "GLATEventCube::naxis(int)" |
| @@ -77,7 +78,7 @@ GLATEventCube::GLATEventCube(void) : GEventCube() | @@ -77,7 +78,7 @@ GLATEventCube::GLATEventCube(void) : GEventCube() | ||
| 77 | * | 78 | * |
| 78 | * Construct event cube object by loading the events from a FITS file. | 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 | // Initialise members | 83 | // Initialise members |
| 83 | init_members(); | 84 | init_members(); |
| @@ -306,13 +307,13 @@ int GLATEventCube::naxis(const int& axis) const | @@ -306,13 +307,13 @@ int GLATEventCube::naxis(const int& axis) const | ||
| 306 | * | 307 | * |
| 307 | * @param[in] filename FITS file name. | 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 | // Clear object | 312 | // Clear object |
| 312 | clear(); | 313 | clear(); |
| 313 | 314 | ||
| 314 | // Open FITS file | 315 | // Open FITS file |
| 315 | - GFits file(filename); | 316 | + GFits file(filename.filename()); |
| 316 | 317 | ||
| 317 | // Read counts map | 318 | // Read counts map |
| 318 | read(file); | 319 | read(file); |
| @@ -329,12 +330,12 @@ void GLATEventCube::load(const std::string& filename) | @@ -329,12 +330,12 @@ void GLATEventCube::load(const std::string& filename) | ||
| 329 | * @brief Save LAT event cube into FITS file | 330 | * @brief Save LAT event cube into FITS file |
| 330 | * | 331 | * |
| 331 | * @param[in] filename FITS file name. | 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 | * Save the LAT event cube into FITS file. | 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 | // Create empty FITS file | 340 | // Create empty FITS file |
| 340 | GFits fits; | 341 | GFits fits; |
| @@ -343,7 +344,7 @@ void GLATEventCube::save(const std::string& filename, | @@ -343,7 +344,7 @@ void GLATEventCube::save(const std::string& filename, | ||
| 343 | write(fits); | 344 | write(fits); |
| 344 | 345 | ||
| 345 | // Save FITS file | 346 | // Save FITS file |
| 346 | - fits.saveto(filename, clobber); | 347 | + fits.saveto(filename.filename(), clobber); |
| 347 | 348 | ||
| 348 | // Return | 349 | // Return |
| 349 | return; | 350 | return; |
inst/lat/src/GLATEventList.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GLATEventList.cpp - Fermi/LAT event list class * | 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 | * 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 * |
| @@ -31,13 +31,14 @@ | @@ -31,13 +31,14 @@ | ||
| 31 | #include <cstdio> // std::sprintf | 31 | #include <cstdio> // std::sprintf |
| 32 | #include "GException.hpp" | 32 | #include "GException.hpp" |
| 33 | #include "GTools.hpp" | 33 | #include "GTools.hpp" |
| 34 | -#include "GLATEventList.hpp" | ||
| 35 | -#include "GLATException.hpp" | 34 | +#include "GFilename.hpp" |
| 36 | #include "GFitsTable.hpp" | 35 | #include "GFitsTable.hpp" |
| 37 | #include "GFitsTableFloatCol.hpp" | 36 | #include "GFitsTableFloatCol.hpp" |
| 38 | #include "GFitsTableDoubleCol.hpp" | 37 | #include "GFitsTableDoubleCol.hpp" |
| 39 | #include "GFitsTableLongCol.hpp" | 38 | #include "GFitsTableLongCol.hpp" |
| 40 | #include "GFitsTableShortCol.hpp" | 39 | #include "GFitsTableShortCol.hpp" |
| 40 | +#include "GLATEventList.hpp" | ||
| 41 | +#include "GLATException.hpp" | ||
| 41 | 42 | ||
| 42 | /* __ Method name definitions ____________________________________________ */ | 43 | /* __ Method name definitions ____________________________________________ */ |
| 43 | #define G_OPERATOR "GLATEventList::operator[](int&)" | 44 | #define G_OPERATOR "GLATEventList::operator[](int&)" |
| @@ -76,7 +77,7 @@ GLATEventList::GLATEventList(void) : GEventList() | @@ -76,7 +77,7 @@ GLATEventList::GLATEventList(void) : GEventList() | ||
| 76 | * | 77 | * |
| 77 | * Construct event list object by loading the events from a FITS file. | 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 | // Initialise members | 82 | // Initialise members |
| 82 | init_members(); | 83 | init_members(); |
| @@ -248,13 +249,13 @@ GLATEventList* GLATEventList::clone(void) const | @@ -248,13 +249,13 @@ GLATEventList* GLATEventList::clone(void) const | ||
| 248 | * | 249 | * |
| 249 | * This method loads LAT events from a FT1 file. | 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 | // Clear object | 254 | // Clear object |
| 254 | clear(); | 255 | clear(); |
| 255 | 256 | ||
| 256 | // Open FITS file | 257 | // Open FITS file |
| 257 | - GFits file(filename); | 258 | + GFits file(filename.filename()); |
| 258 | 259 | ||
| 259 | // Read event list | 260 | // Read event list |
| 260 | read(file); | 261 | read(file); |
| @@ -277,8 +278,8 @@ void GLATEventList::load(const std::string& filename) | @@ -277,8 +278,8 @@ void GLATEventList::load(const std::string& filename) | ||
| 277 | * | 278 | * |
| 278 | * @todo To be implemented. | 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 | // Return | 284 | // Return |
| 284 | return; | 285 | return; |
inst/mwl/include/GMWLSpectrum.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GMWLSpectrum.hpp - Multi-wavelength spectrum class * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -34,6 +34,9 @@ | @@ -34,6 +34,9 @@ | ||
| 34 | #include "GFitsTable.hpp" | 34 | #include "GFitsTable.hpp" |
| 35 | #include "GEnergy.hpp" | 35 | #include "GEnergy.hpp" |
| 36 | 36 | ||
| 37 | +/* __ Forward declarations _______________________________________________ */ | ||
| 38 | +class GFilename; | ||
| 39 | + | ||
| 37 | 40 | ||
| 38 | /***********************************************************************//** | 41 | /***********************************************************************//** |
| 39 | * @class GMWLSpectrum | 42 | * @class GMWLSpectrum |
| @@ -49,7 +52,7 @@ class GMWLSpectrum : public GEventCube { | @@ -49,7 +52,7 @@ class GMWLSpectrum : public GEventCube { | ||
| 49 | public: | 52 | public: |
| 50 | // Constructors and destructors | 53 | // Constructors and destructors |
| 51 | GMWLSpectrum(void); | 54 | GMWLSpectrum(void); |
| 52 | - explicit GMWLSpectrum(const std::string& filename); | 55 | + explicit GMWLSpectrum(const GFilename& filename); |
| 53 | GMWLSpectrum(const GMWLSpectrum& spec); | 56 | GMWLSpectrum(const GMWLSpectrum& spec); |
| 54 | virtual ~GMWLSpectrum(void); | 57 | virtual ~GMWLSpectrum(void); |
| 55 | 58 | ||
| @@ -65,9 +68,9 @@ public: | @@ -65,9 +68,9 @@ public: | ||
| 65 | virtual int size(void) const; | 68 | virtual int size(void) const; |
| 66 | virtual int dim(void) const; | 69 | virtual int dim(void) const; |
| 67 | virtual int naxis(const int& axis) const; | 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 | virtual void read(const GFits& file); | 74 | virtual void read(const GFits& file); |
| 72 | virtual void write(GFits& file) const; | 75 | virtual void write(GFits& file) const; |
| 73 | virtual int number(void) const; | 76 | virtual int number(void) const; |
inst/mwl/pyext/GMWLSpectrum.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GMWLSpectrum.i - Multi-wavelength spectrum class * | 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 | * 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 * |
| @@ -38,7 +38,7 @@ class GMWLSpectrum : public GEventCube { | @@ -38,7 +38,7 @@ class GMWLSpectrum : public GEventCube { | ||
| 38 | public: | 38 | public: |
| 39 | // Constructors and destructors | 39 | // Constructors and destructors |
| 40 | GMWLSpectrum(void); | 40 | GMWLSpectrum(void); |
| 41 | - explicit GMWLSpectrum(const std::string& filename); | 41 | + explicit GMWLSpectrum(const GFilename& filename); |
| 42 | GMWLSpectrum(const GMWLSpectrum& spec); | 42 | GMWLSpectrum(const GMWLSpectrum& spec); |
| 43 | virtual ~GMWLSpectrum(void); | 43 | virtual ~GMWLSpectrum(void); |
| 44 | 44 | ||
| @@ -49,9 +49,9 @@ public: | @@ -49,9 +49,9 @@ public: | ||
| 49 | virtual int size(void) const; | 49 | virtual int size(void) const; |
| 50 | virtual int dim(void) const; | 50 | virtual int dim(void) const; |
| 51 | virtual int naxis(const int& axis) const; | 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 | virtual void read(const GFits& file); | 55 | virtual void read(const GFits& file); |
| 56 | virtual void write(GFits& file) const; | 56 | virtual void write(GFits& file) const; |
| 57 | virtual int number(void) const; | 57 | virtual int number(void) const; |
inst/mwl/src/GMWLSpectrum.cpp
| @@ -81,7 +81,7 @@ GMWLSpectrum::GMWLSpectrum(void) : GEventCube() | @@ -81,7 +81,7 @@ GMWLSpectrum::GMWLSpectrum(void) : GEventCube() | ||
| 81 | * | 81 | * |
| 82 | * Creates instance from file. | 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 | // Initialise members | 86 | // Initialise members |
| 87 | init_members(); | 87 | init_members(); |
| @@ -258,23 +258,20 @@ GMWLSpectrum* GMWLSpectrum::clone(void) const | @@ -258,23 +258,20 @@ GMWLSpectrum* GMWLSpectrum::clone(void) const | ||
| 258 | * | 258 | * |
| 259 | * @todo So far only FITS file support is implemented. | 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 | // Clear object | 263 | // Clear object |
| 267 | clear(); | 264 | clear(); |
| 268 | 265 | ||
| 269 | // Open FITS file | 266 | // Open FITS file |
| 270 | - GFits file(fname.filename()); | 267 | + GFits file(filename.filename()); |
| 271 | 268 | ||
| 272 | // Read spectrum | 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 | else { | 276 | else { |
| 280 | read(file); | 277 | read(file); |
| @@ -296,8 +293,8 @@ void GMWLSpectrum::load(const std::string& filename) | @@ -296,8 +293,8 @@ void GMWLSpectrum::load(const std::string& filename) | ||
| 296 | * | 293 | * |
| 297 | * @todo To be implemented. | 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 | // Return | 299 | // Return |
| 303 | return; | 300 | return; |
pyext/GEnergies.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEnergies.i - Energy container class * | 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 | * 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 * |
| @@ -41,7 +41,7 @@ class GEnergies : public GContainer { | @@ -41,7 +41,7 @@ class GEnergies : public GContainer { | ||
| 41 | public: | 41 | public: |
| 42 | // Constructors and destructors | 42 | // Constructors and destructors |
| 43 | GEnergies(void); | 43 | GEnergies(void); |
| 44 | - explicit GEnergies(const std::string& filename); | 44 | + explicit GEnergies(const GFilename& filename); |
| 45 | GEnergies(const GEnergies& energies); | 45 | GEnergies(const GEnergies& energies); |
| 46 | GEnergies(const int& num, const GEnergy& emin, const GEnergy& emax, | 46 | GEnergies(const int& num, const GEnergy& emin, const GEnergy& emax, |
| 47 | const bool& log = true); | 47 | const bool& log = true); |
| @@ -63,9 +63,9 @@ public: | @@ -63,9 +63,9 @@ public: | ||
| 63 | const GEnergy& emax); | 63 | const GEnergy& emax); |
| 64 | void set_log(const int& num, const GEnergy& emin, | 64 | void set_log(const int& num, const GEnergy& emin, |
| 65 | const GEnergy& emax); | 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 | void read(const GFitsTable& table); | 69 | void read(const GFitsTable& table); |
| 70 | void write(GFits& file, | 70 | void write(GFits& file, |
| 71 | const std::string& extname = "ENERGIES") const; | 71 | const std::string& extname = "ENERGIES") const; |
pyext/GEventCube.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEventCube.i - Abstract event bin container class * | 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 | * 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 * |
| @@ -48,9 +48,9 @@ public: | @@ -48,9 +48,9 @@ public: | ||
| 48 | virtual int size(void) const = 0; | 48 | virtual int size(void) const = 0; |
| 49 | virtual int dim(void) const = 0; | 49 | virtual int dim(void) const = 0; |
| 50 | virtual int naxis(const int& axis) const = 0; | 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 | virtual void read(const GFits& file) = 0; | 54 | virtual void read(const GFits& file) = 0; |
| 55 | virtual void write(GFits& file) const = 0; | 55 | virtual void write(GFits& file) const = 0; |
| 56 | virtual int number(void) const = 0; | 56 | virtual int number(void) const = 0; |
pyext/GEventList.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEventList.i - Abstract event atom container class * | 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 | * 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 * |
| @@ -46,9 +46,9 @@ public: | @@ -46,9 +46,9 @@ public: | ||
| 46 | virtual GEventList* clone(void) const = 0; | 46 | virtual GEventList* clone(void) const = 0; |
| 47 | virtual std::string classname(void) const = 0; | 47 | virtual std::string classname(void) const = 0; |
| 48 | virtual int size(void) const = 0; | 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 | virtual void read(const GFits& file) = 0; | 52 | virtual void read(const GFits& file) = 0; |
| 53 | virtual void write(GFits& file) const = 0; | 53 | virtual void write(GFits& file) const = 0; |
| 54 | virtual int number(void) const = 0; | 54 | virtual int number(void) const = 0; |
pyext/GEvents.i
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEvents.i - Abstract event container class * | 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 | * 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 * |
| @@ -50,9 +50,9 @@ public: | @@ -50,9 +50,9 @@ public: | ||
| 50 | virtual GEvents* clone(void) const = 0; | 50 | virtual GEvents* clone(void) const = 0; |
| 51 | virtual std::string classname(void) const = 0; | 51 | virtual std::string classname(void) const = 0; |
| 52 | virtual int size(void) const = 0; | 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 | virtual void read(const GFits& file) = 0; | 56 | virtual void read(const GFits& file) = 0; |
| 57 | virtual void write(GFits& file) const = 0; | 57 | virtual void write(GFits& file) const = 0; |
| 58 | virtual int number(void) const = 0; | 58 | virtual int number(void) const = 0; |
src/obs/GEnergies.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GEnergies.cpp - Energy container class * | 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 | * 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 * |
| @@ -60,6 +60,8 @@ | @@ -60,6 +60,8 @@ | ||
| 60 | 60 | ||
| 61 | /***********************************************************************//** | 61 | /***********************************************************************//** |
| 62 | * @brief Void constructor | 62 | * @brief Void constructor |
| 63 | + * | ||
| 64 | + * Constructs empty energy container. | ||
| 63 | ***************************************************************************/ | 65 | ***************************************************************************/ |
| 64 | GEnergies::GEnergies(void) | 66 | GEnergies::GEnergies(void) |
| 65 | { | 67 | { |
| @@ -78,7 +80,7 @@ GEnergies::GEnergies(void) | @@ -78,7 +80,7 @@ GEnergies::GEnergies(void) | ||
| 78 | * | 80 | * |
| 79 | * Constructs energy container from a FITS file. | 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 | // Initialise members | 85 | // Initialise members |
| 84 | init_members(); | 86 | init_members(); |
| @@ -95,6 +97,8 @@ GEnergies::GEnergies(const std::string& filename) | @@ -95,6 +97,8 @@ GEnergies::GEnergies(const std::string& filename) | ||
| 95 | * @brief Copy constructor | 97 | * @brief Copy constructor |
| 96 | * | 98 | * |
| 97 | * @param energies Energy container. | 99 | * @param energies Energy container. |
| 100 | + * | ||
| 101 | + * Construct energy container by copying from another energy container. | ||
| 98 | ***************************************************************************/ | 102 | ***************************************************************************/ |
| 99 | GEnergies::GEnergies(const GEnergies& energies) | 103 | GEnergies::GEnergies(const GEnergies& energies) |
| 100 | { | 104 | { |
| @@ -193,7 +197,7 @@ GEnergies& GEnergies::operator=(const GEnergies& energies) | @@ -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 | * Removes all energies from the container. | 202 | * Removes all energies from the container. |
| 199 | ***************************************************************************/ | 203 | ***************************************************************************/ |
| @@ -211,7 +215,7 @@ void GEnergies::clear(void) | @@ -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 | * @return Pointer to deep copy of energy container | 220 | * @return Pointer to deep copy of energy container |
| 217 | * | 221 | * |
| @@ -541,19 +545,16 @@ void GEnergies::set_log(const int& num, | @@ -541,19 +545,16 @@ void GEnergies::set_log(const int& num, | ||
| 541 | * If no extension name is provided, the energies are loaded from the | 545 | * If no extension name is provided, the energies are loaded from the |
| 542 | * "ENERGIES" extension. | 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 | // Allocate FITS file | 550 | // Allocate FITS file |
| 550 | GFits file; | 551 | GFits file; |
| 551 | 552 | ||
| 552 | // Open FITS file | 553 | // Open FITS file |
| 553 | - file.open(fname.filename()); | 554 | + file.open(filename.filename()); |
| 554 | 555 | ||
| 555 | // Get energies table | 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 | // Read energies from table | 559 | // Read energies from table |
| 559 | read(table); | 560 | read(table); |
| @@ -577,19 +578,16 @@ void GEnergies::load(const std::string& filename) | @@ -577,19 +578,16 @@ void GEnergies::load(const std::string& filename) | ||
| 577 | * If no extension name is provided, the energies are saved into an | 578 | * If no extension name is provided, the energies are saved into an |
| 578 | * "ENERGIES" extension. | 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 | // Allocate FITS file | 583 | // Allocate FITS file |
| 586 | GFits file; | 584 | GFits file; |
| 587 | 585 | ||
| 588 | // Write energies to FITS file | 586 | // Write energies to FITS file |
| 589 | - write(file, fname.extname("ENERGIES")); | 587 | + write(file, filename.extname("ENERGIES")); |
| 590 | 588 | ||
| 591 | // Save to file | 589 | // Save to file |
| 592 | - file.saveto(fname.filename(), clobber); | 590 | + file.saveto(filename.filename(), clobber); |
| 593 | 591 | ||
| 594 | // Return | 592 | // Return |
| 595 | return; | 593 | return; |
test/testinst/GTestEventCube.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GTestEventCube.hpp - Test event bin container class * | 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 | * 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 * |
| @@ -40,6 +40,9 @@ | @@ -40,6 +40,9 @@ | ||
| 40 | #include "GFitsTable.hpp" | 40 | #include "GFitsTable.hpp" |
| 41 | #include "GFitsImage.hpp" | 41 | #include "GFitsImage.hpp" |
| 42 | 42 | ||
| 43 | +/* __ Forward declarations _______________________________________________ */ | ||
| 44 | +class GFilename; | ||
| 45 | + | ||
| 43 | 46 | ||
| 44 | /***********************************************************************//** | 47 | /***********************************************************************//** |
| 45 | * @class GTestEventCube | 48 | * @class GTestEventCube |
| @@ -97,16 +100,16 @@ public: | @@ -97,16 +100,16 @@ public: | ||
| 97 | } | 100 | } |
| 98 | virtual GTestEventCube* clone(void) const { return new GTestEventCube(*this);} | 101 | virtual GTestEventCube* clone(void) const { return new GTestEventCube(*this);} |
| 99 | virtual std::string classname(void) const { return "GTestEventCube"; } | 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 | std::string result; | 113 | std::string result; |
| 111 | result.append("=== GTestEventCube ==="); | 114 | result.append("=== GTestEventCube ==="); |
| 112 | result.append("\n"+gammalib::parformat("Number of events")+gammalib::str(number())); | 115 | result.append("\n"+gammalib::parformat("Number of events")+gammalib::str(number())); |
test/testinst/GTestEventList.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GTestEventList.hpp - Test event atom container class * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -34,6 +34,9 @@ | @@ -34,6 +34,9 @@ | ||
| 34 | #include "GTestEventAtom.hpp" | 34 | #include "GTestEventAtom.hpp" |
| 35 | #include "GTestRoi.hpp" | 35 | #include "GTestRoi.hpp" |
| 36 | 36 | ||
| 37 | +/* __ Forward declarations _______________________________________________ */ | ||
| 38 | +class GFilename; | ||
| 39 | + | ||
| 37 | 40 | ||
| 38 | /***********************************************************************//** | 41 | /***********************************************************************//** |
| 39 | * @class GTestEventList | 42 | * @class GTestEventList |
| @@ -93,15 +96,15 @@ public: | @@ -93,15 +96,15 @@ public: | ||
| 93 | virtual GTestEventList* clone(void) const{ | 96 | virtual GTestEventList* clone(void) const{ |
| 94 | return new GTestEventList(*this); | 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 | const GTestRoi* ptr = dynamic_cast<const GTestRoi*>(&roi); | 108 | const GTestRoi* ptr = dynamic_cast<const GTestRoi*>(&roi); |
| 106 | if (ptr == NULL) { | 109 | if (ptr == NULL) { |
| 107 | throw; | 110 | throw; |