GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpectralFunc Class Reference

Spectral function model class. More...

#include <GModelSpectralFunc.hpp>

Inheritance diagram for GModelSpectralFunc:
GModelSpectral GBase

Public Member Functions

 GModelSpectralFunc (void)
 Void constructor. More...
 
 GModelSpectralFunc (const GFilename &filename, const double &norm)
 File constructor. More...
 
 GModelSpectralFunc (const GModelSpectral &model, const GEnergies &energies)
 Spectral model constructor. More...
 
 GModelSpectralFunc (const GXmlElement &xml)
 XML constructor. More...
 
 GModelSpectralFunc (const GModelSpectralFunc &model)
 Copy constructor. More...
 
virtual ~GModelSpectralFunc (void)
 Destructor. More...
 
virtual GModelSpectralFuncoperator= (const GModelSpectralFunc &model)
 Assignment operator. More...
 
virtual void clear (void)
 Clear file function. More...
 
virtual GModelSpectralFuncclone (void) const
 Clone file function. 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 file function information. More...
 
int nodes (void) const
 Return number of nodes in file function. More...
 
bool is_empty (void) const
 Signals if there are nodes in file function. More...
 
void append (const GEnergy &energy, const double &intensity)
 Append node to file function. More...
 
void insert (const GEnergy &energy, const double &intensity)
 Insert node into file function. More...
 
void remove (const int &index)
 Remove node from file function. More...
 
void reserve (const int &num)
 Reserves space for nodes in file function. More...
 
void extend (const GModelSpectralFunc &filefct)
 Append file function. More...
 
GEnergy energy (const int &index) const
 Return energy of node. More...
 
void energy (const int &index, const GEnergy &energy)
 Set energy of node. More...
 
double intensity (const int &index) const
 Return intensity of node. More...
 
void intensity (const int &index, const double &intensity)
 Set intensity of node. More...
 
const GFilenamefilename (void) const
 Return file name. More...
 
void filename (const GFilename &filename)
 Loads nodes from node file and set filename. More...
 
double norm (void) const
 Return normalization factor. More...
 
void norm (const double &norm)
 Set normalization factor. More...
 
void save (const GFilename &filename, const bool &clobber=false) const
 Save file function in ASCII file. 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 GModelSpectraloperator= (const GModelSpectral &model)
 Assignment operator. More...
 
virtual GModelParoperator[] (const int &index)
 Returns model parameter. More...
 
virtual const GModelParoperator[] (const int &index) const
 Returns model parameter (const version) More...
 
virtual GModelParoperator[] (const std::string &name)
 Returns reference to model parameter. More...
 
virtual const GModelParoperator[] (const std::string &name) const
 Returns reference to model parameter (const version) More...
 
GModelParat (const int &index)
 Returns model parameter. More...
 
