From 0e71f297f3c2fe0ed7cffb654b21150d483c6e1c Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sat, 12 Dec 2015 21:34:22 +0100 Subject: [PATCH] Integrate code. --- inst/cta/include/GCTAAeff2D.hpp | 2 +- inst/cta/include/GCTAAeffArf.hpp | 2 +- inst/cta/include/GCTABackground3D.hpp | 2 +- inst/cta/include/GCTAEdisp2D.hpp | 2 +- inst/cta/include/GCTAPsf2D.hpp | 2 +- inst/cta/include/GCTAPsfKing.hpp | 2 +- inst/cta/pyext/GCTAAeff2D.i | 2 +- inst/cta/pyext/GCTAAeffArf.i | 2 +- inst/cta/pyext/GCTABackground3D.i | 2 +- inst/cta/pyext/GCTAEdisp2D.i | 2 +- inst/cta/pyext/GCTAPsf2D.i | 2 +- inst/cta/pyext/GCTAPsfKing.i | 2 +- inst/cta/src/GCTAAeff2D.cpp | 46 +++++++++++++++++++++++++++------------------- inst/cta/src/GCTAAeffArf.cpp | 30 ++++++++++++++++-------------- inst/cta/src/GCTABackground3D.cpp | 41 +++++++++++++++++++++++++---------------- inst/cta/src/GCTAEdisp2D.cpp | 48 +++++++++++++++++++++++++++--------------------- inst/cta/src/GCTAPsf2D.cpp | 59 +++++++++++++++++++++++++++++++---------------------------- inst/cta/src/GCTAPsfKing.cpp | 50 +++++++++++++++++++++++++++----------------------- inst/cta/src/GCTAPsfVector.cpp | 20 +++++++++++--------- 19 files changed, 176 insertions(+), 142 deletions(-) diff --git a/inst/cta/include/GCTAAeff2D.hpp b/inst/cta/include/GCTAAeff2D.hpp index dab9aff..56c4a90 100644 --- a/inst/cta/include/GCTAAeff2D.hpp +++ b/inst/cta/include/GCTAAeff2D.hpp @@ -76,7 +76,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; diff --git a/inst/cta/include/GCTAAeffArf.hpp b/inst/cta/include/GCTAAeffArf.hpp index 8e006a6..9fc76d5 100644 --- a/inst/cta/include/GCTAAeffArf.hpp +++ b/inst/cta/include/GCTAAeffArf.hpp @@ -85,7 +85,7 @@ public: const double& thetacut(void) const; void scale(const double& scale); const double& scale(void) const; - void read(const GFitsTable& hdu); + void read(const GFitsTable& table); void remove_thetacut(const GCTAResponseIrf& rsp); private: diff --git a/inst/cta/include/GCTABackground3D.hpp b/inst/cta/include/GCTABackground3D.hpp index c156b30..c7a0242 100644 --- a/inst/cta/include/GCTABackground3D.hpp +++ b/inst/cta/include/GCTABackground3D.hpp @@ -76,7 +76,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; diff --git a/inst/cta/include/GCTAEdisp2D.hpp b/inst/cta/include/GCTAEdisp2D.hpp index 3fd3d42..738d769 100644 --- a/inst/cta/include/GCTAEdisp2D.hpp +++ b/inst/cta/include/GCTAEdisp2D.hpp @@ -92,7 +92,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; private: diff --git a/inst/cta/include/GCTAPsf2D.hpp b/inst/cta/include/GCTAPsf2D.hpp index 0afd56d..5827642 100644 --- a/inst/cta/include/GCTAPsf2D.hpp +++ b/inst/cta/include/GCTAPsf2D.hpp @@ -97,7 +97,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; diff --git a/inst/cta/include/GCTAPsfKing.hpp b/inst/cta/include/GCTAPsfKing.hpp index 3ee44b5..1c1b5af 100644 --- a/inst/cta/include/GCTAPsfKing.hpp +++ b/inst/cta/include/GCTAPsfKing.hpp @@ -95,7 +95,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; diff --git a/inst/cta/pyext/GCTAAeff2D.i b/inst/cta/pyext/GCTAAeff2D.i index d491b99..23487c0 100644 --- a/inst/cta/pyext/GCTAAeff2D.i +++ b/inst/cta/pyext/GCTAAeff2D.i @@ -67,7 +67,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; }; diff --git a/inst/cta/pyext/GCTAAeffArf.i b/inst/cta/pyext/GCTAAeffArf.i index 5ea4870..4eb3f0c 100644 --- a/inst/cta/pyext/GCTAAeffArf.i +++ b/inst/cta/pyext/GCTAAeffArf.i @@ -71,7 +71,7 @@ public: const double& thetacut(void) const; void scale(const double& scale); const double& scale(void) const; - void read(const GFitsTable& hdu); + void read(const GFitsTable& table); void remove_thetacut(const GCTAResponseIrf& rsp); }; diff --git a/inst/cta/pyext/GCTABackground3D.i b/inst/cta/pyext/GCTABackground3D.i index 6a22f60..c6ad337 100644 --- a/inst/cta/pyext/GCTABackground3D.i +++ b/inst/cta/pyext/GCTABackground3D.i @@ -64,7 +64,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; }; diff --git a/inst/cta/pyext/GCTAEdisp2D.i b/inst/cta/pyext/GCTAEdisp2D.i index 9a16ed9..6dc97ec 100644 --- a/inst/cta/pyext/GCTAEdisp2D.i +++ b/inst/cta/pyext/GCTAEdisp2D.i @@ -78,7 +78,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; }; diff --git a/inst/cta/pyext/GCTAPsf2D.i b/inst/cta/pyext/GCTAPsf2D.i index 0c7acb8..b5e219a 100644 --- a/inst/cta/pyext/GCTAPsf2D.i +++ b/inst/cta/pyext/GCTAPsf2D.i @@ -83,7 +83,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; diff --git a/inst/cta/pyext/GCTAPsfKing.i b/inst/cta/pyext/GCTAPsfKing.i index ec0ac06..660e822 100644 --- a/inst/cta/pyext/GCTAPsfKing.i +++ b/inst/cta/pyext/GCTAPsfKing.i @@ -85,7 +85,7 @@ public: const GCTAResponseTable& table(void) const; void table(const GCTAResponseTable& table); void read(const GFitsTable& table); - void write(GFitsBinTable& hdu) const; + void write(GFitsBinTable& table) const; void save(const std::string& filename, const bool& clobber = false) const; }; diff --git a/inst/cta/src/GCTAAeff2D.cpp b/inst/cta/src/GCTAAeff2D.cpp index df5d02d..f25248f 100644 --- a/inst/cta/src/GCTAAeff2D.cpp +++ b/inst/cta/src/GCTAAeff2D.cpp @@ -37,7 +37,7 @@ #include "GCTAAeff2D.hpp" /* __ Method name definitions ____________________________________________ */ -#define G_READ "GCTAAeff2D::read(GFitsTable&)" +#define G_READ "GCTAAeff2D::read(GFitsTable&)" /* __ Macros _____________________________________________________________ */ @@ -72,8 +72,7 @@ GCTAAeff2D::GCTAAeff2D(void) : GCTAAeff() * * @param[in] filename FITS file name. * - * Construct instance by loading the effective area information from a FITS - * file. + * Constructs effective area from a FITS file. ***************************************************************************/ GCTAAeff2D::GCTAAeff2D(const std::string& filename) : GCTAAeff() { @@ -238,12 +237,13 @@ GCTAAeff2D* GCTAAeff2D::clone(void) const /***********************************************************************//** * @brief Read effective area from FITS table * - * @param[in] table FITS table pointer. + * @param[in] table FITS table. * * @exception GException::invalid_value * FITS file format differs from expectation. * - * Reads the effective area form the FITS table. + * Reads the effective area form the FITS @p table. + * * The data are stored in m_aeff which is of type GCTAResponseTable. The * energy axis will be set to log10, the offset angle axis to radians. ***************************************************************************/ @@ -287,23 +287,25 @@ void GCTAAeff2D::read(const GFitsTable& table) /***********************************************************************//** - * @brief Write CTA effective area table into FITS binary table object. + * @brief Write effective area into FITS binary table + * + * @param[in] table FITS binary table. * - * @param[in] hdu FITS binary table. + * Writes effective area into the FITS binary @p table. * - * @todo Add necessary keywords. + * @todo Add keywords. ***************************************************************************/ -void GCTAAeff2D::write(GFitsBinTable& hdu) const +void GCTAAeff2D::write(GFitsBinTable& table) const { // Create a copy of the response table - GCTAResponseTable table(m_aeff); + GCTAResponseTable aeff(m_aeff); // Convert area from cm2 to m2 - table.scale(0, 1.0e-4); - table.scale(1, 1.0e-4); + aeff.scale(0, 1.0e-4); + aeff.scale(1, 1.0e-4); // Write response table - table.write(hdu); + aeff.write(table); // Return return; @@ -313,9 +315,12 @@ void GCTAAeff2D::write(GFitsBinTable& hdu) const /***********************************************************************//** * @brief Load effective area from FITS file * - * @param[in] filename FITS file. + * @param[in] filename FITS file name. + * + * Loads the effective area from a FITS file. * - * This method loads the effective area information from a FITS file. + * If no extension name is provided, the effective area will be loaded from + * the "EFFECTIVE AREA" extension. ***************************************************************************/ void GCTAAeff2D::load(const std::string& filename) { @@ -343,12 +348,15 @@ void GCTAAeff2D::load(const std::string& filename) /***********************************************************************//** - * @brief Save effectiva area table into FITS file + * @brief Save effectiva area into FITS file + * + * @param[in] filename FITS file name. + * @param[in] clobber Overwrite existing file? (default: false) * - * @param[in] filename Effective area table FITS file name. - * @param[in] clobber Overwrite existing file? (true=yes) + * Save the effectiva area into a FITS file. * - * Save the effectiva area table into a FITS file. + * If no extension name is provided, the effective area will be saved into + * the "EFFECTIVE AREA" extension. ***************************************************************************/ void GCTAAeff2D::save(const std::string& filename, const bool& clobber) const { diff --git a/inst/cta/src/GCTAAeffArf.cpp b/inst/cta/src/GCTAAeffArf.cpp index 8fcb21a..1ab5258 100644 --- a/inst/cta/src/GCTAAeffArf.cpp +++ b/inst/cta/src/GCTAAeffArf.cpp @@ -75,8 +75,7 @@ GCTAAeffArf::GCTAAeffArf(void) : GCTAAeff() * * @param[in] filename ARF FITS file name. * - * Construct instance by loading the effective area information from an - * ARF FITS file. + * Constructs effective area from an ARF FITS file. ***************************************************************************/ GCTAAeffArf::GCTAAeffArf(const std::string& filename) : GCTAAeff() { @@ -239,12 +238,14 @@ GCTAAeffArf* GCTAAeffArf::clone(void) const /***********************************************************************//** - * @brief Load effective area from performance table + * @brief Load effective area from ARF FITS file * - * @param[in] filename Performance table file name. + * @param[in] filename ARF FITS file name. + * + * Loads the effective area from an ARF FITS file. * - * This method loads the effective area information from an ASCII - * performance table. + * If no extension name is provided, the effective area will be loaded from + * the "SPECRESP" extension. ***************************************************************************/ void GCTAAeffArf::load(const std::string& filename) { @@ -274,11 +275,12 @@ void GCTAAeffArf::load(const std::string& filename) /***********************************************************************//** * @brief Read CTA ARF vector * - * @param[in] hdu FITS table. + * @param[in] table FITS table. + * + * Reads a CTA ARF vector from the FITS @p table. * - * This method reads a CTA ARF vector from the FITS HDU. Note that the - * energies are converted to TeV and the effective area is converted to cm2. - * Conversion is done based on the units provided for the energy and + * The energies are converted to TeV and the effective area is converted to + * cm2. Conversion is done based on the units provided for the energy and * effective area columns. Units that are recognized are 'keV', 'MeV', 'GeV', * 'TeV', 'm^2', 'm2', 'cm^2' and 'cm^2' (case independent). * @@ -286,16 +288,16 @@ void GCTAAeffArf::load(const std::string& filename) * For appropriate theta angle assignment, we would need this * information in the response header. ***************************************************************************/ -void GCTAAeffArf::read(const GFitsTable& hdu) +void GCTAAeffArf::read(const GFitsTable& table) { // Clear arrays m_logE.clear(); m_aeff.clear(); // Get pointers to table columns - const GFitsTableCol* energy_lo = hdu["ENERG_LO"]; - const GFitsTableCol* energy_hi = hdu["ENERG_HI"]; - const GFitsTableCol* specresp = hdu["SPECRESP"]; + const GFitsTableCol* energy_lo = table["ENERG_LO"]; + const GFitsTableCol* energy_hi = table["ENERG_HI"]; + const GFitsTableCol* specresp = table["SPECRESP"]; // Determine unit conversion factors (default: TeV and cm^2) std::string u_energy_lo = gammalib::tolower(gammalib::strip_whitespace(energy_lo->unit())); diff --git a/inst/cta/src/GCTABackground3D.cpp b/inst/cta/src/GCTABackground3D.cpp index b00b60c..4887f3f 100644 --- a/inst/cta/src/GCTABackground3D.cpp +++ b/inst/cta/src/GCTABackground3D.cpp @@ -37,7 +37,7 @@ #include "GCTABackground3D.hpp" /* __ Method name definitions ____________________________________________ */ -#define G_READ "GCTABackground3D::read(GFitsTable& table)" +#define G_READ "GCTABackground3D::read(GFitsTable&)" #define G_MC "GCTABackground3D::mc(GEnergy&, GTime&, GRan&)" #define G_INIT_MC_CACHE "GCTABackground3D::init_mc_cache()" @@ -77,7 +77,7 @@ GCTABackground3D::GCTABackground3D(void) : GCTABackground() * * @param[in] filename FITS file name. * - * Construct instance by loading the background information from a FITS file. + * Constructs background from a FITS file. ***************************************************************************/ GCTABackground3D::GCTABackground3D(const std::string& filename) : GCTABackground() @@ -304,17 +304,18 @@ GCTABackground3D* GCTABackground3D::clone(void) const /***********************************************************************//** - * @brief Read background from FITS file + * @brief Read background from FITS table * * @param[in] table FITS table. * * @exception GException::invalid_value * FITS file format differs from expectation. * - * Reads the background from the FITS table. The data - * are stored in m_background which is of type GCTAResponseTable. The DETX - * and DETY axes will be set to radians, the energy axis will be set to - * log10. + * Reads the background from the FITS @p table. + * + * The data are stored in m_background which is of type GCTAResponseTable. + * The DETX and DETY axes will be set to radians, the energy axis will be set + * to log10. ***************************************************************************/ void GCTABackground3D::read(const GFitsTable& table) { @@ -359,16 +360,18 @@ void GCTABackground3D::read(const GFitsTable& table) } /***********************************************************************//** - * @brief Write CTA background table into FITS binary table object. + * @brief Write background into FITS table + * + * @param[in] table FITS binary table. * - * @param[in] hdu FITS binary table. + * Writes background into a FITS binary @p table. * * @todo Add necessary keywords. ***************************************************************************/ -void GCTABackground3D::write(GFitsBinTable& hdu) const +void GCTABackground3D::write(GFitsBinTable& table) const { // Write background table - m_background.write(hdu); + m_background.write(table); // Return return; @@ -378,9 +381,12 @@ void GCTABackground3D::write(GFitsBinTable& hdu) const /***********************************************************************//** * @brief Load background from FITS file * - * @param[in] filename FITS file. + * @param[in] filename FITS file name. * - * This method loads the background information from a FITS file. + * Loads the background from a FITS file. + * + * If no extension name is provided, the background will be loaded from the + * "BACKGROUND" extension. ***************************************************************************/ void GCTABackground3D::load(const std::string& filename) { @@ -408,12 +414,15 @@ void GCTABackground3D::load(const std::string& filename) /***********************************************************************//** - * @brief Save background table into FITS file + * @brief Save background into FITS file * * @param[in] filename background table FITS file name. - * @param[in] clobber Overwrite existing file? (true=yes) + * @param[in] clobber Overwrite existing file? (default: false) + * + * Save the background into a FITS file. * - * Save the background table into a FITS file. + * If no extension name is provided, the background will be saved into the + * "BACKGROUND" extension. ***************************************************************************/ void GCTABackground3D::save(const std::string& filename, const bool& clobber) const { diff --git a/inst/cta/src/GCTAEdisp2D.cpp b/inst/cta/src/GCTAEdisp2D.cpp index 7598941..1cba29c 100644 --- a/inst/cta/src/GCTAEdisp2D.cpp +++ b/inst/cta/src/GCTAEdisp2D.cpp @@ -74,8 +74,7 @@ GCTAEdisp2D::GCTAEdisp2D(void) : GCTAEdisp() * * @param[in] filename FITS file name. * - * Construct instance by loading the energy dispersion information from a - * FITS file. + * Constructs energy dispersion from a FITS file. ***************************************************************************/ GCTAEdisp2D::GCTAEdisp2D(const std::string& filename) : GCTAEdisp() { @@ -233,9 +232,12 @@ GCTAEdisp2D* GCTAEdisp2D::clone(void) const /***********************************************************************//** * @brief Load energy dispersion from FITS file * - * @param[in] filename FITS file. + * @param[in] filename FITS file name. + * + * Loads the energy dispersion from a FITS file. * - * This method loads the energy dispersion information from a FITS file. + * If no extension name is provided, the energy dispersion will be loaded + * from the "ENERGY DISPERSION" extension. ***************************************************************************/ void GCTAEdisp2D::load(const std::string& filename) { @@ -263,17 +265,16 @@ void GCTAEdisp2D::load(const std::string& filename) /***********************************************************************//** - * @brief Read energy dispersion from FITS file + * @brief Read energy dispersion from FITS table + * + * @param[in] fits FITS table. * - * @param[in] fits FITS file pointer. + * Reads the energy dispersion form the FITS @p table. * - * Reads the energy dispersion form the FITS file extension - * "ENERGY DISPERSION". The data are stored in m_edisp which is of type - * GCTAResponseTable. The energy axis will be set to log10, the offset - * angle axis to radians. + * The data are stored in m_edisp which is of type GCTAResponseTable. The + * energy axis will be set to log10, the offset angle axis to radians. * - * The method assures that the energy dispersion information is properly - * normalised. + * The method assures that the energy dispersion is properly normalised. ***************************************************************************/ void GCTAEdisp2D::read(const GFitsTable& table) { @@ -377,16 +378,18 @@ void GCTAEdisp2D::read(const GFitsTable& table) /***********************************************************************//** - * @brief Write CTA energy dispersion table into FITS binary table object. + * @brief Write energy dispersion into FITS binary table * - * @param[in] hdu FITS binary table. + * @param[in] table FITS binary table. * - * @todo Add necessary keywords. + * Writes the energy dispersion into the FITS binary @p table. + * + * @todo Add keywords. ***************************************************************************/ -void GCTAEdisp2D::write(GFitsBinTable& hdu) const +void GCTAEdisp2D::write(GFitsBinTable& table) const { // Write background table - m_edisp.write(hdu); + m_edisp.write(table); // Return return; @@ -396,10 +399,13 @@ void GCTAEdisp2D::write(GFitsBinTable& hdu) const /***********************************************************************//** * @brief Save energy dispersion table into FITS file * - * @param[in] filename Energy dispersion table FITS file name. - * @param[in] clobber Overwrite existing file? (true=yes) + * @param[in] filename FITS file name. + * @param[in] clobber Overwrite existing file? (default: false) + * + * Save the energy dispersion table into FITS file. * - * Save the energy dispersion table into a FITS file. + * If no extension name is provided, the energy dispersion will be saved into + * the "ENERGY DISPERSION" extension. ***************************************************************************/ void GCTAEdisp2D::save(const std::string& filename, const bool& clobber) const { @@ -408,7 +414,7 @@ void GCTAEdisp2D::save(const std::string& filename, const bool& clobber) const // Create binary table GFitsBinTable table; - table.extname(fname.extname("ENERGY DISPERSON")); + table.extname(fname.extname("ENERGY DISPERSION")); // Write the energy dispersion table write(table); diff --git a/inst/cta/src/GCTAPsf2D.cpp b/inst/cta/src/GCTAPsf2D.cpp index fec7bf5..2470243 100644 --- a/inst/cta/src/GCTAPsf2D.cpp +++ b/inst/cta/src/GCTAPsf2D.cpp @@ -39,8 +39,7 @@ #include "GCTAException.hpp" /* __ Method name definitions ____________________________________________ */ -#define G_READ "GCTAPsf2D::read(GFitsTable& table)" -#define G_LOAD "GCTAPsf2D::load(std::string&)" +#define G_READ "GCTAPsf2D::read(GFitsTable&)" #define G_CONTAINMENT_RADIUS "GCTAPsf2D::containment_radius(double&,"\ " double&, double&, double&, double&, double&, bool&)" @@ -76,10 +75,9 @@ GCTAPsf2D::GCTAPsf2D(void) : GCTAPsf() /***********************************************************************//** * @brief File constructor * - * @param[in] filename PSF FITS file name. + * @param[in] filename FITS file name. * - * Construct instance by loading the point spread function information from - * a PSF response table. + * Constructs point spread function from a FITS file. ***************************************************************************/ GCTAPsf2D::GCTAPsf2D(const std::string& filename) : GCTAPsf() { @@ -275,17 +273,18 @@ GCTAPsf2D* GCTAPsf2D::clone(void) const /***********************************************************************//** - * @brief Read PSF from FITS file + * @brief Read point spread function from FITS table * * @param[in] table FITS table. * * @exception GException::invalid_value * FITS file format differs from expectation. * - * Reads the PSF from the FITS table. The data - * are stored in m_psf which is of type GCTAResponseTable. - * The energy axis will be set to log10. The offset angle axis and - * sigma parameter columns will be set to radians. + * Reads point spread function from the FITS @p table. + * + * The data are stored in m_psf which is of type GCTAResponseTable. The + * energy axis will be set to log10. The offset angle axis and sigma + * parameter columns will be set to radians. ***************************************************************************/ void GCTAPsf2D::read(const GFitsTable& table) { @@ -328,24 +327,26 @@ void GCTAPsf2D::read(const GFitsTable& table) /***********************************************************************//** - * @brief Write CTA PSF table into FITS binary table object. + * @brief Write point spread function into FITS binary table + * + * @param[in] table FITS binary table. * - * @param[in] hdu FITS binary table. + * Writes point spread function into FITS binary @p table. * * @todo Add necessary keywords. ***************************************************************************/ -void GCTAPsf2D::write(GFitsBinTable& hdu) const +void GCTAPsf2D::write(GFitsBinTable& table) const { // Create a copy of the response table - GCTAResponseTable table(m_psf); + GCTAResponseTable psf(m_psf); // Convert sigma parameters back to degrees - table.scale(1, gammalib::rad2deg); - table.scale(3, gammalib::rad2deg); - table.scale(5, gammalib::rad2deg); + psf.scale(1, gammalib::rad2deg); + psf.scale(3, gammalib::rad2deg); + psf.scale(5, gammalib::rad2deg); // Write background table - table.write(hdu); + psf.write(table); // Return return; @@ -353,15 +354,14 @@ void GCTAPsf2D::write(GFitsBinTable& hdu) const /***********************************************************************//** - * @brief Load point spread function from performance table + * @brief Load point spread function from FITS file * - * @param[in] filename Performance table file name. + * @param[in] filename FITS file name. * - * @exception GCTAExceptionHandler::file_open_error - * File could not be opened for read access. + * Loads the point spread function from a FITS file. * - * This method loads the point spread function information from a PSF - * response table. + * If no extension name is provided, the point spread function will be loaded + * from the "POINT SPREAD FUNCTION" extension. ***************************************************************************/ void GCTAPsf2D::load(const std::string& filename) { @@ -389,12 +389,15 @@ void GCTAPsf2D::load(const std::string& filename) /***********************************************************************//** - * @brief Save PSF table into FITS file + * @brief Save point spread function table into FITS file + * + * @param[in] filename FITS file name. + * @param[in] clobber Overwrite existing file? (default: false) * - * @param[in] filename PSF table FITS file name. - * @param[in] clobber Overwrite existing file? (true=yes) + * Save the point spread function into a FITS file. * - * Save the PSF table into a FITS file. + * If no extension name is provided, the point spread function will be saved + * into the "POINT SPREAD FUNCTION" extension. ***************************************************************************/ void GCTAPsf2D::save(const std::string& filename, const bool& clobber) const { diff --git a/inst/cta/src/GCTAPsfKing.cpp b/inst/cta/src/GCTAPsfKing.cpp index 0bffc1b..c722018 100644 --- a/inst/cta/src/GCTAPsfKing.cpp +++ b/inst/cta/src/GCTAPsfKing.cpp @@ -39,7 +39,7 @@ #include "GCTAException.hpp" /* __ Method name definitions ____________________________________________ */ -#define G_READ "GCTAPsfKing::read(GFitsTable& table)" +#define G_READ "GCTAPsfKing::read(GFitsTable&)" #define G_CONTAINMENT_RADIUS "GCTAPsfKing::containment_radius(double&,"\ " double&, double&, double&, double&, double&, bool&)" #define G_UPDATE "GCTAPsfKing::update(double&, double&)" @@ -81,8 +81,7 @@ GCTAPsfKing::GCTAPsfKing(void) : GCTAPsf() * * @param[in] filename PSF FITS file. * - * Construct instance by loading the point spread function information from - * a FITS file that contains the PSF information in form of a column. + * Constructs point spread function from a FITS file. ***************************************************************************/ GCTAPsfKing::GCTAPsfKing(const std::string& filename) : GCTAPsf() { @@ -276,17 +275,18 @@ GCTAPsfKing* GCTAPsfKing::clone(void) const /***********************************************************************//** - * @brief Read PSF from FITS file + * @brief Read point spread function from FITS table * * @param[in] table FITS table. * * @exception GException::invalid_value * FITS file format differs from expectation. * - * Reads the PSF from the FITS table. The - * data are stored in m_psf which is of type GCTAResponseTable. - * The energy axis will be set to log10. The offset angle axis and - * sigma parameter columns will be set to radians. + * Reads the point spread function from the FITS @p table. + * + * The data are stored in m_psf which is of type GCTAResponseTable. The + * energy axis will be set to log10. The offset angle axis and sigma + * parameter columns will be set to radians. ***************************************************************************/ void GCTAPsfKing::read(const GFitsTable& table) { @@ -327,16 +327,18 @@ void GCTAPsfKing::read(const GFitsTable& table) /***********************************************************************//** - * @brief Write CTA PSF table into FITS binary table object. + * @brief Write point spread function into FITS table + * + * @param[in] table FITS binary table. * - * @param[in] hdu FITS binary table. + * Writes point spread function into a FITS binary @p table. * - * @todo Add necessary keywords. + * @todo Add keywords. ***************************************************************************/ -void GCTAPsfKing::write(GFitsBinTable& hdu) const +void GCTAPsfKing::write(GFitsBinTable& table) const { // Write background table - m_psf.write(hdu); + m_psf.write(table); // Return return; @@ -344,15 +346,14 @@ void GCTAPsfKing::write(GFitsBinTable& hdu) const /***********************************************************************//** - * @brief Load point spread function from binary table + * @brief Load point spread function from FITS file * - * @param[in] filename Performance table file name. + * @param[in] filename FITS file name. * - * @exception GCTAExceptionHandler::file_open_error - * File could not be opened for read access. + * Loads the point spread function from a FITS file. * - * This method loads the point spread function information from a PSF - * response table. + * If no extension name is provided, the point spread function will be loaded + * from the "POINT SPREAD FUNCTION" extension. ***************************************************************************/ void GCTAPsfKing::load(const std::string& filename) { @@ -379,12 +380,15 @@ void GCTAPsfKing::load(const std::string& filename) } /***********************************************************************//** - * @brief Save PSF table into FITS file + * @brief Save point spread function table into FITS file + * + * @param[in] filename FITS file name. + * @param[in] clobber Overwrite existing file? (default: false) * - * @param[in] filename PSF table FITS file name. - * @param[in] clobber Overwrite existing file? (true=yes) + * Save the point spread function into a FITS file. * - * Save the PSF table into a FITS file. + * If no extension name is provided, the point spread function will be saved + * into the "POINT SPREAD FUNCTION" extension. ***************************************************************************/ void GCTAPsfKing::save(const std::string& filename, const bool& clobber) const { diff --git a/inst/cta/src/GCTAPsfVector.cpp b/inst/cta/src/GCTAPsfVector.cpp index 8978d46..7de99e6 100644 --- a/inst/cta/src/GCTAPsfVector.cpp +++ b/inst/cta/src/GCTAPsfVector.cpp @@ -75,8 +75,7 @@ GCTAPsfVector::GCTAPsfVector(void) : GCTAPsf() * * @param[in] filename PSF FITS file. * - * Construct instance by loading the point spread function information from - * a FITS file that contains the PSF information in form of a column. + * Constructs point spread function vector from a FITS file. ***************************************************************************/ GCTAPsfVector::GCTAPsfVector(const std::string& filename) : GCTAPsf() { @@ -248,12 +247,14 @@ GCTAPsfVector* GCTAPsfVector::clone(void) const /***********************************************************************//** - * @brief Load point spread function from performance table + * @brief Load point spread function from FITS file * - * @param[in] filename Performance table file name. + * @param[in] filename FITS file name. * - * This method loads the point spread function information from a FITS file - * that contains the PSF width in a single column. + * Loads the point spread function from a FITS file. + * + * If no extension name is provided, the point spread function will be loaded + * from the "PSF" extension. ***************************************************************************/ void GCTAPsfVector::load(const std::string& filename) { @@ -281,12 +282,13 @@ void GCTAPsfVector::load(const std::string& filename) /***********************************************************************//** - * @brief Read CTA PSF vector + * @brief Read point spread function vector from FITS table * * @param[in] table FITS table. * - * This method reads a CTA PSF vector from the FITS HDU. Note that the - * energies are converted to TeV. Conversion is done based on the units + * Reads a point spread function vector from the FITS @p table. + * + * The energies are converted to TeV. Conversion is done based on the units * provided for the energy columns. Units that are recognized are 'keV', * 'MeV', 'GeV', and 'TeV' (case independent). * -- libgit2 0.21.4