GammaLib
2.0.0
|
Spectral nodes model class. More...
#include <GModelSpectralNodes.hpp>
Public Member Functions | |
GModelSpectralNodes (void) | |
Void constructor. More... | |
GModelSpectralNodes (const GModelSpectral &model, const GEnergies &energies) | |
Spectral model constructor. More... | |
GModelSpectralNodes (const GXmlElement &xml) | |
XML constructor. More... | |
GModelSpectralNodes (const GModelSpectralNodes &model) | |
Copy constructor. More... | |
virtual | ~GModelSpectralNodes (void) |
Destructor. More... | |
virtual GModelSpectralNodes & | operator= (const GModelSpectralNodes &model) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear spectral nodes model. More... | |
virtual GModelSpectralNodes * | clone (void) const |
Clone spectral nodes model. More... | |
virtual std::string | classname (void) const |
Return class name. More... | |
virtual std::string | type (void) const |
Return model type. More... | |
virtual double | eval (const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const |
Evaluate function. More... | |
virtual double | flux (const GEnergy &emin, const GEnergy &emax) const |
Returns model photon flux between emin, emax More... | |
virtual double | eflux (const GEnergy &emin, const GEnergy &emax) const |
Returns model energy flux between emin, emax More... | |
virtual GEnergy | mc (const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const |
Returns MC energy between [emin, emax]. More... | |
virtual void | read (const GXmlElement &xml) |
Read model from XML element. More... | |
virtual void | write (GXmlElement &xml) const |
Write model into XML element. More... | |
virtual std::string | print (const GChatter &chatter=NORMAL) const |
Print node function information. More... | |
int | nodes (void) const |
Return number of nodes. More... | |
void | append (const GEnergy &energy, const double &intensity) |
Append node. More... | |
void | insert (const int &index, const GEnergy &energy, const double &intensity) |
Insert node. More... | |
void | remove (const int &index) |
Remove node. More... | |
void | reserve (const int &num) |
Reserve space for nodes. More... | |
void | extend (const GModelSpectralNodes &nodes) |
Append nodes from node function. More... | |
GEnergy | energy (const int &index) const |
Return node energy. More... | |
void | energy (const int &index, const GEnergy &energy) |
Set node energy. More... | |
double | intensity (const int &index) const |
Return node intensity. More... | |
void | intensity (const int &index, const double &intensity) |
Set node intensity. More... | |
double | error (const int &index) const |
Return intensity error of node. More... | |
Public Member Functions inherited from GModelSpectral | |
GModelSpectral (void) | |
Void constructor. More... | |
GModelSpectral (const GModelSpectral &model) | |
Copy constructor. More... | |
virtual | ~GModelSpectral (void) |
Destructor. More... | |
virtual GModelSpectral & | operator= (const GModelSpectral &model) |
Assignment operator. More... | |
virtual GModelPar & | operator[] (const int &index) |
Returns model parameter. More... | |
virtual const GModelPar & | operator[] (const int &index) const |
Returns model parameter (const version) More... | |
virtual GModelPar & | operator[] (const std::string &name) |
Returns reference to model parameter. More... | |
virtual const GModelPar & | operator[] (const std::string &name) const |
Returns reference to model parameter (const version) More... | |
GModelPar & | at (const int &index) |
Returns model parameter. More... | |
const GModelPar & | at (const int &index) const |
Returns model parameter (const version) More... | |
bool | has_par (const std::string &name) const |
Checks if parameter name exists. More... | |
int | size (void) const |
Return number of parameters. More... | |
void | autoscale (void) |
Autoscale parameters. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Protected Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GModelSpectralNodes &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | update_pars (void) |
Update parameter mapping. More... | |
void | set_cache (void) const |
Set pre-computation cache. More... | |
void | set_eval_cache (void) const |
Set evaluation cache. More... | |
void | set_flux_cache (void) const |
Set flux computation cache. More... | |
void | update_eval_cache (void) const |
Update evaluation cache. More... | |
void | update_flux_cache (void) const |
Update flux computation cache. More... | |
void | mc_update (const GEnergy &emin, const GEnergy &emax) const |
Set MC pre-computation cache. More... | |
Protected Member Functions inherited from GModelSpectral | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GModelSpectral &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
std::vector< GModelPar > | m_energies |
Node energies. More... | |
std::vector< GModelPar > | m_values |
Node values. More... | |
std::vector< double > | m_old_energies |
Old energies. More... | |
std::vector< double > | m_old_values |
Old values. More... | |
GNodeArray | m_log_energies |
log10(energy) of nodes More... | |
std::vector< double > | m_log_values |
log10(value) of nodes More... | |
GNodeArray | m_lin_energies |
Energy of nodes. More... | |
std::vector< double > | m_lin_values |
Values of nodes. More... | |
std::vector< double > | m_prefactor |
Power-law normalisations. More... | |
std::vector< double > | m_gamma |
Power-law indices. More... | |
std::vector< double > | m_epivot |
Power-law pivot energies. More... | |
std::vector< double > | m_flux |
Photon fluxes. More... | |
std::vector< double > | m_eflux |
Energy fluxes. More... | |
GEnergy | m_mc_emin |
Minimum energy. More... | |
GEnergy | m_mc_emax |
Maximum energy. More... | |
std::vector< double > | m_mc_cum |
Cumulative distribution. More... | |
std::vector< double > | m_mc_min |
Lower boundary for MC. More... | |
std::vector< double > | m_mc_max |
Upper boundary for MC. More... | |
std::vector< double > | m_mc_exp |
Exponent for MC. More... | |
Protected Attributes inherited from GModelSpectral | |
std::vector< GModelPar * > | m_pars |
Parameter pointers. More... | |
Spectral nodes model class.
This class implements a piecewise power law between spectral nodes
\[ ({\tt m\_energies[i]}, {\tt m\_values[i]}) \]
where
For a given energy \(E\), the piecewise power law is computing by finding the bracketing energies \({\tt m\_energies[i]} <= E <= {\tt m\_energies[i+1]}\) and computing
\[ S_{\rm E}(E | t) = 10^{(\log {\tt m\_values[i]}) w_{i} + (\log {\tt m\_values[i+1]}) w_{i+1}} \]
where
The weightings \(w_{i}\) and \(w_{i+1}\) are computed by linear interpolation (in the log-log plane) between the nodes \((\log {\tt m\_energies[i]}, \log{\tt m\_values[i]})\) and \((\log {\tt m\_energies[i+1]}, \log{\tt m\_values[i+1]})\) to the requested energy \(\log E\).
Definition at line 84 of file GModelSpectralNodes.hpp.
GModelSpectralNodes::GModelSpectralNodes | ( | void | ) |
Void constructor.
Constructs an empty spectral node model.
Definition at line 78 of file GModelSpectralNodes.cpp.
References init_members().
Referenced by clone().
GModelSpectralNodes::GModelSpectralNodes | ( | const GModelSpectral & | model, |
const GEnergies & | energies | ||
) |
Spectral model constructor.
[in] | model | Spectral model. |
[in] | energies | Node energies. |
Constructs a spectral node model from any spectral model.
Definition at line 96 of file GModelSpectralNodes.cpp.
References append(), GModelSpectral::eval(), init_members(), reserve(), and GEnergies::size().
|
explicit |
XML constructor.
[in] | xml | XML element. |
Construct spectral nodes model by extracting information from an XML element. See the read() method for more information about the expected structure of the XML element.
Definition at line 125 of file GModelSpectralNodes.cpp.
References init_members(), and read().
GModelSpectralNodes::GModelSpectralNodes | ( | const GModelSpectralNodes & | model | ) |
Copy constructor.
[in] | model | Spectral nodes model. |
Definition at line 144 of file GModelSpectralNodes.cpp.
References copy_members(), and init_members().
|
virtual |
void GModelSpectralNodes::append | ( | const GEnergy & | energy, |
const double & | intensity | ||
) |
Append node.
[in] | energy | Node energy. |
[in] | intensity | Node intensity. |
GException::invalid_argument | Non-positive energy or intensity specified. |
Appends one node to the node function. By default the energy of the node is fixed while the intensity of the node is free.
Definition at line 801 of file GModelSpectralNodes.cpp.
References GOptimizerPar::fix(), GOptimizerPar::free(), G_APPEND, GOptimizerPar::has_grad(), m_energies, m_values, GEnergy::MeV(), GOptimizerPar::name(), GEnergy::print(), set_cache(), gammalib::str(), GOptimizerPar::unit(), update_pars(), and GOptimizerPar::value().
Referenced by GModelSpectralNodes(), GCTABackgroundPerfTable::init_mc_cache(), GCTABackground3D::init_mc_cache(), GCTABackground2D::init_mc_cache(), GModelSpatialDiffuseCube::mc_cone(), GModelSpectralExponential::update_mc_cache(), and GModelSpectralMultiplicative::update_mc_cache().
|
inlinevirtual |
Return class name.
Implements GModelSpectral.
Definition at line 179 of file GModelSpectralNodes.hpp.
|
virtual |
Clear spectral nodes model.
Implements GModelSpectral.
Definition at line 216 of file GModelSpectralNodes.cpp.
References GModelSpectral::free_members(), free_members(), GModelSpectral::init_members(), and init_members().
Referenced by GCTABackgroundPerfTable::init_mc_cache(), GCTABackground3D::init_mc_cache(), GCTABackground2D::init_mc_cache(), GCTABackgroundPerfTable::init_members(), GModelSpectralExponential::init_members(), GModelSpectralMultiplicative::init_members(), GCTABackground2D::init_members(), GCTABackground3D::init_members(), GModelSpatialDiffuseCube::init_members(), GModelSpatialDiffuseCube::mc_cone(), GModelSpectralExponential::update_mc_cache(), and GModelSpectralMultiplicative::update_mc_cache().
|
virtual |
Clone spectral nodes model.
Implements GModelSpectral.
Definition at line 234 of file GModelSpectralNodes.cpp.
References GModelSpectralNodes().
|
protected |
Copy class members.
[in] | model | Spectral function model. |
Definition at line 1288 of file GModelSpectralNodes.cpp.
References m_eflux, m_energies, m_epivot, m_flux, m_gamma, m_lin_energies, m_lin_values, m_log_energies, m_log_values, m_mc_cum, m_mc_emax, m_mc_emin, m_mc_exp, m_mc_max, m_mc_min, m_old_energies, m_old_values, m_prefactor, m_values, and update_pars().
Referenced by GModelSpectralNodes(), and operator=().
Returns model energy flux between emin, emax
[in] | emin | Minimum photon energy. |
[in] | emax | Maximum photon energy. |
Computes
\[ \int_{\tt emin}^{\tt emax} S_{\rm E}(E | t) E \, dE \]
where
emin
, emax
] is an energy interval, andImplements GModelSpectral.
Definition at line 446 of file GModelSpectralNodes.cpp.
References GNodeArray::inx_left(), m_eflux, m_epivot, m_gamma, m_lin_energies, m_prefactor, GEnergy::MeV(), gammalib::MeV2erg, gammalib::plaw_energy_flux(), GNodeArray::set_value(), and update_flux_cache().
Referenced by GModelSky::eflux(), and set_flux_cache().
GEnergy GModelSpectralNodes::energy | ( | const int & | index | ) | const |
Return node energy.
[in] | index | Node index [0,...,nodes()[. |
index
.GException::out_of_range | Index is out of range. |
Returns the energy of node index
.
Definition at line 1037 of file GModelSpectralNodes.cpp.
References G_ENERGY_GET, m_energies, GEnergy::MeV(), and nodes().
Referenced by GModelSky::eflux(), GModelSky::flux(), GCTABackground3D::mc(), GCTABackground2D::mc(), mc(), GModelSky::mc(), GModelSpatialDiffuseCube::mc_cone(), read(), update_eval_cache(), and write().
void GModelSpectralNodes::energy | ( | const int & | index, |
const GEnergy & | energy | ||
) |
Set node energy.
[in] | index | Node index [0,...,nodes()[. |
[in] | energy | Node energy. |
GException::out_of_range | Index is out of range. |
GException::invalid_argument | Non-positive energy specified. |
Sets the energy of node index
.
Definition at line 1069 of file GModelSpectralNodes.cpp.
References G_ENERGY_SET, m_energies, GEnergy::MeV(), nodes(), GEnergy::print(), and set_cache().
double GModelSpectralNodes::error | ( | const int & | index | ) | const |
Return intensity error of node.
[in] | index | Node index [0,...,nodes()[. |
index
.GException::out_of_range | Index is out of range. |
Returns the intensity error of node index
.
Definition at line 1134 of file GModelSpectralNodes.cpp.
References G_ERROR_GET, m_values, and nodes().
|
virtual |
Evaluate function.
[in] | srcEng | True photon energy. |
[in] | srcTime | True photon arrival time. |
[in] | gradients | Compute gradients? |
Computes
\[ S_{\rm E}(E | t) = 10^{(\log {\tt m\_values[i]}) w_{i} + (\log {\tt m\_values[i+1]}) w_{i+1}} \]
where
The weightings \(w_{i}\) and \(w_{i+1}\) are computed by linear interpolation (in the log-log plane) between the nodes \((\log {\tt m\_energies[i]}, \log{\tt m\_values[i]})\) and \((\log {\tt m\_energies[i+1]}, \log{\tt m\_values[i+1]})\) to the requested energy \(\log E\).
If the gradients
flag is true the method will also compute the partial derivatives of the model with respect to the parameters using
\[ \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_values[i]}} = \frac{S_{\rm E}(E | t) \, w_i}{{\tt m\_values[i]}} \]
Implements GModelSpectral.
Definition at line 279 of file GModelSpectralNodes.cpp.
References GNodeArray::inx_left(), GNodeArray::inx_right(), gammalib::is_infinite(), gammalib::is_notanumber(), GEnergy::log10MeV(), m_log_energies, m_log_values, m_values, pow(), GNodeArray::set_value(), update_eval_cache(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().
void GModelSpectralNodes::extend | ( | const GModelSpectralNodes & | nodes | ) |
Append nodes from node function.
[in] | nodes | Node function. |
Appends all nodes from a node function to current object.
Definition at line 994 of file GModelSpectralNodes.cpp.
References m_energies, m_values, nodes(), reserve(), set_cache(), and update_pars().
Returns model photon flux between emin, emax
[in] | emin | Minimum photon energy. |
[in] | emax | Maximum photon energy. |
Computes
\[ \int_{\tt emin}^{\tt emax} S_{\rm E}(E | t) dE \]
where
emin
, emax
] is an energy interval, andImplements GModelSpectral.
Definition at line 359 of file GModelSpectralNodes.cpp.
References GNodeArray::inx_left(), m_epivot, m_flux, m_gamma, m_lin_energies, m_prefactor, GEnergy::MeV(), gammalib::plaw_photon_flux(), GNodeArray::set_value(), and update_flux_cache().
Referenced by GModelSky::flux(), mc_update(), and set_flux_cache().
|
protected |
Delete class members.
Definition at line 1328 of file GModelSpectralNodes.cpp.
Referenced by clear(), operator=(), and ~GModelSpectralNodes().
|
protected |
Initialise class members.
Definition at line 1246 of file GModelSpectralNodes.cpp.
References GNodeArray::clear(), GEnergy::clear(), m_eflux, m_energies, m_epivot, m_flux, m_gamma, m_lin_energies, m_lin_values, m_log_energies, m_log_values, m_mc_cum, m_mc_emax, m_mc_emin, m_mc_exp, m_mc_max, m_mc_min, m_old_energies, m_old_values, m_prefactor, m_values, and update_pars().
Referenced by clear(), GModelSpectralNodes(), and operator=().
void GModelSpectralNodes::insert | ( | const int & | index, |
const GEnergy & | energy, | ||
const double & | intensity | ||
) |
Insert node.
[in] | index | Node index [0,...,nodes()[. |
[in] | energy | Node energy. |
[in] | intensity | Node intensity. |
GException::out_of_range | Node index is out of range. |
GException::invalid_argument | Non-positive energy or intensity specified. |
Inserts a node into the node function before the node with the specified index
. By default the energy of the node is fixed while the intensity of the node is free.
Definition at line 867 of file GModelSpectralNodes.cpp.
References GOptimizerPar::fix(), GOptimizerPar::free(), G_INSERT, GOptimizerPar::has_grad(), m_energies, m_values, GEnergy::MeV(), GOptimizerPar::name(), nodes(), GEnergy::print(), set_cache(), gammalib::str(), GOptimizerPar::unit(), update_pars(), and GOptimizerPar::value().
double GModelSpectralNodes::intensity | ( | const int & | index | ) | const |
Return node intensity.
[in] | index | Node index [0,...,nodes()[. |
index
.GException::out_of_range | Index is out of range. |
Returns the intensity of node index
.
Definition at line 1108 of file GModelSpectralNodes.cpp.
References G_INTENSITY_GET, m_values, and nodes().
Referenced by GModelSky::eflux(), GModelSky::flux(), GModelSky::mc(), GModelSpatialDiffuseCube::mc_cone(), GModelSpatialDiffuseCube::print(), read(), and write().
void GModelSpectralNodes::intensity | ( | const int & | index, |
const double & | intensity | ||
) |
Set node intensity.
[in] | index | Node index [0,...,nodes()[. |
[in] | intensity | Node Intensity. |
GException::out_of_range | Index is out of range. |
GException::invalid_argument | Non-positive intensity specified. |
Set the intensity of node index
.
Definition at line 1162 of file GModelSpectralNodes.cpp.
References G_INSERT, G_INTENSITY_SET, m_values, nodes(), set_cache(), and gammalib::str().
|
virtual |
Returns MC energy between [emin, emax].
[in] | emin | Minimum photon energy. |
[in] | emax | Maximum photon energy. |
[in] | time | True photon arrival time. |
[in,out] | ran | Random number generator. |
GException::invalid_return_value | No valid Monte Carlo cache |
Returns Monte Carlo energy by randomly drawing from node function.
Implements GModelSpectral.
Definition at line 534 of file GModelSpectralNodes.cpp.
References gammalib::check_energy_interval(), energy(), exp(), G_MC, log(), m_mc_cum, m_mc_exp, m_mc_max, m_mc_min, mc_update(), GEnergy::MeV(), GEnergy::print(), and GRan::uniform().
Referenced by GModelSpectralMultiplicative::mc(), and GModelSpectralExponential::mc().
Set MC pre-computation cache.
[in] | emin | Minimum energy. |
[in] | emax | Maximum energy. |
This method sets up an array of indices and the cumulative distribution function needed for MC simulations.
Definition at line 1564 of file GModelSpectralNodes.cpp.
References abs(), flux(), GNodeArray::inx_left(), log(), m_epivot, m_flux, m_gamma, m_lin_energies, m_mc_cum, m_mc_emax, m_mc_emin, m_mc_exp, m_mc_max, m_mc_min, m_prefactor, GEnergy::MeV(), norm(), gammalib::plaw_photon_flux(), pow(), and GNodeArray::set_value().
Referenced by mc().
|
inline |
Return number of nodes.
Returns the number of nodes in the node function model.
Definition at line 207 of file GModelSpectralNodes.hpp.
References m_energies.
Referenced by GModelSky::eflux(), energy(), error(), extend(), GModelSky::flux(), GCTABackground2D::init_mc_cache(), GCTABackground3D::init_mc_cache(), insert(), intensity(), GCTABackground2D::mc(), GCTABackground3D::mc(), GModelSky::mc(), GModelSpatialDiffuseCube::mc_cone(), GModelSpatialDiffuseCube::print(), read(), remove(), GCTABackgroundPerfTable::spectrum(), GCTABackground3D::spectrum(), GCTABackground2D::spectrum(), update_pars(), and write().
|
virtual |
Assignment operator.
[in] | model | Spectral nodes model. |
Definition at line 183 of file GModelSpectralNodes.cpp.
References copy_members(), free_members(), init_members(), and GModelSpectral::operator=().
Print node function information.
[in] | chatter | Chattiness. |
Implements GModelSpectral.
Definition at line 1198 of file GModelSpectralNodes.cpp.
References m_eflux, m_energies, m_epivot, m_flux, m_gamma, GModelSpectral::m_pars, m_prefactor, gammalib::parformat(), SILENT, GModelSpectral::size(), gammalib::str(), and VERBOSE.
|
virtual |
Read model from XML element.
[in] | xml | XML element. |
GException::invalid_value | Not enough nodes in node function. |
GException::invalid_value | Energy or intensity are not positive. |
Reads the spectral information from an XML element. The format of the XML elements is
<spectrum type="NodeFunction"> <node> <parameter name="Energy" ../> <parameter name="Intensity" ../> </node> ... <node> <parameter name="Energy" ../> <parameter name="Intensity" ../> </node> </spectrum>
Check that nodes are ordered
Check that energy boundaries are not overlapping
Check whether we require at least one or two nodes
Implements GModelSpectral.
Definition at line 620 of file GModelSpectralNodes.cpp.
References GXmlNode::element(), GXmlNode::elements(), energy(), G_READ, GOptimizerPar::has_grad(), intensity(), m_energies, m_values, GOptimizerPar::name(), nodes(), GModelPar::read(), set_cache(), gammalib::str(), GOptimizerPar::unit(), update_pars(), GOptimizerPar::value(), and gammalib::xml_get_par().
Referenced by GModelSpectralNodes().
void GModelSpectralNodes::remove | ( | const int & | index | ) |
Remove node.
[in] | index | Node index [0,...,nodes()[. |
GException::out_of_range | Node index is out of range. |
Removes node of specified index
from the node function.
Definition at line 944 of file GModelSpectralNodes.cpp.
References G_REMOVE, m_energies, m_values, nodes(), set_cache(), and update_pars().
void GModelSpectralNodes::reserve | ( | const int & | num | ) |
Reserve space for nodes.
[in] | num | Number of reseved nodes. |
Reserves space for num
nodes.
Definition at line 976 of file GModelSpectralNodes.cpp.
References m_energies, and m_values.
Referenced by extend(), GModelSpectralNodes(), and GModelSpatialDiffuseCube::mc_cone().
|
protected |
Set pre-computation cache.
Definition at line 1382 of file GModelSpectralNodes.cpp.
References set_eval_cache(), and set_flux_cache().
Referenced by append(), energy(), extend(), insert(), intensity(), read(), and remove().
|
protected |
Set evaluation cache.
The evaluation cache contains pre-computed results that are needed for fast function evaluation.
Definition at line 1403 of file GModelSpectralNodes.cpp.
References GNodeArray::append(), GNodeArray::clear(), log10(), m_energies, m_log_energies, m_log_values, m_old_energies, m_old_values, and m_values.
Referenced by set_cache().
|
protected |
Set flux computation cache.
Pre-computes some values that are needed for flux computation.
Definition at line 1438 of file GModelSpectralNodes.cpp.
References GNodeArray::append(), GNodeArray::clear(), eflux(), flux(), log(), m_eflux, m_energies, m_epivot, m_flux, m_gamma, m_lin_energies, m_lin_values, m_prefactor, m_values, gammalib::MeV2erg, gammalib::plaw_energy_flux(), gammalib::plaw_photon_flux(), pow(), and sqrt().
Referenced by set_cache(), and update_flux_cache().
|
inlinevirtual |
Return model type.
Returns the type of the spectral node function model.
Implements GModelSpectral.
Definition at line 193 of file GModelSpectralNodes.hpp.
Referenced by write().
|
protected |
Update evaluation cache.
Updates the evaluation cache by computing only results for values that changed.
Definition at line 1507 of file GModelSpectralNodes.cpp.
References energy(), log10(), m_energies, m_log_energies, m_log_values, m_old_energies, m_old_values, and m_values.
Referenced by eval().
|
protected |
Update flux computation cache.
Updates the flux computation cache if either the energy boundaries or the intensity values have changed.
Definition at line 1538 of file GModelSpectralNodes.cpp.
References m_energies, m_lin_energies, m_lin_values, m_values, and set_flux_cache().
|
protected |
Update parameter mapping.
Sets the parameter pointers in the m_pars array, enabling iterating over all model parameters. This method needs to be called after changing the number of nodes in the spectral model. The method needs not to be called after value update.
Definition at line 1343 of file GModelSpectralNodes.cpp.
References m_energies, GModelSpectral::m_pars, m_values, nodes(), and gammalib::str().
Referenced by append(), copy_members(), extend(), init_members(), insert(), read(), and remove().
|
virtual |
Write model into XML element.
[in] | xml | XML element into which model information is written. |
GException::invalid_value | Invalid number of nodes found in XML element. |
Writes the spectral information into an XML element. The format of the XML element is
<spectrum type="NodeFunction"> <node> <parameter name="Energy" ../> <parameter name="Intensity" ../> </node> ... <node> <parameter name="Energy" ../> <parameter name="Intensity" ../> </node> </spectrum>
Implements GModelSpectral.
Definition at line 726 of file GModelSpectralNodes.cpp.
References GXmlNode::append(), GXmlNode::element(), GXmlNode::elements(), energy(), G_WRITE, intensity(), m_energies, m_values, GOptimizerPar::name(), nodes(), gammalib::str(), type(), GModelPar::write(), gammalib::xml_check_type(), and gammalib::xml_need_par().
|
mutableprotected |
Energy fluxes.
Definition at line 161 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), eflux(), init_members(), print(), and set_flux_cache().
|
protected |
Node energies.
Definition at line 145 of file GModelSpectralNodes.hpp.
Referenced by append(), copy_members(), energy(), extend(), init_members(), insert(), nodes(), print(), read(), remove(), reserve(), set_eval_cache(), set_flux_cache(), update_eval_cache(), update_flux_cache(), update_pars(), and write().
|
mutableprotected |
Power-law pivot energies.
Definition at line 159 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), eflux(), flux(), init_members(), mc_update(), print(), and set_flux_cache().
|
mutableprotected |
Photon fluxes.
Definition at line 160 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), flux(), init_members(), mc_update(), print(), and set_flux_cache().
|
mutableprotected |
Power-law indices.
Definition at line 158 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), eflux(), flux(), init_members(), mc_update(), print(), and set_flux_cache().
|
mutableprotected |
Energy of nodes.
Definition at line 155 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), eflux(), flux(), init_members(), mc_update(), set_flux_cache(), and update_flux_cache().
|
mutableprotected |
Values of nodes.
Definition at line 156 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), set_flux_cache(), and update_flux_cache().
|
mutableprotected |
log10(energy) of nodes
Definition at line 151 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), eval(), init_members(), set_eval_cache(), and update_eval_cache().
|
mutableprotected |
log10(value) of nodes
Definition at line 152 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), eval(), init_members(), set_eval_cache(), and update_eval_cache().
|
mutableprotected |
Cumulative distribution.
Definition at line 166 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), mc(), and mc_update().
|
mutableprotected |
Maximum energy.
Definition at line 165 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), and mc_update().
|
mutableprotected |
Minimum energy.
Definition at line 164 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), and mc_update().
|
mutableprotected |
Exponent for MC.
Definition at line 169 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), mc(), and mc_update().
|
mutableprotected |
Upper boundary for MC.
Definition at line 168 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), mc(), and mc_update().
|
mutableprotected |
Lower boundary for MC.
Definition at line 167 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), mc(), and mc_update().
|
mutableprotected |
Old energies.
Definition at line 149 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), set_eval_cache(), and update_eval_cache().
|
mutableprotected |
Old values.
Definition at line 150 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), init_members(), set_eval_cache(), and update_eval_cache().
|
mutableprotected |
Power-law normalisations.
Definition at line 157 of file GModelSpectralNodes.hpp.
Referenced by copy_members(), eflux(), flux(), init_members(), mc_update(), print(), and set_flux_cache().
|
protected |
Node values.
Definition at line 146 of file GModelSpectralNodes.hpp.
Referenced by append(), copy_members(), error(), eval(), extend(), init_members(), insert(), intensity(), read(), remove(), reserve(), set_eval_cache(), set_flux_cache(), update_eval_cache(), update_flux_cache(), update_pars(), and write().