42 #if defined(G_LEGACY_XML_FORMAT)
48 #define G_CONSTRUCTOR "GModelSpatialRadialGauss::GModelSpatialRadialGauss("\
49 "GSkyDir&, double&, std::string&)"
50 #define G_EVAL "GModelSpatialRadialGauss::eval(double&, GEnergy&, GTime&, "\
52 #define G_READ "GModelSpatialRadialGauss::read(GXmlElement&)"
53 #define G_WRITE "GModelSpatialRadialGauss::write(GXmlElement&)"
92 const std::string& type) :
123 const std::string& coordsys) :
127 if ((coordsys !=
"CEL") && (coordsys !=
"GAL")) {
128 std::string msg =
"Invalid coordinate system \""+coordsys+
"\" "
129 "specified. Please specify either \"CEL\" or "
138 if (coordsys ==
"CEL") {
226 if (
this != &model) {
352 const bool& gradients)
const
358 double theta2 = theta * theta;
385 double g_sigma = 0.0;
394 #if defined(G_NAN_CHECK)
396 std::string msg =
"Model value not a number:";
397 for (
int i = 0; i <
m_pars.size(); ++i) {
398 msg +=
" " +
m_pars[i]->name() +
"=";
401 msg +=
" energy=" + energy.
print();
402 msg +=
" time=" + time.
print();
431 double phi = 360.0 * ran.
uniform();
452 const double& margin)
const
455 double distance = dir.
dist(this->
dir());
566 result.append(
"=== GModelSpatialRadialGauss ===");
571 for (
int i = 0; i <
size(); ++i) {
596 m_type =
"RadialGaussian";
680 double sigma2_rad = sigma_rad * sigma_rad;
681 if (sigma2_rad > 0.0) {
double chisq2(void)
Returns Chi2 deviates for 2 degrees of freedom.
const double & factor_gradient(void) const
Return parameter factor gradient.
double sigma(void) const
Return Gaussian sigma.
const std::string & name(void) const
Return parameter name.
void warning(const std::string &origin, const std::string &message)
Emits warning.
virtual double theta_max(void) const
Return maximum model radius (in radians)
double gradient(void) const
Return parameter gradient.
int size(void) const
Return number of parameters.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
Random number generator class.
Interface for the circular sky region class.
Interface definition for the spatial model registry class.
virtual void write(GXmlElement &xml) const
Write model into XML element.
double min(void) const
Return parameter minimum boundary.
bool is_free(void) const
Signal if parameter is free.
void init_members(void)
Initialise class members.
GModelPar m_sigma
Gaussian width (deg)
GSkyRegionCircle m_region
Bounding circle.
void copy_members(const GModelSpatialRadialGauss &model)
Copy class members.
virtual GModelSpatialRadialGauss * clone(void) const
Clone radial Gauss model.
bool is_notanumber(const double &x)
Signal if argument is not a number.
const double & scale(void) const
Return parameter scale.
bool is_infinite(const double &x)
Signal if argument is infinite.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
double m_inv_sigma2_rad
sigma(rad)^-2
const GSkyDir & dir(void) const
Return position of radial spatial model.
GModelSpatialRadialGauss(void)
Void constructor.
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
void free_members(void)
Delete class members.
void free(void)
Free a parameter.
std::vector< GModelPar * > m_pars
Parameter pointers.
double m_g_theta_norm
sigma(rad)^-2 deg2rad
void rotate_deg(const double &phi, const double &theta)
Rotate sky direction by zenith and azimuth angle.
double m_value_norm
(2pi sigma(rad))^-2
double m_g_sigma_norm
sigma(rad)^-1 sigma_scale deg2rad
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
virtual void read(const GXmlElement &xml)
Read model from XML element.
double uniform(void)
Returns random double precision floating value in range 0 to 1.
void clear(void)
Clear parameter.
Spatial model registry class definition.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual void set_region(void) const
Set boundary sky region.
std::string print(const GChatter &chatter=NORMAL) const
Print time.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate Gaussian source model.
std::string type(void) const
Return model type.
void xml_check_parnum(const std::string &origin, const GXmlElement &xml, const int &number)
Checks number of parameters.
virtual void write(GXmlElement &xml) const
Write model into XML element.
const GSkyRegion * region(void) const
Return boundary sky region.
virtual GModelSpatialRadial & operator=(const GModelSpatialRadial &model)
Assignment operator.
void free_members(void)
Delete class members.
std::string m_type
Spatial model type.
GModelPar m_lat
Declination or Galactic latitude (deg)
void init_members(void)
Initialise class members.
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
double value(void) const
Return parameter value.
GModelPar m_lon
Right Ascension or Galactic longitude (deg)
const std::string & unit(void) const
Return parameter unit.
double m_last_sigma
Last Gaussian sigma.
Exception handler interface definition.
double dist(const GSkyDir &dir) const
Compute angular distance between sky directions in radians.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
virtual GModelSpatialRadialGauss & operator=(const GModelSpatialRadialGauss &model)
Assignment operator.
Abstract radial spatial model base class.
void init_members(void)
Initialise class members.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void free_members(void)
Delete class members.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
Radial Gaussian model class.
void update(const bool &gradients) const
Update precomputation cache.
virtual void clear(void)
Clear radial Gauss model.
Radial Gaussian model class interface definition.
const GXmlElement * xml_get_par(const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
const GModelSpatialRadialGauss g_radial_gauss_seed
Mathematical function definitions.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Gaussian source information.
Class that handles energies in a unit independent way.
virtual ~GModelSpatialRadialGauss(void)
Destructor.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.