Commit 04d8c1544567403c3a2560b5ed4f60f475005069
1 parent
7f7a1d41
add LAT observation class
Showing
7 changed files
with
129 additions
and
9 deletions
include/GLATObservation.hpp
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | 21 | ||
| 22 | /* __ Includes ___________________________________________________________ */ | 22 | /* __ Includes ___________________________________________________________ */ |
| 23 | #include "GObservation.hpp" | 23 | #include "GObservation.hpp" |
| 24 | +#include "GFits.hpp" | ||
| 24 | 25 | ||
| 25 | /* __ Namespaces _________________________________________________________ */ | 26 | /* __ Namespaces _________________________________________________________ */ |
| 26 | 27 | ||
| @@ -35,24 +36,30 @@ class GLATObservation : public GObservation { | @@ -35,24 +36,30 @@ class GLATObservation : public GObservation { | ||
| 35 | public: | 36 | public: |
| 36 | // Constructors and destructors | 37 | // Constructors and destructors |
| 37 | GLATObservation(); | 38 | GLATObservation(); |
| 39 | + GLATObservation(const std::string& ft1name, const std::string& ft2name); | ||
| 38 | GLATObservation(const GLATObservation& obs); | 40 | GLATObservation(const GLATObservation& obs); |
| 39 | virtual ~GLATObservation(); | 41 | virtual ~GLATObservation(); |
| 40 | 42 | ||
| 41 | // Operators | 43 | // Operators |
| 42 | - virtual GLATObservation& operator= (const GLATObservation& obs); | 44 | + GLATObservation& operator= (const GLATObservation& obs); |
| 43 | 45 | ||
| 44 | // Methods | 46 | // Methods |
| 47 | + GFits* ft1(void) const; | ||
| 48 | + GFits* ft2(void) const; | ||
| 45 | 49 | ||
| 46 | protected: | 50 | protected: |
| 47 | // Protected methods | 51 | // Protected methods |
| 48 | - void init_members(void); | ||
| 49 | - void copy_members(const GLATObservation& obs); | ||
| 50 | - void free_members(void); | ||
| 51 | - virtual GLATObservation* clone(void) const; | 52 | + void init_members(void); |
| 53 | + void copy_members(const GLATObservation& obs); | ||
| 54 | + void free_members(void); | ||
| 55 | + GLATObservation* clone(void) const; | ||
| 52 | 56 | ||
| 53 | // Protected data area | 57 | // Protected data area |
| 54 | 58 | ||
| 55 | private: | 59 | private: |
| 60 | + GFits* m_ft1; //!< FT1 FITS file | ||
| 61 | + GFits* m_ft2; //!< FT2 FITS file | ||
| 62 | + GFits* m_ltcube; //!< Lifetime cube FITS file | ||
| 56 | }; | 63 | }; |
| 57 | 64 | ||
| 58 | #endif /* GLATOBSERVATION_HPP */ | 65 | #endif /* GLATOBSERVATION_HPP */ |
include/Makefile.am
| @@ -17,6 +17,7 @@ pkginclude_HEADERS = GammaLib.hpp \ | @@ -17,6 +17,7 @@ pkginclude_HEADERS = GammaLib.hpp \ | ||
| 17 | GFitsAsciiTable.hpp \ | 17 | GFitsAsciiTable.hpp \ |
| 18 | GFitsBinTable.hpp \ | 18 | GFitsBinTable.hpp \ |
| 19 | GFitsTableCol.hpp \ | 19 | GFitsTableCol.hpp \ |
| 20 | + GFitsTableLogCol.hpp \ | ||
| 20 | GFitsTableStrCol.hpp \ | 21 | GFitsTableStrCol.hpp \ |
| 21 | GFitsTableShtCol.hpp \ | 22 | GFitsTableShtCol.hpp \ |
| 22 | GFitsTableLngCol.hpp \ | 23 | GFitsTableLngCol.hpp \ |
include/Makefile.in
| @@ -123,6 +123,7 @@ pkginclude_HEADERS = GammaLib.hpp \ | @@ -123,6 +123,7 @@ pkginclude_HEADERS = GammaLib.hpp \ | ||
| 123 | GFitsAsciiTable.hpp \ | 123 | GFitsAsciiTable.hpp \ |
| 124 | GFitsBinTable.hpp \ | 124 | GFitsBinTable.hpp \ |
| 125 | GFitsTableCol.hpp \ | 125 | GFitsTableCol.hpp \ |
| 126 | + GFitsTableLogCol.hpp \ | ||
| 126 | GFitsTableStrCol.hpp \ | 127 | GFitsTableStrCol.hpp \ |
| 127 | GFitsTableShtCol.hpp \ | 128 | GFitsTableShtCol.hpp \ |
| 128 | GFitsTableLngCol.hpp \ | 129 | GFitsTableLngCol.hpp \ |
pyext/GLATObservation.i
0 → 100644
| 1 | +/*************************************************************************** | ||
| 2 | + * GLATObservation.i - LAT Observation class SWIG interface * | ||
| 3 | + * ----------------------------------------------------------------------- * | ||
| 4 | + * copyright : (C) 2008 by Jurgen Knodlseder * | ||
| 5 | + * ----------------------------------------------------------------------- * | ||
| 6 | + * * | ||
| 7 | + * This program is free software; you can redistribute it and/or modify * | ||
| 8 | + * it under the terms of the GNU General Public License as published by * | ||
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | ||
| 10 | + * (at your option) any later version. * | ||
| 11 | + * * | ||
| 12 | + ***************************************************************************/ | ||
| 13 | +/** | ||
| 14 | + * @file GLATObservation.i | ||
| 15 | + * @brief GLATObservation class SWIG file. | ||
| 16 | + * @author J. Knodlseder | ||
| 17 | + */ | ||
| 18 | +%{ | ||
| 19 | +/* Put headers and other declarations here that are needed for compilation */ | ||
| 20 | +#include "GLATObservation.hpp" | ||
| 21 | +%} | ||
| 22 | +%include stl.i | ||
| 23 | +%feature("notabstract") GLATObservation; | ||
| 24 | +%import GObservation.i | ||
| 25 | + | ||
| 26 | +/***********************************************************************//** | ||
| 27 | + * @class GLATObservation | ||
| 28 | + * | ||
| 29 | + * @brief Interface for the LAT observation classes. | ||
| 30 | + ***************************************************************************/ | ||
| 31 | +class GLATObservation : public GObservation { | ||
| 32 | +public: | ||
| 33 | + // Constructors and destructors | ||
| 34 | + GLATObservation(); | ||
| 35 | + GLATObservation(const std::string& ft1name, const std::string& ft2name); | ||
| 36 | + GLATObservation(const GLATObservation& obs); | ||
| 37 | + virtual ~GLATObservation(); | ||
| 38 | + | ||
| 39 | + // Methods | ||
| 40 | + GFits* ft1(void) const; | ||
| 41 | + GFits* ft2(void) const; | ||
| 42 | +}; | ||
| 43 | + |
src/Makefile.am
| @@ -30,6 +30,7 @@ files = GException.cpp \ | @@ -30,6 +30,7 @@ files = GException.cpp \ | ||
| 30 | fits/GFitsAsciiTable.cpp \ | 30 | fits/GFitsAsciiTable.cpp \ |
| 31 | fits/GFitsBinTable.cpp \ | 31 | fits/GFitsBinTable.cpp \ |
| 32 | fits/GFitsTableCol.cpp \ | 32 | fits/GFitsTableCol.cpp \ |
| 33 | + fits/GFitsTableLogCol.cpp \ | ||
| 33 | fits/GFitsTableStrCol.cpp \ | 34 | fits/GFitsTableStrCol.cpp \ |
| 34 | fits/GFitsTableShtCol.cpp \ | 35 | fits/GFitsTableShtCol.cpp \ |
| 35 | fits/GFitsTableLngCol.cpp \ | 36 | fits/GFitsTableLngCol.cpp \ |
src/Makefile.in
| @@ -135,6 +135,7 @@ files = GException.cpp \ | @@ -135,6 +135,7 @@ files = GException.cpp \ | ||
| 135 | fits/GFitsAsciiTable.cpp \ | 135 | fits/GFitsAsciiTable.cpp \ |
| 136 | fits/GFitsBinTable.cpp \ | 136 | fits/GFitsBinTable.cpp \ |
| 137 | fits/GFitsTableCol.cpp \ | 137 | fits/GFitsTableCol.cpp \ |
| 138 | + fits/GFitsTableLogCol.cpp \ | ||
| 138 | fits/GFitsTableStrCol.cpp \ | 139 | fits/GFitsTableStrCol.cpp \ |
| 139 | fits/GFitsTableShtCol.cpp \ | 140 | fits/GFitsTableShtCol.cpp \ |
| 140 | fits/GFitsTableLngCol.cpp \ | 141 | fits/GFitsTableLngCol.cpp \ |
| @@ -169,10 +170,11 @@ am__objects_1 = GException.lo GTools.lo GSkyDir.lo GNodeArray.lo \ | @@ -169,10 +170,11 @@ am__objects_1 = GException.lo GTools.lo GSkyDir.lo GNodeArray.lo \ | ||
| 169 | GLATObservation.lo GFitsHeaderCard.lo GFitsHeader.lo \ | 170 | GLATObservation.lo GFitsHeaderCard.lo GFitsHeader.lo \ |
| 170 | GFitsData.lo GFitsImage.lo GFitsDblImage.lo GFitsTable.lo \ | 171 | GFitsData.lo GFitsImage.lo GFitsDblImage.lo GFitsTable.lo \ |
| 171 | GFitsAsciiTable.lo GFitsBinTable.lo GFitsTableCol.lo \ | 172 | GFitsAsciiTable.lo GFitsBinTable.lo GFitsTableCol.lo \ |
| 172 | - GFitsTableStrCol.lo GFitsTableShtCol.lo GFitsTableLngCol.lo \ | ||
| 173 | - GFitsTableFltCol.lo GFitsTableDblCol.lo GFitsHDU.lo GFits.lo \ | ||
| 174 | - GFitPar.lo GVector.lo GMatrixBase.lo GMatrix.lo GSymMatrix.lo \ | ||
| 175 | - GSparseMatrix.lo GSparseSymbolic.lo GSparseNumeric.lo | 173 | + GFitsTableLogCol.lo GFitsTableStrCol.lo GFitsTableShtCol.lo \ |
| 174 | + GFitsTableLngCol.lo GFitsTableFltCol.lo GFitsTableDblCol.lo \ | ||
| 175 | + GFitsHDU.lo GFits.lo GFitPar.lo GVector.lo GMatrixBase.lo \ | ||
| 176 | + GMatrix.lo GSymMatrix.lo GSparseMatrix.lo GSparseSymbolic.lo \ | ||
| 177 | + GSparseNumeric.lo | ||
| 176 | am_libgamma_la_OBJECTS = $(am__objects_1) | 178 | am_libgamma_la_OBJECTS = $(am__objects_1) |
| 177 | libgamma_la_OBJECTS = $(am_libgamma_la_OBJECTS) | 179 | libgamma_la_OBJECTS = $(am_libgamma_la_OBJECTS) |
| 178 | 180 | ||
| @@ -251,6 +253,7 @@ GFitsTable.lo: fits/GFitsTable.cpp | @@ -251,6 +253,7 @@ GFitsTable.lo: fits/GFitsTable.cpp | ||
| 251 | GFitsAsciiTable.lo: fits/GFitsAsciiTable.cpp | 253 | GFitsAsciiTable.lo: fits/GFitsAsciiTable.cpp |
| 252 | GFitsBinTable.lo: fits/GFitsBinTable.cpp | 254 | GFitsBinTable.lo: fits/GFitsBinTable.cpp |
| 253 | GFitsTableCol.lo: fits/GFitsTableCol.cpp | 255 | GFitsTableCol.lo: fits/GFitsTableCol.cpp |
| 256 | +GFitsTableLogCol.lo: fits/GFitsTableLogCol.cpp | ||
| 254 | GFitsTableStrCol.lo: fits/GFitsTableStrCol.cpp | 257 | GFitsTableStrCol.lo: fits/GFitsTableStrCol.cpp |
| 255 | GFitsTableShtCol.lo: fits/GFitsTableShtCol.cpp | 258 | GFitsTableShtCol.lo: fits/GFitsTableShtCol.cpp |
| 256 | GFitsTableLngCol.lo: fits/GFitsTableLngCol.cpp | 259 | GFitsTableLngCol.lo: fits/GFitsTableLngCol.cpp |
| @@ -446,6 +449,15 @@ GFitsTableCol.obj: fits/GFitsTableCol.cpp | @@ -446,6 +449,15 @@ GFitsTableCol.obj: fits/GFitsTableCol.cpp | ||
| 446 | GFitsTableCol.lo: fits/GFitsTableCol.cpp | 449 | GFitsTableCol.lo: fits/GFitsTableCol.cpp |
| 447 | $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GFitsTableCol.lo `test -f 'fits/GFitsTableCol.cpp' || echo '$(srcdir)/'`fits/GFitsTableCol.cpp | 450 | $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GFitsTableCol.lo `test -f 'fits/GFitsTableCol.cpp' || echo '$(srcdir)/'`fits/GFitsTableCol.cpp |
| 448 | 451 | ||
| 452 | +GFitsTableLogCol.o: fits/GFitsTableLogCol.cpp | ||
| 453 | + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GFitsTableLogCol.o `test -f 'fits/GFitsTableLogCol.cpp' || echo '$(srcdir)/'`fits/GFitsTableLogCol.cpp | ||
| 454 | + | ||
| 455 | +GFitsTableLogCol.obj: fits/GFitsTableLogCol.cpp | ||
| 456 | + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GFitsTableLogCol.obj `cygpath -w fits/GFitsTableLogCol.cpp` | ||
| 457 | + | ||
| 458 | +GFitsTableLogCol.lo: fits/GFitsTableLogCol.cpp | ||
| 459 | + $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GFitsTableLogCol.lo `test -f 'fits/GFitsTableLogCol.cpp' || echo '$(srcdir)/'`fits/GFitsTableLogCol.cpp | ||
| 460 | + | ||
| 449 | GFitsTableStrCol.o: fits/GFitsTableStrCol.cpp | 461 | GFitsTableStrCol.o: fits/GFitsTableStrCol.cpp |
| 450 | $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GFitsTableStrCol.o `test -f 'fits/GFitsTableStrCol.cpp' || echo '$(srcdir)/'`fits/GFitsTableStrCol.cpp | 462 | $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GFitsTableStrCol.o `test -f 'fits/GFitsTableStrCol.cpp' || echo '$(srcdir)/'`fits/GFitsTableStrCol.cpp |
| 451 | 463 |
src/obs/GLATObservation.cpp
| @@ -54,6 +54,31 @@ GLATObservation::GLATObservation() : GObservation() | @@ -54,6 +54,31 @@ GLATObservation::GLATObservation() : GObservation() | ||
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | /***********************************************************************//** | 56 | /***********************************************************************//** |
| 57 | + * @brief Constructor | ||
| 58 | + * | ||
| 59 | + * @param[in] ft1name FT1 FITS filename. | ||
| 60 | + * @param[in] ft2name FT2 FITS filename. | ||
| 61 | + ***************************************************************************/ | ||
| 62 | +GLATObservation::GLATObservation(const std::string& ft1name, | ||
| 63 | + const std::string& ft2name) : GObservation() | ||
| 64 | +{ | ||
| 65 | + // Initialise class members for clean destruction | ||
| 66 | + init_members(); | ||
| 67 | + | ||
| 68 | + // Allocate FT1 & FT2 FITS files | ||
| 69 | + m_ft1 = new GFits; | ||
| 70 | + m_ft2 = new GFits; | ||
| 71 | + | ||
| 72 | + // Open FT1 & FT2 FITS files | ||
| 73 | + m_ft1->open(ft1name); | ||
| 74 | + m_ft2->open(ft2name); | ||
| 75 | + | ||
| 76 | + // Return | ||
| 77 | + return; | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | + | ||
| 81 | +/***********************************************************************//** | ||
| 57 | * @brief Copy constructor | 82 | * @brief Copy constructor |
| 58 | * | 83 | * |
| 59 | * @param[in] obs Observation from which the instance should be built. | 84 | * @param[in] obs Observation from which the instance should be built. |
| @@ -125,6 +150,25 @@ GLATObservation& GLATObservation::operator= (const GLATObservation& obs) | @@ -125,6 +150,25 @@ GLATObservation& GLATObservation::operator= (const GLATObservation& obs) | ||
| 125 | = = | 150 | = = |
| 126 | ==========================================================================*/ | 151 | ==========================================================================*/ |
| 127 | 152 | ||
| 153 | +/***********************************************************************//** | ||
| 154 | + * @brief Return pointer to FT1 file. | ||
| 155 | + ***************************************************************************/ | ||
| 156 | +GFits* GLATObservation::ft1(void) const | ||
| 157 | +{ | ||
| 158 | + // Return FT1 pointer | ||
| 159 | + return m_ft1; | ||
| 160 | +} | ||
| 161 | + | ||
| 162 | + | ||
| 163 | +/***********************************************************************//** | ||
| 164 | + * @brief Return pointer to FT2 file. | ||
| 165 | + ***************************************************************************/ | ||
| 166 | +GFits* GLATObservation::ft2(void) const | ||
| 167 | +{ | ||
| 168 | + // Return FT2 pointer | ||
| 169 | + return m_ft2; | ||
| 170 | +} | ||
| 171 | + | ||
| 128 | 172 | ||
| 129 | /*========================================================================== | 173 | /*========================================================================== |
| 130 | = = | 174 | = = |
| @@ -138,6 +182,9 @@ GLATObservation& GLATObservation::operator= (const GLATObservation& obs) | @@ -138,6 +182,9 @@ GLATObservation& GLATObservation::operator= (const GLATObservation& obs) | ||
| 138 | void GLATObservation::init_members(void) | 182 | void GLATObservation::init_members(void) |
| 139 | { | 183 | { |
| 140 | // Initialise members | 184 | // Initialise members |
| 185 | + m_ft1 = NULL; | ||
| 186 | + m_ft2 = NULL; | ||
| 187 | + m_ltcube = NULL; | ||
| 141 | 188 | ||
| 142 | // Return | 189 | // Return |
| 143 | return; | 190 | return; |
| @@ -164,6 +211,14 @@ void GLATObservation::copy_members(const GLATObservation& obs) | @@ -164,6 +211,14 @@ void GLATObservation::copy_members(const GLATObservation& obs) | ||
| 164 | void GLATObservation::free_members(void) | 211 | void GLATObservation::free_members(void) |
| 165 | { | 212 | { |
| 166 | // Free members | 213 | // Free members |
| 214 | + if (m_ft1 != NULL) delete m_ft1; | ||
| 215 | + if (m_ft2 != NULL) delete m_ft2; | ||
| 216 | + if (m_ltcube != NULL) delete m_ltcube; | ||
| 217 | + | ||
| 218 | + // Mark memory as free | ||
| 219 | + m_ft1 = NULL; | ||
| 220 | + m_ft2 = NULL; | ||
| 221 | + m_ltcube = NULL; | ||
| 167 | 222 | ||
| 168 | // Return | 223 | // Return |
| 169 | return; | 224 | return; |