const GModelParat (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 GModelSpectralFunc &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void load_nodes (const GFilename &filename)
 Load nodes from file. More...
 
void set_cache (void) const
 Set pre-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

GModelPar m_norm
 Normalization factor. More...
 
GNodeArray m_lin_nodes
 Energy nodes of function. More...
 
GNodeArray m_log_nodes
 log10(Energy) nodes of function More...
 
std::vector< double > m_lin_values
 Function values at nodes. More...
 
std::vector< double > m_log_values
 log10(Function) values at nodes More...
 
GFilename m_filename
 Name of file function. 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...
 

Detailed Description

Spectral function model class.

This class implements an arbitrary function as the spectral model component. The model is defined by

\[ S_{\rm E}(E | t) = {\tt m\_norm} \]

where

  • \({\tt m\_norm}\) is the normalization of the function.

Definition at line 61 of file GModelSpectralFunc.hpp.

Constructor & Destructor Documentation

GModelSpectralFunc::GModelSpectralFunc ( void  )

Void constructor.

Definition at line 77 of file GModelSpectralFunc.cpp.

References init_members().

Referenced by clone().

GModelSpectralFunc::GModelSpectralFunc ( const GFilename filename,
const double &  norm 
)

File constructor.

Parameters
[in]filenameFile name of nodes.
[in]normNormalization factor.

Constructs spectral file function model from a list of nodes that is found in the specified ASCII file. See the load_nodes() method for more information about the expected structure of the file.

Definition at line 97 of file GModelSpectralFunc.cpp.

References init_members(), load_nodes(), m_norm, and GOptimizerPar::value().

GModelSpectralFunc::GModelSpectralFunc ( const GModelSpectral model,
const GEnergies energies 
)

Spectral model constructor.

Parameters
[in]modelSpectral model.
[in]energiesFile function node energies.

Constructs a spectral file function model from any spectral model. The file function normalisation will be set to unity.

Definition at line 147 of file GModelSpectralFunc.cpp.

References append(), GModelSpectral::eval(), init_members(), reserve(), and GEnergies::size().

GModelSpectralFunc::GModelSpectralFunc ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML element.

Constructs spectral file function 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 124 of file GModelSpectralFunc.cpp.

References init_members(), and read().

GModelSpectralFunc::GModelSpectralFunc ( const GModelSpectralFunc model)

Copy constructor.

Parameters
[in]modelFile function model.

Definition at line 172 of file GModelSpectralFunc.cpp.

References copy_members(), and init_members().

GModelSpectralFunc::~GModelSpectralFunc ( void  )
virtual

Destructor.

Definition at line 189 of file GModelSpectralFunc.cpp.

References free_members().

Member Function Documentation

void GModelSpectralFunc::append ( const GEnergy energy,
const double &  intensity 
)

Append node to file function.

Parameters
[in]energyEnergy.
[in]intensityIntensity.
Exceptions
GException::invalid_argumentEnergy not larger than energy of last node or energy or intensity are not positive.

Appends one node to the file function.

Definition at line 656 of file GModelSpectralFunc.cpp.

References GNodeArray::append(), G_APPEND, log10(), GEnergy::log10MeV(), m_lin_nodes, m_lin_values, m_log_nodes, m_log_values, GEnergy::MeV(), nodes(), GEnergy::print(), set_cache(), and gammalib::str().

Referenced by extend(), and GModelSpectralFunc().

std::string GModelSpectralFunc::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GModelSpectralFunc").

Implements GModelSpectral.

Definition at line 154 of file GModelSpectralFunc.hpp.

void GModelSpectralFunc::clear ( void  )
virtual

Clear file function.

Implements GModelSpectral.

Definition at line 244 of file GModelSpectralFunc.cpp.

References GModelSpectral::free_members(), free_members(), GModelSpectral::init_members(), and init_members().

GModelSpectralFunc * GModelSpectralFunc::clone ( void  ) const
virtual

Clone file function.

Implements GModelSpectral.

Definition at line 262 of file GModelSpectralFunc.cpp.

References GModelSpectralFunc().

void GModelSpectralFunc::copy_members ( const GModelSpectralFunc model)
protected

Copy class members.

Parameters
[in]modelSpectral function model.

Definition at line 1114 of file GModelSpectralFunc.cpp.

References m_eflux, m_epivot, m_filename, m_flux, m_gamma, m_lin_nodes, m_lin_values, m_log_nodes, m_log_values, m_mc_cum, m_mc_emax, m_mc_emin, m_mc_exp, m_mc_max, m_mc_min, m_norm, GModelSpectral::m_pars, and m_prefactor.

Referenced by GModelSpectralFunc(), and operator=().

double GModelSpectralFunc::eflux ( const GEnergy emin,
const GEnergy emax 
) const
virtual

Returns model energy flux between emin, emax

Parameters
[in]eminMinimum photon energy.
[in]emaxMaximum photon energy.
Returns
Energy flux (erg/cm2/s).

Computes

\[ \int_{\tt emin}^{\tt emax} S_{\rm E}(E | t) E \, dE \]

where

  • [emin, emax] is an energy interval, and
  • \(S_{\rm E}(E | t)\) is the spectral model (ph/cm2/s/MeV).

Implements GModelSpectral.

Definition at line 442 of file GModelSpectralFunc.cpp.

References GNodeArray::inx_left(), m_eflux, m_epivot, m_gamma, m_lin_nodes, m_prefactor, GEnergy::MeV(), gammalib::MeV2erg, norm(), gammalib::plaw_energy_flux(), and GNodeArray::set_value().

Referenced by set_cache().

GEnergy GModelSpectralFunc::energy ( const int &  index) const

Return energy of node.

Parameters
[in]indexNode index [0,...,nodes()-1].
Exceptions
GException::out_of_rangeNode index is out of range.

Returns the energy of node with specified index in the file function.

Definition at line 839 of file GModelSpectralFunc.cpp.

References G_ENERGY1, m_lin_nodes, GEnergy::MeV(), and nodes().

Referenced by extend(), and mc().

void GModelSpectralFunc::energy ( const int &  index,
const GEnergy energy 
)

Set energy of node.

Parameters
[in]indexNode index [0,...,nodes()-1].
[in]energyEnergy.
Exceptions
GException::out_of_rangeNode index is out of range.
GException::invalid_argumentSpecified energy is not larger than energy of preceeding node or not smaller than energy of following node.

Sets the energy of node with specified index in the file function.

Definition at line 871 of file GModelSpectralFunc.cpp.

References G_ENERGY2, GEnergy::log10MeV(), m_lin_nodes, m_log_nodes, GEnergy::MeV(), nodes(), GEnergy::print(), and set_cache().

double GModelSpectralFunc::eval ( const GEnergy srcEng,
const GTime srcTime = GTime(),
const bool &  gradients = false 
) const
virtual

Evaluate function.

Parameters
[in]srcEngTrue photon energy.
[in]srcTimeTrue photon arrival time.
[in]gradientsCompute gradients?
Returns
Model value (ph/cm2/s/MeV).

Evaluates

\[ S_{\rm E}(E | t) = {\tt m\_norm} F(E) \]

where

  • \({\tt m\_norm}\) is the normalization factor and
  • \({F(E)}\) is the spectral function.

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\_norm}} = \frac{S_{\rm E}(E | t)}{{\tt m\_norm}} \]

