GammaLib
2.0.0
|
Abstract data model class. More...
#include <GModelData.hpp>
Public Member Functions | |
GModelData (void) | |
Void constructor. More... | |
GModelData (const GXmlElement &xml) | |
XML constructor. More... | |
GModelData (const GModelData &model) | |
Copy constructor. More... | |
virtual | ~GModelData (void) |
Destructor. More... | |
virtual GModelData & | operator= (const GModelData &model) |
Assignment operator. More... | |
virtual void | clear (void)=0 |
Clear object. More... | |
virtual GModelData * | 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 double | npred (const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const =0 |
virtual GEvents * | mc (const GObservation &obs, GRan &ran) 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... | |
virtual GVector | eval (const GObservation &obs, GMatrixSparse *gradients=NULL) const |
Return model values and gradients. More... | |
Public Member Functions inherited from GModel | |
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... | |
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 GModelData &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GModel | |
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... | |
Additional Inherited Members | |
Protected Attributes inherited from GModel | |
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 data model class.
This abstract base class implements a model of the event distribution in the instrument's data space.
Definition at line 55 of file GModelData.hpp.
GModelData::GModelData | ( | void | ) |
|
explicit |
XML constructor.
[in] | xml | XML element. |
Definition at line 72 of file GModelData.cpp.
References init_members().
GModelData::GModelData | ( | const GModelData & | model | ) |
Copy constructor.
[in] | model | Data model. |
Definition at line 87 of file GModelData.cpp.
References copy_members(), and init_members().
|
virtual |
|
pure virtual |
Return class name.
Returns the class name for non-abstract classes in a human readable way.
Implements GModel.
Implemented in GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, 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 GModel.
Implemented in GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, 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 GModel.
Implemented in GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
|
protected |
Copy class members.
[in] | model | Data model. |
Definition at line 290 of file GModelData.cpp.
Referenced by GModelData(), and operator=().
|
pure virtual |
Implements GModel.
Implemented in GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
Referenced by eval().
|
virtual |
Return model values and gradients.
[in] | obs | Observation. |
[out] | gradients | Pointer to matrix of gradients. |
Evaluates the model values and parameter gradients for all events in an observation. Gradients are only returned if the gradients
pointer is not NULL.
The matrix of gradients is a sparse matrix where the number of rows corresponds to the number of model parameters and the number of columns corresponds to the number of events. An exception is thrown if the dimension of the gradients
matrix is not compatible with the model and the observations.
Implements GModel.
Definition at line 172 of file GModelData.cpp.
References GMatrixSparse::column(), GMatrixBase::columns(), GObservation::computed_gradient(), eval(), GObservation::events(), GOptimizerPar::factor_gradient(), G_EVAL, GOptimizerPar::has_grad(), GOptimizerPar::is_free(), GMatrixBase::rows(), GEvents::size(), GModel::size(), and gammalib::str().
|
protected |
Delete class members.
Definition at line 300 of file GModelData.cpp.
Referenced by GCTAModelIrfBackground::clear(), GCOMModelDRM::clear(), GCTAModelAeffBackground::clear(), GCOMModelDRBPhibarNodes::clear(), GCOMModelDRBPhibarBins::clear(), GCTAModelCubeBackground::clear(), GCTAModelRadialAcceptance::clear(), GCTAModelBackground::clear(), GSPIModelDataSpace::clear(), GCTAModelSkyCube::clear(), operator=(), and ~GModelData().
|
protected |
Initialise class members.
Definition at line 278 of file GModelData.cpp.
Referenced by GCTAModelIrfBackground::clear(), GCOMModelDRM::clear(), GCTAModelAeffBackground::clear(), GCOMModelDRBPhibarNodes::clear(), GCOMModelDRBPhibarBins::clear(), GCTAModelCubeBackground::clear(), GCTAModelRadialAcceptance::clear(), GCTAModelBackground::clear(), GSPIModelDataSpace::clear(), GCTAModelSkyCube::clear(), GModelData(), and operator=().
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
virtual |
Assignment operator.
[in] | model | Data model. |
Definition at line 125 of file GModelData.cpp.
References copy_members(), free_members(), init_members(), and GModel::operator=().
Referenced by GCTAModelIrfBackground::operator=(), GCOMModelDRM::operator=(), GCTAModelAeffBackground::operator=(), GCOMModelDRBPhibarNodes::operator=(), GCOMModelDRBPhibarBins::operator=(), GCTAModelCubeBackground::operator=(), GCTAModelRadialAcceptance::operator=(), GCTAModelBackground::operator=(), GSPIModelDataSpace::operator=(), and GCTAModelSkyCube::operator=().
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 GModel.
Implemented in GCTAModelSkyCube, GSPIModelDataSpace, GCTAModelBackground, GCTAModelRadialAcceptance, GCTAModelCubeBackground, GCOMModelDRBPhibarBins, GCOMModelDRBPhibarNodes, GCTAModelAeffBackground, GCOMModelDRM, and GCTAModelIrfBackground.
|
pure virtual |
|
pure virtual |
|
pure virtual |