From 0e72361becbad432a5058509752d1c889dbc44a1 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Thu, 21 Jul 2016 17:21:43 +0200 Subject: [PATCH] Add CTA background cube skymap grid constructor --- inst/cta/include/GCTACubeBackground.hpp | 9 +++++++++ inst/cta/pyext/GCTACubeBackground.i | 9 +++++++++ inst/cta/src/GCTACubeBackground.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ inst/cta/src/GCTACubeEdisp.cpp | 5 +++-- inst/cta/src/GCTACubeExposure.cpp | 4 ++-- inst/cta/src/GCTACubePsf.cpp | 5 ++--- 6 files changed, 68 insertions(+), 7 deletions(-) diff --git a/inst/cta/include/GCTACubeBackground.hpp b/inst/cta/include/GCTACubeBackground.hpp index 648c9ca..569ed1e 100644 --- a/inst/cta/include/GCTACubeBackground.hpp +++ b/inst/cta/include/GCTACubeBackground.hpp @@ -55,6 +55,15 @@ public: explicit GCTACubeBackground(const GFilename& filename); explicit GCTACubeBackground(const GCTAEventCube& cube); GCTACubeBackground(const GCTACubeBackground& bgd); + GCTACubeBackground(const std::string& wcs, + const std::string& coords, + const double& x, + const double& y, + const double& dx, + const double& dy, + const int& nx, + const int& ny, + const GEnergies& energies); virtual ~GCTACubeBackground(void); // Operators diff --git a/inst/cta/pyext/GCTACubeBackground.i b/inst/cta/pyext/GCTACubeBackground.i index 6d23da7..9662b64 100644 --- a/inst/cta/pyext/GCTACubeBackground.i +++ b/inst/cta/pyext/GCTACubeBackground.i @@ -42,6 +42,15 @@ public: explicit GCTACubeBackground(const GFilename& filename); explicit GCTACubeBackground(const GCTAEventCube& cube); GCTACubeBackground(const GCTACubeBackground& bgd); + GCTACubeBackground(const std::string& wcs, + const std::string& coords, + const double& x, + const double& y, + const double& dx, + const double& dy, + const int& nx, + const int& ny, + const GEnergies& energies); virtual ~GCTACubeBackground(void); // Operators diff --git a/inst/cta/src/GCTACubeBackground.cpp b/inst/cta/src/GCTACubeBackground.cpp index 44ac190..62046fb 100644 --- a/inst/cta/src/GCTACubeBackground.cpp +++ b/inst/cta/src/GCTACubeBackground.cpp @@ -158,6 +158,49 @@ GCTACubeBackground::GCTACubeBackground(const GCTACubeBackground& bgd) /***********************************************************************//** + * @brief Background cube constructor + * + * @param[in] wcs World Coordinate System. + * @param[in] coords Coordinate System (CEL or GAL). + * @param[in] x X coordinate of sky map centre (deg). + * @param[in] y Y coordinate of sky map centre (deg). + * @param[in] dx Pixel size in x direction at centre (deg/pixel). + * @param[in] dy Pixel size in y direction at centre (deg/pixel). + * @param[in] nx Number of pixels in x direction. + * @param[in] ny Number of pixels in y direction. + * @param[in] energies Energies. + * + * Constructs a background cube by specifying the sky map grid and the + * energies. + ***************************************************************************/ +GCTACubeBackground::GCTACubeBackground(const std::string& wcs, + const std::string& coords, + const double& x, + const double& y, + const double& dx, + const double& dy, + const int& nx, + const int& ny, + const GEnergies& energies) +{ + // Initialise class members + init_members(); + + // Store energies + m_energies = energies; + + // Set GNodeArray used for interpolation + set_eng_axis(); + + // Create sky map + m_cube = GSkyMap(wcs, coords, x, y, dx, dy, nx, ny, m_energies.size()); + + // Return + return; +} + + +/***********************************************************************//** * @brief Destructor ***************************************************************************/ GCTACubeBackground::~GCTACubeBackground(void) diff --git a/inst/cta/src/GCTACubeEdisp.cpp b/inst/cta/src/GCTACubeEdisp.cpp index 54c108b..d18eff5 100644 --- a/inst/cta/src/GCTACubeEdisp.cpp +++ b/inst/cta/src/GCTACubeEdisp.cpp @@ -202,7 +202,7 @@ GCTACubeEdisp::GCTACubeEdisp(const GCTAEventCube& cube, const double& mmax, /***********************************************************************//** - * @brief Mean PSF cube constructor + * @brief Energy dispersion cube constructor * * @param[in] wcs World Coordinate System. * @param[in] coords Coordinate System (CEL or GAL). @@ -219,7 +219,8 @@ GCTACubeEdisp::GCTACubeEdisp(const GCTAEventCube& cube, const double& mmax, * @exception GException::invalid_argument * Maximum energy migration or number of migration bins invalid. * - * Construct an energy dispersion cube with all elements set to zero. + * Constructs an energy dispersion cube by specifying the sky map grid and + * the energies. ***************************************************************************/ GCTACubeEdisp::GCTACubeEdisp(const std::string& wcs, const std::string& coords, diff --git a/inst/cta/src/GCTACubeExposure.cpp b/inst/cta/src/GCTACubeExposure.cpp index 6e72015..c8d35f5 100644 --- a/inst/cta/src/GCTACubeExposure.cpp +++ b/inst/cta/src/GCTACubeExposure.cpp @@ -161,8 +161,8 @@ GCTACubeExposure::GCTACubeExposure(const GCTAEventCube& cube) * @param[in] ny Number of pixels in y direction. * @param[in] energies Energies. * - * Constructs an exposure cube by specifying the sky map grid and the energy - * boundaries. + * Constructs an exposure cube by specifying the sky map grid and the + * energies. ***************************************************************************/ GCTACubeExposure::GCTACubeExposure(const std::string& wcs, const std::string& coords, diff --git a/inst/cta/src/GCTACubePsf.cpp b/inst/cta/src/GCTACubePsf.cpp index 070e8fe..91b38bf 100644 --- a/inst/cta/src/GCTACubePsf.cpp +++ b/inst/cta/src/GCTACubePsf.cpp @@ -181,7 +181,7 @@ GCTACubePsf::GCTACubePsf(const GCTAEventCube& cube, const double& dmax, /***********************************************************************//** - * @brief Mean PSF cube constructor + * @brief PSF cube constructor * * @param[in] wcs World Coordinate System. * @param[in] coords Coordinate System (CEL or GAL). @@ -195,8 +195,7 @@ GCTACubePsf::GCTACubePsf(const GCTAEventCube& cube, const double& dmax, * @param[in] dmax Maximum delta (deg). * @param[in] ndbins Number of delta bins. * - * Constructs a mean PSF cube by computing the mean PSF from all CTA - * observations found in the observation container. + * Constructs a PSF cube by specifying the sky map grid and the energies. ***************************************************************************/ GCTACubePsf::GCTACubePsf(const std::string& wcs, const std::string& coords, -- libgit2 0.21.4