Implements GModelSpectral.

Definition at line 295 of file GModelSpectralFunc.cpp.

References GOptimizerPar::factor_gradient(), GNodeArray::interpolate(), GOptimizerPar::is_free(), gammalib::is_infinite(), gammalib::is_notanumber(), GEnergy::log10MeV(), m_log_nodes, m_log_values, m_norm, norm(), pow(), GOptimizerPar::scale(), and GOptimizerPar::value().

void GModelSpectralFunc::extend ( const GModelSpectralFunc filefct)

Append file function.

Parameters
[in]filefctFile function.

Appends file function to the existing file function.

Definition at line 803 of file GModelSpectralFunc.cpp.

References append(), energy(), intensity(), is_empty(), nodes(), reserve(), and set_cache().

const GFilename & GModelSpectralFunc::filename ( void  ) const
inline

Return file name.

Returns
Name of node file.

Returns the name of the file function node file.

Definition at line 257 of file GModelSpectralFunc.hpp.

References m_filename.

Referenced by load_nodes(), and save().

void GModelSpectralFunc::filename ( const GFilename filename)
inline

Loads nodes from node file and set filename.

Parameters
[in]filenameNode file name.

Loads the nodes from a file function node file and sets the filename.

Definition at line 271 of file GModelSpectralFunc.hpp.

References load_nodes().

double GModelSpectralFunc::flux ( const GEnergy emin,
const GEnergy emax 
) const
virtual

Returns model photon flux between emin, emax

Parameters
[in]eminMinimum photon energy.
[in]emaxMaximum photon energy.
Returns
Photon flux (ph/cm2/s).

Computes

\[ \int_{\tt emin}^{\tt emax} S_{\rm E}(E | t) dE \]

where

  • [emin, emax] is an energy interval, and
  • \(S_{\rm E}(E | t)\) is the spectral model (ph/cm2/s/MeV).

Implements GModelSpectral.

Definition at line 354 of file GModelSpectralFunc.cpp.

References GNodeArray::inx_left(), m_epivot, m_flux, m_gamma, m_lin_nodes, m_prefactor, GEnergy::MeV(), norm(), gammalib::plaw_photon_flux(), and GNodeArray::set_value().

Referenced by mc_update(), and set_cache().

void GModelSpectralFunc::free_members ( void  )
protected

Delete class members.

Definition at line 1151 of file GModelSpectralFunc.cpp.

Referenced by clear(), operator=(), and ~GModelSpectralFunc().

void GModelSpectralFunc::insert ( const GEnergy energy,
const double &  intensity 
)

Insert node into file function.

