Commit d6f2c6c8aa2cd1fbdf06fc78aab9edc2565de9ab
1 parent
988869ab
Rename GModelSpatialPtsrc to GModelSpatialPointSource
Showing
7 changed files
with
129 additions
and
103 deletions
include/GModelSpatialPointSource.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | - * GModelSpatialPtsrc.hpp - Spatial point source model class * | |
| 2 | + * GModelSpatialPointSource.hpp - Spatial point source model class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2011 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2009-2013 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -19,13 +19,13 @@ |
| 19 | 19 | * * |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | - * @file GModelSpatialPtsrc.hpp | |
| 22 | + * @file GModelSpatialPointSource.hpp | |
| 23 | 23 | * @brief Point source spatial model class interface definition |
| 24 | - * @author J. Knodlseder | |
| 24 | + * @author Juergen Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -#ifndef GMODELSPATIALPTSRC_HPP | |
| 28 | -#define GMODELSPATIALPTSRC_HPP | |
| 27 | +#ifndef GMODELSPATIALPOINTSOURCE_HPP | |
| 28 | +#define GMODELSPATIALPOINTSOURCE_HPP | |
| 29 | 29 | |
| 30 | 30 | /* __ Includes ___________________________________________________________ */ |
| 31 | 31 | #include <string> |
| ... | ... | @@ -36,36 +36,39 @@ |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | /***********************************************************************//** |
| 39 | - * @class GModelSpatialPtsrc | |
| 39 | + * @class GModelSpatialPointSource | |
| 40 | 40 | * |
| 41 | 41 | * @brief Point source spatial model |
| 42 | 42 | * |
| 43 | - * This class implements the spatial component of the factorised source | |
| 44 | - * model for a point source. | |
| 43 | + * This class implements a point source as the spatial component of the | |
| 44 | + * factorised source model. The point source has two parameters: the Right | |
| 45 | + * Ascension and Declination of the point source location. | |
| 46 | + * | |
| 47 | + * The model is of type "SkyDirFunction". | |
| 45 | 48 | ***************************************************************************/ |
| 46 | -class GModelSpatialPtsrc : public GModelSpatial { | |
| 49 | +class GModelSpatialPointSource : public GModelSpatial { | |
| 47 | 50 | |
| 48 | 51 | public: |
| 49 | 52 | // Constructors and destructors |
| 50 | - GModelSpatialPtsrc(void); | |
| 51 | - explicit GModelSpatialPtsrc(const GSkyDir& dir); | |
| 52 | - explicit GModelSpatialPtsrc(const GXmlElement& xml); | |
| 53 | - GModelSpatialPtsrc(const GModelSpatialPtsrc& model); | |
| 54 | - virtual ~GModelSpatialPtsrc(void); | |
| 53 | + GModelSpatialPointSource(void); | |
| 54 | + explicit GModelSpatialPointSource(const GSkyDir& dir); | |
| 55 | + explicit GModelSpatialPointSource(const GXmlElement& xml); | |
| 56 | + GModelSpatialPointSource(const GModelSpatialPointSource& model); | |
| 57 | + virtual ~GModelSpatialPointSource(void); | |
| 55 | 58 | |
| 56 | 59 | // Operators |
| 57 | - virtual GModelSpatialPtsrc& operator=(const GModelSpatialPtsrc& model); | |
| 60 | + virtual GModelSpatialPointSource& operator=(const GModelSpatialPointSource& model); | |
| 58 | 61 | |
| 59 | 62 | // Implemented pure virtual methods |
| 60 | - virtual void clear(void); | |
| 61 | - virtual GModelSpatialPtsrc* clone(void) const; | |
| 62 | - virtual std::string type(void) const { return "SkyDirFunction"; } | |
| 63 | - virtual double eval(const GSkyDir& srcDir) const; | |
| 64 | - virtual double eval_gradients(const GSkyDir& srcDir) const; | |
| 65 | - virtual GSkyDir mc(GRan& ran) const; | |
| 66 | - virtual void read(const GXmlElement& xml); | |
| 67 | - virtual void write(GXmlElement& xml) const; | |
| 68 | - virtual std::string print(void) const; | |
| 63 | + virtual void clear(void); | |
| 64 | + virtual GModelSpatialPointSource* clone(void) const; | |
| 65 | + virtual std::string type(void) const { return "SkyDirFunction"; } | |
| 66 | + virtual double eval(const GSkyDir& srcDir) const; | |
| 67 | + virtual double eval_gradients(const GSkyDir& srcDir) const; | |
| 68 | + virtual GSkyDir mc(GRan& ran) const; | |
| 69 | + virtual void read(const GXmlElement& xml); | |
| 70 | + virtual void write(GXmlElement& xml) const; | |
| 71 | + virtual std::string print(void) const; | |
| 69 | 72 | |
| 70 | 73 | // Other methods |
| 71 | 74 | double ra(void) const { return m_ra.real_value(); } |
| ... | ... | @@ -76,7 +79,7 @@ public: |
| 76 | 79 | protected: |
| 77 | 80 | // Protected methods |
| 78 | 81 | void init_members(void); |
| 79 | - void copy_members(const GModelSpatialPtsrc& model); | |
| 82 | + void copy_members(const GModelSpatialPointSource& model); | |
| 80 | 83 | void free_members(void); |
| 81 | 84 | |
| 82 | 85 | // Protected members |
| ... | ... | @@ -84,4 +87,4 @@ protected: |
| 84 | 87 | GModelPar m_dec; //!< Declination (deg) |
| 85 | 88 | }; |
| 86 | 89 | |
| 87 | -#endif /* GMODELSPATIALPTSRC_HPP */ | |
| 90 | +#endif /* GMODELSPATIALPOINTSOURCE_HPP */ | ... | ... |
include/GammaLib.hpp
| ... | ... | @@ -164,10 +164,10 @@ |
| 164 | 164 | #include "GModelData.hpp" |
| 165 | 165 | #include "GModelSpatial.hpp" |
| 166 | 166 | #include "GModelSpatialRegistry.hpp" |
| 167 | +#include "GModelSpatialPointSource.hpp" | |
| 167 | 168 | #include "GModelSpatialConst.hpp" |
| 168 | 169 | #include "GModelSpatialCube.hpp" |
| 169 | 170 | #include "GModelSpatialMap.hpp" |
| 170 | -#include "GModelSpatialPtsrc.hpp" | |
| 171 | 171 | #include "GModelRadial.hpp" |
| 172 | 172 | #include "GModelRadialDisk.hpp" |
| 173 | 173 | #include "GModelRadialGauss.hpp" | ... | ... |
include/Makefile.am
| ... | ... | @@ -109,7 +109,7 @@ pkginclude_HEADERS = GammaLib.hpp \ |
| 109 | 109 | GModelData.hpp \ |
| 110 | 110 | GModelSpatial.hpp \ |
| 111 | 111 | GModelSpatialRegistry.hpp \ |
| 112 | - GModelSpatialPtsrc.hpp \ | |
| 112 | + GModelSpatialPointSource.hpp \ | |
| 113 | 113 | GModelSpatialConst.hpp \ |
| 114 | 114 | GModelSpatialCube.hpp \ |
| 115 | 115 | GModelSpatialMap.hpp \ | ... | ... |
pyext/GModelSpatialPointSource.i
| 1 | 1 | /*************************************************************************** |
| 2 | - * GModelSpatialPtsrc.i - Spatial point source model class * | |
| 2 | + * GModelSpatialPointSource.i - Spatial point source model class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2011 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2009-2013 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -19,40 +19,40 @@ |
| 19 | 19 | * * |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | - * @file GModelSpatialPtsrc.i | |
| 22 | + * @file GModelSpatialPointSource.i | |
| 23 | 23 | * @brief Point source spatial model class Python interface |
| 24 | - * @author J. Knodlseder | |
| 24 | + * @author Juergen Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | %{ |
| 27 | 27 | /* Put headers and other declarations here that are needed for compilation */ |
| 28 | -#include "GModelSpatialPtsrc.hpp" | |
| 28 | +#include "GModelSpatialPointSource.hpp" | |
| 29 | 29 | #include "GTools.hpp" |
| 30 | 30 | %} |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | /***********************************************************************//** |
| 34 | - * @class GModelSpatialPtsrc | |
| 34 | + * @class GModelSpatialPointSource | |
| 35 | 35 | * |
| 36 | 36 | * @brief Point source spatial model |
| 37 | 37 | ***************************************************************************/ |
| 38 | -class GModelSpatialPtsrc : public GModelSpatial { | |
| 38 | +class GModelSpatialPointSource : public GModelSpatial { | |
| 39 | 39 | public: |
| 40 | 40 | // Constructors and destructors |
| 41 | - explicit GModelSpatialPtsrc(void); | |
| 42 | - explicit GModelSpatialPtsrc(const GSkyDir& dir); | |
| 43 | - explicit GModelSpatialPtsrc(const GXmlElement& xml); | |
| 44 | - GModelSpatialPtsrc(const GModelSpatialPtsrc& model); | |
| 45 | - virtual ~GModelSpatialPtsrc(void); | |
| 41 | + explicit GModelSpatialPointSource(void); | |
| 42 | + explicit GModelSpatialPointSource(const GSkyDir& dir); | |
| 43 | + explicit GModelSpatialPointSource(const GXmlElement& xml); | |
| 44 | + GModelSpatialPointSource(const GModelSpatialPointSource& model); | |
| 45 | + virtual ~GModelSpatialPointSource(void); | |
| 46 | 46 | |
| 47 | 47 | // Implemented virtual methods |
| 48 | - virtual void clear(void); | |
| 49 | - virtual GModelSpatialPtsrc* clone(void) const; | |
| 50 | - virtual std::string type(void) const; | |
| 51 | - virtual double eval(const GSkyDir& srcDir) const; | |
| 52 | - virtual double eval_gradients(const GSkyDir& srcDir) const; | |
| 53 | - virtual GSkyDir mc(GRan& ran) const; | |
| 54 | - virtual void read(const GXmlElement& xml); | |
| 55 | - virtual void write(GXmlElement& xml) const; | |
| 48 | + virtual void clear(void); | |
| 49 | + virtual GModelSpatialPointSource* clone(void) const; | |
| 50 | + virtual std::string type(void) const; | |
| 51 | + virtual double eval(const GSkyDir& srcDir) const; | |
| 52 | + virtual double eval_gradients(const GSkyDir& srcDir) const; | |
| 53 | + virtual GSkyDir mc(GRan& ran) const; | |
| 54 | + virtual void read(const GXmlElement& xml); | |
| 55 | + virtual void write(GXmlElement& xml) const; | |
| 56 | 56 | |
| 57 | 57 | // Other methods |
| 58 | 58 | double ra(void) const; |
| ... | ... | @@ -63,10 +63,10 @@ public: |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | /***********************************************************************//** |
| 66 | - * @brief GModelSpatialPtsrc class extension | |
| 66 | + * @brief GModelSpatialPointSource class extension | |
| 67 | 67 | ***************************************************************************/ |
| 68 | -%extend GModelSpatialPtsrc { | |
| 69 | - GModelSpatialPtsrc copy() { | |
| 68 | +%extend GModelSpatialPointSource { | |
| 69 | + GModelSpatialPointSource copy() { | |
| 70 | 70 | return (*self); |
| 71 | 71 | } |
| 72 | 72 | }; | ... | ... |
pyext/gammalib/model.i
| ... | ... | @@ -52,10 +52,10 @@ |
| 52 | 52 | %include "GModelData.i" |
| 53 | 53 | %include "GModelSpatial.i" |
| 54 | 54 | %include "GModelSpatialRegistry.i" |
| 55 | +%include "GModelSpatialPointSource.i" | |
| 55 | 56 | %include "GModelSpatialConst.i" |
| 56 | 57 | %include "GModelSpatialCube.i" |
| 57 | 58 | %include "GModelSpatialMap.i" |
| 58 | -%include "GModelSpatialPtsrc.i" | |
| 59 | 59 | %include "GModelRadial.i" |
| 60 | 60 | %include "GModelRadialDisk.i" |
| 61 | 61 | %include "GModelRadialGauss.i" | ... | ... |
src/model/GModelSpatialPointSource.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | - * GModelSpatialPtsrc.cpp - Spatial point source model class * | |
| 2 | + * GModelSpatialPointSource.cpp - Spatial point source model class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2012 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2013 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -19,9 +19,9 @@ |
| 19 | 19 | * * |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | - * @file GModelSpatialPtsrc.cpp | |
| 22 | + * @file GModelSpatialPointSource.cpp | |
| 23 | 23 | * @brief Point source spatial model class implementation |
| 24 | - * @author J. Knoedlseder | |
| 24 | + * @author Juergen Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | /* __ Includes ___________________________________________________________ */ |
| ... | ... | @@ -30,19 +30,19 @@ |
| 30 | 30 | #endif |
| 31 | 31 | #include "GException.hpp" |
| 32 | 32 | #include "GTools.hpp" |
| 33 | -#include "GModelSpatialPtsrc.hpp" | |
| 33 | +#include "GModelSpatialPointSource.hpp" | |
| 34 | 34 | #include "GModelSpatialRegistry.hpp" |
| 35 | 35 | |
| 36 | 36 | /* __ Constants __________________________________________________________ */ |
| 37 | 37 | const double tolerance = 0.000027777778; // angular tolerance is 1 arcsec |
| 38 | 38 | |
| 39 | 39 | /* __ Globals ____________________________________________________________ */ |
| 40 | -const GModelSpatialPtsrc g_spatial_ptsrc_seed; | |
| 41 | -const GModelSpatialRegistry g_spatial_ptsrc_registry(&g_spatial_ptsrc_seed); | |
| 40 | +const GModelSpatialPointSource g_spatial_ptsrc_seed; | |
| 41 | +const GModelSpatialRegistry g_spatial_ptsrc_registry(&g_spatial_ptsrc_seed); | |
| 42 | 42 | |
| 43 | 43 | /* __ Method name definitions ____________________________________________ */ |
| 44 | -#define G_READ "GModelSpatialPtsrc::read(GXmlElement&)" | |
| 45 | -#define G_WRITE "GModelSpatialPtsrc::write(GXmlElement&)" | |
| 44 | +#define G_READ "GModelSpatialPointSource::read(GXmlElement&)" | |
| 45 | +#define G_WRITE "GModelSpatialPointSource::write(GXmlElement&)" | |
| 46 | 46 | |
| 47 | 47 | /* __ Macros _____________________________________________________________ */ |
| 48 | 48 | |
| ... | ... | @@ -60,7 +60,7 @@ const GModelSpatialRegistry g_spatial_ptsrc_registry(&g_spatial_ptsrc_seed); |
| 60 | 60 | /***********************************************************************//** |
| 61 | 61 | * @brief Void constructor |
| 62 | 62 | ***************************************************************************/ |
| 63 | -GModelSpatialPtsrc::GModelSpatialPtsrc(void) : GModelSpatial() | |
| 63 | +GModelSpatialPointSource::GModelSpatialPointSource(void) : GModelSpatial() | |
| 64 | 64 | { |
| 65 | 65 | // Initialise members |
| 66 | 66 | init_members(); |
| ... | ... | @@ -75,9 +75,10 @@ GModelSpatialPtsrc::GModelSpatialPtsrc(void) : GModelSpatial() |
| 75 | 75 | * |
| 76 | 76 | * @param[in] dir Sky direction. |
| 77 | 77 | * |
| 78 | - * Creates instance of a point source spatial model using a sky direction. | |
| 78 | + * Construct a point source spatial model from a sky direction. | |
| 79 | 79 | ***************************************************************************/ |
| 80 | -GModelSpatialPtsrc::GModelSpatialPtsrc(const GSkyDir& dir) : GModelSpatial() | |
| 80 | +GModelSpatialPointSource::GModelSpatialPointSource(const GSkyDir& dir) : | |
| 81 | + GModelSpatial() | |
| 81 | 82 | { |
| 82 | 83 | // Initialise members |
| 83 | 84 | init_members(); |
| ... | ... | @@ -95,11 +96,12 @@ GModelSpatialPtsrc::GModelSpatialPtsrc(const GSkyDir& dir) : GModelSpatial() |
| 95 | 96 | * |
| 96 | 97 | * @param[in] xml XML element. |
| 97 | 98 | * |
| 98 | - * Creates instance of a point source spatial model by extracting information | |
| 99 | - * from an XML element. See GModelSpatialPtsrc::read() for more information | |
| 99 | + * Construct a point source spatial model by extracting information from an | |
| 100 | + * XML element. See GModelSpatialPointSource::read() for more information | |
| 100 | 101 | * about the expected structure of the XML element. |
| 101 | 102 | ***************************************************************************/ |
| 102 | -GModelSpatialPtsrc::GModelSpatialPtsrc(const GXmlElement& xml) : GModelSpatial() | |
| 103 | +GModelSpatialPointSource::GModelSpatialPointSource(const GXmlElement& xml) : | |
| 104 | + GModelSpatial() | |
| 103 | 105 | { |
| 104 | 106 | // Initialise members |
| 105 | 107 | init_members(); |
| ... | ... | @@ -117,8 +119,8 @@ GModelSpatialPtsrc::GModelSpatialPtsrc(const GXmlElement& xml) : GModelSpatial() |
| 117 | 119 | * |
| 118 | 120 | * @param[in] model Point source spatial model. |
| 119 | 121 | ***************************************************************************/ |
| 120 | -GModelSpatialPtsrc::GModelSpatialPtsrc(const GModelSpatialPtsrc& model) | |
| 121 | - : GModelSpatial(model) | |
| 122 | +GModelSpatialPointSource::GModelSpatialPointSource(const GModelSpatialPointSource& model) : | |
| 123 | + GModelSpatial(model) | |
| 122 | 124 | { |
| 123 | 125 | // Initialise members |
| 124 | 126 | init_members(); |
| ... | ... | @@ -134,7 +136,7 @@ GModelSpatialPtsrc::GModelSpatialPtsrc(const GModelSpatialPtsrc& model) |
| 134 | 136 | /***********************************************************************//** |
| 135 | 137 | * @brief Destructor |
| 136 | 138 | ***************************************************************************/ |
| 137 | -GModelSpatialPtsrc::~GModelSpatialPtsrc(void) | |
| 139 | +GModelSpatialPointSource::~GModelSpatialPointSource(void) | |
| 138 | 140 | { |
| 139 | 141 | // Free members |
| 140 | 142 | free_members(); |
| ... | ... | @@ -154,8 +156,9 @@ GModelSpatialPtsrc::~GModelSpatialPtsrc(void) |
| 154 | 156 | * @brief Assignment operator |
| 155 | 157 | * |
| 156 | 158 | * @param[in] model Point source spatial model. |
| 159 | + * @return Point source spatial model. | |
| 157 | 160 | ***************************************************************************/ |
| 158 | -GModelSpatialPtsrc& GModelSpatialPtsrc::operator= (const GModelSpatialPtsrc& model) | |
| 161 | +GModelSpatialPointSource& GModelSpatialPointSource::operator=(const GModelSpatialPointSource& model) | |
| 159 | 162 | { |
| 160 | 163 | // Execute only if object is not identical |
| 161 | 164 | if (this != &model) { |
| ... | ... | @@ -187,8 +190,8 @@ GModelSpatialPtsrc& GModelSpatialPtsrc::operator= (const GModelSpatialPtsrc& mod |
| 187 | 190 | |
| 188 | 191 | /***********************************************************************//** |
| 189 | 192 | * @brief Clear instance |
| 190 | -***************************************************************************/ | |
| 191 | -void GModelSpatialPtsrc::clear(void) | |
| 193 | + ***************************************************************************/ | |
| 194 | +void GModelSpatialPointSource::clear(void) | |
| 192 | 195 | { |
| 193 | 196 | // Free class members (base and derived classes, derived class first) |
| 194 | 197 | free_members(); |
| ... | ... | @@ -205,10 +208,12 @@ void GModelSpatialPtsrc::clear(void) |
| 205 | 208 | |
| 206 | 209 | /***********************************************************************//** |
| 207 | 210 | * @brief Clone instance |
| 208 | -***************************************************************************/ | |
| 209 | -GModelSpatialPtsrc* GModelSpatialPtsrc::clone(void) const | |
| 211 | + * | |
| 212 | + * @return Pointer to deep copy of point source spatial model. | |
| 213 | + ***************************************************************************/ | |
| 214 | +GModelSpatialPointSource* GModelSpatialPointSource::clone(void) const | |
| 210 | 215 | { |
| 211 | - return new GModelSpatialPtsrc(*this); | |
| 216 | + return new GModelSpatialPointSource(*this); | |
| 212 | 217 | } |
| 213 | 218 | |
| 214 | 219 | |
| ... | ... | @@ -216,13 +221,14 @@ GModelSpatialPtsrc* GModelSpatialPtsrc::clone(void) const |
| 216 | 221 | * @brief Evaluate function |
| 217 | 222 | * |
| 218 | 223 | * @param[in] srcDir True photon arrival direction. |
| 224 | + * @return Model value (1 if srcDir corresponds to source direction, 0 else). | |
| 219 | 225 | * |
| 220 | 226 | * Evaluates the spatial part for a point source model. It implements a delta |
| 221 | 227 | * function with respect to the coordinates of the source. For numerical |
| 222 | 228 | * reasons a certain tolerance is accepted (typically 0.1 arcsec, i.e. well |
| 223 | 229 | * below the angular resolution of gamma-ray telescopes). |
| 224 | 230 | ***************************************************************************/ |
| 225 | -double GModelSpatialPtsrc::eval(const GSkyDir& srcDir) const | |
| 231 | +double GModelSpatialPointSource::eval(const GSkyDir& srcDir) const | |
| 226 | 232 | { |
| 227 | 233 | // Set value dependent on source distance |
| 228 | 234 | double value = (srcDir.dist_deg(dir()) < tolerance) ? 1.0 : 0.0; |
| ... | ... | @@ -236,6 +242,7 @@ double GModelSpatialPtsrc::eval(const GSkyDir& srcDir) const |
| 236 | 242 | * @brief Evaluate function and gradients |
| 237 | 243 | * |
| 238 | 244 | * @param[in] srcDir True photon arrival direction. |
| 245 | + * @return Model value (1 if srcDir corresponds to source direction, 0 else). | |
| 239 | 246 | * |
| 240 | 247 | * Evaluates the spatial part for a point source model and the gradient. |
| 241 | 248 | * It implements a delta function with respect to the coordinates of the |
| ... | ... | @@ -245,7 +252,7 @@ double GModelSpatialPtsrc::eval(const GSkyDir& srcDir) const |
| 245 | 252 | * |
| 246 | 253 | * This method does not provide valid parameter gradients. |
| 247 | 254 | ***************************************************************************/ |
| 248 | -double GModelSpatialPtsrc::eval_gradients(const GSkyDir& srcDir) const | |
| 255 | +double GModelSpatialPointSource::eval_gradients(const GSkyDir& srcDir) const | |
| 249 | 256 | { |
| 250 | 257 | // Set value dependent on source distance |
| 251 | 258 | double value = (srcDir.dist_deg(dir()) < tolerance) ? 1.0 : 0.0; |
| ... | ... | @@ -259,10 +266,11 @@ double GModelSpatialPtsrc::eval_gradients(const GSkyDir& srcDir) const |
| 259 | 266 | * @brief Returns MC sky direction |
| 260 | 267 | * |
| 261 | 268 | * @param[in] ran Random number generator. |
| 269 | + * @return Sky direction. | |
| 262 | 270 | * |
| 263 | 271 | * This method always returns the directon of the point source. |
| 264 | 272 | ***************************************************************************/ |
| 265 | -GSkyDir GModelSpatialPtsrc::mc(GRan& ran) const | |
| 273 | +GSkyDir GModelSpatialPointSource::mc(GRan& ran) const | |
| 266 | 274 | { |
| 267 | 275 | // Return point source direction |
| 268 | 276 | return dir(); |
| ... | ... | @@ -279,11 +287,23 @@ GSkyDir GModelSpatialPtsrc::mc(GRan& ran) const |
| 279 | 287 | * @exception GException::model_invalid_parnames |
| 280 | 288 | * Invalid model parameter names found in XML element. |
| 281 | 289 | * |
| 282 | - * Read the point source information from an XML element. The XML element | |
| 283 | - * is required to have 2 parameters named either "RA" and "DEC" or "GLON" | |
| 284 | - * and "GLAT". | |
| 290 | + * Read the point source information from an XML element with the following | |
| 291 | + * format | |
| 292 | + * | |
| 293 | + * <spatialModel type="SkyDirFunction"> | |
| 294 | + * <parameter free="0" max="360" min="-360" name="RA" scale="1" value="83.6331" /> | |
| 295 | + * <parameter free="0" max="90" min="-90" name="DEC" scale="1" value="22.0145" /> | |
| 296 | + * </spatialModel> | |
| 297 | + * | |
| 298 | + * or | |
| 299 | + * | |
| 300 | + * <spatialModel type="SkyDirFunction"> | |
| 301 | + * <parameter free="0" max="360" min="-360" name="GLON" scale="1" value="83.6331" /> | |
| 302 | + * <parameter free="0" max="90" min="-90" name="GLAT" scale="1" value="22.0145" /> | |
| 303 | + * </spatialModel> | |
| 304 | + * | |
| 285 | 305 | ***************************************************************************/ |
| 286 | -void GModelSpatialPtsrc::read(const GXmlElement& xml) | |
| 306 | +void GModelSpatialPointSource::read(const GXmlElement& xml) | |
| 287 | 307 | { |
| 288 | 308 | // Verify that XML element has exactly 2 parameters |
| 289 | 309 | if (xml.elements() != 2 || xml.elements("parameter") != 2) { |
| ... | ... | @@ -353,14 +373,18 @@ void GModelSpatialPtsrc::read(const GXmlElement& xml) |
| 353 | 373 | * @exception GException::model_invalid_parnames |
| 354 | 374 | * Invalid model parameter names found in XML element. |
| 355 | 375 | * |
| 356 | - * Write the point source information into an XML element. The XML element | |
| 357 | - * has to be of type 'SkyDirFunction' and will have 2 parameter leafs | |
| 358 | - * named 'RA' and 'DEC'. | |
| 376 | + * Write the point source information into an XML element with the following | |
| 377 | + * format | |
| 378 | + * | |
| 379 | + * <spatialModel type="SkyDirFunction"> | |
| 380 | + * <parameter free="0" max="360" min="-360" name="RA" scale="1" value="83.6331" /> | |
| 381 | + * <parameter free="0" max="90" min="-90" name="DEC" scale="1" value="22.0145" /> | |
| 382 | + * </spatialModel> | |
| 359 | 383 | * |
| 360 | 384 | * @todo The case that an existing spatial XML element with "GLON" and "GLAT" |
| 361 | 385 | * as coordinates is not supported. |
| 362 | 386 | ***************************************************************************/ |
| 363 | -void GModelSpatialPtsrc::write(GXmlElement& xml) const | |
| 387 | +void GModelSpatialPointSource::write(GXmlElement& xml) const | |
| 364 | 388 | { |
| 365 | 389 | // Set model type |
| 366 | 390 | if (xml.attribute("type") == "") { |
| ... | ... | @@ -410,14 +434,18 @@ void GModelSpatialPtsrc::write(GXmlElement& xml) const |
| 410 | 434 | |
| 411 | 435 | /***********************************************************************//** |
| 412 | 436 | * @brief Print point source information |
| 437 | + * | |
| 438 | + * @return String containing point source information. | |
| 413 | 439 | ***************************************************************************/ |
| 414 | -std::string GModelSpatialPtsrc::print(void) const | |
| 440 | +std::string GModelSpatialPointSource::print(void) const | |
| 415 | 441 | { |
| 416 | 442 | // Initialise result string |
| 417 | 443 | std::string result; |
| 418 | 444 | |
| 419 | 445 | // Append header |
| 420 | - result.append("=== GModelSpatialPtsrc ===\n"); | |
| 446 | + result.append("=== GModelSpatialPointSource ===\n"); | |
| 447 | + | |
| 448 | + // Append parameters | |
| 421 | 449 | result.append(parformat("Number of parameters")+str(size())); |
| 422 | 450 | for (int i = 0; i < size(); ++i) { |
| 423 | 451 | result.append("\n"+m_pars[i]->print()); |
| ... | ... | @@ -430,8 +458,10 @@ std::string GModelSpatialPtsrc::print(void) const |
| 430 | 458 | |
| 431 | 459 | /***********************************************************************//** |
| 432 | 460 | * @brief Return position of point source |
| 461 | + * | |
| 462 | + * @return Point source sky direction. | |
| 433 | 463 | ***************************************************************************/ |
| 434 | -GSkyDir GModelSpatialPtsrc::dir(void) const | |
| 464 | +GSkyDir GModelSpatialPointSource::dir(void) const | |
| 435 | 465 | { |
| 436 | 466 | // Allocate sky direction |
| 437 | 467 | GSkyDir srcDir; |
| ... | ... | @@ -447,7 +477,7 @@ GSkyDir GModelSpatialPtsrc::dir(void) const |
| 447 | 477 | /***********************************************************************//** |
| 448 | 478 | * @brief Set position of point source |
| 449 | 479 | ***************************************************************************/ |
| 450 | -void GModelSpatialPtsrc::dir(const GSkyDir& dir) | |
| 480 | +void GModelSpatialPointSource::dir(const GSkyDir& dir) | |
| 451 | 481 | { |
| 452 | 482 | // Assign Right Ascension and Declination |
| 453 | 483 | m_ra.real_value(dir.ra_deg()); |
| ... | ... | @@ -467,7 +497,7 @@ void GModelSpatialPtsrc::dir(const GSkyDir& dir) |
| 467 | 497 | /***********************************************************************//** |
| 468 | 498 | * @brief Initialise class members |
| 469 | 499 | ***************************************************************************/ |
| 470 | -void GModelSpatialPtsrc::init_members(void) | |
| 500 | +void GModelSpatialPointSource::init_members(void) | |
| 471 | 501 | { |
| 472 | 502 | // Initialise Right Ascension |
| 473 | 503 | m_ra.clear(); |
| ... | ... | @@ -502,7 +532,7 @@ void GModelSpatialPtsrc::init_members(void) |
| 502 | 532 | * |
| 503 | 533 | * @param[in] model Point source spatial model. |
| 504 | 534 | ***************************************************************************/ |
| 505 | -void GModelSpatialPtsrc::copy_members(const GModelSpatialPtsrc& model) | |
| 535 | +void GModelSpatialPointSource::copy_members(const GModelSpatialPointSource& model) | |
| 506 | 536 | { |
| 507 | 537 | // Copy members |
| 508 | 538 | m_ra = model.m_ra; |
| ... | ... | @@ -521,15 +551,8 @@ void GModelSpatialPtsrc::copy_members(const GModelSpatialPtsrc& model) |
| 521 | 551 | /***********************************************************************//** |
| 522 | 552 | * @brief Delete class members |
| 523 | 553 | ***************************************************************************/ |
| 524 | -void GModelSpatialPtsrc::free_members(void) | |
| 554 | +void GModelSpatialPointSource::free_members(void) | |
| 525 | 555 | { |
| 526 | 556 | // Return |
| 527 | 557 | return; |
| 528 | 558 | } |
| 529 | - | |
| 530 | - | |
| 531 | -/*========================================================================== | |
| 532 | - = = | |
| 533 | - = Friends = | |
| 534 | - = = | |
| 535 | - ==========================================================================*/ | ... | ... |
src/model/Makefile.am
| ... | ... | @@ -14,10 +14,10 @@ sources = GModelPar.cpp \ |
| 14 | 14 | GModelData.cpp \ |
| 15 | 15 | GModelSpatial.cpp \ |
| 16 | 16 | GModelSpatialRegistry.cpp \ |
| 17 | + GModelSpatialPointSource.cpp \ | |
| 17 | 18 | GModelSpatialConst.cpp \ |
| 18 | 19 | GModelSpatialCube.cpp \ |
| 19 | 20 | GModelSpatialMap.cpp \ |
| 20 | - GModelSpatialPtsrc.cpp \ | |
| 21 | 21 | GModelRadial.cpp \ |
| 22 | 22 | GModelRadialDisk.cpp \ |
| 23 | 23 | GModelRadialGauss.cpp \ | ... | ... |