GammaLib
2.1.0.dev
|
Abstract model class. More...
#include <GModel.hpp>
Public Member Functions | |
GModel (void) | |
Void constructor. More... | |
GModel (const GXmlElement &xml) | |
XML constructor. More... | |
GModel (const GModel &model) | |
Copy constructor. More... | |
virtual | ~GModel (void) |
Destructor. More... | |
virtual GModel & | operator= (const GModel &model) |
Assignment operator. More... | |
virtual GModelPar & | operator[] (const int &index) |
Returns reference to model parameter by index. More... | |
virtual const GModelPar & | operator[] (const int &index) const |
Returns reference to model parameter by index (const version) More... | |
virtual GModelPar & | operator[] (const std::string &name) |
Returns reference to model parameter by name. More... | |
virtual const GModelPar & | operator[] (const std::string &name) const |
Returns reference to model parameter by name const version) More... | |
virtual void | clear (void)=0 |
Clear object. More... | |
virtual GModel * | clone (void) const =0 |
Clones object. More... | |
virtual std::string | classname (void) const =0 |
Return class name. More... | |
virtual std::string | type (void) const =0 |
virtual bool | is_constant (void) const =0 |
virtual double | eval (const GEvent &event, const GObservation &obs, const bool &gradients=false) const =0 |
virtual GVector | eval (const GObservation &obs, GMatrixSparse *gradients=NULL) const =0 |
virtual double | npred (const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const =0 |
virtual void | read (const GXmlElement &xml)=0 |
virtual void | write (GXmlElement &xml) const =0 |
virtual std::string | print (const GChatter &chatter=NORMAL) const =0 |
Print content of object. More... | |
int | size (void) const |
Return number of parameters in model. More... | |
int | scales (void) const |
Return number of scale parameters in model. More... | |
GModelPar & | at (const int &index) |
Returns reference to model parameter by index. More... | |
const GModelPar & | at (const int &index) const |
Returns reference to model parameter by index (const version) More... | |
bool | has_par (const std::string &name) const |
Checks if parameter name exists. More... | |
bool | has_scales (void) const |
Signals that model has scales. More... | |
const std::string & | name (void) const |
Return parameter name. More... | |
void | name (const std::string &name) |
Set parameter name. More... | |
const double & | ts (void) const |
Return Test Statistic value. More... | |
void | ts (const double &ts) |
Set Test Statistic value. More... | |
const bool & | tscalc (void) const |
Return Test Statistic computation flag. More... | |
void | tscalc (const bool &tscalc) |
Set Test Statistic computation flag. More... | |
const bool & | has_ts (void) const |
Signals that model has Test Statistics value. More... | |
std::string | instruments (void) const |
Returns instruments to which model applies. More... | |
void | instruments (const std::string &instruments) |
Set instruments to which model applies. More... | |
GModelPar & | scale (const int &index) |
Returns reference to scale parameter by index. More... | |
const GModelPar & | scale (const int &index) const |
Returns reference to scale parameter by index (const version) More... | |
GModelPar | scale (const std::string &instrument) const |
Returns model scale factor for a given instrument. More... | |
void | scale (const GModelPar &par) |
Set model scale factor for a given instrument. More... | |
std::string | ids (void) const |
Returns observation identifiers to which model applies. More... | |
void | ids (const std::string &ids) |
Set observation identifiers to which model applies. More... | |
bool | is_valid (const std::string &instruments, const std::string &ids) const |
Verifies if model is valid for a given instrument and identifier. More... | |
const GModelAssociations & | associations (void) const |
Return model associations. More... | |
void | associations (const GModelAssociations &associations) |
Set model associations. More... | |
const bool & | has_eval_indices (void) const |
Signals that parameter indices updated by eval() method were set. More... | |
const std::vector< int > & | eval_indices (void) const |
Return vector of parameter indices updated by eval() method. 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 GModel &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | read_attributes (const GXmlElement &xml) |
Read model attributes. More... | |
void | write_attributes (GXmlElement &xml) const |
Write model attributes. More... | |
std::string | print_attributes (void) const |
Print model attributes. More... | |
void | read_scales (const GXmlElement &xml) |
Read instrument scales from XML element. More... | |
void | write_scales (GXmlElement &xml) const |
Write instrument scales into XML element. More... | |
Protected Attributes | |
std::string | m_name |
Model name. More... | |
std::vector< std::string > | m_instruments |
Instruments to which model applies. More... | |
std::vector< GModelPar > | m_scales |
Model instrument scale factors. More... | |
std::vector< std::string > | m_ids |
Identifiers to which model applies. More... | |
std::vector< GModelPar * > | m_pars |
Pointers to all model parameters. More... | |
GModelAssociations | m_associations |
Model associations. More... | |
bool | m_has_ts |
Signals if TS is available. More... | |
bool | m_has_tscalc |
Signals if tscalc attribute is available. More... | |
bool | m_tscalc |
Signals if TS should be computed. More... | |
double | m_ts |
Test Statistic of the model. More... | |
bool | m_has_eval_inx |
std::vector< int > | m_eval_inx |
Abstract model class.
This class implements a parametric model. The eval() method evaluates the model for a given event and observation. If the gradients parameter is set to true, the eval() method also computes analytical parameter gradients if they exist.
A model has the following attributes:
name
type
instruments
ids
scales
The model name
is a text string that names the model. The name() methods allow setting and retrieving the model name. The model handling does not actual depend on the value of this text string.
The model type
is a text string that specifies the kind of the model. Examples are PointSource
, ExtendedSource
or DiffuseSource
for sky models. The type() method allows retrieving the model type. The model handling does not actual depend on the value of this text string.
The model instruments
is a list of text strings that specifies the instruments to which the model applies. The is_valid() method will check a given instrument name against that list to verify if the model applies to an instrument. The instruments() method returns a comma separated list of all instruments. Another instance of this method allows setting the instrument list from a comma separated list. If the instruments
list is empty, the model applies to all instruments.
The model ids
is a list of text strings that specifies the observation identifiers to which the model applies. This allows specifying of models for a specific list of observations. The is_valid() method will check a given observation identifier against that list to verify if the model applies. The ids() method returns a comma separated list of all observation identifiers. Another instance of this method allows setting the observation identifiers from a comma separated list. If the ids
list is empty, the model applies to all observation identifiers.
The model scales
is a list of model parameters that specify an instrument dependent scaling factor. This allows to prescale a model for a given instrument. The scale() methods allow to set and to retrieve the scale factor for a specific instrument.
As the class holds simply a collection of model parameters, it should neither deal with allocation and deallocation, nor with cloning of model parameters. This will be done by the classes that actually implement the model parameters.
Definition at line 100 of file GModel.hpp.
GModel::GModel | ( | void | ) |
|
explicit |
XML constructor.
[in] | xml | XML element. |
Construct model from XML element. The method extracts all model attributes from the XML file (see the read_attributes() method for more information about the supported attributes).
Definition at line 76 of file GModel.cpp.
References init_members(), and read_attributes().
GModel::GModel | ( | const GModel & | model | ) |
Copy constructor.
[in] | model | Model. |
Definition at line 94 of file GModel.cpp.
References copy_members(), and init_members().
|
virtual |
|
inline |
Return model associations.
Returns model associations.
Definition at line 381 of file GModel.hpp.
References m_associations.
Referenced by associations().
|
inline |
Set model associations.
[in] | associations | Model associations. |
Set the model associations.
Definition at line 395 of file GModel.hpp.
References associations(), and m_associations.
GModelPar & GModel::at | ( | const int & | index | ) |
Returns reference to model parameter by index.
[in] | index | Parameter index [0,...,size()[. |
GException::out_of_range | Parameter index is out of range. |
Returns a reference to the model parameter of the specified index
. Throws an exception if index
is not valid.
Definition at line 239 of file GModel.cpp.
const GModelPar & GModel::at | ( | const int & | index | ) | const |
Returns reference to model parameter by index (const version)
[in] | index | Parameter index [0,...,size()[. |
GException::out_of_range | Parameter index is out of range. |
Returns a const reference to the model parameter of the specified index
. Throws an exception if index
is not valid.
Definition at line 263 of file GModel.cpp.
|
pure virtual |
Return class name.
Returns the class name for non-abstract classes in a human readable way.
Implements GBase.
Implemented in GModelSky, GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GModelData, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
|
pure virtual |
Clear object.
Sets the object to a clean initial state. After calling the method the object will be in the same state as it were if an empty instance of the object would have been created.
Implements GBase.
Implemented in GModelSky, GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GModelData, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
|
pure virtual |
Clones object.
Creates a deep copy of the object and returns a pointer to the object.
Implements GBase.
Implemented in GModelSky, GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GModelData, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
Referenced by GModels::append(), GModels::insert(), and GModels::set().
|
protected |
Copy class members.
[in] | model | Model. |
Definition at line 648 of file GModel.cpp.
References m_associations, m_eval_inx, m_has_eval_inx, m_has_ts, m_has_tscalc, m_ids, m_instruments, m_name, m_pars, m_scales, m_ts, and m_tscalc.
Referenced by GModel(), and operator=().
|
pure virtual |
Implemented in GModelSky, GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GModelData, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
Referenced by GCOMDri::compute_drm(), GObservation::model_func::eval(), GObservation::model(), and GObservation::model_grad().
|
pure virtual |
Implemented in GModelSky, and GModelData.
|
inline |
Return vector of parameter indices updated by eval() method.
Definition at line 420 of file GModel.hpp.
References m_eval_inx.
Referenced by GObservation::model().
|
protected |
Delete class members.
Definition at line 672 of file GModel.cpp.
Referenced by GCOMModelDRM::clear(), GCOMModelDRBPhibarNodes::clear(), GCOMModelDRBPhibarBins::clear(), GCTAModelRadialAcceptance::clear(), GCTAModelBackground::clear(), GSPIModelDataSpace::clear(), GModelSky::clear(), operator=(), and ~GModel().
|
inline |
Signals that parameter indices updated by eval() method were set.
Definition at line 408 of file GModel.hpp.
References m_has_eval_inx.
Referenced by GObservation::model().
bool GModel::has_par | ( | const std::string & | name | ) | const |
Checks if parameter name exists.
[in] | name | Parameter name. |
name
exists.Searches all parameter names for a match with the specified name
. If the specified name has been found, true is returned.
Definition at line 284 of file GModel.cpp.
References m_pars, name(), and size().
Referenced by GSPIModelDataSpace::setup_pars().
|
inline |
Signals that model has scales.
Definition at line 355 of file GModel.hpp.
References m_scales.
Referenced by GResponse::convolve(), GResponse::edisp_kerns::edisp_kerns(), GResponse::eval_prob(), GResponse::eval_probs(), GCTAOnOffObservation::N_gamma(), GCTAResponseIrf::nroi(), GModelSky::signal_analytical_gradients(), and GResponse::size_edisp_vector().
|
inline |
Signals that model has Test Statistics value.
Definition at line 367 of file GModel.hpp.
References m_has_ts.
std::string GModel::ids | ( | void | ) | const |
Returns observation identifiers to which model applies.
Returns a comma separated list of observation identifiers to which model applies. If no observation identifier exists then an empty string is returned.
Definition at line 502 of file GModel.cpp.
References m_ids.
Referenced by read_attributes(), and write_attributes().
void GModel::ids | ( | const std::string & | ids | ) |
Set observation identifiers to which model applies.
[in] | ids | String of observation identifiers. |
Sets the observation identifiers to which the model applies from a comma separated list of strings. The observation identifiers are case sensitive, but any leading and trailing whitespace will be stripped.
If the observation identifier string is empty, the model is considered to apply to all observation identifiers.
Definition at line 532 of file GModel.cpp.
References m_ids, gammalib::split(), and gammalib::strip_whitespace().
|
protected |
Initialise class members.
Definition at line 622 of file GModel.cpp.
References GModelAssociations::clear(), m_associations, m_eval_inx, m_has_eval_inx, m_has_ts, m_has_tscalc, m_ids, m_instruments, m_name, m_pars, m_scales, m_ts, and m_tscalc.
Referenced by GCOMModelDRM::clear(), GCOMModelDRBPhibarNodes::clear(), GCOMModelDRBPhibarBins::clear(), GCTAModelRadialAcceptance::clear(), GCTAModelBackground::clear(), GSPIModelDataSpace::clear(), GModelSky::clear(), GModel(), and operator=().
std::string GModel::instruments | ( | void | ) | const |
Returns instruments to which model applies.
Returns a comma separated list of instruments to which model applies. If no instrument exists then an empty string is returned.
Definition at line 310 of file GModel.cpp.
References m_instruments.
Referenced by read_attributes(), GCOMModelDRM::write(), GCOMModelDRBPhibarNodes::write(), GCOMModelDRBPhibarBins::write(), GSPIModelDataSpace::write(), and write_attributes().
void GModel::instruments | ( | const std::string & | instruments | ) |
Set instruments to which model applies.
[in] | instruments | String of instruments. |
Sets the instruments to which the model applies from a comma separated list of strings. The instrument names are case sensitive.
If the instrument
string is empty, the model is considered to apply to all instruments.
Definition at line 339 of file GModel.cpp.
References m_instruments, gammalib::split(), and gammalib::strip_whitespace().
|
pure virtual |
Implemented in GModelSky, GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GModelData, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
Referenced by GObservation::npred().
bool GModel::is_valid | ( | const std::string & | instrument, |
const std::string & | id | ||
) | const |
Verifies if model is valid for a given instrument and identifier.
[in] | instrument | Instrument name. |
[in] | id | Observation identifier. |
Checks if specified instrument name and observation identifier is in list of applicable instruments and identifiers. The check is case sensitive.
If the list of applicable instruments is empty, the model applies to all possible instruments. If the list of applicable observation identifiers is empty, the model applies to all identifiers.
If an empty string is provided as instrument
parameter, the check for instrument validity will be skipped. Similarily, if an empty string is provided as id
parameter, the identifier check will be skipped. This allows for example to check for models of a given identifier whatever the instrument, or for models for a given instrument, whatever the identifier.
Definition at line 570 of file GModel.cpp.
References m_ids, and m_instruments.
Referenced by GObservation::model(), GCTAOnOffObservation::N_bgd(), GCTAOnOffObservation::N_gamma(), GObservation::npred(), and GObservations::npred().
|
inline |
Return parameter name.
Returns the parameter name.
Definition at line 261 of file GModel.hpp.
References m_name.
Referenced by GModels::append(), GObservation::computed_gradient(), GCOMModelDRM::eval(), GCOMModelDRBPhibarNodes::eval(), GCOMModelDRBPhibarBins::eval(), GSPIModelDataSpace::eval(), GResponse::eval_prob(), GSPIModelDataSpace::GSPIModelDataSpace(), GObservation::has_gradient(), has_par(), GModels::insert(), GResponse::irf_diffuse(), GResponse::irf_elliptical(), GResponse::irf_ptsrc(), GResponse::irf_radial(), GResponse::irf_spatial(), GCTAModelIrfBackground::mc(), GCTAModelAeffBackground::mc(), GCTAModelRadialAcceptance::mc(), GCTAModelBackground::mc(), GModelSky::mc(), name(), GCTAResponseIrf::nroi(), operator[](), print_attributes(), read_attributes(), scale(), GModels::set(), GSPIModelDataSpace::setup_model(), GSPIModelDataSpace::setup_pars(), GCTAModelIrfBackground::write(), GCOMModelDRM::write(), GCTAModelAeffBackground::write(), GCOMModelDRBPhibarNodes::write(), GCOMModelDRBPhibarBins::write(), GCTAModelCubeBackground::write(), GCTAModelRadialAcceptance::write(), GCTAModelBackground::write(), GCTAModelSkyCube::write(), GSPIModelDataSpace::write(), GModelSky::write(), write_attributes(), and write_scales().
|
inline |
Set parameter name.
[in] | name | Parameter name. |
Set the parameter name.
Definition at line 275 of file GModel.hpp.
|
pure virtual |
Assignment operator.
[in] | model | Model. |
Definition at line 132 of file GModel.cpp.
References copy_members(), free_members(), and init_members().
Referenced by GModelData::operator=(), and GModelSky::operator=().
|
inlinevirtual |
Returns reference to model parameter by index.
[in] | index | Parameter index [0,...,size()-1]. |
Returns a reference to the model parameter of the specified index
.
Definition at line 202 of file GModel.hpp.
References m_pars.
|
inlinevirtual |
Returns reference to model parameter by index (const version)
[in] | index | Parameter index [0,...,size()-1]. |
Returns a const reference to the model parameter of the specified
Definition at line 218 of file GModel.hpp.
References m_pars.
|
virtual |
Returns reference to model parameter by name.
[in] | name | Parameter name. |
GException::invalid_argument | Parameter with specified name not found. |
Returns a reference to the model parameter of the specified name
. Throws an exception if no parameter with name
is found.
Definition at line 165 of file GModel.cpp.
|
virtual |
Returns reference to model parameter by name const version)
[in] | name | Parameter name. |
GException::invalid_argument | Parameter with specified name not found. |
Returns a const reference to the model parameter of the specified name
. Throws an exception if no parameter with name
is found.
Definition at line 199 of file GModel.cpp.
Print content of object.
[in] | chatter | Chattiness (defaults to NORMAL). |
Formats the content in a standard way and puts this content in a C++ string that is returned.
Implements GBase.
Implemented in GModelSky, GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GCTAModelCubeBackground, GModelData, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
|
protected |
Print model attributes.
Definition at line 770 of file GModel.cpp.
References GModelAssociations::is_empty(), m_associations, m_has_ts, m_ids, m_instruments, m_tscalc, name(), gammalib::parformat(), GModelAssociations::size(), gammalib::str(), and ts().
Referenced by GCOMModelDRM::print(), GCTAModelIrfBackground::print(), GCOMModelDRBPhibarNodes::print(), GCTAModelAeffBackground::print(), GCOMModelDRBPhibarBins::print(), GCTAModelCubeBackground::print(), GCTAModelRadialAcceptance::print(), GCTAModelBackground::print(), GCTAModelSkyCube::print(), GSPIModelDataSpace::print(), and GModelSky::print().
|
pure virtual |
|
protected |
Read model attributes.
[in] | xml | XML element. |
Definition at line 684 of file GModel.cpp.
References GXmlElement::attribute(), GXmlElement::has_attribute(), ids(), instruments(), m_associations, name(), GModelAssociations::read(), read_scales(), gammalib::todouble(), ts(), and tscalc().
Referenced by GModel(), GCOMModelDRM::read(), GCTAModelIrfBackground::read(), GCTAModelAeffBackground::read(), GCOMModelDRBPhibarNodes::read(), GCOMModelDRBPhibarBins::read(), GCTAModelCubeBackground::read(), GCTAModelRadialAcceptance::read(), GCTAModelBackground::read(), GCTAModelSkyCube::read(), GSPIModelDataSpace::read(), and GModelSky::read().
|
protected |
Read instrument scales from XML element.
[in] | xml | XML source element. |
Reads the instrument scale factors from a tag with the following format
<scaling> <instrument name="LAT" scale="1.0" min="0.1" max="10.0" value="1.0" free="0"/> <instrument name="CTA" scale="1.0" min="0.1" max="10.0" value="0.5" free="0"/> </scaling>
The instrument name is case sensitive, but any leading and trailing white space will be removed.
If no scaling tag is found, all instrument scale factors will be cleared.
Definition at line 849 of file GModel.cpp.
References GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), GOptimizerPar::has_grad(), m_pars, m_scales, GOptimizerPar::name(), GModelPar::read(), scale(), scales(), and gammalib::strip_whitespace().
Referenced by read_attributes().
GModelPar & GModel::scale | ( | const int & | index | ) |
Returns reference to scale parameter by index.
[in] | index | Scale parameter index [0,...,scales()[. |
GException::out_of_range | Scale parameter index is out of range. |
Returns a reference to the scale parameter of the specified index
. Throws an exception if index
is not valid.
Definition at line 369 of file GModel.cpp.
References G_SCALE, m_scales, and scales().
Referenced by GResponse::convolve(), GResponse::edisp_kerns::edisp_kerns(), GCOMModelDRBPhibarNodes::eval(), GCOMModelDRBPhibarBins::eval(), GSPIModelDataSpace::eval(), GResponse::eval_prob(), GResponse::eval_probs(), GSPIModelDataSpace::get_date_time(), GCTAOnOffObservation::N_gamma(), GCTAResponseIrf::nroi(), GModelSky::print(), read_scales(), scale(), GModelSky::signal_analytical_gradients(), GResponse::size_edisp_vector(), and write_scales().
const GModelPar & GModel::scale | ( | const int & | index | ) | const |
Returns reference to scale parameter by index (const version)
[in] | index | Scale parameter index [0,...,scales()[. |
GException::out_of_range | Scale parameter index is out of range. |
Returns a reference to the scale parameter of the specified index
. Throws an exception if index
is not valid.
Definition at line 394 of file GModel.cpp.
GModelPar GModel::scale | ( | const std::string & | instrument | ) | const |
Returns model scale factor for a given instrument.
[in] | instrument | Instrument. |
Returns the model scale factor for a given instrument
. The search is case sensitive.
If the instrument
is not found, the method returns a scale factor of unity.
Definition at line 418 of file GModel.cpp.
References GOptimizerPar::fix(), m_scales, name(), GOptimizerPar::name(), scale(), and GOptimizerPar::value().
void GModel::scale | ( | const GModelPar & | par | ) |
Set model scale factor for a given instrument.
[in] | par | Model parameter for scaling. |
Sets the model parameter for a given instrument. The instrument name is case sensitive, but any leading to trailing white space will be stripped.
If the instrument is not yet defined it will be appended to the list of instruments.
Definition at line 451 of file GModel.cpp.
References m_pars, m_scales, name(), GOptimizerPar::name(), and gammalib::strip_whitespace().
|
inline |
Return number of scale parameters in model.
Returns the number of scale parameters in the model.
Definition at line 247 of file GModel.hpp.
References m_scales.
Referenced by GResponse::convolve(), GResponse::edisp_kerns::edisp_kerns(), GResponse::eval_prob(), GResponse::eval_probs(), GModelSky::print(), read_scales(), scale(), GModelSky::signal_analytical_gradients(), and GResponse::size_edisp_vector().
|
inline |
Return number of parameters in model.
Returns the number of parameters in the model.
Definition at line 233 of file GModel.hpp.
References m_pars.
Referenced by at(), GResponse::convolve(), GModelSky::eflux_error(), GCOMModelDRM::eval(), GCOMModelDRBPhibarBins::eval(), GCOMModelDRBPhibarNodes::eval(), GSPIModelDataSpace::eval(), GModelData::eval(), GResponse::eval_probs(), GModelSky::flux_error(), GModelSky::gradients(), has_par(), GResponse::irf_spatial(), GObservation::model(), GCTAOnOffObservation::N_bgd(), GCTAOnOffObservation::N_gamma(), GObservation::npred(), operator[](), GModels::pars(), GCTAModelIrfBackground::print(), GCOMModelDRM::print(), GCOMModelDRBPhibarNodes::print(), GCOMModelDRBPhibarBins::print(), GCTAModelAeffBackground::print(), GCTAModelCubeBackground::print(), GCTAModelRadialAcceptance::print(), GCTAModelBackground::print(), GSPIModelDataSpace::print(), GCTAModelSkyCube::print(), and GModelSky::print().
|
inline |
Return Test Statistic value.
Returns the Test Statistic value. The Test Statistic value is twice the difference between the log-likelihood of the null hypothesis and the alternative hypothesis.
Definition at line 292 of file GModel.hpp.
References m_ts.
Referenced by print_attributes(), read_attributes(), ts(), and write_attributes().
|
inline |
Set Test Statistic value.
[in] | ts | Test Statistic value. |
Set the Test Statistic value. The Test Statistic value is twice the difference between the log-likelihood of the null hypothesis and the alternative hypothesis.
< Signals that TS is now available
Definition at line 308 of file GModel.hpp.
|
inline |
Return Test Statistic computation flag.
Returns the flag that signals whether Test Statistic values should be computed.
Definition at line 326 of file GModel.hpp.
References m_tscalc.
Referenced by read_attributes(), tscalc(), and write_attributes().
|
inline |
Set Test Statistic computation flag.
[in] | tscalc | Test Statistic computation flag. |
Set the flag that signals whether Test Statistic values should be computed.
< Signals that tscalc is now available
Definition at line 341 of file GModel.hpp.
References m_has_tscalc, m_tscalc, and tscalc().
|
pure virtual |
Implemented in GModelSky, GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GModelData, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
Referenced by GModelRegistry::GModelRegistry(), and write_attributes().
|
pure virtual |
|
protected |
Write model attributes.
[in] | xml | XML element. |
Definition at line 723 of file GModel.cpp.
References GXmlElement::attribute(), ids(), instruments(), m_associations, m_has_ts, m_has_tscalc, name(), gammalib::str(), ts(), tscalc(), type(), GModelAssociations::write(), and write_scales().
Referenced by GCOMModelDRM::write(), GCTAModelIrfBackground::write(), GCOMModelDRBPhibarNodes::write(), GCTAModelAeffBackground::write(), GCOMModelDRBPhibarBins::write(), GCTAModelCubeBackground::write(), GCTAModelRadialAcceptance::write(), GCTAModelBackground::write(), GCTAModelSkyCube::write(), GSPIModelDataSpace::write(), and GModelSky::write().
|
protected |
Write instrument scales into XML element.
[in] | xml | XML source element. |
GException::invalid_value | Invalid number of instrument tags found in XML element. |
If there are instrument scale factors then add a tag with the following format to the XML element:
<scaling> <instrument name="LAT" scale="1" min="0.1" max="10" value="1.0" free="0"/> <instrument name="CTA" scale="1" min="0.1" max="10" value="0.5" free="0"/> </scaling>
Definition at line 897 of file GModel.cpp.
References GXmlNode::append(), GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), G_WRITE_SCALES, m_scales, name(), scale(), and gammalib::str().
Referenced by write_attributes().
|
protected |
Model associations.
Definition at line 179 of file GModel.hpp.
Referenced by associations(), copy_members(), init_members(), print_attributes(), read_attributes(), and write_attributes().
|
mutableprotected |
List of parameter indices updated by eval() method
Definition at line 188 of file GModel.hpp.
Referenced by copy_members(), GSPIModelDataSpace::eval(), eval_indices(), and init_members().
|
mutableprotected |
Signal that parameter indices updated by eval() method exist
Definition at line 186 of file GModel.hpp.
Referenced by copy_members(), GSPIModelDataSpace::eval(), has_eval_indices(), and init_members().
|
protected |
Signals if TS is available.
Definition at line 180 of file GModel.hpp.
Referenced by copy_members(), has_ts(), init_members(), print_attributes(), ts(), and write_attributes().
|
protected |
Signals if tscalc attribute is available.
Definition at line 181 of file GModel.hpp.
Referenced by copy_members(), init_members(), tscalc(), and write_attributes().
|
protected |
Identifiers to which model applies.
Definition at line 177 of file GModel.hpp.
Referenced by copy_members(), ids(), init_members(), is_valid(), and print_attributes().
|
protected |
Instruments to which model applies.
Definition at line 175 of file GModel.hpp.
Referenced by copy_members(), GSPIModelDataSpace::init_members(), init_members(), instruments(), is_valid(), and print_attributes().
|
protected |
Model name.
Definition at line 174 of file GModel.hpp.
Referenced by copy_members(), GSPIModelDataSpace::GSPIModelDataSpace(), init_members(), name(), and GSPIModelDataSpace::setup_pars().
|
protected |
Pointers to all model parameters.
Definition at line 178 of file GModel.hpp.
Referenced by at(), GCOMModelDRM::copy_members(), copy_members(), GModelSky::gradients(), has_par(), GCOMModelDRM::init_members(), GCTAModelSkyCube::init_members(), init_members(), operator[](), GCOMModelDRM::print(), GCOMModelDRBPhibarNodes::print(), GCOMModelDRBPhibarBins::print(), GSPIModelDataSpace::print(), read_scales(), scale(), GCOMModelDRBPhibarBins::set_pointers(), GCOMModelDRBPhibarNodes::set_pointers(), GCTAModelIrfBackground::set_pointers(), GCTAModelAeffBackground::set_pointers(), GCTAModelCubeBackground::set_pointers(), GSPIModelDataSpace::set_pointers(), GCTAModelRadialAcceptance::set_pointers(), GCTAModelBackground::set_pointers(), GCTAModelSkyCube::set_pointers(), GModelSky::set_pointers(), and size().
|
protected |
Model instrument scale factors.
Definition at line 176 of file GModel.hpp.
Referenced by copy_members(), has_scales(), init_members(), read_scales(), scale(), scales(), GModelSky::set_pointers(), and write_scales().
|
protected |
Test Statistic of the model.
Definition at line 183 of file GModel.hpp.
Referenced by copy_members(), init_members(), and ts().
|
protected |
Signals if TS should be computed.
Definition at line 182 of file GModel.hpp.
Referenced by copy_members(), init_members(), print_attributes(), and tscalc().