Parameters
[in]energyEnergy.
[in]intensityIntensity.
Exceptions
GException::invalid_argumentEnergy or intensity are not positive, or energy does already exist in file function.

Inserts one node at the appropriate location into the file function.

Definition at line 712 of file GModelSpectralFunc.cpp.

References G_INSERT, GNodeArray::insert(), intensity(), log10(), GEnergy::log10MeV(), m_lin_nodes, m_lin_values, m_log_nodes, m_log_values, GEnergy::MeV(), nodes(), GEnergy::print(), set_cache(), and gammalib::str().

double GModelSpectralFunc::intensity ( const int &  index) const

Return intensity of node.

Parameters
[in]indexNode index [0,...,nodes()-1].
Returns
Intensity (ph/cm2/s/MeV).
Exceptions
GException::out_of_rangeNode index is out of range.

Returns the intensity of node with specified index in the file function.

Definition at line 927 of file GModelSpectralFunc.cpp.

References G_INTENSITY1, m_lin_values, and nodes().

Referenced by extend(), insert(), and intensity().

void GModelSpectralFunc::intensity ( const int &  index,
const double &  intensity 
)

Set intensity of node.

Parameters
[in]indexNode index [0,...,nodes()-1].
[in]intensityIntensity (ph/cm2/s/MeV).
Exceptions
GException::out_of_rangeNode index is out of range.
GException::invalid_argumentIntensity is not positive.

Sets the intensity of node with specified index in the file function.

Definition at line 954 of file GModelSpectralFunc.cpp.

References G_INTENSITY2, intensity(), log10(), m_lin_values, m_log_values, nodes(), set_cache(), and gammalib::str().

bool GModelSpectralFunc::is_empty ( void  ) const
inline

Signals if there are nodes in file function.

Returns
True if file function is empty, false otherwise.

Signals if the file function does not contain any node.

Definition at line 196 of file GModelSpectralFunc.hpp.

References GNodeArray::is_empty(), and m_lin_nodes.

Referenced by extend().

void GModelSpectralFunc::load_nodes ( const GFilename filename)
protected

Load nodes from file.

Parameters
[in]filenameFile name.
Exceptions
GException::invalid_argumentEmpty filename specified. GException::invalid_value Invalid file function ASCII file.

The file function is stored as a column separated value table (CSV) in an ASCII file with (at least) 2 columns. The first column specifies the energy in MeV while the second column specifies the intensity at this energy in units of ph/cm2/s/MeV.

The node energies and values will be stored both linearly and as log10. The log10 storing requires that node energies and node values are positive. Also, at least 2 nodes and 2 columns are required in the file function.

Definition at line 1178 of file GModelSpectralFunc.cpp.

References GNodeArray::append(), GNodeArray::clear(), filename(), G_LOAD_NODES, GFilename::is_empty(), log10(), m_filename, m_lin_nodes, m_lin_values, m_log_nodes, m_log_values, GCsv::ncols(), GCsv::nrows(), GCsv::real(), set_cache(), gammalib::str(), and GFilename::url().

Referenced by filename(), GModelSpectralFunc(), and read().

GEnergy GModelSpectralFunc::mc ( const GEnergy emin,
const GEnergy emax,
const GTime time,
GRan ran 
) const
virtual

Returns MC energy between [emin, emax].

Parameters
[in]eminMinimum photon energy.
[in]emaxMaximum photon energy.
[in]timeTrue photon arrival time.
[in,out]ranRandom number generator.
Returns
Energy.
Exceptions
GException::erange_invalidEnergy range is invalid (emin < emax required).

Returns Monte Carlo energy by randomly drawing from a broken power law defined by the file function.

Implements GModelSpectral.

Definition at line 531 of file GModelSpectralFunc.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(), and GRan::uniform().

void GModelSpectralFunc::mc_update ( const GEnergy emin,
const GEnergy emax 
) const
protected

Set MC pre-computation cache.

Parameters
[in]eminMinimum energy.
[in]emaxMaximum energy.

This method sets up an array of indices and the cumulative distribution function needed for MC simulations.

Definition at line 1346 of file GModelSpectralFunc.cpp.

References abs(), flux(), GNodeArray::inx_left(), log(), m_epivot, m_flux, m_gamma, m_lin_nodes, 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().

