Commit 4b8c145e64e9597b767b29aba631853195c0d9e7
1 parent
9abb30cf
Support pickling of LAT classes (#1938)
Showing
52 changed files
with
512 additions
and
124 deletions
NEWS
| ... | ... | @@ -104,6 +104,9 @@ The following methods have been added: |
| 104 | 104 | - GCOMEventBin::ontime(double&) |
| 105 | 105 | - GCOMResponse::write(GFitsImageFloat&) |
| 106 | 106 | - GCOMTim(GGti&) |
| 107 | +- GLATObservation(GXmlElement&) | |
| 108 | +- GLATLtCube::read(GFits&) | |
| 109 | +- GLATLtCube::write(GFits&) | |
| 107 | 110 | - GMWLDatum(GEnergy&, GEnergy&, double&, double&) |
| 108 | 111 | - GMWLDatum::energy(GEnergy&) |
| 109 | 112 | - GMWLDatum::energy_err(GEnergy&) | ... | ... |
inst/com/Makefile.am
| 1 | 1 | ############################################################################# |
| 2 | 2 | # Makefile.am for com module # |
| 3 | 3 | # ------------------------------------------------------------------------- # |
| 4 | -# Copyright (C) 2016-2017 Juergen Knoedlseder # | |
| 4 | +# Copyright (C) 2016-2018 Juergen Knoedlseder # | |
| 5 | 5 | # ------------------------------------------------------------------------- # |
| 6 | 6 | # # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify # |
| ... | ... | @@ -94,17 +94,34 @@ caldb_irfs = caldb/data/cgro/comptel/bcf/module_status.fits.gz \ |
| 94 | 94 | caldb/data/cgro/comptel/bcf/plaw2_10-30MeV_iaq.fits.gz \ |
| 95 | 95 | caldb/data/cgro/comptel/bcf/plaw2_3-10MeV_iaq.fits.gz |
| 96 | 96 | |
| 97 | -# Build libtool library | |
| 98 | -noinst_LTLIBRARIES = libcom.la | |
| 99 | -libcom_la_SOURCES = $(sources) | |
| 100 | -libcom_la_LDFLAGS = | |
| 101 | - | |
| 102 | 97 | # Distribute calibration database files |
| 103 | 98 | caldbindxdir = $(datadir)/caldb/data/cgro/comptel |
| 104 | 99 | caldbindx_DATA = $(caldb_indx) |
| 105 | 100 | caldbirfsdir = $(datadir)/caldb/data/cgro/comptel/bcf |
| 106 | 101 | caldbirfs_DATA = $(caldb_irfs) |
| 107 | 102 | |
| 103 | +# Test data to distribute | |
| 104 | +testdatacom = test/data/obs.xml \ | |
| 105 | + test/data/crab.xml \ | |
| 106 | + test/data/m32171_drx.fits.gz \ | |
| 107 | + test/data/m34997_drg.fits.gz \ | |
| 108 | + test/data/m50439_dre.fits.gz | |
| 109 | +testdatacomdir = $(pyexecdir)/gammalib/tests/com/data | |
| 110 | +testdatacom_DATA = $(testdatacom) | |
| 111 | +testcaldbcom = test/caldb/data/cgro/comptel/caldb.indx | |
| 112 | +testcaldbcomdir = $(pyexecdir)/gammalib/tests/com/caldb/data/cgro/comptel | |
| 113 | +testcaldbcom_DATA = $(testcaldbcom) | |
| 114 | +testirfcom = test/caldb/data/cgro/comptel/bcf/m10371_sda.fits.gz \ | |
| 115 | + test/caldb/data/cgro/comptel/bcf/m10564_sdb.fits.gz \ | |
| 116 | + test/caldb/data/cgro/comptel/bcf/u47569_iaq.fits.gz | |
| 117 | +testirfcomdir = $(pyexecdir)/gammalib/tests/com/caldb/data/cgro/comptel/bcf | |
| 118 | +testirfcom_DATA = $(testirfcom) | |
| 119 | + | |
| 120 | +# Build libtool library | |
| 121 | +noinst_LTLIBRARIES = libcom.la | |
| 122 | +libcom_la_SOURCES = $(sources) | |
| 123 | +libcom_la_LDFLAGS = | |
| 124 | + | |
| 108 | 125 | # Extra files to be distributed in the tar file |
| 109 | 126 | EXTRA_DIST = README.md caldb pyext \ |
| 110 | 127 | include/GCOMLib.hpp \ | ... | ... |
inst/cta/Makefile.am
| 1 | 1 | ############################################################################# |
| 2 | 2 | # Makefile.am for cta module # |
| 3 | 3 | # ------------------------------------------------------------------------- # |
| 4 | -# Copyright (C) 2016 Juergen Knoedlseder # | |
| 4 | +# Copyright (C) 2016-2018 Juergen Knoedlseder # | |
| 5 | 5 | # ------------------------------------------------------------------------- # |
| 6 | 6 | # # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify # |
| ... | ... | @@ -135,6 +135,7 @@ pkginclude_HEADERS = include/GCTATypemaps.hpp \ |
| 135 | 135 | include/GCTAModelRadialAcceptance.hpp \ |
| 136 | 136 | include/GCTALib.hpp |
| 137 | 137 | |
| 138 | + | |
| 138 | 139 | # Build libtool library |
| 139 | 140 | noinst_LTLIBRARIES = libcta.la |
| 140 | 141 | libcta_la_SOURCES = $(sources) |
| ... | ... | @@ -157,6 +158,28 @@ caldb_prod2_south2_DATA = caldb/data/cta/prod2/bcf/South_5h/irf_file.fits.gz |
| 157 | 158 | caldb_prod2_south3dir = $(datadir)/caldb/data/cta/prod2/bcf/South_50h |
| 158 | 159 | caldb_prod2_south3_DATA = caldb/data/cta/prod2/bcf/South_50h/irf_file.fits.gz |
| 159 | 160 | |
| 161 | +# Test data to distribute | |
| 162 | +testdatacta = test/data/irf_1dc.xml \ | |
| 163 | + test/data/irf_unbinned.xml \ | |
| 164 | + test/data/crab_irf.xml \ | |
| 165 | + test/data/onoff_model.xml \ | |
| 166 | + test/data/crab_events.fits.gz \ | |
| 167 | + test/data/crab_cntmap.fits.gz | |
| 168 | +testdatactadir = $(pyexecdir)/gammalib/tests/cta/data | |
| 169 | +testdatacta_DATA = $(testdatacta) | |
| 170 | +testcaldbcta = test/caldb/cta_dummy_irf.dat \ | |
| 171 | + test/caldb/prod1_gauss.fits.gz \ | |
| 172 | + test/caldb/prod1_king.fits.gz | |
| 173 | +testcaldbctadir = $(pyexecdir)/gammalib/tests/cta/caldb | |
| 174 | +testcaldbcta_DATA = $(testcaldbcta) | |
| 175 | +testdc1cta = test/caldb/dc1/arf.fits.gz \ | |
| 176 | + test/caldb/dc1/psf.fits.gz \ | |
| 177 | + test/caldb/dc1/psf_magic.fits.gz \ | |
| 178 | + test/caldb/dc1/rmf.fits.gz | |
| 179 | +testdc1ctadir = $(pyexecdir)/gammalib/tests/cta/caldb/dc1 | |
| 180 | +testdc1cta_DATA = $(testdc1cta) | |
| 181 | + | |
| 182 | + | |
| 160 | 183 | # Extra files to be distributed in the tar file |
| 161 | 184 | EXTRA_DIST = README.md caldb pyext \ |
| 162 | 185 | include/GCTALib.hpp \ | ... | ... |
inst/cta/pyext/GCTAInstDir.i
| ... | ... | @@ -69,8 +69,8 @@ public: |
| 69 | 69 | } |
| 70 | 70 | %pythoncode { |
| 71 | 71 | def __getstate__(self): |
| 72 | - args = self.dir(), self.detx(), self.dety() | |
| 73 | - return args | |
| 72 | + state = self.dir(), self.detx(), self.dety() | |
| 73 | + return state | |
| 74 | 74 | def __setstate__(self, state): |
| 75 | 75 | self.__init__() |
| 76 | 76 | self.dir(state[0]) | ... | ... |
inst/lat/Makefile.am
| ... | ... | @@ -243,11 +243,6 @@ caldb_psf = caldb/data/glast/lat/bcf/psf/psf_P6_v3_diff_front.fits.gz \ |
| 243 | 243 | caldb/data/glast/lat/bcf/psf/psf_P8R2_ULTRACLEAN_V6_FB.fits.gz \ |
| 244 | 244 | caldb/data/glast/lat/bcf/psf/psf_P8R2_ULTRACLEAN_V6_PSF.fits.gz |
| 245 | 245 | |
| 246 | -# Build libtool library | |
| 247 | -noinst_LTLIBRARIES = liblat.la | |
| 248 | -liblat_la_SOURCES = $(sources) | |
| 249 | -liblat_la_LDFLAGS = | |
| 250 | - | |
| 251 | 246 | # Distribute calibration database files |
| 252 | 247 | caldbindxdir = $(datadir)/caldb/data/glast/lat |
| 253 | 248 | caldbindx_DATA = $(caldb_indx) |
| ... | ... | @@ -260,6 +255,67 @@ caldbedisp_DATA = $(caldb_edisp) |
| 260 | 255 | caldbpsfdir = $(datadir)/caldb/data/glast/lat/bcf/psf |
| 261 | 256 | caldbpsf_DATA = $(caldb_psf) |
| 262 | 257 | |
| 258 | +# Test data to distribute | |
| 259 | +testdatalat = test/data/p8v2/binned_expmap.fits.gz \ | |
| 260 | + test/data/p8v2/cntmap.fits.gz \ | |
| 261 | + test/data/p8v2/ft1.fits.gz \ | |
| 262 | + test/data/p8v2/ft2.fits.gz \ | |
| 263 | + test/data/p8v2/iso_P8R2_SOURCE_V6_v06.txt \ | |
| 264 | + test/data/p8v2/ltcube.fits.gz \ | |
| 265 | + test/data/p8v2/modmap.fits.gz \ | |
| 266 | + test/data/p8v2/obs_binned.xml \ | |
| 267 | + test/data/p8v2/obs_unbinned.xml \ | |
| 268 | + test/data/p8v2/source_model.xml \ | |
| 269 | + test/data/p8v2/srcmap.fits.gz | |
| 270 | +testdatalatdir = $(pyexecdir)/gammalib/tests/lat/data/p8v2 | |
| 271 | +testdatalat_DATA = $(testdatalat) | |
| 272 | +testcaldblat = test/caldb/data/glast/lat/caldb.indx.gz | |
| 273 | +testcaldblatdir = $(pyexecdir)/gammalib/tests/lat/caldb/data/glast/lat | |
| 274 | +testcaldblat_DATA = $(testcaldblat) | |
| 275 | +testbcflat = test/caldb/data/glast/lat/bcf/irf_index.fits.gz \ | |
| 276 | + test/caldb/data/glast/lat/bcf/valid_evclass_selections.txt \ | |
| 277 | + test/caldb/data/glast/lat/bcf/valid_evtype_selections.txt | |
| 278 | +testbcflatdir = $(pyexecdir)/gammalib/tests/lat/caldb/data/glast/lat/bcf | |
| 279 | +testbcflat_DATA = $(testbcflat) | |
| 280 | +testealat = test/caldb/data/glast/lat/bcf/ea/aeff_P6_v3_diff_front.fits.gz \ | |
| 281 | + test/caldb/data/glast/lat/bcf/ea/aeff_P6_v3_diff_back.fits.gz \ | |
| 282 | + test/caldb/data/glast/lat/bcf/ea/aeff_P7SOURCE_V6_front.fits.gz \ | |
| 283 | + test/caldb/data/glast/lat/bcf/ea/aeff_P7SOURCE_V6_back.fits.gz \ | |
| 284 | + test/caldb/data/glast/lat/bcf/ea/aeff_P7REP_SOURCE_V15_back.fits.gz \ | |
| 285 | + test/caldb/data/glast/lat/bcf/ea/aeff_P7REP_SOURCE_V15_front.fits.gz \ | |
| 286 | + test/caldb/data/glast/lat/bcf/ea/aeff_P8R2_SOURCE_V6_EDISP.fits.gz \ | |
| 287 | + test/caldb/data/glast/lat/bcf/ea/aeff_P8R2_SOURCE_V6_FB.fits.gz \ | |
| 288 | + test/caldb/data/glast/lat/bcf/ea/aeff_P8R2_SOURCE_V6_PSF.fits.gz | |
| 289 | +testealatdir = $(pyexecdir)/gammalib/tests/lat/caldb/data/glast/lat/bcf/ea | |
| 290 | +testealat_DATA = $(testealat) | |
| 291 | +testedisplat = test/caldb/data/glast/lat/bcf/edisp/edisp_P6_v3_diff_front.fits.gz \ | |
| 292 | + test/caldb/data/glast/lat/bcf/edisp/edisp_P6_v3_diff_back.fits.gz \ | |
| 293 | + test/caldb/data/glast/lat/bcf/edisp/edisp_P7SOURCE_V6_front.fits.gz \ | |
| 294 | + test/caldb/data/glast/lat/bcf/edisp/edisp_P7SOURCE_V6_back.fits.gz \ | |
| 295 | + test/caldb/data/glast/lat/bcf/edisp/edisp_P7REP_SOURCE_V15_back.fits.gz \ | |
| 296 | + test/caldb/data/glast/lat/bcf/edisp/edisp_P7REP_SOURCE_V15_front.fits.gz \ | |
| 297 | + test/caldb/data/glast/lat/bcf/edisp/edisp_P8R2_SOURCE_V6_EDISP.fits.gz \ | |
| 298 | + test/caldb/data/glast/lat/bcf/edisp/edisp_P8R2_SOURCE_V6_FB.fits.gz \ | |
| 299 | + test/caldb/data/glast/lat/bcf/edisp/edisp_P8R2_SOURCE_V6_PSF.fits.gz | |
| 300 | +testedisplatdir = $(pyexecdir)/gammalib/tests/lat/caldb/data/glast/lat/bcf/edisp | |
| 301 | +testedisplat_DATA = $(testedisplat) | |
| 302 | +testpsflat = test/caldb/data/glast/lat/bcf/psf/psf_P6_v3_diff_front.fits.gz \ | |
| 303 | + test/caldb/data/glast/lat/bcf/psf/psf_P6_v3_diff_back.fits.gz \ | |
| 304 | + test/caldb/data/glast/lat/bcf/psf/psf_P7SOURCE_V6_front.fits.gz \ | |
| 305 | + test/caldb/data/glast/lat/bcf/psf/psf_P7SOURCE_V6_back.fits.gz \ | |
| 306 | + test/caldb/data/glast/lat/bcf/psf/psf_P7REP_SOURCE_V15_back.fits.gz \ | |
| 307 | + test/caldb/data/glast/lat/bcf/psf/psf_P7REP_SOURCE_V15_front.fits.gz \ | |
| 308 | + test/caldb/data/glast/lat/bcf/psf/psf_P8R2_SOURCE_V6_EDISP.fits.gz \ | |
| 309 | + test/caldb/data/glast/lat/bcf/psf/psf_P8R2_SOURCE_V6_FB.fits.gz \ | |
| 310 | + test/caldb/data/glast/lat/bcf/psf/psf_P8R2_SOURCE_V6_PSF.fits.gz | |
| 311 | +testpsflatdir = $(pyexecdir)/gammalib/tests/lat/caldb/data/glast/lat/bcf/psf | |
| 312 | +testpsflat_DATA = $(testpsflat) | |
| 313 | + | |
| 314 | +# Build libtool library | |
| 315 | +noinst_LTLIBRARIES = liblat.la | |
| 316 | +liblat_la_SOURCES = $(sources) | |
| 317 | +liblat_la_LDFLAGS = | |
| 318 | + | |
| 263 | 319 | # Extra files to be distributed in the tar file |
| 264 | 320 | EXTRA_DIST = README.md caldb pyext \ |
| 265 | 321 | include/GLATLib.hpp \ | ... | ... |
inst/lat/include/GLATLtCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATLtCube.hpp - Fermi/LAT livetime cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -84,6 +84,8 @@ public: |
| 84 | 84 | void load(const GFilename& filename); |
| 85 | 85 | void save(const GFilename& filename, |
| 86 | 86 | const bool& clobber = false) const; |
| 87 | + void read(const GFits& file); | |
| 88 | + void write(GFits& file) const; | |
| 87 | 89 | std::string print(const GChatter& chatter = NORMAL) const; |
| 88 | 90 | |
| 89 | 91 | private: |
| ... | ... | @@ -91,7 +93,7 @@ private: |
| 91 | 93 | void init_members(void); |
| 92 | 94 | void copy_members(const GLATLtCube& cube); |
| 93 | 95 | void free_members(void); |
| 94 | - | |
| 96 | + | |
| 95 | 97 | // Protected members |
| 96 | 98 | GLATLtCubeMap m_exposure; |
| 97 | 99 | GLATLtCubeMap m_weighted_exposure; | ... | ... |
inst/lat/include/GLATLtCubeMap.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATLtCubeMap.hpp - Fermi LAT livetime cube map class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -30,11 +30,19 @@ |
| 30 | 30 | /* __ Includes ___________________________________________________________ */ |
| 31 | 31 | #include <string> |
| 32 | 32 | #include "GBase.hpp" |
| 33 | -#include "GFitsTable.hpp" | |
| 34 | 33 | #include "GSkyMap.hpp" |
| 35 | -#include "GSkyDir.hpp" | |
| 36 | -#include "GLATAeff.hpp" | |
| 37 | -#include "GLATPsf.hpp" | |
| 34 | + | |
| 35 | +/* __ Forward declarations _______________________________________________ */ | |
| 36 | +class GFits; | |
| 37 | +class GFitsTable; | |
| 38 | +class GSkyDir; | |
| 39 | +class GLATAeff; | |
| 40 | +class GLATPsf; | |
| 41 | + | |
| 42 | +/* __ Constants __________________________________________________________ */ | |
| 43 | +namespace gammalib { | |
| 44 | + const std::string extname_lat_ltcubemap = "EXPOSURE"; | |
| 45 | +} | |
| 38 | 46 | |
| 39 | 47 | /* __ Typedefs ___________________________________________________________ */ |
| 40 | 48 | typedef double (*_ltcube_ctheta)(const double& costheta); |
| ... | ... | @@ -72,7 +80,8 @@ public: |
| 72 | 80 | GLATLtCubeMap* clone(void) const; |
| 73 | 81 | std::string classname(void) const; |
| 74 | 82 | void read(const GFitsTable& table); |
| 75 | - void write(GFits& file) const; | |
| 83 | + void write(GFits& fits, | |
| 84 | + const std::string& extname = gammalib::extname_lat_ltcubemap) const; | |
| 76 | 85 | const int& ncostheta(void) const; |
| 77 | 86 | const int& nphi(void) const; |
| 78 | 87 | bool has_phi(void) const; |
| ... | ... | @@ -87,7 +96,7 @@ private: |
| 87 | 96 | void init_members(void); |
| 88 | 97 | void copy_members(const GLATLtCubeMap& cube); |
| 89 | 98 | void free_members(void); |
| 90 | - | |
| 99 | + | |
| 91 | 100 | // Protected members |
| 92 | 101 | GSkyMap m_map; //!< Lifetime cube map |
| 93 | 102 | int m_num_ctheta; //!< Number of bins in cos theta | ... | ... |
inst/lat/include/GLATObservation.hpp
| ... | ... | @@ -51,6 +51,7 @@ class GLATObservation : public GObservation { |
| 51 | 51 | public: |
| 52 | 52 | // Constructors and destructors |
| 53 | 53 | GLATObservation(void); |
| 54 | + explicit GLATObservation(const GXmlElement& xml); | |
| 54 | 55 | GLATObservation(const GLATObservation& obs); |
| 55 | 56 | virtual ~GLATObservation(void); |
| 56 | 57 | ... | ... |
inst/lat/pyext/GLATAeff.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATAeff.i - Fermi LAT effective area class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -78,4 +78,15 @@ public: |
| 78 | 78 | GLATAeff copy() { |
| 79 | 79 | return (*self); |
| 80 | 80 | } |
| 81 | +%pythoncode { | |
| 82 | + def __getstate__(self): | |
| 83 | + fits = gammalib.GFits() | |
| 84 | + self.write(fits) | |
| 85 | + state = (fits,) | |
| 86 | + return state | |
| 87 | + def __setstate__(self, state): | |
| 88 | + self.__init__() | |
| 89 | + if state[0].size() > 0: | |
| 90 | + self.read(state[0]) | |
| 91 | +} | |
| 81 | 92 | }; | ... | ... |
inst/lat/pyext/GLATEdisp.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEdisp.i - Fermi LAT energy dispersion class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -73,4 +73,15 @@ public: |
| 73 | 73 | GLATEdisp copy() { |
| 74 | 74 | return (*self); |
| 75 | 75 | } |
| 76 | +%pythoncode { | |
| 77 | + def __getstate__(self): | |
| 78 | + fits = gammalib.GFits() | |
| 79 | + self.write(fits) | |
| 80 | + state = (fits,) | |
| 81 | + return state | |
| 82 | + def __setstate__(self, state): | |
| 83 | + self.__init__() | |
| 84 | + if state[0].size() > 0: | |
| 85 | + self.read(state[0]) | |
| 86 | +} | |
| 76 | 87 | }; | ... | ... |
inst/lat/pyext/GLATInstDir.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATInstDir.i - Fermi/LAT instrument direction class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -60,4 +60,11 @@ public: |
| 60 | 60 | GLATInstDir copy() { |
| 61 | 61 | return (*self); |
| 62 | 62 | } |
| 63 | +%pythoncode { | |
| 64 | + def __getstate__(self): | |
| 65 | + state = (self.dir(),) | |
| 66 | + return state | |
| 67 | + def __setstate__(self, state): | |
| 68 | + self.__init__(state[0]) | |
| 69 | +} | |
| 63 | 70 | }; | ... | ... |
inst/lat/pyext/GLATLtCube.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATLtCube.i - Fermi/LAT livetime cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -28,6 +28,13 @@ |
| 28 | 28 | #include "GLATLtCube.hpp" |
| 29 | 29 | %} |
| 30 | 30 | |
| 31 | +/* __ Constants __________________________________________________________ */ | |
| 32 | +namespace gammalib { | |
| 33 | + const std::string extname_lat_exposure = "EXPOSURE"; | |
| 34 | + const std::string extname_lat_wgtexposure = "WEIGHTED_EXPOSURE"; | |
| 35 | + const std::string extname_lat_cthetabounds = "CTHETABOUNDS"; | |
| 36 | +} | |
| 37 | + | |
| 31 | 38 | |
| 32 | 39 | /***********************************************************************//** |
| 33 | 40 | * @class GLATLtCube |
| ... | ... | @@ -61,6 +68,8 @@ public: |
| 61 | 68 | void load(const GFilename& filename); |
| 62 | 69 | void save(const GFilename& filename, |
| 63 | 70 | const bool& clobber = false) const; |
| 71 | + void read(const GFits& file); | |
| 72 | + void write(GFits& file) const; | |
| 64 | 73 | }; |
| 65 | 74 | |
| 66 | 75 | |
| ... | ... | @@ -71,4 +80,15 @@ public: |
| 71 | 80 | GLATLtCube copy() { |
| 72 | 81 | return (*self); |
| 73 | 82 | } |
| 83 | +%pythoncode { | |
| 84 | + def __getstate__(self): | |
| 85 | + fits = gammalib.GFits() | |
| 86 | + self.write(fits) | |
| 87 | + state = (fits,) | |
| 88 | + return state | |
| 89 | + def __setstate__(self, state): | |
| 90 | + self.__init__() | |
| 91 | + if state[0].size() > 3: | |
| 92 | + self.read(state[0]) | |
| 93 | +} | |
| 74 | 94 | }; | ... | ... |
inst/lat/pyext/GLATObservation.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATObservation.i - Fermi/LAT observation class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -38,6 +38,7 @@ class GLATObservation : public GObservation { |
| 38 | 38 | public: |
| 39 | 39 | // Constructors and destructors |
| 40 | 40 | GLATObservation(); |
| 41 | + explicit GLATObservation(const GXmlElement& xml); | |
| 41 | 42 | GLATObservation(const GLATObservation& obs); |
| 42 | 43 | virtual ~GLATObservation(); |
| 43 | 44 | |
| ... | ... | @@ -73,4 +74,17 @@ public: |
| 73 | 74 | GLATObservation copy() { |
| 74 | 75 | return (*self); |
| 75 | 76 | } |
| 77 | +%pythoncode { | |
| 78 | + def __getstate__(self): | |
| 79 | + xml = gammalib.GXmlElement() | |
| 80 | + if self.has_events(): | |
| 81 | + self.write(xml) | |
| 82 | + state = (xml,) | |
| 83 | + return state | |
| 84 | + def __setstate__(self, state): | |
| 85 | + if state[0].elements() == 0: | |
| 86 | + self.__init__() | |
| 87 | + else: | |
| 88 | + self.__init__(state[0]) | |
| 89 | +} | |
| 76 | 90 | }; | ... | ... |
inst/lat/pyext/GLATPsf.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATPsf.i - Fermi LAT point spread function class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -75,4 +75,15 @@ public: |
| 75 | 75 | GLATPsf copy() { |
| 76 | 76 | return (*self); |
| 77 | 77 | } |
| 78 | +%pythoncode { | |
| 79 | + def __getstate__(self): | |
| 80 | + fits = gammalib.GFits() | |
| 81 | + self.write(fits) | |
| 82 | + state = (fits,) | |
| 83 | + return state | |
| 84 | + def __setstate__(self, state): | |
| 85 | + self.__init__() | |
| 86 | + if state[0].size() > 0: | |
| 87 | + self.read(state[0]) | |
| 88 | +} | |
| 78 | 89 | }; | ... | ... |
inst/lat/pyext/GLATRoi.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATRoi.i - Fermi/LAT region of interest class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -63,4 +63,11 @@ public: |
| 63 | 63 | GLATRoi copy() { |
| 64 | 64 | return (*self); |
| 65 | 65 | } |
| 66 | +%pythoncode { | |
| 67 | + def __getstate__(self): | |
| 68 | + state = (self.centre(), self.radius()) | |
| 69 | + return state | |
| 70 | + def __setstate__(self, state): | |
| 71 | + self.__init__(state[0], state[1]) | |
| 72 | +} | |
| 66 | 73 | }; | ... | ... |
inst/lat/src/GLATLtCube.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATLtCube.cpp - Fermi/LAT livetime cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -179,7 +179,7 @@ double GLATLtCube::operator()(const GSkyDir& dir, const GEnergy& energy, |
| 179 | 179 | // energy-dependent efficiency corrections |
| 180 | 180 | /* |
| 181 | 181 | if (aeff.has_efficiency()) { |
| 182 | - | |
| 182 | + | |
| 183 | 183 | // Compute correction factors |
| 184 | 184 | double f1 = aeff.efficiency_factor1(energy); |
| 185 | 185 | double f2 = aeff.efficiency_factor2(energy); |
| ... | ... | @@ -231,7 +231,7 @@ double GLATLtCube::operator()(const GSkyDir& dir, const GEnergy& energy, |
| 231 | 231 | // energy-dependent efficiency corrections |
| 232 | 232 | /* |
| 233 | 233 | if (aeff.has_efficiency()) { |
| 234 | - | |
| 234 | + | |
| 235 | 235 | // Compute correction factors |
| 236 | 236 | double f1 = aeff.efficiency_factor1(energy); |
| 237 | 237 | double f2 = aeff.efficiency_factor2(energy); |
| ... | ... | @@ -277,7 +277,7 @@ double GLATLtCube::operator()(const GSkyDir& dir, const GEnergy& energy, |
| 277 | 277 | // Optionally compute livetime factors for trigger rate- and |
| 278 | 278 | // energy-dependent efficiency corrections |
| 279 | 279 | if (aeff.has_efficiency()) { |
| 280 | - | |
| 280 | + | |
| 281 | 281 | // Compute correction factors |
| 282 | 282 | double f1 = aeff.efficiency_factor1(energy); |
| 283 | 283 | double f2 = aeff.efficiency_factor2(energy); |
| ... | ... | @@ -330,7 +330,7 @@ double GLATLtCube::operator()(const GSkyDir& dir, const GEnergy& energy, |
| 330 | 330 | // Optionally compute livetime factors for trigger rate- and |
| 331 | 331 | // energy-dependent efficiency corrections |
| 332 | 332 | if (aeff.has_efficiency()) { |
| 333 | - | |
| 333 | + | |
| 334 | 334 | // Compute correction factors |
| 335 | 335 | double f1 = aeff.efficiency_factor1(energy); |
| 336 | 336 | double f2 = aeff.efficiency_factor2(energy); |
| ... | ... | @@ -385,10 +385,6 @@ GLATLtCube* GLATLtCube::clone(void) const |
| 385 | 385 | * @brief Load livetime cube from FITS file |
| 386 | 386 | * |
| 387 | 387 | * @param[in] filename FITS file name. |
| 388 | - * | |
| 389 | - * @todo Loading of cos theta boundaries not yet implemented. This is not | |
| 390 | - * critical since they are not really needed. We just need them once | |
| 391 | - * we want to implement also saving. | |
| 392 | 388 | ***************************************************************************/ |
| 393 | 389 | void GLATLtCube::load(const GFilename& filename) |
| 394 | 390 | { |
| ... | ... | @@ -398,6 +394,57 @@ void GLATLtCube::load(const GFilename& filename) |
| 398 | 394 | // Open livetime cube FITS file |
| 399 | 395 | GFits fits(filename); |
| 400 | 396 | |
| 397 | + // Read livetime cube | |
| 398 | + GLATLtCube::read(fits); | |
| 399 | + | |
| 400 | + // Close FITS file | |
| 401 | + fits.close(); | |
| 402 | + | |
| 403 | + // Return | |
| 404 | + return; | |
| 405 | +} | |
| 406 | + | |
| 407 | + | |
| 408 | +/***********************************************************************//** | |
| 409 | + * @brief Save livetime cube into FITS file | |
| 410 | + * | |
| 411 | + * @param[in] filename FITS file name. | |
| 412 | + * @param[in] clobber Overwrite existing file? (default: false) | |
| 413 | + * | |
| 414 | + * @todo Not yet implemented. | |
| 415 | + ***************************************************************************/ | |
| 416 | +void GLATLtCube::save(const GFilename& filename, const bool& clobber) const | |
| 417 | +{ | |
| 418 | + // Create FITS file | |
| 419 | + GFits fits; | |
| 420 | + | |
| 421 | + // Write effective area into file | |
| 422 | + write(fits); | |
| 423 | + | |
| 424 | + // Close FITS file | |
| 425 | + fits.saveto(filename, clobber); | |
| 426 | + | |
| 427 | + // Return | |
| 428 | + return; | |
| 429 | +} | |
| 430 | + | |
| 431 | + | |
| 432 | +/***********************************************************************//** | |
| 433 | + * @brief Read livetime cube from FITS file | |
| 434 | + * | |
| 435 | + * @param[in] fits FITS. | |
| 436 | + * | |
| 437 | + * Reads a livetime cube from a FITS file. | |
| 438 | + * | |
| 439 | + * @todo Reading of cos theta boundaries not yet implemented. This is not | |
| 440 | + * critical since they are not really needed. We just need them once | |
| 441 | + * we want to implement also saving. | |
| 442 | + ***************************************************************************/ | |
| 443 | +void GLATLtCube::read(const GFits& fits) | |
| 444 | +{ | |
| 445 | + // Clear object | |
| 446 | + clear(); | |
| 447 | + | |
| 401 | 448 | // Get HDUs |
| 402 | 449 | const GFitsTable& hdu_exposure = *fits.table(gammalib::extname_lat_exposure); |
| 403 | 450 | const GFitsTable& hdu_weighted_exposure = *fits.table(gammalib::extname_lat_wgtexposure); |
| ... | ... | @@ -411,28 +458,35 @@ void GLATLtCube::load(const GFilename& filename) |
| 411 | 458 | m_weighted_exposure.read(hdu_weighted_exposure); |
| 412 | 459 | |
| 413 | 460 | // Load cos theta boundaries |
| 414 | - | |
| 461 | + | |
| 415 | 462 | // Load GTIs |
| 416 | 463 | m_gti.read(hdu_gti); |
| 417 | 464 | |
| 418 | - // Close FITS file | |
| 419 | - fits.close(); | |
| 420 | - | |
| 421 | 465 | // Return |
| 422 | 466 | return; |
| 423 | 467 | } |
| 424 | 468 | |
| 425 | 469 | |
| 426 | 470 | /***********************************************************************//** |
| 427 | - * @brief Save livetime cube into FITS file | |
| 471 | + * @brief Write livetime cube into FITS file | |
| 428 | 472 | * |
| 429 | - * @param[in] filename FITS file name. | |
| 430 | - * @param[in] clobber Overwrite existing file? (default: false) | |
| 473 | + * @param[in] fits FITS file. | |
| 431 | 474 | * |
| 432 | - * @todo Not yet implemented. | |
| 475 | + * Writes the livetime cube into a FITS file. | |
| 433 | 476 | ***************************************************************************/ |
| 434 | -void GLATLtCube::save(const GFilename& filename, const bool& clobber) const | |
| 477 | +void GLATLtCube::write(GFits& fits) const | |
| 435 | 478 | { |
| 479 | + // Write exposure | |
| 480 | + m_exposure.write(fits, gammalib::extname_lat_exposure); | |
| 481 | + | |
| 482 | + // Write weighted exposure | |
| 483 | + m_weighted_exposure.write(fits, gammalib::extname_lat_wgtexposure); | |
| 484 | + | |
| 485 | + // Write cos theta boundaries | |
| 486 | + | |
| 487 | + // Write GTIs | |
| 488 | + m_gti.write(fits, gammalib::extname_gti); | |
| 489 | + | |
| 436 | 490 | // Return |
| 437 | 491 | return; |
| 438 | 492 | } |
| ... | ... | @@ -441,7 +495,7 @@ void GLATLtCube::save(const GFilename& filename, const bool& clobber) const |
| 441 | 495 | /***********************************************************************//** |
| 442 | 496 | * @brief Print livetime cube information |
| 443 | 497 | * |
| 444 | - * @param[in] chatter Chattiness (defaults to NORMAL). | |
| 498 | + * @param[in] chatter Chattiness. | |
| 445 | 499 | * @return String containing livetime cube information. |
| 446 | 500 | ***************************************************************************/ |
| 447 | 501 | std::string GLATLtCube::print(const GChatter& chatter) const | ... | ... |
inst/lat/src/GLATLtCubeMap.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATLtCubeMap.cpp - Fermi LAT livetime cube map class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -28,10 +28,13 @@ |
| 28 | 28 | #ifdef HAVE_CONFIG_H |
| 29 | 29 | #include <config.h> |
| 30 | 30 | #endif |
| 31 | -#include "GLATLtCubeMap.hpp" | |
| 32 | 31 | #include "GTools.hpp" |
| 33 | 32 | #include "GMath.hpp" |
| 34 | 33 | #include "GEnergy.hpp" |
| 34 | +#include "GFitsBinTable.hpp" | |
| 35 | +#include "GLATAeff.hpp" | |
| 36 | +#include "GLATPsf.hpp" | |
| 37 | +#include "GLATLtCubeMap.hpp" | |
| 35 | 38 | |
| 36 | 39 | /* __ Method name definitions ____________________________________________ */ |
| 37 | 40 | #define G_COSTHETA "GLATLtCubeMap::costheta(int&)" |
| ... | ... | @@ -378,7 +381,7 @@ void GLATLtCubeMap::read(const GFitsTable& table) |
| 378 | 381 | // Clear object |
| 379 | 382 | clear(); |
| 380 | 383 | |
| 381 | - // Load skymap | |
| 384 | + // Read skymap | |
| 382 | 385 | m_map.read(table); |
| 383 | 386 | |
| 384 | 387 | // Set costheta binning scheme |
| ... | ... | @@ -397,14 +400,32 @@ void GLATLtCubeMap::read(const GFitsTable& table) |
| 397 | 400 | |
| 398 | 401 | |
| 399 | 402 | /***********************************************************************//** |
| 400 | - * @brief Save livetime cube map into FITS file | |
| 403 | + * @brief Write livetime cube map into FITS file | |
| 401 | 404 | * |
| 402 | - * @param[in] file FITS file. | |
| 405 | + * @param[in] fits FITS file. | |
| 406 | + * @param[in] extname Livetime cube map extension name. | |
| 403 | 407 | * |
| 404 | - * @todo Not yet implemented. | |
| 408 | + * Writes livetime cube map into a FITS file. | |
| 405 | 409 | ***************************************************************************/ |
| 406 | -void GLATLtCubeMap::write(GFits& file) const | |
| 410 | +void GLATLtCubeMap::write(GFits& fits, const std::string& extname) const | |
| 407 | 411 | { |
| 412 | + // If the FITS file contains already an extension with the same name | |
| 413 | + // then remove this extension now | |
| 414 | + if (fits.contains(extname)) { | |
| 415 | + fits.remove(extname); | |
| 416 | + } | |
| 417 | + | |
| 418 | + // Write sky map info FITS file | |
| 419 | + GFitsHDU* hdu = m_map.write(fits, extname); | |
| 420 | + | |
| 421 | + // If HDU is valid then set sky map keywords | |
| 422 | + if (hdu != NULL) { | |
| 423 | + hdu->card("THETABIN", costhetabin(), "Costheta binning scheme"); | |
| 424 | + hdu->card("NBRBINS", m_num_ctheta, "Number of costheta bins"); | |
| 425 | + hdu->card("PHIBINS", m_num_phi, "Number of phi bins"); | |
| 426 | + hdu->card("COSMIN", m_min_ctheta, "Minimum costheta value"); | |
| 427 | + } | |
| 428 | + | |
| 408 | 429 | // Return |
| 409 | 430 | return; |
| 410 | 431 | } |
| ... | ... | @@ -432,14 +453,16 @@ double GLATLtCubeMap::costheta(const int& index) const |
| 432 | 453 | { |
| 433 | 454 | // Optionally check if the index is valid |
| 434 | 455 | #if defined(G_RANGE_CHECK) |
| 435 | - if (index < 0 || index >= m_num_ctheta) | |
| 456 | + if (index < 0 || index >= m_num_ctheta) { | |
| 436 | 457 | throw GException::out_of_range(G_COSTHETA, index, 0, m_num_ctheta-1); |
| 458 | + } | |
| 437 | 459 | #endif |
| 438 | 460 | |
| 439 | 461 | // Set cos theta scale |
| 440 | 462 | double f = (index+0.5)/m_num_ctheta; |
| 441 | - if (m_sqrt_bin) | |
| 463 | + if (m_sqrt_bin) { | |
| 442 | 464 | f = f*f; |
| 465 | + } | |
| 443 | 466 | |
| 444 | 467 | // Set cos theta value |
| 445 | 468 | double costheta = 1.0 - f * (1.0 - m_min_ctheta); |
| ... | ... | @@ -467,8 +490,9 @@ double GLATLtCubeMap::phi(const int& index) const |
| 467 | 490 | { |
| 468 | 491 | // Optionally check if the index is valid |
| 469 | 492 | #if defined(G_RANGE_CHECK) |
| 470 | - if (index < 0 || index >= m_num_phi) | |
| 493 | + if (index < 0 || index >= m_num_phi) { | |
| 471 | 494 | throw GException::out_of_range(G_PHI, index, 0, m_num_phi-1); |
| 495 | + } | |
| 472 | 496 | #endif |
| 473 | 497 | |
| 474 | 498 | // Set phi value | ... | ... |
inst/lat/src/GLATObservation.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATObservation.cpp - Fermi LAT observation class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2017 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2018 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -75,6 +75,27 @@ GLATObservation::GLATObservation(void) : GObservation() |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | /***********************************************************************//** |
| 78 | + * @brief XML constructor | |
| 79 | + * | |
| 80 | + * @param[in] xml XML element. | |
| 81 | + * | |
| 82 | + * Constructs a LAT observation from the information that is found in an | |
| 83 | + * XML element. | |
| 84 | + ***************************************************************************/ | |
| 85 | +GLATObservation::GLATObservation(const GXmlElement& xml) : GObservation() | |
| 86 | +{ | |
| 87 | + // Initialise members | |
| 88 | + init_members(); | |
| 89 | + | |
| 90 | + // Read XML | |
| 91 | + read(xml); | |
| 92 | + | |
| 93 | + // Return | |
| 94 | + return; | |
| 95 | +} | |
| 96 | + | |
| 97 | + | |
| 98 | +/***********************************************************************//** | |
| 78 | 99 | * @brief Copy constructor |
| 79 | 100 | * |
| 80 | 101 | * @param[in] obs LAT observation. | ... | ... |
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P6_v3_diff_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P6_v3_diff_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P7REP_SOURCE_V15_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P7REP_SOURCE_V15_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P7SOURCE_V6_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P7SOURCE_V6_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P8R2_SOURCE_V6_EDISP.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P8R2_SOURCE_V6_FB.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/ea/aeff_P8R2_SOURCE_V6_PSF.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P6_v3_diff_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P6_v3_diff_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P7REP_SOURCE_V15_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P7REP_SOURCE_V15_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P7SOURCE_V6_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P7SOURCE_V6_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P8R2_SOURCE_V6_EDISP.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P8R2_SOURCE_V6_FB.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/edisp/edisp_P8R2_SOURCE_V6_PSF.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/irf_index.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P6_v3_diff_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P6_v3_diff_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P7REP_SOURCE_V15_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P7REP_SOURCE_V15_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P7SOURCE_V6_back.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P7SOURCE_V6_front.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P8R2_SOURCE_V6_EDISP.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P8R2_SOURCE_V6_FB.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/psf/psf_P8R2_SOURCE_V6_PSF.fits.gz
0 → 100644
No preview for this file type
inst/lat/test/caldb/data/glast/lat/bcf/valid_evclass_selections.txt
0 → 100644
| 1 | +1,2047 | |
| 2 | +2,2046 | |
| 3 | +3,2047 | |
| 4 | +4,2004 | |
| 5 | +5,2047 | |
| 6 | +6,2046 | |
| 7 | +8,2040 | |
| 8 | +9,2047 | |
| 9 | +10,2046 | |
| 10 | +12,2044 | |
| 11 | +16,2000 | |
| 12 | +17,2047 | |
| 13 | +18,2046 | |
| 14 | +20,2004 | |
| 15 | +24,2040 | |
| 16 | +32,2016 | |
| 17 | +33,2047 | |
| 18 | +34,2046 | |
| 19 | +36,2036 | |
| 20 | +40,2040 | |
| 21 | +48,2032 | |
| 22 | +64,1984 | |
| 23 | +65,2047 | |
| 24 | +66,2046 | |
| 25 | +68,2004 | |
| 26 | +72,2040 | |
| 27 | +80,2000 | |
| 28 | +96,2016 | |
| 29 | +128,1920 | |
| 30 | +129,2047 | |
| 31 | +130,2046 | |
| 32 | +132,2004 | |
| 33 | +136,2040 | |
| 34 | +144,2000 | |
| 35 | +160,2016 | |
| 36 | +192,1984 | |
| 37 | +256,1792 | |
| 38 | +257,2047 | |
| 39 | +258,2046 | |
| 40 | +260,2004 | |
| 41 | +264,2040 | |
| 42 | +272,2000 | |
| 43 | +288,2016 | |
| 44 | +320,1984 | |
| 45 | +384,1920 | |
| 46 | +512,1536 | |
| 47 | +513,2047 | |
| 48 | +514,2046 | |
| 49 | +516,2004 | |
| 50 | +520,2040 | |
| 51 | +528,2000 | |
| 52 | +544,2016 | |
| 53 | +576,1984 | |
| 54 | +640,1920 | |
| 55 | +768,1792 | |
| 56 | +1024,1024 | |
| 57 | +1025,2047 | |
| 58 | +1026,2046 | |
| 59 | +1028,2004 | |
| 60 | +1032,2040 | |
| 61 | +1040,2000 | |
| 62 | +1056,2016 | |
| 63 | +1088,1984 | |
| 64 | +1152,1920 | |
| 65 | +1280,1792 | |
| 66 | +1536,1536 | |
| 67 | +32768,98304 | |
| 68 | +32769,100351 | |
| 69 | +32770,100350 | |
| 70 | +32772,100308 | |
| 71 | +32776,100344 | |
| 72 | +32784,100304 | |
| 73 | +32800,100320 | |
| 74 | +32832,100288 | |
| 75 | +32896,100224 | |
| 76 | +33024,100096 | |
| 77 | +33280,99840 | |
| 78 | +33792,99328 | |
| 79 | +65536,65536 | |
| 80 | +65537,67583 | |
| 81 | +65538,67582 | |
| 82 | +65540,67540 | |
| 83 | +65544,67576 | |
| 84 | +65552,67536 | |
| 85 | +65568,67552 | |
| 86 | +65600,67520 | |
| 87 | +65664,67456 | |
| 88 | +65792,67328 | |
| 89 | +66048,67072 | |
| 90 | +66560,66560 | |
| 91 | +98304,98304 | ... | ... |
inst/lat/test/caldb/data/glast/lat/bcf/valid_evtype_selections.txt
0 → 100644
| 1 | +1,1 | |
| 2 | +2,2 | |
| 3 | +3,2047 | |
| 4 | +4,4 | |
| 5 | +8,8 | |
| 6 | +12,12 | |
| 7 | +16,16 | |
| 8 | +20,20 | |
| 9 | +24,24 | |
| 10 | +28,28 | |
| 11 | +32,32 | |
| 12 | +36,36 | |
| 13 | +40,40 | |
| 14 | +44,44 | |
| 15 | +48,48 | |
| 16 | +52,52 | |
| 17 | +56,56 | |
| 18 | +60,2047 | |
| 19 | +64,64 | |
| 20 | +128,128 | |
| 21 | +192,192 | |
| 22 | +256,256 | |
| 23 | +320,320 | |
| 24 | +384,384 | |
| 25 | +448,448 | |
| 26 | +512,512 | |
| 27 | +576,576 | |
| 28 | +640,640 | |
| 29 | +704,704 | |
| 30 | +768,768 | |
| 31 | +832,832 | |
| 32 | +896,896 | |
| 33 | +960,2047 | ... | ... |
inst/lat/test/caldb/data/glast/lat/caldb.indx.gz
0 → 100644
No preview for this file type
inst/lat/test/test_LAT.py
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | 18 | # |
| 19 | 19 | # ========================================================================== |
| 20 | +import os | |
| 20 | 21 | import gammalib |
| 21 | 22 | import test_support |
| 22 | 23 | |
| ... | ... | @@ -92,29 +93,45 @@ class Test(gammalib.GPythonTestSuite): |
| 92 | 93 | """ |
| 93 | 94 | Test class pickeling |
| 94 | 95 | """ |
| 96 | + # Set CALDB | |
| 97 | + os.environ['CALDB'] = os.environ['TEST_LAT_DATA']+'/../caldb' | |
| 98 | + | |
| 95 | 99 | # Perform pickeling tests of empty classes |
| 96 | - #test_support._pickeling(self, gammalib.GLATAeff()) | |
| 97 | - #test_support._pickeling(self, gammalib.GLATEdisp()) | |
| 98 | - #test_support._pickeling(self, gammalib.GLATEfficiency()) | |
| 100 | + test_support._pickeling(self, gammalib.GLATAeff()) | |
| 101 | + test_support._pickeling(self, gammalib.GLATEdisp()) | |
| 99 | 102 | #test_support._pickeling(self, gammalib.GLATEventAtom()) |
| 100 | 103 | #test_support._pickeling(self, gammalib.GLATEventBin()) |
| 101 | 104 | #test_support._pickeling(self, gammalib.GLATEventCube()) |
| 102 | 105 | #test_support._pickeling(self, gammalib.GLATEventList()) |
| 103 | - #test_support._pickeling(self, gammalib.GLATInstDir()) | |
| 104 | - #test_support._pickeling(self, gammalib.GLATLtCube()) | |
| 105 | - #test_support._pickeling(self, gammalib.GLATLtCubeMap()) | |
| 106 | - #test_support._pickeling(self, gammalib.GLATMeanPsf()) | |
| 107 | - #test_support._pickeling(self, gammalib.GLATObservation()) | |
| 108 | - #test_support._pickeling(self, gammalib.GLATPsf()) | |
| 109 | - #test_support._pickeling(self, gammalib.GLATPsfV1()) | |
| 110 | - #test_support._pickeling(self, gammalib.GLATPsfV3()) | |
| 106 | + test_support._pickeling(self, gammalib.GLATInstDir()) | |
| 107 | + test_support._pickeling(self, gammalib.GLATLtCube()) | |
| 108 | + test_support._pickeling(self, gammalib.GLATObservation()) | |
| 109 | + test_support._pickeling(self, gammalib.GLATPsf()) | |
| 111 | 110 | #test_support._pickeling(self, gammalib.GLATResponse()) |
| 112 | - #test_support._pickeling(self, gammalib.GLATResponseTable()) | |
| 113 | - #test_support._pickeling(self, gammalib.GLATRoi()) | |
| 111 | + test_support._pickeling(self, gammalib.GLATRoi()) | |
| 114 | 112 | |
| 115 | 113 | # Setup test |
| 114 | + datadir = os.environ['TEST_LAT_DATA'] + '/p8v2' | |
| 115 | + ltcube = datadir + '/ltcube.fits' | |
| 116 | + unbinned = gammalib.GObservations(datadir + '/obs_unbinned.xml') | |
| 117 | + binned = gammalib.GObservations(datadir + '/obs_binned.xml') | |
| 118 | + dir = gammalib.GSkyDir() | |
| 119 | + instdir = gammalib.GLATInstDir(dir) | |
| 116 | 120 | |
| 117 | 121 | # Perform pickeling tests of filled classes |
| 122 | + #test_support._pickeling(self, gammalib.GLATAeff()) # No test data | |
| 123 | + #test_support._pickeling(self, gammalib.GLATEdisp()) # No test data | |
| 124 | + #test_support._pickeling(self, gammalib.GLATEventAtom()) | |
| 125 | + #test_support._pickeling(self, gammalib.GLATEventBin()) | |
| 126 | + #test_support._pickeling(self, gammalib.GLATEventCube()) | |
| 127 | + #test_support._pickeling(self, gammalib.GLATEventList()) | |
| 128 | + test_support._pickeling(self, gammalib.GLATInstDir(dir)) | |
| 129 | + test_support._pickeling(self, gammalib.GLATLtCube(ltcube)) | |
| 130 | + test_support._pickeling(self, gammalib.GLATObservation(unbinned[0])) | |
| 131 | + test_support._pickeling(self, gammalib.GLATObservation(binned[0])) | |
| 132 | + #test_support._pickeling(self, gammalib.GLATPsf()) # No test data | |
| 133 | + #test_support._pickeling(self, gammalib.GLATResponse()) | |
| 134 | + test_support._pickeling(self, gammalib.GLATRoi(instdir, 2.0)) | |
| 118 | 135 | |
| 119 | 136 | # Return |
| 120 | 137 | return | ... | ... |
inst/mwl/Makefile.am
| 1 | 1 | ############################################################################# |
| 2 | -# Makefile.am for com module # | |
| 2 | +# Makefile.am for mwl module # | |
| 3 | 3 | # ------------------------------------------------------------------------- # |
| 4 | -# Copyright (C) 2016 Juergen Knoedlseder # | |
| 4 | +# Copyright (C) 2016-2018 Juergen Knoedlseder # | |
| 5 | 5 | # ------------------------------------------------------------------------- # |
| 6 | 6 | # # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify # |
| ... | ... | @@ -53,6 +53,11 @@ noinst_LTLIBRARIES = libmwl.la |
| 53 | 53 | libmwl_la_SOURCES = $(sources) |
| 54 | 54 | libmwl_la_LDFLAGS = |
| 55 | 55 | |
| 56 | +# Test data to distribute | |
| 57 | +testdatamwl = test/data/crab_mwl.fits | |
| 58 | +testdatamwldir = $(pyexecdir)/gammalib/tests/mwl/data | |
| 59 | +testdatamwl_DATA = $(testdatamwl) | |
| 60 | + | |
| 56 | 61 | # Extra files to be distributed in the tar file |
| 57 | 62 | EXTRA_DIST = README.md pyext \ |
| 58 | 63 | include/GMWLLib.hpp \ | ... | ... |
pyext/Makefile.am
| ... | ... | @@ -142,55 +142,6 @@ testcaldbidx_DATA = $(testcaldbidx) |
| 142 | 142 | testcaldbbcfdir = $(pyexecdir)/gammalib/tests/data/caldb/data/cta/prod2/bcf/North_0.5h |
| 143 | 143 | testcaldbbcf_DATA = $(testcaldbbcf) |
| 144 | 144 | |
| 145 | -# Distribute MWL test data (optionally) | |
| 146 | -if WITH_INST_MWL | |
| 147 | - testdatamwl = $(top_srcdir)/inst/mwl/test/data/crab_mwl.fits | |
| 148 | - testdatamwldir = $(pyexecdir)/gammalib/tests/mwl/data | |
| 149 | - testdatamwl_DATA = $(testdatamwl) | |
| 150 | -endif | |
| 151 | - | |
| 152 | -# Distribute CTA test data (optionally) | |
| 153 | -if WITH_INST_CTA | |
| 154 | - testdatacta = $(top_srcdir)/inst/cta/test/data/irf_1dc.xml \ | |
| 155 | - $(top_srcdir)/inst/cta/test/data/irf_unbinned.xml \ | |
| 156 | - $(top_srcdir)/inst/cta/test/data/crab_irf.xml \ | |
| 157 | - $(top_srcdir)/inst/cta/test/data/onoff_model.xml \ | |
| 158 | - $(top_srcdir)/inst/cta/test/data/crab_events.fits.gz \ | |
| 159 | - $(top_srcdir)/inst/cta/test/data/crab_cntmap.fits.gz | |
| 160 | - testdatactadir = $(pyexecdir)/gammalib/tests/cta/data | |
| 161 | - testdatacta_DATA = $(testdatacta) | |
| 162 | - testcaldbcta = $(top_srcdir)/inst/cta/test/caldb/cta_dummy_irf.dat \ | |
| 163 | - $(top_srcdir)/inst/cta/test/caldb/prod1_gauss.fits.gz \ | |
| 164 | - $(top_srcdir)/inst/cta/test/caldb/prod1_king.fits.gz | |
| 165 | - testcaldbctadir = $(pyexecdir)/gammalib/tests/cta/caldb | |
| 166 | - testcaldbcta_DATA = $(testcaldbcta) | |
| 167 | - testdc1cta = $(top_srcdir)/inst/cta/test/caldb/dc1/arf.fits.gz \ | |
| 168 | - $(top_srcdir)/inst/cta/test/caldb/dc1/psf.fits.gz \ | |
| 169 | - $(top_srcdir)/inst/cta/test/caldb/dc1/psf_magic.fits.gz \ | |
| 170 | - $(top_srcdir)/inst/cta/test/caldb/dc1/rmf.fits.gz | |
| 171 | - testdc1ctadir = $(pyexecdir)/gammalib/tests/cta/caldb/dc1 | |
| 172 | - testdc1cta_DATA = $(testdc1cta) | |
| 173 | -endif | |
| 174 | - | |
| 175 | -# Distribute COM test data (optionally) | |
| 176 | -if WITH_INST_COM | |
| 177 | - testdatacom = $(top_srcdir)/inst/com/test/data/obs.xml \ | |
| 178 | - $(top_srcdir)/inst/com/test/data/crab.xml \ | |
| 179 | - $(top_srcdir)/inst/com/test/data/m32171_drx.fits.gz \ | |
| 180 | - $(top_srcdir)/inst/com/test/data/m34997_drg.fits.gz \ | |
| 181 | - $(top_srcdir)/inst/com/test/data/m50439_dre.fits.gz | |
| 182 | - testdatacomdir = $(pyexecdir)/gammalib/tests/com/data | |
| 183 | - testdatacom_DATA = $(testdatacom) | |
| 184 | - testcaldbcom = $(top_srcdir)/inst/com/test/caldb/data/cgro/comptel/caldb.indx | |
| 185 | - testcaldbcomdir = $(pyexecdir)/gammalib/tests/com/caldb/data/cgro/comptel | |
| 186 | - testcaldbcom_DATA = $(testcaldbcom) | |
| 187 | - testirfcom = $(top_srcdir)/inst/com/test/caldb/data/cgro/comptel/bcf/m10371_sda.fits.gz \ | |
| 188 | - $(top_srcdir)/inst/com/test/caldb/data/cgro/comptel/bcf/m10564_sdb.fits.gz \ | |
| 189 | - $(top_srcdir)/inst/com/test/caldb/data/cgro/comptel/bcf/u47569_iaq.fits.gz | |
| 190 | - testirfcomdir = $(pyexecdir)/gammalib/tests/com/caldb/data/cgro/comptel/bcf | |
| 191 | - testirfcom_DATA = $(testirfcom) | |
| 192 | -endif | |
| 193 | - | |
| 194 | 145 | # If building of Python wrappers was requested then add them to the build |
| 195 | 146 | # source |
| 196 | 147 | if BUILD_WRAPPERS | ... | ... |