Commit 8ebdfced8b8eed3d3eaf6ce2be4d7328d19e39df
1 parent
914ed611
Define extension names as constant strings
Showing
51 changed files
with
322 additions
and
207 deletions
include/GArf.hpp
| ... | ... | @@ -38,6 +38,11 @@ |
| 38 | 38 | class GFits; |
| 39 | 39 | class GFitsTable; |
| 40 | 40 | |
| 41 | +/* __ Constants __________________________________________________________ */ | |
| 42 | +namespace gammalib { | |
| 43 | + const std::string extname_arf = "SPECRESP"; | |
| 44 | +} | |
| 45 | + | |
| 41 | 46 | |
| 42 | 47 | /***********************************************************************//** |
| 43 | 48 | * @class GArf | ... | ... |
include/GEbounds.hpp
| ... | ... | @@ -39,6 +39,11 @@ class GFitsTable; |
| 39 | 39 | class GFilename; |
| 40 | 40 | class GEnergies; |
| 41 | 41 | |
| 42 | +/* __ Constants __________________________________________________________ */ | |
| 43 | +namespace gammalib { | |
| 44 | + const std::string extname_ebounds = "EBOUNDS"; | |
| 45 | +} | |
| 46 | + | |
| 42 | 47 | |
| 43 | 48 | /***********************************************************************//** |
| 44 | 49 | * @class GEbounds |
| ... | ... | @@ -91,7 +96,7 @@ public: |
| 91 | 96 | const std::string& unit = "keV") const; |
| 92 | 97 | void read(const GFitsTable& table); |
| 93 | 98 | void write(GFits& file, |
| 94 | - const std::string& extname = "EBOUNDS", | |
| 99 | + const std::string& extname = gammalib::extname_ebounds, | |
| 95 | 100 | const std::string& unit = "keV") const; |
| 96 | 101 | void read(const GXmlElement& xml); |
| 97 | 102 | void write(GXmlElement& xml) const; | ... | ... |
include/GEnergies.hpp
| ... | ... | @@ -39,6 +39,11 @@ |
| 39 | 39 | class GFilename; |
| 40 | 40 | class GEbounds; |
| 41 | 41 | |
| 42 | +/* __ Constants __________________________________________________________ */ | |
| 43 | +namespace gammalib { | |
| 44 | + const std::string extname_energies = "ENERGIES"; | |
| 45 | +} | |
| 46 | + | |
| 42 | 47 | |
| 43 | 48 | /***********************************************************************//** |
| 44 | 49 | * @class GEnergies |
| ... | ... | @@ -92,7 +97,7 @@ public: |
| 92 | 97 | const bool& clobber = false) const; |
| 93 | 98 | void read(const GFitsTable& table); |
| 94 | 99 | void write(GFits& file, |
| 95 | - const std::string& extname = "ENERGIES") const; | |
| 100 | + const std::string& extname = gammalib::extname_energies) const; | |
| 96 | 101 | std::string print(const GChatter& chatter = NORMAL) const; |
| 97 | 102 | |
| 98 | 103 | protected: | ... | ... |
include/GGti.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GGti.hpp - Good time interval class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -39,6 +39,11 @@ class GXmlElement; |
| 39 | 39 | class GFits; |
| 40 | 40 | class GFitsTable; |
| 41 | 41 | |
| 42 | +/* __ Constants __________________________________________________________ */ | |
| 43 | +namespace gammalib { | |
| 44 | + const std::string extname_gti = "GTI"; | |
| 45 | +} | |
| 46 | + | |
| 42 | 47 | |
| 43 | 48 | /***********************************************************************//** |
| 44 | 49 | * @class GGti |
| ... | ... | @@ -88,7 +93,7 @@ public: |
| 88 | 93 | const bool& clobber = false) const; |
| 89 | 94 | void read(const GFitsTable& table); |
| 90 | 95 | void write(GFits& fits, |
| 91 | - const std::string& extname = "GTI") const; | |
| 96 | + const std::string& extname = gammalib::extname_gti) const; | |
| 92 | 97 | void read(const GXmlElement& xml); |
| 93 | 98 | void write(GXmlElement& xml) const; |
| 94 | 99 | const GTime& tstart(void) const; | ... | ... |
include/GPha.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GPha.hpp - XSPEC Pulse Height Analyzer class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -38,6 +38,11 @@ class GEnergy; |
| 38 | 38 | class GFits; |
| 39 | 39 | class GFitsTable; |
| 40 | 40 | |
| 41 | +/* __ Constants __________________________________________________________ */ | |
| 42 | +namespace gammalib { | |
| 43 | + const std::string extname_pha = "SPECTRUM"; | |
| 44 | +} | |
| 45 | + | |
| 41 | 46 | |
| 42 | 47 | /***********************************************************************//** |
| 43 | 48 | * @class GPha | ... | ... |
include/GRmf.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GRmf.hpp - XSPEC Redistribution Matrix File class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -38,6 +38,11 @@ |
| 38 | 38 | class GFits; |
| 39 | 39 | class GFitsTable; |
| 40 | 40 | |
| 41 | +/* __ Constants __________________________________________________________ */ | |
| 42 | +namespace gammalib { | |
| 43 | + const std::string extname_rmf = "MATRIX"; | |
| 44 | +} | |
| 45 | + | |
| 41 | 46 | |
| 42 | 47 | /***********************************************************************//** |
| 43 | 48 | * @class GRmf | ... | ... |
inst/cta/include/GCTAAeff2D.hpp
| ... | ... | @@ -37,6 +37,11 @@ |
| 37 | 37 | class GFitsTable; |
| 38 | 38 | class GFitsBinTable; |
| 39 | 39 | |
| 40 | +/* __ Constants __________________________________________________________ */ | |
| 41 | +namespace gammalib { | |
| 42 | + const std::string extname_cta_aeff2d = "EFFECTIVE AREA"; | |
| 43 | +} | |
| 44 | + | |
| 40 | 45 | |
| 41 | 46 | /***********************************************************************//** |
| 42 | 47 | * @class GCTAAeff2D | ... | ... |
inst/cta/include/GCTABackground3D.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTABackground3D.hpp - CTA 3D background class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2014-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -37,6 +37,11 @@ |
| 37 | 37 | class GFits; |
| 38 | 38 | class GFitsBinTable; |
| 39 | 39 | |
| 40 | +/* __ Constants __________________________________________________________ */ | |
| 41 | +namespace gammalib { | |
| 42 | + const std::string extname_cta_background3d = "BACKGROUND"; | |
| 43 | +} | |
| 44 | + | |
| 40 | 45 | |
| 41 | 46 | /***********************************************************************//** |
| 42 | 47 | * @class GCTABackground3D | ... | ... |
inst/cta/include/GCTACubeEdisp.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTACubeEdisp.hpp - CTA cube analysis energy dispersion class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016 by Michael Mayer * | |
| 4 | + * copyright (C) 2016-2017 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -43,6 +43,11 @@ class GObservations; |
| 43 | 43 | class GCTAEventCube; |
| 44 | 44 | class GCTAObservation; |
| 45 | 45 | |
| 46 | +/* __ Constants __________________________________________________________ */ | |
| 47 | +namespace gammalib { | |
| 48 | + const std::string extname_cta_migras = "MIGRAS"; | |
| 49 | +} | |
| 50 | + | |
| 46 | 51 | |
| 47 | 52 | /***********************************************************************//** |
| 48 | 53 | * @class GCTACubeEdisp | ... | ... |
inst/cta/include/GCTACubePsf.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTACubePsf.hpp - CTA cube analysis point spread function class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2016 by Chia-Chun Lu * | |
| 4 | + * copyright (C) 2014-2017 by Chia-Chun Lu * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -42,6 +42,11 @@ class GObservations; |
| 42 | 42 | class GCTAEventCube; |
| 43 | 43 | class GCTAObservation; |
| 44 | 44 | |
| 45 | +/* __ Constants __________________________________________________________ */ | |
| 46 | +namespace gammalib { | |
| 47 | + const std::string extname_deltas = "DELTAS"; | |
| 48 | +} | |
| 49 | + | |
| 45 | 50 | |
| 46 | 51 | |
| 47 | 52 | /***********************************************************************//** | ... | ... |
inst/cta/include/GCTAEdisp2D.hpp
| ... | ... | @@ -39,6 +39,11 @@ class GRan; |
| 39 | 39 | class GFits; |
| 40 | 40 | class GFitsBinTable; |
| 41 | 41 | |
| 42 | +/* __ Constants __________________________________________________________ */ | |
| 43 | +namespace gammalib { | |
| 44 | + const std::string extname_cta_edisp2d = "ENERGY DISPERSION"; | |
| 45 | +} | |
| 46 | + | |
| 42 | 47 | |
| 43 | 48 | /***********************************************************************//** |
| 44 | 49 | * @class GCTAEdisp2D | ... | ... |
inst/cta/include/GCTAEventCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAEventCube.hpp - CTA event bin container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -44,6 +44,12 @@ |
| 44 | 44 | /* __ Forward declarations _______________________________________________ */ |
| 45 | 45 | class GFilename; |
| 46 | 46 | |
| 47 | +/* __ Constants __________________________________________________________ */ | |
| 48 | +namespace gammalib { | |
| 49 | + const std::string extname_cta_counts = "COUNTS"; | |
| 50 | + const std::string extname_cta_weights = "WEIGHTS"; | |
| 51 | +} | |
| 52 | + | |
| 47 | 53 | |
| 48 | 54 | /***********************************************************************//** |
| 49 | 55 | * @class GCTAEventCube | ... | ... |
inst/cta/include/GCTAEventList.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAEventList.hpp - CTA event list class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -41,6 +41,11 @@ class GFitsHDU; |
| 41 | 41 | class GFitsTable; |
| 42 | 42 | class GFitsBinTable; |
| 43 | 43 | |
| 44 | +/* __ Constants __________________________________________________________ */ | |
| 45 | +namespace gammalib { | |
| 46 | + const std::string extname_cta_events = "EVENTS"; | |
| 47 | +} | |
| 48 | + | |
| 44 | 49 | |
| 45 | 50 | /***********************************************************************//** |
| 46 | 51 | * @class GCTAEventList |
| ... | ... | @@ -100,7 +105,8 @@ protected: |
| 100 | 105 | virtual void set_times(void) { return; } |
| 101 | 106 | void read_events(const GFitsTable& table) const; |
| 102 | 107 | void write_events(GFitsBinTable& table) const; |
| 103 | - void write_ds_keys(GFitsHDU& hdu, const std::string& gtiname = "GTI") const; | |
| 108 | + void write_ds_keys(GFitsHDU& hdu, | |
| 109 | + const std::string& gtiname = gammalib::extname_gti) const; | |
| 104 | 110 | int irf_cache_init(const std::string& name) const; |
| 105 | 111 | int irf_cache_index(const std::string& name) const; |
| 106 | 112 | ... | ... |
inst/cta/include/GCTAObservation.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAObservation.hpp - CTA Observation class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -33,6 +33,7 @@ |
| 33 | 33 | #include "GObservation.hpp" |
| 34 | 34 | #include "GCTAResponse.hpp" |
| 35 | 35 | #include "GCTAPointing.hpp" |
| 36 | +#include "GCTAEventList.hpp" | |
| 36 | 37 | |
| 37 | 38 | /* __ Forward declarations _______________________________________________ */ |
| 38 | 39 | class GTime; |
| ... | ... | @@ -100,8 +101,8 @@ public: |
| 100 | 101 | bool has_events(void) const; |
| 101 | 102 | void read(const GFits& fits); |
| 102 | 103 | void write(GFits& fits, |
| 103 | - const std::string& evtname = "EVENTS", | |
| 104 | - const std::string& gtiname = "GTI") const; | |
| 104 | + const std::string& evtname = gammalib::extname_cta_events, | |
| 105 | + const std::string& gtiname = gammalib::extname_gti) const; | |
| 105 | 106 | void load(const GFilename& filename); |
| 106 | 107 | void load(const GFilename& cntcube, |
| 107 | 108 | const GFilename& expcube, | ... | ... |
inst/cta/include/GCTAPsf2D.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAPsf2D.hpp - CTA 2D point spread function class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | |
| 30 | 30 | /* __ Includes ___________________________________________________________ */ |
| 31 | 31 | #include <string> |
| 32 | -//#include "GRan.hpp" | |
| 33 | 32 | #include "GFilename.hpp" |
| 34 | 33 | #include "GCTAPsf.hpp" |
| 35 | 34 | #include "GCTAResponseTable.hpp" |
| ... | ... | @@ -38,6 +37,11 @@ |
| 38 | 37 | class GRan; |
| 39 | 38 | class GFitsBinTable; |
| 40 | 39 | |
| 40 | +/* __ Constants __________________________________________________________ */ | |
| 41 | +namespace gammalib { | |
| 42 | + const std::string extname_cta_psf2d = "POINT SPREAD FUNCTION"; | |
| 43 | +} | |
| 44 | + | |
| 41 | 45 | |
| 42 | 46 | /***********************************************************************//** |
| 43 | 47 | * @class GCTAPsf2D | ... | ... |
inst/cta/include/GCTAPsfKing.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAPsfKing.hpp - King profile CTA point spread function class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Michael Mayer * | |
| 4 | + * copyright (C) 2013-2017 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -37,6 +37,11 @@ |
| 37 | 37 | class GRan; |
| 38 | 38 | class GFitsTable; |
| 39 | 39 | |
| 40 | +/* __ Constants __________________________________________________________ */ | |
| 41 | +namespace gammalib { | |
| 42 | + const std::string extname_cta_psfking = "POINT SPREAD FUNCTION"; | |
| 43 | +} | |
| 44 | + | |
| 40 | 45 | |
| 41 | 46 | /***********************************************************************//** |
| 42 | 47 | * @class GCTAPsfKing | ... | ... |
inst/cta/include/GCTAPsfTable.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAPsfTable.hpp - CTA point spread function table class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -37,6 +37,11 @@ |
| 37 | 37 | class GRan; |
| 38 | 38 | class GFitsTable; |
| 39 | 39 | |
| 40 | +/* __ Constants __________________________________________________________ */ | |
| 41 | +namespace gammalib { | |
| 42 | + const std::string extname_cta_psftable = "POINT SPREAD FUNCTION"; | |
| 43 | +} | |
| 44 | + | |
| 40 | 45 | |
| 41 | 46 | /***********************************************************************//** |
| 42 | 47 | * @class GCTAPsfTable | ... | ... |
inst/cta/src/GCTAAeff2D.cpp
| ... | ... | @@ -356,7 +356,7 @@ void GCTAAeff2D::write(GFitsBinTable& table) const |
| 356 | 356 | * @param[in] filename FITS file name. |
| 357 | 357 | * |
| 358 | 358 | * Loads the effective area from a FITS file. If no extension name is given |
| 359 | - * the effective area will be loaded from the "EFFECTIVE AREA" extension. | |
| 359 | + * the effective area will be loaded from the `EFFECTIVE AREA` extension. | |
| 360 | 360 | ***************************************************************************/ |
| 361 | 361 | void GCTAAeff2D::load(const GFilename& filename) |
| 362 | 362 | { |
| ... | ... | @@ -364,7 +364,8 @@ void GCTAAeff2D::load(const GFilename& filename) |
| 364 | 364 | GFits fits(filename); |
| 365 | 365 | |
| 366 | 366 | // Get effective area table |
| 367 | - const GFitsTable& table = *fits.table(filename.extname("EFFECTIVE AREA")); | |
| 367 | + const GFitsTable& table = | |
| 368 | + *fits.table(filename.extname(gammalib::extname_cta_aeff2d)); | |
| 368 | 369 | |
| 369 | 370 | // Read effective area from table |
| 370 | 371 | read(table); |
| ... | ... | @@ -391,7 +392,7 @@ void GCTAAeff2D::load(const GFilename& filename) |
| 391 | 392 | * opens the existing file. The method will create a (or replace an existing) |
| 392 | 393 | * effective area extension. The extension name can be specified as part |
| 393 | 394 | * of the @p filename, or if no extension name is given, is assumed to be |
| 394 | - * "EFFECTIVE AREA". | |
| 395 | + * `EFFECTIVE AREA`. | |
| 395 | 396 | * |
| 396 | 397 | * An existing file will only be modified if the @p clobber flag is set to |
| 397 | 398 | * true. |
| ... | ... | @@ -399,7 +400,7 @@ void GCTAAeff2D::load(const GFilename& filename) |
| 399 | 400 | void GCTAAeff2D::save(const GFilename& filename, const bool& clobber) const |
| 400 | 401 | { |
| 401 | 402 | // Get extension name |
| 402 | - std::string extname = filename.extname("EFFECTIVE AREA"); | |
| 403 | + std::string extname = filename.extname(gammalib::extname_cta_aeff2d); | |
| 403 | 404 | |
| 404 | 405 | // Open or create FITS file (without extension name since the requested |
| 405 | 406 | // extension may not yet exist in the file) | ... | ... |
inst/cta/src/GCTAAeffArf.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAAeffArf.cpp - CTA ARF effective area class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -34,6 +34,7 @@ |
| 34 | 34 | #include "GFilename.hpp" |
| 35 | 35 | #include "GFitsTable.hpp" |
| 36 | 36 | #include "GFitsTableCol.hpp" |
| 37 | +#include "GArf.hpp" | |
| 37 | 38 | #include "GCTAAeffArf.hpp" |
| 38 | 39 | #include "GCTAResponseIrf.hpp" |
| 39 | 40 | #include "GCTAResponse_helpers.hpp" |
| ... | ... | @@ -245,7 +246,7 @@ GCTAAeffArf* GCTAAeffArf::clone(void) const |
| 245 | 246 | * Loads the effective area from an ARF FITS file. |
| 246 | 247 | * |
| 247 | 248 | * If no extension name is provided, the effective area will be loaded from |
| 248 | - * the "SPECRESP" extension. | |
| 249 | + * the `SPECRESP` extension. | |
| 249 | 250 | ***************************************************************************/ |
| 250 | 251 | void GCTAAeffArf::load(const GFilename& filename) |
| 251 | 252 | { |
| ... | ... | @@ -253,7 +254,7 @@ void GCTAAeffArf::load(const GFilename& filename) |
| 253 | 254 | GFits fits(filename); |
| 254 | 255 | |
| 255 | 256 | // Get ARF table |
| 256 | - const GFitsTable& table = *fits.table(filename.extname("SPECRESP")); | |
| 257 | + const GFitsTable& table = *fits.table(filename.extname(gammalib::extname_arf)); | |
| 257 | 258 | |
| 258 | 259 | // Read ARF from table |
| 259 | 260 | read(table); | ... | ... |
inst/cta/src/GCTABackground3D.cpp
| ... | ... | @@ -401,7 +401,7 @@ void GCTABackground3D::write(GFitsBinTable& table) const |
| 401 | 401 | * Loads the background from a FITS file. |
| 402 | 402 | * |
| 403 | 403 | * If no extension name is provided, the background will be loaded from the |
| 404 | - * "BACKGROUND" extension. | |
| 404 | + * `BACKGROUND` extension. | |
| 405 | 405 | ***************************************************************************/ |
| 406 | 406 | void GCTABackground3D::load(const GFilename& filename) |
| 407 | 407 | { |
| ... | ... | @@ -409,7 +409,8 @@ void GCTABackground3D::load(const GFilename& filename) |
| 409 | 409 | GFits fits(filename); |
| 410 | 410 | |
| 411 | 411 | // Get background table |
| 412 | - const GFitsTable& table = *fits.table(filename.extname("BACKGROUND")); | |
| 412 | + const GFitsTable& table = | |
| 413 | + *fits.table(filename.extname(gammalib::extname_cta_background3d)); | |
| 413 | 414 | |
| 414 | 415 | // Read effective area from table |
| 415 | 416 | read(table); |
| ... | ... | @@ -436,7 +437,7 @@ void GCTABackground3D::load(const GFilename& filename) |
| 436 | 437 | * existing file. The method will create a (or replace an existing) |
| 437 | 438 | * background extension. The extension name can be specified as part |
| 438 | 439 | * of the @p filename, or if no extension name is given, is assumed to be |
| 439 | - * "BACKGROUND". | |
| 440 | + * `BACKGROUND`. | |
| 440 | 441 | * |
| 441 | 442 | * An existing file will only be modified if the @p clobber flag is set to |
| 442 | 443 | * true. |
| ... | ... | @@ -444,7 +445,7 @@ void GCTABackground3D::load(const GFilename& filename) |
| 444 | 445 | void GCTABackground3D::save(const GFilename& filename, const bool& clobber) const |
| 445 | 446 | { |
| 446 | 447 | // Get extension name |
| 447 | - std::string extname = filename.extname("BACKGROUND"); | |
| 448 | + std::string extname = filename.extname(gammalib::extname_cta_background3d); | |
| 448 | 449 | |
| 449 | 450 | // Open or create FITS file (without extension name since the requested |
| 450 | 451 | // extension may not yet exist in the file) | ... | ... |
inst/cta/src/GCTACubeBackground.cpp
| ... | ... | @@ -520,7 +520,7 @@ void GCTACubeBackground::read(const GFits& fits) |
| 520 | 520 | |
| 521 | 521 | // Get HDUs |
| 522 | 522 | const GFitsImage& hdu_bgdcube = *fits.image("Primary"); |
| 523 | - const GFitsTable& hdu_energies = *fits.table("ENERGIES"); | |
| 523 | + const GFitsTable& hdu_energies = *fits.table(gammalib::extname_energies); | |
| 524 | 524 | |
| 525 | 525 | // Read cube |
| 526 | 526 | m_cube.read(hdu_bgdcube); | ... | ... |
inst/cta/src/GCTACubeEdisp.cpp
| ... | ... | @@ -496,8 +496,8 @@ void GCTACubeEdisp::fill(const GObservations& obs, GLog* log) |
| 496 | 496 | * |
| 497 | 497 | * Reads the energy dispersion cube from a FITS file. The energy dispersion |
| 498 | 498 | * cube values are expected in the primary extension of the FITS file, the |
| 499 | - * true energy boundaries are expected in the "ENERGIES" extension, and the | |
| 500 | - * migration values are expected in the "MIGRAS" extension. | |
| 499 | + * true energy boundaries are expected in the `ENERGIES` extension, and the | |
| 500 | + * migration values are expected in the `MIGRAS` extension. | |
| 501 | 501 | ***************************************************************************/ |
| 502 | 502 | void GCTACubeEdisp::read(const GFits& fits) |
| 503 | 503 | { |
| ... | ... | @@ -506,8 +506,8 @@ void GCTACubeEdisp::read(const GFits& fits) |
| 506 | 506 | |
| 507 | 507 | // Get HDUs |
| 508 | 508 | const GFitsImage& hdu_edispcube = *fits.image("Primary"); |
| 509 | - const GFitsTable& hdu_energies = *fits.table("ENERGIES"); | |
| 510 | - const GFitsTable& hdu_migras = *fits.table("MIGRAS"); | |
| 509 | + const GFitsTable& hdu_energies = *fits.table(gammalib::extname_energies); | |
| 510 | + const GFitsTable& hdu_migras = *fits.table(gammalib::extname_cta_migras); | |
| 511 | 511 | |
| 512 | 512 | // Read energy dispersion cube |
| 513 | 513 | m_cube.read(hdu_edispcube); |
| ... | ... | @@ -536,17 +536,17 @@ void GCTACubeEdisp::read(const GFits& fits) |
| 536 | 536 | * |
| 537 | 537 | * Write the energy dispersion cube into a FITS file. The energy dispersion |
| 538 | 538 | * cube values are written into the primary extension of the FITS file, the |
| 539 | - * true energy boundaries are written into the "EBOUNDS" extension, and the | |
| 540 | - * migration values are written into the "MIGRAS" extension. | |
| 539 | + * true energy boundaries are written into the `ENERGIES` extension, and the | |
| 540 | + * migration values are written into the `MIGRAS` extension. | |
| 541 | 541 | ***************************************************************************/ |
| 542 | 542 | void GCTACubeEdisp::write(GFits& fits) const |
| 543 | 543 | { |
| 544 | 544 | // Remove extensions from FITS file |
| 545 | - if (fits.contains("MIGRAS")) { | |
| 546 | - fits.remove("MIGRAS"); | |
| 545 | + if (fits.contains(gammalib::extname_cta_migras)) { | |
| 546 | + fits.remove(gammalib::extname_cta_migras); | |
| 547 | 547 | } |
| 548 | - if (fits.contains("ENERGIES")) { | |
| 549 | - fits.remove("ENERGIES"); | |
| 548 | + if (fits.contains(gammalib::extname_energies)) { | |
| 549 | + fits.remove(gammalib::extname_energies); | |
| 550 | 550 | } |
| 551 | 551 | if (fits.contains("Primary")) { |
| 552 | 552 | fits.remove("Primary"); |
| ... | ... | @@ -556,10 +556,10 @@ void GCTACubeEdisp::write(GFits& fits) const |
| 556 | 556 | m_cube.write(fits); |
| 557 | 557 | |
| 558 | 558 | // Write energy boundaries |
| 559 | - m_energies.write(fits, "ENERGIES"); | |
| 559 | + m_energies.write(fits, gammalib::extname_energies); | |
| 560 | 560 | |
| 561 | 561 | // Write migration nodes |
| 562 | - m_migras.write(fits, "MIGRAS"); | |
| 562 | + m_migras.write(fits, gammalib::extname_cta_migras); | |
| 563 | 563 | |
| 564 | 564 | // Return |
| 565 | 565 | return; | ... | ... |
inst/cta/src/GCTACubeExposure.cpp
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 | #include "GCTAEventList.hpp" |
| 40 | 40 | |
| 41 | 41 | /* __ Method name definitions ____________________________________________ */ |
| 42 | -#define G_FILL_CUBE "GCTACubeExposure::fill_cube(GCTAObservation&, GLog*)" | |
| 42 | +#define G_FILL_CUBE "GCTACubeExposure::fill_cube(GCTAObservation&, GLog*)" | |
| 43 | 43 | |
| 44 | 44 | /* __ Macros _____________________________________________________________ */ |
| 45 | 45 | |
| ... | ... | @@ -386,8 +386,8 @@ void GCTACubeExposure::read(const GFits& fits) |
| 386 | 386 | |
| 387 | 387 | // Get HDUs |
| 388 | 388 | const GFitsImage& hdu_expcube = *fits.image("Primary"); |
| 389 | - const GFitsTable& hdu_energies = *fits.table("ENERGIES"); | |
| 390 | - const GFitsTable& hdu_gti = *fits.table("GTI"); | |
| 389 | + const GFitsTable& hdu_energies = *fits.table(gammalib::extname_energies); | |
| 390 | + const GFitsTable& hdu_gti = *fits.table(gammalib::extname_gti); | |
| 391 | 391 | |
| 392 | 392 | // Read cube |
| 393 | 393 | m_cube.read(hdu_expcube); | ... | ... |
inst/cta/src/GCTACubePsf.cpp
| ... | ... | @@ -478,8 +478,8 @@ void GCTACubePsf::read(const GFits& fits) |
| 478 | 478 | |
| 479 | 479 | // Get HDUs |
| 480 | 480 | const GFitsImage& hdu_psfcube = *fits.image("Primary"); |
| 481 | - const GFitsTable& hdu_energies = *fits.table("ENERGIES"); | |
| 482 | - const GFitsTable& hdu_deltas = *fits.table("DELTAS"); | |
| 481 | + const GFitsTable& hdu_energies = *fits.table(gammalib::extname_energies); | |
| 482 | + const GFitsTable& hdu_deltas = *fits.table(gammalib::extname_deltas); | |
| 483 | 483 | |
| 484 | 484 | // Read cube |
| 485 | 485 | m_cube.read(hdu_psfcube); |
| ... | ... | @@ -522,10 +522,10 @@ void GCTACubePsf::write(GFits& fits) const |
| 522 | 522 | m_energies.write(fits); |
| 523 | 523 | |
| 524 | 524 | // Write delta nodes |
| 525 | - m_deltas.write(fits, "DELTAS"); | |
| 525 | + m_deltas.write(fits, gammalib::extname_deltas); | |
| 526 | 526 | |
| 527 | 527 | // Set the nodes unit to "deg" |
| 528 | - (*fits.table("DELTAS"))["Value"]->unit("deg"); | |
| 528 | + (*fits.table(gammalib::extname_deltas))["Value"]->unit("deg"); | |
| 529 | 529 | |
| 530 | 530 | // Return |
| 531 | 531 | return; | ... | ... |
inst/cta/src/GCTAEdisp2D.cpp
| ... | ... | @@ -430,7 +430,7 @@ void GCTAEdisp2D::write(GFitsBinTable& table) const |
| 430 | 430 | * Loads the energy dispersion from a FITS file. |
| 431 | 431 | * |
| 432 | 432 | * If no extension name is provided, the energy dispersion will be loaded |
| 433 | - * from the "ENERGY DISPERSION" extension. | |
| 433 | + * from the `ENERGY DISPERSION` extension. | |
| 434 | 434 | ***************************************************************************/ |
| 435 | 435 | void GCTAEdisp2D::load(const GFilename& filename) |
| 436 | 436 | { |
| ... | ... | @@ -456,7 +456,7 @@ void GCTAEdisp2D::load(const GFilename& filename) |
| 456 | 456 | * opens the existing file. The method will create a (or replace an existing) |
| 457 | 457 | * energy dispersion extension. The extension name can be specified as part |
| 458 | 458 | * of the @p filename, or if no extension name is given, is assumed to be |
| 459 | - * "ENERGY DISPERSION". | |
| 459 | + * `ENERGY DISPERSION`. | |
| 460 | 460 | * |
| 461 | 461 | * An existing file will only be modified if the @p clobber flag is set to |
| 462 | 462 | * true. |
| ... | ... | @@ -464,7 +464,7 @@ void GCTAEdisp2D::load(const GFilename& filename) |
| 464 | 464 | void GCTAEdisp2D::save(const GFilename& filename, const bool& clobber) const |
| 465 | 465 | { |
| 466 | 466 | // Get extension name |
| 467 | - std::string extname = filename.extname("ENERGY DISPERSION"); | |
| 467 | + std::string extname = filename.extname(gammalib::extname_cta_edisp2d); | |
| 468 | 468 | |
| 469 | 469 | // Open or create FITS file (without extension name since the requested |
| 470 | 470 | // extension may not yet exist in the file) |
| ... | ... | @@ -745,7 +745,8 @@ void GCTAEdisp2D::fetch(void) const |
| 745 | 745 | GFits fits(m_filename); |
| 746 | 746 | |
| 747 | 747 | // Initialise energy dispersion extension name |
| 748 | - std::string extname = m_filename.extname("ENERGY DISPERSION"); | |
| 748 | + std::string extname = | |
| 749 | + m_filename.extname(gammalib::extname_cta_edisp2d); | |
| 749 | 750 | |
| 750 | 751 | // Get energy dispersion table |
| 751 | 752 | const GFitsTable& table = *fits.table(extname); | ... | ... |
inst/cta/src/GCTAEventCube.cpp
| ... | ... | @@ -437,14 +437,14 @@ void GCTAEventCube::read(const GFits& fits) |
| 437 | 437 | |
| 438 | 438 | // Set counts cube HDU |
| 439 | 439 | std::string counts_hdu("Primary"); |
| 440 | - if (fits.contains("COUNTS")) { | |
| 441 | - counts_hdu = "COUNTS"; | |
| 440 | + if (fits.contains(gammalib::extname_cta_counts)) { | |
| 441 | + counts_hdu = gammalib::extname_cta_counts; | |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | // Get HDUs |
| 445 | 445 | const GFitsImage& hdu_cntmap = *fits.image(counts_hdu); |
| 446 | - const GFitsTable& hdu_ebounds = *fits.table("EBOUNDS"); | |
| 447 | - const GFitsTable& hdu_gti = *fits.table("GTI"); | |
| 446 | + const GFitsTable& hdu_ebounds = *fits.table(gammalib::extname_ebounds); | |
| 447 | + const GFitsTable& hdu_gti = *fits.table(gammalib::extname_gti); | |
| 448 | 448 | |
| 449 | 449 | // Load counts map |
| 450 | 450 | read_cntmap(hdu_cntmap); |
| ... | ... | @@ -456,10 +456,10 @@ void GCTAEventCube::read(const GFits& fits) |
| 456 | 456 | read_gti(hdu_gti); |
| 457 | 457 | |
| 458 | 458 | // If a WEIGHTS HDU exist then load it from the FITS file ... |
| 459 | - if (fits.contains("WEIGHTS")) { | |
| 459 | + if (fits.contains(gammalib::extname_cta_weights)) { | |
| 460 | 460 | |
| 461 | 461 | // Get WEIGHTS HDU |
| 462 | - const GFitsImage& hdu_weights = *fits.image("WEIGHTS"); | |
| 462 | + const GFitsImage& hdu_weights = *fits.image(gammalib::extname_cta_weights); | |
| 463 | 463 | |
| 464 | 464 | // Read HDU |
| 465 | 465 | m_weights.read(hdu_weights); |
| ... | ... | @@ -500,27 +500,27 @@ void GCTAEventCube::read(const GFits& fits) |
| 500 | 500 | void GCTAEventCube::write(GFits& fits) const |
| 501 | 501 | { |
| 502 | 502 | // Remove HDUs if they exist already |
| 503 | - if (fits.contains("GTI")) { | |
| 504 | - fits.remove("GTI"); | |
| 503 | + if (fits.contains(gammalib::extname_gti)) { | |
| 504 | + fits.remove(gammalib::extname_gti); | |
| 505 | 505 | } |
| 506 | - if (fits.contains("EBOUNDS")) { | |
| 507 | - fits.remove("EBOUNDS"); | |
| 506 | + if (fits.contains(gammalib::extname_ebounds)) { | |
| 507 | + fits.remove(gammalib::extname_ebounds); | |
| 508 | 508 | } |
| 509 | - if (fits.contains("WEIGHTS")) { | |
| 510 | - fits.remove("WEIGHTS"); | |
| 509 | + if (fits.contains(gammalib::extname_cta_weights)) { | |
| 510 | + fits.remove(gammalib::extname_cta_weights); | |
| 511 | 511 | } |
| 512 | - if (fits.contains("COUNTS")) { | |
| 513 | - fits.remove("COUNTS"); | |
| 512 | + if (fits.contains(gammalib::extname_cta_counts)) { | |
| 513 | + fits.remove(gammalib::extname_cta_counts); | |
| 514 | 514 | } |
| 515 | 515 | if (fits.contains("Primary")) { |
| 516 | 516 | fits.remove("Primary"); |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | // Write counts cube |
| 520 | - m_map.write(fits, "COUNTS"); | |
| 520 | + m_map.write(fits, gammalib::extname_cta_counts); | |
| 521 | 521 | |
| 522 | 522 | // Write cube weighting |
| 523 | - m_weights.write(fits, "WEIGHTS"); | |
| 523 | + m_weights.write(fits, gammalib::extname_cta_weights); | |
| 524 | 524 | |
| 525 | 525 | // Write energy boundaries |
| 526 | 526 | ebounds().write(fits); | ... | ... |
inst/cta/src/GCTAEventList.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAEventList.cpp - CTA event list class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -325,17 +325,17 @@ void GCTAEventList::save(const GFilename& filename, |
| 325 | 325 | * |
| 326 | 326 | * Reads the event list from a FITS file. |
| 327 | 327 | * |
| 328 | - * The events will be read by default from the extension "EVENTS" unless | |
| 328 | + * The events will be read by default from the extension `EVENTS` unless | |
| 329 | 329 | * an extension name is explicitly specified in the FITS file name. The |
| 330 | 330 | * FITS header of the extension will be scanned for data sub-space keywords |
| 331 | 331 | * to extract the energy boundaries, the region of interest, as well as the |
| 332 | 332 | * extension name for the Good Time Intervals. If no extension name for |
| 333 | 333 | * Good Time Intervals is found it is expected that the Good Time Intervals |
| 334 | - * reside in the "GTI" extension. | |
| 334 | + * reside in the `GTI` extension. | |
| 335 | 335 | * |
| 336 | 336 | * If a Good Time Intervals is found in the same FITS file, the Good Time |
| 337 | 337 | * Intervals will be loaded. Otherwise, a single Good Time Interval will |
| 338 | - * be assumed based on the "TSTART" and "TSTOP" keywords found in the header | |
| 338 | + * be assumed based on the `TSTART` and `TSTOP` keywords found in the header | |
| 339 | 339 | * of the event list. |
| 340 | 340 | * |
| 341 | 341 | * The method clears the event list before reading, thus any events that |
| ... | ... | @@ -356,7 +356,7 @@ void GCTAEventList::read(const GFits& fits) |
| 356 | 356 | m_filename = fits.filename(); |
| 357 | 357 | |
| 358 | 358 | // Initialise events extension name |
| 359 | - std::string extname = fits.filename().extname("EVENTS"); | |
| 359 | + std::string extname = fits.filename().extname(gammalib::extname_cta_events); | |
| 360 | 360 | |
| 361 | 361 | // Get event list HDU |
| 362 | 362 | const GFitsTable& events = *fits.table(extname); |
| ... | ... | @@ -385,7 +385,7 @@ void GCTAEventList::read(const GFits& fits) |
| 385 | 385 | |
| 386 | 386 | // If no GTI extension name was found then |
| 387 | 387 | if (gti_extname.empty()) { |
| 388 | - gti_extname = "GTI"; | |
| 388 | + gti_extname = gammalib::extname_gti; | |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | // If GTI extension is present in FITS file then read Good Time Intervals |
| ... | ... | @@ -443,7 +443,7 @@ void GCTAEventList::read(const GFits& fits) |
| 443 | 443 | * |
| 444 | 444 | * Writes the CTA event list and the Good Time intervals into a FITS file. |
| 445 | 445 | * |
| 446 | - * The events will be written by default into the extension "EVENTS" unless | |
| 446 | + * The events will be written by default into the extension `EVENTS` unless | |
| 447 | 447 | * an extension name is explicitly specified in the FITS file name. The |
| 448 | 448 | * method also writes the data sub-space keywords in the FITS header of the |
| 449 | 449 | * events table. |
| ... | ... | @@ -451,15 +451,16 @@ void GCTAEventList::read(const GFits& fits) |
| 451 | 451 | * In addition, the method will also append a table containing the Good Time |
| 452 | 452 | * Intervals of the events to the FITS file. The extension name for the Good |
| 453 | 453 | * Time Intervals is either taken from the m_gti_extname member, or if empty, |
| 454 | - * is set to "GTI". | |
| 454 | + * is set to `GTI`. | |
| 455 | 455 | ***************************************************************************/ |
| 456 | 456 | void GCTAEventList::write(GFits& fits) const |
| 457 | 457 | { |
| 458 | 458 | // Set event extension name |
| 459 | - std::string evtname = fits.filename().extname("EVENTS"); | |
| 459 | + std::string evtname = fits.filename().extname(gammalib::extname_cta_events); | |
| 460 | 460 | |
| 461 | 461 | // Set GTI extension name |
| 462 | - std::string gtiname = (m_gti_extname.empty()) ? "GTI" : m_gti_extname; | |
| 462 | + std::string gtiname = (m_gti_extname.empty()) | |
| 463 | + ? gammalib::extname_gti : m_gti_extname; | |
| 463 | 464 | |
| 464 | 465 | // Write events and GTIs |
| 465 | 466 | write(fits, evtname, gtiname); |
| ... | ... | @@ -662,7 +663,7 @@ void GCTAEventList::fetch(void) const |
| 662 | 663 | GFits fits(m_filename); |
| 663 | 664 | |
| 664 | 665 | // Initialise events extension name |
| 665 | - std::string extname = fits.filename().extname("EVENTS"); | |
| 666 | + std::string extname = fits.filename().extname(gammalib::extname_cta_events); | |
| 666 | 667 | |
| 667 | 668 | // Get event list HDU |
| 668 | 669 | const GFitsTable& events = *fits.table(extname); |
| ... | ... | @@ -869,7 +870,7 @@ void GCTAEventList::init_members(void) |
| 869 | 870 | m_columns.clear(); |
| 870 | 871 | m_filename.clear(); |
| 871 | 872 | m_num_events = 0; |
| 872 | - m_gti_extname = "GTI"; //!< Default GTI extension name | |
| 873 | + m_gti_extname = gammalib::extname_gti; //!< Default GTI extension name | |
| 873 | 874 | m_has_phase = false; |
| 874 | 875 | m_has_detxy = true; |
| 875 | 876 | |
| ... | ... | @@ -1075,7 +1076,7 @@ void GCTAEventList::write_events(GFitsBinTable& hdu) const |
| 1075 | 1076 | fetch(); |
| 1076 | 1077 | |
| 1077 | 1078 | // Set extension name |
| 1078 | - hdu.extname("EVENTS"); | |
| 1079 | + hdu.extname(gammalib::extname_cta_events); | |
| 1079 | 1080 | |
| 1080 | 1081 | // If there are events then write them now |
| 1081 | 1082 | if (size() > 0) { | ... | ... |
inst/cta/src/GCTAObservation.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAObservation.cpp - CTA Observation class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -998,7 +998,7 @@ void GCTAObservation::write(GXmlElement& xml) const |
| 998 | 998 | * depending of the information provided in the FITS file. If an extension |
| 999 | 999 | * name is specified, the method checks whether the extension exists and |
| 1000 | 1000 | * loads the extension as event list. Otherwise, it checks whether the file |
| 1001 | - * contains an "EVENTS" extension and loads the extension as event list. | |
| 1001 | + * contains an `EVENTS` extension and loads the extension as event list. | |
| 1002 | 1002 | * If none of the above are satistified, the method loads a counts cube. |
| 1003 | 1003 | ***************************************************************************/ |
| 1004 | 1004 | void GCTAObservation::read(const GFits& fits) |
| ... | ... | @@ -1012,7 +1012,7 @@ void GCTAObservation::read(const GFits& fits) |
| 1012 | 1012 | GFilename filename(fits.filename()); |
| 1013 | 1013 | |
| 1014 | 1014 | // Get extension name |
| 1015 | - std::string extname = filename.extname("EVENTS"); | |
| 1015 | + std::string extname = filename.extname(gammalib::extname_cta_events); | |
| 1016 | 1016 | |
| 1017 | 1017 | // If FITS file contains an EVENTS extension we have an unbinned |
| 1018 | 1018 | // observation ... |
| ... | ... | @@ -1060,8 +1060,8 @@ void GCTAObservation::read(const GFits& fits) |
| 1060 | 1060 | * @brief Write observation into FITS file. |
| 1061 | 1061 | * |
| 1062 | 1062 | * @param[in] fits FITS file. |
| 1063 | - * @param[in] evtname Events FITS extension name (default: "EVENTS"). | |
| 1064 | - * @param[in] gtiname Good Time Intervals FITS extension name (default: "GTI"). | |
| 1063 | + * @param[in] evtname Events FITS extension name. | |
| 1064 | + * @param[in] gtiname Good Time Intervals FITS extension name. | |
| 1065 | 1065 | * |
| 1066 | 1066 | * Writes the observation into a FITS file. |
| 1067 | 1067 | * |
| ... | ... | @@ -1264,7 +1264,7 @@ void GCTAObservation::load(const GFilename& cntcube, |
| 1264 | 1264 | * If the CTA observation contains an event cube, the method will write the |
| 1265 | 1265 | * cube into the primary image, followed by binary tables containing the |
| 1266 | 1266 | * energy boundaries and the Good Time Intervals. The extension names of |
| 1267 | - * these binary tables are "EBOUNDS" and "GTI", and cannot be modified. | |
| 1267 | + * these binary tables are `EBOUNDS` and `GTI`, and cannot be modified. | |
| 1268 | 1268 | ***************************************************************************/ |
| 1269 | 1269 | void GCTAObservation::save(const GFilename& filename, |
| 1270 | 1270 | const bool& clobber) const |
| ... | ... | @@ -1274,8 +1274,8 @@ void GCTAObservation::save(const GFilename& filename, |
| 1274 | 1274 | // The specific format that is implemented is [events;gti], where the |
| 1275 | 1275 | // part before the semi-colon is the events extension name and the part |
| 1276 | 1276 | // after the semi-colon is the Good Time Intervals extension name. |
| 1277 | - std::string evtname = "EVENTS"; | |
| 1278 | - std::string gtiname = "GTI"; | |
| 1277 | + std::string evtname = gammalib::extname_cta_events; | |
| 1278 | + std::string gtiname = gammalib::extname_gti; | |
| 1279 | 1279 | if (filename.has_extname()) { |
| 1280 | 1280 | std::vector<std::string> extnames = gammalib::split(filename.extname(), ";"); |
| 1281 | 1281 | if (extnames.size() > 0) { | ... | ... |
inst/cta/src/GCTAOnOffObservation.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAOnOffObservation.cpp - CTA On/Off observation class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Chia-Chun Lu & Christoph Deil * | |
| 4 | + * copyright (C) 2013-2017 by Chia-Chun Lu & Christoph Deil * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -1007,7 +1007,7 @@ void GCTAOnOffObservation::compute_arf(const GCTAObservation& obs) |
| 1007 | 1007 | * |
| 1008 | 1008 | * Compute the background rate in units of events/s/MeV in all Off regions |
| 1009 | 1009 | * and stores the background rate as additional column with name |
| 1010 | - * "BACKGROUND" in the Auxiliary Response File (ARF). | |
| 1010 | + * `BACKGROUND` in the Auxiliary Response File (ARF). | |
| 1011 | 1011 | * |
| 1012 | 1012 | * @todo Should implement integration of background model over region. |
| 1013 | 1013 | * @todo Allow general region, not only circles. | ... | ... |
inst/cta/src/GCTAPsf2D.cpp
| ... | ... | @@ -385,7 +385,7 @@ void GCTAPsf2D::write(GFitsBinTable& table) const |
| 385 | 385 | * Loads the point spread function from a FITS file. |
| 386 | 386 | * |
| 387 | 387 | * If no extension name is provided, the point spread function will be loaded |
| 388 | - * from the "POINT SPREAD FUNCTION" extension. | |
| 388 | + * from the `POINT SPREAD FUNCTION` extension. | |
| 389 | 389 | ***************************************************************************/ |
| 390 | 390 | void GCTAPsf2D::load(const GFilename& filename) |
| 391 | 391 | { |
| ... | ... | @@ -393,7 +393,8 @@ void GCTAPsf2D::load(const GFilename& filename) |
| 393 | 393 | GFits fits(filename); |
| 394 | 394 | |
| 395 | 395 | // Get PSFa table |
| 396 | - const GFitsTable& table = *fits.table(filename.extname("POINT SPREAD FUNCTION")); | |
| 396 | + const GFitsTable& table = | |
| 397 | + *fits.table(filename.extname(gammalib::extname_cta_psf2d)); | |
| 397 | 398 | |
| 398 | 399 | // Read PSF from table |
| 399 | 400 | read(table); |
| ... | ... | @@ -413,17 +414,17 @@ void GCTAPsf2D::load(const GFilename& filename) |
| 413 | 414 | * @brief Save point spread function table into FITS file |
| 414 | 415 | * |
| 415 | 416 | * @param[in] filename FITS file name. |
| 416 | - * @param[in] clobber Overwrite existing file? (default: false) | |
| 417 | + * @param[in] clobber Overwrite existing file? | |
| 417 | 418 | * |
| 418 | 419 | * Save the point spread function into a FITS file. |
| 419 | 420 | * |
| 420 | 421 | * If no extension name is provided, the point spread function will be saved |
| 421 | - * into the "POINT SPREAD FUNCTION" extension. | |
| 422 | + * into the `POINT SPREAD FUNCTION` extension. | |
| 422 | 423 | ***************************************************************************/ |
| 423 | 424 | void GCTAPsf2D::save(const GFilename& filename, const bool& clobber) const |
| 424 | 425 | { |
| 425 | 426 | // Get extension name |
| 426 | - std::string extname = filename.extname("POINT SPREAD FUNCTION"); | |
| 427 | + std::string extname = filename.extname(gammalib::extname_cta_psf2d); | |
| 427 | 428 | |
| 428 | 429 | // Open or create FITS file (without extension name since the requested |
| 429 | 430 | // extension may not yet exist in the file) | ... | ... |
inst/cta/src/GCTAPsfKing.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAPsfKing.cpp - King profile CTA point spread function class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Michael Mayer * | |
| 4 | + * copyright (C) 2013-2017 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -379,7 +379,7 @@ void GCTAPsfKing::write(GFitsBinTable& table) const |
| 379 | 379 | * Loads the point spread function from a FITS file. |
| 380 | 380 | * |
| 381 | 381 | * If no extension name is provided, the point spread function will be loaded |
| 382 | - * from the "POINT SPREAD FUNCTION" extension. | |
| 382 | + * from the `POINT SPREAD FUNCTION` extension. | |
| 383 | 383 | ***************************************************************************/ |
| 384 | 384 | void GCTAPsfKing::load(const GFilename& filename) |
| 385 | 385 | { |
| ... | ... | @@ -387,7 +387,8 @@ void GCTAPsfKing::load(const GFilename& filename) |
| 387 | 387 | GFits fits(filename); |
| 388 | 388 | |
| 389 | 389 | // Get PSFa table |
| 390 | - const GFitsTable& table = *fits.table(filename.extname("POINT SPREAD FUNCTION")); | |
| 390 | + const GFitsTable& table = | |
| 391 | + *fits.table(filename.extname(gammalib::extname_cta_psfking)); | |
| 391 | 392 | |
| 392 | 393 | // Read PSF from table |
| 393 | 394 | read(table); |
| ... | ... | @@ -406,14 +407,14 @@ void GCTAPsfKing::load(const GFilename& filename) |
| 406 | 407 | * @brief Save point spread function table into FITS file |
| 407 | 408 | * |
| 408 | 409 | * @param[in] filename FITS file name. |
| 409 | - * @param[in] clobber Overwrite existing file? (default: false) | |
| 410 | + * @param[in] clobber Overwrite existing file? | |
| 410 | 411 | * |
| 411 | 412 | * Saves point spread function into a FITS file. If a file with the given |
| 412 | 413 | * @p filename does not yet exist it will be created, otherwise the method |
| 413 | 414 | * opens the existing file. The method will create a (or replace an existing) |
| 414 | 415 | * point spread function extension. The extension name can be specified as |
| 415 | 416 | * part of the @p filename, or if no extension name is given, is assumed to |
| 416 | - * be "POINT SPREAD FUNCTION". | |
| 417 | + * be `POINT SPREAD FUNCTION`. | |
| 417 | 418 | * |
| 418 | 419 | * An existing file will only be modified if the @p clobber flag is set to |
| 419 | 420 | * true. |
| ... | ... | @@ -421,7 +422,7 @@ void GCTAPsfKing::load(const GFilename& filename) |
| 421 | 422 | void GCTAPsfKing::save(const GFilename& filename, const bool& clobber) const |
| 422 | 423 | { |
| 423 | 424 | // Get extension name |
| 424 | - std::string extname = filename.extname("POINT SPREAD FUNCTION"); | |
| 425 | + std::string extname = filename.extname(gammalib::extname_cta_psfking); | |
| 425 | 426 | |
| 426 | 427 | // Open or create FITS file (without extension name since the requested |
| 427 | 428 | // extension may not yet exist in the file) | ... | ... |
inst/cta/src/GCTAPsfTable.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAPsfTable.cpp - CTA point spread function table class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -355,7 +355,7 @@ void GCTAPsfTable::write(GFitsBinTable& table) const |
| 355 | 355 | * Loads the point spread function from a FITS file. |
| 356 | 356 | * |
| 357 | 357 | * If no extension name is provided, the point spread function will be loaded |
| 358 | - * from the "POINT SPREAD FUNCTION" extension. | |
| 358 | + * from the `POINT SPREAD FUNCTION` extension. | |
| 359 | 359 | ***************************************************************************/ |
| 360 | 360 | void GCTAPsfTable::load(const GFilename& filename) |
| 361 | 361 | { |
| ... | ... | @@ -363,7 +363,8 @@ void GCTAPsfTable::load(const GFilename& filename) |
| 363 | 363 | GFits fits(filename); |
| 364 | 364 | |
| 365 | 365 | // Get PSF table |
| 366 | - const GFitsTable& table = *fits.table(filename.extname("POINT SPREAD FUNCTION")); | |
| 366 | + const GFitsTable& table = | |
| 367 | + *fits.table(filename.extname(gammalib::extname_cta_psftable)); | |
| 367 | 368 | |
| 368 | 369 | // Read PSF from table |
| 369 | 370 | read(table); |
| ... | ... | @@ -382,14 +383,14 @@ void GCTAPsfTable::load(const GFilename& filename) |
| 382 | 383 | * @brief Save point spread function table into FITS file |
| 383 | 384 | * |
| 384 | 385 | * @param[in] filename FITS file name. |
| 385 | - * @param[in] clobber Overwrite existing file? (default: false) | |
| 386 | + * @param[in] clobber Overwrite existing file? | |
| 386 | 387 | * |
| 387 | 388 | * Saves point spread function into a FITS file. If a file with the given |
| 388 | 389 | * @p filename does not yet exist it will be created, otherwise the method |
| 389 | 390 | * opens the existing file. The method will create a (or replace an existing) |
| 390 | 391 | * point spread function extension. The extension name can be specified as |
| 391 | 392 | * part of the @p filename, or if no extension name is given, is assumed to |
| 392 | - * be "POINT SPREAD FUNCTION". | |
| 393 | + * be `POINT SPREAD FUNCTION`. | |
| 393 | 394 | * |
| 394 | 395 | * An existing file will only be modified if the @p clobber flag is set to |
| 395 | 396 | * true. |
| ... | ... | @@ -397,7 +398,7 @@ void GCTAPsfTable::load(const GFilename& filename) |
| 397 | 398 | void GCTAPsfTable::save(const GFilename& filename, const bool& clobber) const |
| 398 | 399 | { |
| 399 | 400 | // Get extension name |
| 400 | - std::string extname = filename.extname("POINT SPREAD FUNCTION"); | |
| 401 | + std::string extname = filename.extname(gammalib::extname_cta_psftable); | |
| 401 | 402 | |
| 402 | 403 | // Open or create FITS file (without extension name since the requested |
| 403 | 404 | // extension may not yet exist in the file) | ... | ... |
inst/cta/src/GCTAResponseIrf.cpp
| ... | ... | @@ -45,6 +45,7 @@ |
| 45 | 45 | #include "GModelSpatialRadialShell.hpp" |
| 46 | 46 | #include "GModelSpatialElliptical.hpp" |
| 47 | 47 | #include "GModelSpatialComposite.hpp" |
| 48 | +#include "GArf.hpp" | |
| 48 | 49 | #include "GCTAObservation.hpp" |
| 49 | 50 | #include "GCTAResponseIrf.hpp" |
| 50 | 51 | #include "GCTAResponse_helpers.hpp" |
| ... | ... | @@ -1088,11 +1089,11 @@ void GCTAResponseIrf::load(const std::string& rspname) |
| 1088 | 1089 | * |
| 1089 | 1090 | * If the file is a FITS file, the method will either use the extension name |
| 1090 | 1091 | * specified with the filename, or if no extension name is given, search for |
| 1091 | - * an "EFFECTIVE AREA" or "SPECRESP" extension in the file and open the | |
| 1092 | - * corresponding FITS table. If a column named "SPECRESP" is found in the | |
| 1092 | + * an `EFFECTIVE AREA` or `SPECRESP` extension in the file and open the | |
| 1093 | + * corresponding FITS table. If a column named `SPECRESP` is found in the | |
| 1093 | 1094 | * table, a GCTAAeffArf object will be allocated. Otherwise, a GCTAAeff2D |
| 1094 | 1095 | * object will be allocated. In both cases, the method will extract the |
| 1095 | - * optional "LO_THRES" and "HI_THRES" save energy thresholds from the FITS | |
| 1096 | + * optional `LO_THRES` and `HI_THRES` save energy thresholds from the FITS | |
| 1096 | 1097 | * file header. |
| 1097 | 1098 | * |
| 1098 | 1099 | * If the file is not a FITS file, it will be interpreted as a |
| ... | ... | @@ -1125,11 +1126,11 @@ void GCTAResponseIrf::load_aeff(const GFilename& filename) |
| 1125 | 1126 | extname = filename.extname(); |
| 1126 | 1127 | } |
| 1127 | 1128 | else { |
| 1128 | - if (fits.contains("EFFECTIVE AREA")) { | |
| 1129 | - extname = "EFFECTIVE AREA"; | |
| 1129 | + if (fits.contains(gammalib::extname_cta_aeff2d)) { | |
| 1130 | + extname = gammalib::extname_cta_aeff2d; | |
| 1130 | 1131 | } |
| 1131 | - else if (fits.contains("SPECRESP")) { | |
| 1132 | - extname = "SPECRESP"; | |
| 1132 | + else if (fits.contains(gammalib::extname_arf)) { | |
| 1133 | + extname = gammalib::extname_arf; | |
| 1133 | 1134 | } |
| 1134 | 1135 | } |
| 1135 | 1136 | |
| ... | ... | @@ -1148,7 +1149,7 @@ void GCTAResponseIrf::load_aeff(const GFilename& filename) |
| 1148 | 1149 | } |
| 1149 | 1150 | |
| 1150 | 1151 | // Check for specific table column |
| 1151 | - if (table.contains("SPECRESP")) { | |
| 1152 | + if (table.contains(gammalib::extname_arf)) { | |
| 1152 | 1153 | |
| 1153 | 1154 | // Close file |
| 1154 | 1155 | fits.close(); |
| ... | ... | @@ -1212,13 +1213,13 @@ void GCTAResponseIrf::load_aeff(const GFilename& filename) |
| 1212 | 1213 | * PSF |
| 1213 | 1214 | * PSF_2D_TABLE |
| 1214 | 1215 | * |
| 1215 | - * in the file and open the corresponding FITS table. If columns named "GAMMA" | |
| 1216 | - * and "SIGMA" are found in the table, a GCTAPsfKing object will be allocated. | |
| 1216 | + * in the file and open the corresponding FITS table. If columns named `GAMMA` | |
| 1217 | + * and `SIGMA` are found in the table, a GCTAPsfKing object will be allocated. | |
| 1217 | 1218 | * |
| 1218 | - * If columns named "SCALE", "SIGMA_1", "AMPL_2", "SIGMA_2", "AMPL_3" and | |
| 1219 | - * "SIGMA_3" are found in the table, a GCTAPsf2D object will be allocated. | |
| 1219 | + * If columns named `SCALE`, `SIGMA_1`, `AMPL_2`, `SIGMA_2`, `AMPL_3` and | |
| 1220 | + * `SIGMA_3` are found in the table, a GCTAPsf2D object will be allocated. | |
| 1220 | 1221 | * |
| 1221 | - * If columns named "RAD_LO", "RAD_HI", and "RPSF" are found in the table, a | |
| 1222 | + * If columns named `RAD_LO`, `RAD_HI`, and `RPSF` are found in the table, a | |
| 1222 | 1223 | * GCTAPsfTable object will be allocated. |
| 1223 | 1224 | * |
| 1224 | 1225 | * Otherwise, a CTAPsfVector object will be allocated. |
| ... | ... | @@ -1359,7 +1360,7 @@ void GCTAResponseIrf::load_psf(const GFilename& filename) |
| 1359 | 1360 | * |
| 1360 | 1361 | * If the file is a FITS file, the method will either use the extension name |
| 1361 | 1362 | * specified with the filename, or if no extension name is given, search for |
| 1362 | - * an "ENERGY DISPERSION" or "MATRIX" extension in the file and open the | |
| 1363 | + * an `ENERGY DISPERSION` or `MATRIX` extension in the file and open the | |
| 1363 | 1364 | * corresponding FITS table. If columns named "MIGRA_LO" and "MIGRA_HI" are |
| 1364 | 1365 | * found in the table, a GCTAEdisp2D object will be allocated. Otherwise, a |
| 1365 | 1366 | * GCTAEdispRmf object will be allocated. |
| ... | ... | @@ -1387,18 +1388,18 @@ void GCTAResponseIrf::load_edisp(const GFilename& filename) |
| 1387 | 1388 | GFits fits(filename); |
| 1388 | 1389 | |
| 1389 | 1390 | // Get the extension name. If an extension name has been specified |
| 1390 | - // then use this name, otherwise use either the "EFFECTIVE AREA" | |
| 1391 | - // or the "SPECRESP" extension. | |
| 1391 | + // then use this name, otherwise use either the "ENERGY DISPERSION" | |
| 1392 | + // or the "MATRIX" extension. | |
| 1392 | 1393 | std::string extname = ""; |
| 1393 | 1394 | if (filename.has_extname()) { |
| 1394 | 1395 | extname = filename.extname(); |
| 1395 | 1396 | } |
| 1396 | 1397 | else { |
| 1397 | - if (fits.contains("ENERGY DISPERSION")) { | |
| 1398 | - extname = "ENERGY DISPERSION"; | |
| 1398 | + if (fits.contains(gammalib::extname_cta_edisp2d)) { | |
| 1399 | + extname = gammalib::extname_cta_edisp2d; | |
| 1399 | 1400 | } |
| 1400 | - else if (fits.contains("MATRIX")) { | |
| 1401 | - extname = "MATRIX"; | |
| 1401 | + else if (fits.contains(gammalib::extname_rmf)) { | |
| 1402 | + extname = gammalib::extname_rmf; | |
| 1402 | 1403 | } |
| 1403 | 1404 | } |
| 1404 | 1405 | ... | ... |
inst/lat/include/GLATAeff.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATAeff.hpp - Fermi LAT effective area * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -40,6 +40,12 @@ class GEnergy; |
| 40 | 40 | class GFits; |
| 41 | 41 | class GFitsTable; |
| 42 | 42 | |
| 43 | +/* __ Constants __________________________________________________________ */ | |
| 44 | +namespace gammalib { | |
| 45 | + const std::string extname_lat_aeff = "EFFECTIVE AREA"; | |
| 46 | + const std::string extname_lat_efficiency = "EFFICIENCY_PARAMS"; | |
| 47 | +} | |
| 48 | + | |
| 43 | 49 | |
| 44 | 50 | /***********************************************************************//** |
| 45 | 51 | * @class GLATAeff | ... | ... |
inst/lat/include/GLATEdisp.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEdisp.hpp - Fermi LAT energy dispersion * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -38,6 +38,12 @@ class GFilename; |
| 38 | 38 | class GFits; |
| 39 | 39 | class GFitsTable; |
| 40 | 40 | |
| 41 | +/* __ Constants __________________________________________________________ */ | |
| 42 | +namespace gammalib { | |
| 43 | + const std::string extname_lat_edisp = "ENERGY DISPERSION"; | |
| 44 | + const std::string extname_lat_edisp_scale = "EDISP_SCALING_PARAMS"; | |
| 45 | +} | |
| 46 | + | |
| 41 | 47 | |
| 42 | 48 | /***********************************************************************//** |
| 43 | 49 | * @class GLATEdisp | ... | ... |
inst/lat/include/GLATEventList.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventList.hpp - Fermi/LAT event list class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -40,6 +40,11 @@ |
| 40 | 40 | /* __ Forward declarations _______________________________________________ */ |
| 41 | 41 | class GFilename; |
| 42 | 42 | |
| 43 | +/* __ Constants __________________________________________________________ */ | |
| 44 | +namespace gammalib { | |
| 45 | + const std::string extname_lat_events = "EVENTS"; | |
| 46 | +} | |
| 47 | + | |
| 43 | 48 | |
| 44 | 49 | /***********************************************************************//** |
| 45 | 50 | * @class GLATEventList | ... | ... |
inst/lat/include/GLATLtCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATLtCube.hpp - Fermi/LAT livetime cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -40,6 +40,13 @@ class GEnergy; |
| 40 | 40 | class GLATAeff; |
| 41 | 41 | class GLATPsf; |
| 42 | 42 | |
| 43 | +/* __ Constants __________________________________________________________ */ | |
| 44 | +namespace gammalib { | |
| 45 | + const std::string extname_lat_exposure = "EXPOSURE"; | |
| 46 | + const std::string extname_lat_wgtexposure = "WEIGHTED_EXPOSURE"; | |
| 47 | + const std::string extname_lat_cthetabounds = "CTHETABOUNDS"; | |
| 48 | +} | |
| 49 | + | |
| 43 | 50 | |
| 44 | 51 | /***********************************************************************//** |
| 45 | 52 | * @class GLATLtCube | ... | ... |
inst/lat/src/GLATAeff.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATAeff.cpp - Fermi LAT effective area * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -309,10 +309,10 @@ void GLATAeff::save(const GFilename& filename, const bool& clobber) |
| 309 | 309 | * @param[in] fits FITS file. |
| 310 | 310 | * |
| 311 | 311 | * Reads the effective area and efficiency parameter information form the |
| 312 | - * FITS file. The effective area is read from the extension EFFECTIVE AREA | |
| 313 | - * (or EFFECTIVE AREA_<evtype> for Pass 8), the efficiency parameter | |
| 314 | - * information from the extension EFFICIENCY_PARAMS (or | |
| 315 | - * EFFICIENCY_PARAMS_<evtype> for Pass 8). If the latter extension does not | |
| 312 | + * FITS file. The effective area is read from the extension `EFFECTIVE AREA` | |
| 313 | + * (or `EFFECTIVE AREA_<evtype>` for Pass 8), the efficiency parameter | |
| 314 | + * information from the extension `EFFICIENCY_PARAMS` (or | |
| 315 | + * `EFFICIENCY_PARAMS_<evtype>` for Pass 8). If the latter extension does not | |
| 316 | 316 | * exist, no efficiency parameters will be loaded. |
| 317 | 317 | * |
| 318 | 318 | * @todo Implement reading of Phi-dependence information. |
| ... | ... | @@ -325,8 +325,8 @@ void GLATAeff::read(const GFits& fits) |
| 325 | 325 | m_evtype = evtype; |
| 326 | 326 | |
| 327 | 327 | // Set extension names |
| 328 | - std::string effarea = "EFFECTIVE AREA"; | |
| 329 | - std::string effparms = "EFFICIENCY_PARAMS"; | |
| 328 | + std::string effarea = gammalib::extname_lat_aeff; | |
| 329 | + std::string effparms = gammalib::extname_lat_efficiency; | |
| 330 | 330 | if (!fits.contains(effarea)) { |
| 331 | 331 | effarea += "_" + m_evtype; |
| 332 | 332 | } |
| ... | ... | @@ -702,7 +702,7 @@ void GLATAeff::write_aeff(GFits& file) const |
| 702 | 702 | GFitsBinTable* hdu_aeff = new GFitsBinTable; |
| 703 | 703 | |
| 704 | 704 | // Set table attributes |
| 705 | - hdu_aeff->extname("EFFECTIVE AREA"); | |
| 705 | + hdu_aeff->extname(gammalib::extname_lat_aeff); | |
| 706 | 706 | |
| 707 | 707 | // Write boundaries into table |
| 708 | 708 | m_aeff_bins.write(*hdu_aeff); | ... | ... |
inst/lat/src/GLATEdisp.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEdisp.cpp - Fermi LAT energy dispersion * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -249,8 +249,8 @@ void GLATEdisp::read(const GFits& fits) |
| 249 | 249 | m_evtype = evtype; |
| 250 | 250 | |
| 251 | 251 | // Set extension names |
| 252 | - std::string engdisp = "ENERGY DISPERSION"; | |
| 253 | - std::string escales = "EDISP_SCALING_PARAMS"; | |
| 252 | + std::string engdisp = gammalib::extname_lat_edisp; | |
| 253 | + std::string escales = gammalib::extname_lat_edisp_scale; | |
| 254 | 254 | if (!fits.contains(engdisp)) { |
| 255 | 255 | engdisp += "_" + m_evtype; |
| 256 | 256 | } |
| ... | ... | @@ -436,7 +436,7 @@ void GLATEdisp::write_edisp(GFits& file) const |
| 436 | 436 | GFitsBinTable* hdu_edisp = new GFitsBinTable; |
| 437 | 437 | |
| 438 | 438 | // Set table attributes |
| 439 | - hdu_edisp->extname("ENERGY DISPERSION"); | |
| 439 | + hdu_edisp->extname(gammalib::extname_lat_edisp); | |
| 440 | 440 | |
| 441 | 441 | // Write boundaries into table |
| 442 | 442 | m_edisp_bins.write(*hdu_edisp); | ... | ... |
inst/lat/src/GLATEventCube.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventCube.cpp - Fermi/LAT event cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -354,8 +354,8 @@ void GLATEventCube::save(const GFilename& filename, |
| 354 | 354 | * @param[in] fits FITS file. |
| 355 | 355 | * |
| 356 | 356 | * It is assumed that the counts map resides in the primary extension of the |
| 357 | - * FITS file, the energy boundaries reside in the EBOUNDS extension and the | |
| 358 | - * Good Time Intervals reside in the GTI extension. The method clears the | |
| 357 | + * FITS file, the energy boundaries reside in the `EBOUNDS` extension and the | |
| 358 | + * Good Time Intervals reside in the `GTI` extension. The method clears the | |
| 359 | 359 | * object before loading, thus any events residing in the object before |
| 360 | 360 | * loading will be lost. |
| 361 | 361 | ***************************************************************************/ |
| ... | ... | @@ -366,8 +366,8 @@ void GLATEventCube::read(const GFits& fits) |
| 366 | 366 | |
| 367 | 367 | // Get HDUs |
| 368 | 368 | const GFitsImage& hdu_cntmap = *fits.image("Primary"); |
| 369 | - const GFitsTable& hdu_ebounds = *fits.table("EBOUNDS"); | |
| 370 | - const GFitsTable& hdu_gti = *fits.table("GTI"); | |
| 369 | + const GFitsTable& hdu_ebounds = *fits.table(gammalib::extname_ebounds); | |
| 370 | + const GFitsTable& hdu_gti = *fits.table(gammalib::extname_gti); | |
| 371 | 371 | |
| 372 | 372 | // Load counts map |
| 373 | 373 | read_cntmap(hdu_cntmap); | ... | ... |
inst/lat/src/GLATEventList.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventList.cpp - Fermi/LAT event list class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -299,7 +299,7 @@ void GLATEventList::read(const GFits& file) |
| 299 | 299 | clear(); |
| 300 | 300 | |
| 301 | 301 | // Get HDU (pointer is always valid) |
| 302 | - const GFitsTable& hdu = *file.table("EVENTS"); | |
| 302 | + const GFitsTable& hdu = *file.table(gammalib::extname_lat_events); | |
| 303 | 303 | |
| 304 | 304 | // Read event data |
| 305 | 305 | read_events(hdu); |
| ... | ... | @@ -309,8 +309,8 @@ void GLATEventList::read(const GFits& file) |
| 309 | 309 | |
| 310 | 310 | // If we have a GTI extension, then read Good Time Intervals from that |
| 311 | 311 | // extension |
| 312 | - if (file.contains("GTI")) { | |
| 313 | - const GFitsTable& gti = *file.table("GTI"); | |
| 312 | + if (file.contains(gammalib::extname_gti)) { | |
| 313 | + const GFitsTable& gti = *file.table(gammalib::extname_gti); | |
| 314 | 314 | m_gti.read(gti); |
| 315 | 315 | } |
| 316 | 316 | ... | ... |
inst/lat/src/GLATLtCube.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATLtCube.cpp - Fermi/LAT livetime cube class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -399,10 +399,10 @@ void GLATLtCube::load(const GFilename& filename) |
| 399 | 399 | GFits fits(filename); |
| 400 | 400 | |
| 401 | 401 | // Get HDUs |
| 402 | - const GFitsTable& hdu_exposure = *fits.table("EXPOSURE"); | |
| 403 | - const GFitsTable& hdu_weighted_exposure = *fits.table("WEIGHTED_EXPOSURE"); | |
| 404 | - //const GFitsTable& hdu_cthetabounds = *fits.table("CTHETABOUNDS"); | |
| 405 | - const GFitsTable& hdu_gti = *fits.table("GTI"); | |
| 402 | + const GFitsTable& hdu_exposure = *fits.table(gammalib::extname_lat_exposure); | |
| 403 | + const GFitsTable& hdu_weighted_exposure = *fits.table(gammalib::extname_lat_wgtexposure); | |
| 404 | + //const GFitsTable& hdu_cthetabounds = *fits.table(gammalib::extname_lat_cthetabounds); | |
| 405 | + const GFitsTable& hdu_gti = *fits.table(gammalib::extname_gti); | |
| 406 | 406 | |
| 407 | 407 | // Load exposure |
| 408 | 408 | m_exposure.read(hdu_exposure); | ... | ... |
pyext/GEbounds.i
| ... | ... | @@ -70,7 +70,7 @@ public: |
| 70 | 70 | const std::string& unit = "keV") const; |
| 71 | 71 | void read(const GFitsTable& table); |
| 72 | 72 | void write(GFits& file, |
| 73 | - const std::string& extname = "EBOUNDS", | |
| 73 | + const std::string& extname = gammalib::extname_ebounds, | |
| 74 | 74 | const std::string& unit = "keV") const; |
| 75 | 75 | void read(const GXmlElement& xml); |
| 76 | 76 | void write(GXmlElement& xml) const; | ... | ... |
pyext/GEnergies.i
pyext/GGti.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GGti.i - Good time interval class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -66,7 +66,7 @@ public: |
| 66 | 66 | const bool& clobber = false) const; |
| 67 | 67 | void read(const GFitsTable& table); |
| 68 | 68 | void write(GFits& fits, |
| 69 | - const std::string& extname = "GTI") const; | |
| 69 | + const std::string& extname = gammalib::extname_gti) const; | |
| 70 | 70 | void read(const GXmlElement& xml); |
| 71 | 71 | void write(GXmlElement& xml) const; |
| 72 | 72 | const GTime& tstart(void) const; | ... | ... |
src/obs/GEbounds.cpp
| ... | ... | @@ -642,7 +642,7 @@ void GEbounds::set_log(const int& num, const GEnergy& emin, const GEnergy& emax) |
| 642 | 642 | * Loads the energy boundaries from a FITS file. |
| 643 | 643 | * |
| 644 | 644 | * If no extension name is provided, the energy boundaries are loaded from |
| 645 | - * the "EBOUNDS" extension. | |
| 645 | + * the `EBOUNDS` extension. | |
| 646 | 646 | ***************************************************************************/ |
| 647 | 647 | void GEbounds::load(const GFilename& filename) |
| 648 | 648 | { |
| ... | ... | @@ -650,7 +650,7 @@ void GEbounds::load(const GFilename& filename) |
| 650 | 650 | GFits fits(filename); |
| 651 | 651 | |
| 652 | 652 | // Get energy boundary table |
| 653 | - const GFitsTable& table = *fits.table(filename.extname("EBOUNDS")); | |
| 653 | + const GFitsTable& table = *fits.table(filename.extname(gammalib::extname_ebounds)); | |
| 654 | 654 | |
| 655 | 655 | // Read energy boundaries from table |
| 656 | 656 | read(table); |
| ... | ... | @@ -673,7 +673,7 @@ void GEbounds::load(const GFilename& filename) |
| 673 | 673 | * Saves energy boundaries into a FITS file. If a file with the given |
| 674 | 674 | * @p filename does not yet exist it will be created, otherwise the method |
| 675 | 675 | * opens the existing file. Energy boundaries can only be appended to an |
| 676 | - * existing file if the @p clobber flag is set to `true` (otherwise an | |
| 676 | + * existing file if the @p clobber flag is set to "true" (otherwise an | |
| 677 | 677 | * exception is thrown). |
| 678 | 678 | * |
| 679 | 679 | * The method will append a binary FITS table containing the energy |
| ... | ... | @@ -683,7 +683,7 @@ void GEbounds::load(const GFilename& filename) |
| 683 | 683 | * myfile.fits[ENERGY BOUNDARIES] |
| 684 | 684 | * |
| 685 | 685 | * will save the energy boundaries in the `ENERGY BOUNDARIES` extension of |
| 686 | - * the `myfile.fits` file. If the extension exists already in the file it | |
| 686 | + * the "myfile.fits" file. If the extension exists already in the file it | |
| 687 | 687 | * will be replaced, otherwise a new extension will be created. If no |
| 688 | 688 | * extension name is provided, the method will use `EBOUNDS` as the default |
| 689 | 689 | * extension name for energy boundaries. |
| ... | ... | @@ -697,7 +697,7 @@ void GEbounds::save(const GFilename& filename, |
| 697 | 697 | GFits fits(filename.url(), true); |
| 698 | 698 | |
| 699 | 699 | // Write energy boundaries to FITS file |
| 700 | - write(fits, filename.extname("EBOUNDS"), unit); | |
| 700 | + write(fits, filename.extname(gammalib::extname_ebounds), unit); | |
| 701 | 701 | |
| 702 | 702 | // Save to file |
| 703 | 703 | fits.save(clobber); |
| ... | ... | @@ -762,8 +762,8 @@ void GEbounds::read(const GFitsTable& table) |
| 762 | 762 | * @brief Write energy boundaries into FITS object |
| 763 | 763 | * |
| 764 | 764 | * @param[in] fits FITS file. |
| 765 | - * @param[in] extname Energy boundary extension name (defaults to "EBOUNDS") | |
| 766 | - * @param[in] unit Energy units (defaults to "keV") | |
| 765 | + * @param[in] extname Energy boundary extension name. | |
| 766 | + * @param[in] unit Energy units. | |
| 767 | 767 | * |
| 768 | 768 | * Writes the energy boundaries into a FITS object. The @p unit parameter |
| 769 | 769 | * specifies in which unit the energies are written. By default, the energy |
| ... | ... | @@ -801,7 +801,7 @@ void GEbounds::write(GFits& fits, |
| 801 | 801 | fits.remove(extname); |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | - // Append EBOUNDS table to FITS file | |
| 804 | + // Append energy boundary table to FITS file | |
| 805 | 805 | fits.append(table); |
| 806 | 806 | |
| 807 | 807 | // Return | ... | ... |
src/obs/GEnergies.cpp
| ... | ... | @@ -610,7 +610,7 @@ void GEnergies::set_log(const int& num, |
| 610 | 610 | * Loads the energies from FITS file. |
| 611 | 611 | * |
| 612 | 612 | * If no extension name is provided, the energies are loaded from the |
| 613 | - * "ENERGIES" extension. | |
| 613 | + * `ENERGIES` extension. | |
| 614 | 614 | ***************************************************************************/ |
| 615 | 615 | void GEnergies::load(const GFilename& filename) |
| 616 | 616 | { |
| ... | ... | @@ -618,7 +618,7 @@ void GEnergies::load(const GFilename& filename) |
| 618 | 618 | GFits fits(filename); |
| 619 | 619 | |
| 620 | 620 | // Get energies table |
| 621 | - const GFitsTable& table = *fits.table(filename.extname("ENERGIES")); | |
| 621 | + const GFitsTable& table = *fits.table(filename.extname(gammalib::extname_energies)); | |
| 622 | 622 | |
| 623 | 623 | // Read energies from table |
| 624 | 624 | read(table); |
| ... | ... | @@ -661,7 +661,7 @@ void GEnergies::save(const GFilename& filename, const bool& clobber) const |
| 661 | 661 | GFits fits(filename.url(), true); |
| 662 | 662 | |
| 663 | 663 | // Write energies to FITS file |
| 664 | - write(fits, filename.extname("ENERGIES")); | |
| 664 | + write(fits, filename.extname(gammalib::extname_energies)); | |
| 665 | 665 | |
| 666 | 666 | // Save to file |
| 667 | 667 | fits.save(clobber); |
| ... | ... | @@ -718,7 +718,7 @@ void GEnergies::read(const GFitsTable& table) |
| 718 | 718 | * @brief Write energies into FITS object |
| 719 | 719 | * |
| 720 | 720 | * @param[in] fits FITS file. |
| 721 | - * @param[in] extname Energy extension name (default: "ENERGIES") | |
| 721 | + * @param[in] extname Energy extension name. | |
| 722 | 722 | * |
| 723 | 723 | * Writes energies into FITS object. |
| 724 | 724 | ***************************************************************************/ |
| ... | ... | @@ -747,7 +747,7 @@ void GEnergies::write(GFits& fits, const std::string& extname) const |
| 747 | 747 | fits.remove(extname); |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | - // Append ENERGIES table to FITS file | |
| 750 | + // Append energies table to FITS file | |
| 751 | 751 | fits.append(table); |
| 752 | 752 | |
| 753 | 753 | // Return | ... | ... |
src/obs/GGti.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GGti.cpp - Good time interval class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -580,7 +580,7 @@ void GGti::extend(const GGti& gti) |
| 580 | 580 | * Loads the Good Time Intervals from FITS file. |
| 581 | 581 | * |
| 582 | 582 | * If no extension name is provided in the @p filename, the Good Time |
| 583 | - * Intervals are loaded from the "GTI" extension. | |
| 583 | + * Intervals are loaded from the `GTI` extension. | |
| 584 | 584 | ***************************************************************************/ |
| 585 | 585 | void GGti::load(const GFilename& filename) |
| 586 | 586 | { |
| ... | ... | @@ -588,7 +588,7 @@ void GGti::load(const GFilename& filename) |
| 588 | 588 | GFits fits(filename); |
| 589 | 589 | |
| 590 | 590 | // Get GTI table |
| 591 | - const GFitsTable& table = *fits.table(filename.extname("GTI")); | |
| 591 | + const GFitsTable& table = *fits.table(filename.extname(gammalib::extname_gti)); | |
| 592 | 592 | |
| 593 | 593 | // Read GTI from table |
| 594 | 594 | read(table); |
| ... | ... | @@ -632,7 +632,7 @@ void GGti::save(const GFilename& filename, const bool& clobber) const |
| 632 | 632 | GFits fits(filename.url(), true); |
| 633 | 633 | |
| 634 | 634 | // Write GTI to FITS object |
| 635 | - write(fits, filename.extname("GTI")); | |
| 635 | + write(fits, filename.extname(gammalib::extname_gti)); | |
| 636 | 636 | |
| 637 | 637 | // Save to file |
| 638 | 638 | fits.save(clobber); |
| ... | ... | @@ -685,14 +685,14 @@ void GGti::read(const GFitsTable& table) |
| 685 | 685 | * @brief Write Good Time Intervals and time reference into FITS object |
| 686 | 686 | * |
| 687 | 687 | * @param[in] fits FITS file. |
| 688 | - * @param[in] extname GTI extension name (defaults to "GTI") | |
| 688 | + * @param[in] extname GTI extension name. | |
| 689 | 689 | * |
| 690 | 690 | * Writes Good Time Intervals and time reference into a FITS object. If an |
| 691 | 691 | * extension with the same name does already exist in the FITS object, the |
| 692 | 692 | * values in that extension will be replaced. |
| 693 | 693 | * |
| 694 | 694 | * The start and stop tims of the Good Time Intervals will be written into |
| 695 | - * double precision columns named "START" and "STOP". | |
| 695 | + * double precision columns named `START` and `STOP`. | |
| 696 | 696 | ***************************************************************************/ |
| 697 | 697 | void GGti::write(GFits& fits, const std::string& extname) const |
| 698 | 698 | { | ... | ... |
src/xspec/GArf.cpp
| ... | ... | @@ -399,7 +399,7 @@ void GArf::load(const GFilename& filename) |
| 399 | 399 | GFits fits(filename.url()); |
| 400 | 400 | |
| 401 | 401 | // Get ARF table |
| 402 | - const GFitsTable& table = *fits.table("SPECRESP"); | |
| 402 | + const GFitsTable& table = *fits.table(gammalib::extname_arf); | |
| 403 | 403 | |
| 404 | 404 | // Read ARF data |
| 405 | 405 | read(table); |
| ... | ... | @@ -554,8 +554,8 @@ void GArf::write(GFits& fits) const |
| 554 | 554 | { |
| 555 | 555 | // If the FITS object contains already an extension with the same |
| 556 | 556 | // name then remove now this extension |
| 557 | - if (fits.contains("SPECRESP")) { | |
| 558 | - fits.remove("SPECRESP"); | |
| 557 | + if (fits.contains(gammalib::extname_arf)) { | |
| 558 | + fits.remove(gammalib::extname_arf); | |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // Set column length |
| ... | ... | @@ -585,7 +585,7 @@ void GArf::write(GFits& fits) const |
| 585 | 585 | specresp.unit("cm^2"); |
| 586 | 586 | |
| 587 | 587 | // Set table attributes |
| 588 | - hdu.extname("SPECRESP"); | |
| 588 | + hdu.extname(gammalib::extname_arf); | |
| 589 | 589 | |
| 590 | 590 | // Append columns to table |
| 591 | 591 | hdu.append(energy_lo); | ... | ... |
src/xspec/GPha.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GPha.cpp - XSPEC Pulse Height Analyzer class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -344,21 +344,21 @@ void GPha::load(const GFilename& filename) |
| 344 | 344 | GFits fits(filename.url()); |
| 345 | 345 | |
| 346 | 346 | // Get PHA table |
| 347 | - const GFitsTable& pha = *fits.table("SPECTRUM"); | |
| 347 | + const GFitsTable& pha = *fits.table(gammalib::extname_pha); | |
| 348 | 348 | |
| 349 | 349 | // Read PHA data |
| 350 | 350 | read(pha); |
| 351 | 351 | |
| 352 | - // Optionally read EBOUNDS data | |
| 353 | - if (fits.contains("EBOUNDS")) { | |
| 352 | + // Optionally read energy boundaries | |
| 353 | + if (fits.contains(gammalib::extname_ebounds)) { | |
| 354 | 354 | |
| 355 | - // Get EBOUNDS table | |
| 356 | - const GFitsTable& ebounds = *fits.table("EBOUNDS"); | |
| 355 | + // Get energy boundary table | |
| 356 | + const GFitsTable& ebounds = *fits.table(gammalib::extname_ebounds); | |
| 357 | 357 | |
| 358 | - // Read EBOUNDS data | |
| 358 | + // Read energy boundaries | |
| 359 | 359 | m_ebounds.read(ebounds); |
| 360 | 360 | |
| 361 | - } // endif: has EBOUNDS table | |
| 361 | + } // endif: had energy boundary table | |
| 362 | 362 | |
| 363 | 363 | // Close FITS file |
| 364 | 364 | fits.close(); |
| ... | ... | @@ -484,11 +484,11 @@ void GPha::read(const GFitsTable& table) |
| 484 | 484 | void GPha::write(GFits& fits) const |
| 485 | 485 | { |
| 486 | 486 | // Remove extensions if they exist already |
| 487 | - if (fits.contains("EBOUNDS")) { | |
| 488 | - fits.remove("EBOUNDS"); | |
| 487 | + if (fits.contains(gammalib::extname_ebounds)) { | |
| 488 | + fits.remove(gammalib::extname_ebounds); | |
| 489 | 489 | } |
| 490 | - if (fits.contains("SPECTRUM")) { | |
| 491 | - fits.remove("SPECTRUM"); | |
| 490 | + if (fits.contains(gammalib::extname_pha)) { | |
| 491 | + fits.remove(gammalib::extname_pha); | |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | // Set column length |
| ... | ... | @@ -517,7 +517,7 @@ void GPha::write(GFits& fits) const |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | // Set table attributes |
| 520 | - hdu.extname("SPECTRUM"); | |
| 520 | + hdu.extname(gammalib::extname_pha); | |
| 521 | 521 | |
| 522 | 522 | // Append columns to table |
| 523 | 523 | hdu.append(col_chan); | ... | ... |
src/xspec/GRmf.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GRmf.cpp - XSPEC Redistribution Matrix File class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -387,7 +387,7 @@ void GRmf::load(const GFilename& filename) |
| 387 | 387 | m_ebds_measured.load(filename.url()); |
| 388 | 388 | |
| 389 | 389 | // Get RMF table |
| 390 | - const GFitsTable& table = *fits.table("MATRIX"); | |
| 390 | + const GFitsTable& table = *fits.table(gammalib::extname_rmf); | |
| 391 | 391 | |
| 392 | 392 | // Read RMF data |
| 393 | 393 | read(table); |
| ... | ... | @@ -547,11 +547,11 @@ void GRmf::read(const GFitsTable& table) |
| 547 | 547 | void GRmf::write(GFits& fits, const std::string& unit) const |
| 548 | 548 | { |
| 549 | 549 | // Remove extensions if they exist already |
| 550 | - if (fits.contains("MATRIX")) { | |
| 551 | - fits.remove("MATRIX"); | |
| 550 | + if (fits.contains(gammalib::extname_rmf)) { | |
| 551 | + fits.remove(gammalib::extname_rmf); | |
| 552 | 552 | } |
| 553 | - if (fits.contains("EBOUNDS")) { | |
| 554 | - fits.remove("EBOUNDS"); | |
| 553 | + if (fits.contains(gammalib::extname_ebounds)) { | |
| 554 | + fits.remove(gammalib::extname_ebounds); | |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | // Set table length |
| ... | ... | @@ -648,7 +648,7 @@ void GRmf::write(GFits& fits, const std::string& unit) const |
| 648 | 648 | energy_hi.unit(unit); |
| 649 | 649 | |
| 650 | 650 | // Set table attributes |
| 651 | - hdu.extname("MATRIX"); | |
| 651 | + hdu.extname(gammalib::extname_rmf); | |
| 652 | 652 | |
| 653 | 653 | // Append columns to table |
| 654 | 654 | hdu.append(energy_lo); | ... | ... |