int GModelSpectralFunc::nodes ( void  ) const
inline

Return number of nodes in file function.

Returns
Number of nodes in file function.

Returns the number of nodes in the file function model.

Definition at line 182 of file GModelSpectralFunc.hpp.

References m_lin_nodes, and GNodeArray::size().

Referenced by append(), energy(), extend(), insert(), intensity(), print(), remove(), save(), and set_cache().

double GModelSpectralFunc::norm ( void  ) const
inline

Return normalization factor.

Returns
Normalization factor.

Returns the normalization factor.

Definition at line 228 of file GModelSpectralFunc.hpp.

References m_norm, and GOptimizerPar::value().

Referenced by eflux(), eval(), flux(), mc_update(), read(), and write().

void GModelSpectralFunc::norm ( const double &  norm)
inline

Set normalization factor.

Parameters
[in]normNormalization factor.

Sets the normalization factor.

Definition at line 242 of file GModelSpectralFunc.hpp.

References m_norm, and GOptimizerPar::value().

GModelSpectralFunc & GModelSpectralFunc::operator= ( const GModelSpectralFunc model)
virtual

Assignment operator.

Parameters
[in]modelFile function model.
Returns
File function model.

Definition at line 211 of file GModelSpectralFunc.cpp.

References copy_members(), free_members(), init_members(), and GModelSpectral::operator=().

std::string GModelSpectralFunc::print ( const GChatter chatter = NORMAL) const
virtual

Print file function information.

Parameters
[in]chatterChattiness.
Returns
String containing file function information.

Implements GModelSpectral.

Definition at line 1018 of file GModelSpectralFunc.cpp.

References m_eflux, m_epivot, m_filename, m_flux, m_gamma, GModelSpectral::m_pars, m_prefactor, nodes(), gammalib::parformat(), SILENT, GModelSpectral::size(), gammalib::str(), and GFilename::url().

void GModelSpectralFunc::read ( const GXmlElement xml)
virtual

Read model from XML element.

Parameters
[in]xmlXML element containing power law model information.

Reads the spectral information from an XML element. The format of the XML elements is

<spectrum type="FileFunction" file="..">
  <parameter name="Normalization" scale=".." value=".." min=".." max=".." free=".."/>
</spectrum>

Implements GModelSpectral.

Definition at line 591 of file GModelSpectralFunc.cpp.

References GXmlElement::attribute(), G_READ, load_nodes(), m_norm, GOptimizerPar::name(), norm(), GModelPar::read(), gammalib::xml_check_parnum(), gammalib::xml_file_expand(), and gammalib::xml_get_par().

Referenced by GModelSpectralFunc().

void GModelSpectralFunc::remove ( const int &  index)

Remove node from file function.

Parameters
[in]indexNode index [0,...,nodes()-1].
Exceptions
GException::out_of_rangeNode index is out of range.

Removes the node of specified index from the file function.

Definition at line 773 of file GModelSpectralFunc.cpp.

References G_REMOVE, m_lin_nodes, m_lin_values, m_log_nodes, m_log_values, nodes(), GNodeArray::remove(), and set_cache().

void GModelSpectralFunc::reserve ( const int &  num)
inline

Reserves space for nodes in file function.

Parameters
[in]numNumber of nodes

Reserves space for num nodes in file function.

Definition at line 210 of file GModelSpectralFunc.hpp.

References m_lin_nodes, m_lin_values, m_log_nodes, m_log_values, and GNodeArray::reserve().

Referenced by extend(), and GModelSpectralFunc().

void GModelSpectralFunc::save ( const GFilename filename,
const bool &  clobber = false 
) const

Save file function in ASCII file.

Parameters
[in]filenameASCII filename.
[in]clobberOverwrite existing file?

Saves file function in ASCII file.

Definition at line 990 of file GModelSpectralFunc.cpp.

References filename(), m_filename, m_lin_nodes, m_lin_values, nodes(), GCsv::save(), and gammalib::str().

void GModelSpectralFunc::set_cache ( void  ) const
protected
std::string GModelSpectralFunc::type ( void  ) const
inlinevirtual

Return model type.

Returns
"FileFunction".

Returns the type of the spectral function model.

Implements GModelSpectral.

Definition at line 168 of file GModelSpectralFunc.hpp.

Referenced by write().

void GModelSpectralFunc::write ( GXmlElement xml) const
virtual

Write model into XML element.

Parameters
[in]xmlXML element into which model information is written.

Writes the spectral information into an XML element. The format of the XML element is

<spectrum type="FileFunction" file="..">
  <parameter name="Normalization" scale=".." value=".." min=".." max=".." free=".."/>
</spectrum>

Note that the function nodes will not be written since they will not be altered by any method.

Implements GModelSpectral.

Definition at line 625 of file GModelSpectralFunc.cpp.

References GXmlElement::attribute(), G_WRITE, m_filename, m_norm, GOptimizerPar::name(), norm(), type(), GModelPar::write(), gammalib::xml_check_type(), gammalib::xml_file_reduce(), and gammalib::xml_need_par().

Member Data Documentation

std::vector<double> GModelSpectralFunc::m_eflux
mutableprotected

Energy fluxes.

Definition at line 136 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), eflux(), init_members(), print(), and set_cache().

std::vector<double> GModelSpectralFunc::m_epivot
mutableprotected

Power-law pivot energies.

Definition at line 134 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), eflux(), flux(), init_members(), mc_update(), print(), and set_cache().

GFilename GModelSpectralFunc::m_filename
mutableprotected

Name of file function.

Definition at line 129 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), filename(), init_members(), load_nodes(), print(), save(), and write().

std::vector<double> GModelSpectralFunc::m_flux
mutableprotected

Photon fluxes.

Definition at line 135 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), flux(), init_members(), mc_update(), print(), and set_cache().

std::vector<double> GModelSpectralFunc::m_gamma
mutableprotected

Power-law indices.

Definition at line 133 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), eflux(), flux(), init_members(), mc_update(), print(), and set_cache().

GNodeArray GModelSpectralFunc::m_lin_nodes
mutableprotected
std::vector<double> GModelSpectralFunc::m_lin_values
protected

Function values at nodes.

Definition at line 127 of file GModelSpectralFunc.hpp.

Referenced by append(), copy_members(), init_members(), insert(), intensity(), load_nodes(), remove(), reserve(), save(), and set_cache().

GNodeArray GModelSpectralFunc::m_log_nodes
mutableprotected

log10(Energy) nodes of function

Definition at line 126 of file GModelSpectralFunc.hpp.

Referenced by append(), copy_members(), energy(), eval(), init_members(), insert(), load_nodes(), remove(), and reserve().

std::vector<double> GModelSpectralFunc::m_log_values
protected

log10(Function) values at nodes

Definition at line 128 of file GModelSpectralFunc.hpp.

Referenced by append(), copy_members(), eval(), init_members(), insert(), intensity(), load_nodes(), remove(), and reserve().

std::vector<double> GModelSpectralFunc::m_mc_cum
mutableprotected

Cumulative distribution.

Definition at line 141 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), init_members(), mc(), and mc_update().

GEnergy GModelSpectralFunc::m_mc_emax
mutableprotected

Maximum energy.

Definition at line 140 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), init_members(), and mc_update().

GEnergy GModelSpectralFunc::m_mc_emin
mutableprotected

Minimum energy.

Definition at line 139 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), init_members(), and mc_update().

std::vector<double> GModelSpectralFunc::m_mc_exp
mutableprotected

Exponent for MC.

Definition at line 144 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), init_members(), mc(), and mc_update().

std::vector<double> GModelSpectralFunc::m_mc_max
mutableprotected

Upper boundary for MC.

Definition at line 143 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), init_members(), mc(), and mc_update().

std::vector<double> GModelSpectralFunc::m_mc_min
mutableprotected

Lower boundary for MC.

Definition at line 142 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), init_members(), mc(), and mc_update().

GModelPar GModelSpectralFunc::m_norm
protected

Normalization factor.

Definition at line 124 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), eval(), GModelSpectralFunc(), init_members(), norm(), read(), and write().

std::vector<double> GModelSpectralFunc::m_prefactor
mutableprotected

Power-law normalisations.

Definition at line 132 of file GModelSpectralFunc.hpp.

Referenced by copy_members(), eflux(), flux(), init_members(), mc_update(), print(), and set_cache().


The documentation for this class was generated from the following files: