GammaLib
2.0.0
|
Node array class. More...
#include <GNodeArray.hpp>
Public Member Functions | |
GNodeArray (void) | |
Void constructor. More... | |
GNodeArray (const GFilename &filename) | |
FITS file constructor. More... | |
GNodeArray (const GVector &vector) | |
GVector constructor. More... | |
GNodeArray (const std::vector< double > &vector) | |
Vector constructor. More... | |
GNodeArray (const int &num, const double *array) | |
Element constructor. More... | |
GNodeArray (const GNodeArray &array) | |
Copy constructor. More... | |
virtual | ~GNodeArray (void) |
Destructor. More... | |
GNodeArray & | operator= (const GNodeArray &array) |
Assignment operator. More... | |
double & | operator[] (const int &index) |
Node access operator. More... | |
const double & | operator[] (const int &index) const |
Node access operator (const version) More... | |
void | clear (void) |
Clear node array. More... | |
GNodeArray * | clone (void) const |
Clone node array. More... | |
std::string | classname (void) const |
Return class name. More... | |
double & | at (const int &index) |
Node access operator. More... | |
const double & | at (const int &index) const |
Node access operator (const version) More... | |
int | size (void) const |
Return number of nodes in node array. More... | |
bool | is_empty (void) const |
Signals if there are no nodes in node array. More... | |
void | append (const double &node) |
Append one node to array. More... | |
void | insert (const int &index, const double &node) |
Insert one node into array. More... | |
void | remove (const int &index) |
Remove one node into array. More... | |
void | reserve (const int &num) |
Reserves space for nodes in node array. More... | |
void | extend (const GNodeArray &nodes) |
Append node array. More... | |
void | nodes (const int &num, const double *array) |
Set node array. More... | |
void | nodes (const GVector &vector) |
Set node array from vector. More... | |
void | nodes (const std::vector< double > &vector) |
Set node array from vector. More... | |
double | interpolate (const double &value, const std::vector< double > &vector) const |
Interpolate value. More... | |
void | set_value (const double &value) const |
Set indices and weighting factors for interpolation. More... | |
const int & | inx_left (void) const |
Returns left node index. More... | |
const int & | inx_right (void) const |
Returns right node index. More... | |
const double & | wgt_left (void) const |
Returns left node weight. More... | |
const double & | wgt_right (void) const |
Returns right node weight. More... | |
const double & | wgt_grad_left (void) const |
Returns left node weight gradient. More... | |
const double & | wgt_grad_right (void) const |
Returns right node weight gradient. More... | |
void | load (const GFilename &filename) |
Load nodes from FITS file. More... | |
void | save (const GFilename &filename, const bool &clobber=false) const |
Save node array into FITS file. More... | |
void | read (const GFitsTable &table) |
Read nodes from FITS table. More... | |
void | write (GFits &fits, const std::string &extname="NODES") const |
Write nodes into FITS object. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print nodes. More... | |
Public Member Functions inherited from GContainer | |
virtual | ~GContainer (void) |
Destructor. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Private Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GNodeArray &array) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | setup (void) const |
Compute distance array and linear slope/offset. More... | |
Private Attributes | |
std::vector< double > | m_node |
Array of nodes. More... | |
bool | m_need_setup |
Call of setup is required. More... | |
bool | m_is_linear |
Nodes form a linear array. More... | |
bool | m_has_last_value |
Last value is valid. More... | |
std::vector< double > | m_step |
Distance to next node. More... | |
double | m_last_value |
Last requested value. More... | |
double | m_linear_slope |
Slope for linear array. More... | |
double | m_linear_offset |
Offset for linear array. More... | |
int | m_inx_left |
Index of left node for linear interpolation. More... | |
int | m_inx_right |
Index of right node for linear interpolation. More... | |
double | m_wgt_left |
Weight for left node for linear interpolation. More... | |
double | m_wgt_right |
Weight for right node for linear interpolation. More... | |
double | m_wgt_grad_left |
Weight gradient for left node. More... | |
double | m_wgt_grad_right |
Weight gradient for right node. More... | |
Node array class.
The node array class collects nodes \(x_i\) that may be used to describe a functional relation \(y_i=f(x_i)\). This class may be used to perform a linear interpolation between the nodes to determine any value of \(y=f(x)\). Nodes are allocated either from a double precision array, a GVector object or a std::vector using the nodes() method. Alternatively, the node array may be built on the fly using the append() method. Interpolation can be either performed using the interpolate() method or using the set_value(). In the latter case, the node indices and weighting factors can be recovered using inx_left(), inx_right(), wgt_left() and wgt_right(). If the nodes are equally spaced, interpolation is more rapid.
Definition at line 60 of file GNodeArray.hpp.
GNodeArray::GNodeArray | ( | void | ) |
Void constructor.
Definition at line 69 of file GNodeArray.cpp.
References init_members().
Referenced by clone().
|
explicit |
FITS file constructor.
[in] | filename | FITS file name. |
Constructs node array from a FITS file.
Definition at line 86 of file GNodeArray.cpp.
References init_members(), and load().
|
explicit |
GVector constructor.
[in] | vector | Vector. |
Constructs a node array from the elements in a vector
, represented by a GVector object.
Definition at line 129 of file GNodeArray.cpp.
References init_members(), and nodes().
|
explicit |
Vector constructor.
[in] | vector | Vector. |
Constructs a node array from the elements in a double precision vector
.
Definition at line 149 of file GNodeArray.cpp.
References init_members(), and nodes().
GNodeArray::GNodeArray | ( | const int & | num, |
const double * | array | ||
) |
Element constructor.
[in] | num | Number of elements. |
[in] | array | Array of elements. |
Constructs a node array from an array
of double precision values of length num
.
Definition at line 108 of file GNodeArray.cpp.
References init_members(), and nodes().
GNodeArray::GNodeArray | ( | const GNodeArray & | array | ) |
Copy constructor.
[in] | array | Node array. |
Definition at line 167 of file GNodeArray.cpp.
References copy_members(), and init_members().
|
virtual |
void GNodeArray::append | ( | const double & | node | ) |
Append one node to array.
[in] | node | Node. |
Definition at line 351 of file GNodeArray.cpp.
References m_node, and setup().
Referenced by GModelSpectralFunc::append(), GModelSpatialRadialProfile::cache_index(), GModelSpatialDiffuseCube::energies(), GCTACubePsf::GCTACubePsf(), GCTABackgroundPerfTable::load(), GCTAAeffPerfTable::load(), GCTAPsfPerfTable::load(), GCTAEdispPerfTable::load(), GCTAModelSkyCube::load(), GModelSpatialDiffuseCube::load_cube(), GSPIResponse::load_irfs(), GModelTemporalLightCurve::load_nodes(), GModelSpectralFunc::load_nodes(), GModelTemporalPhaseCurve::load_nodes(), GCOMIaq::location_smearing(), GCTAEdispPerfTable::print(), GCOMD1Response::read(), GCOMD2Response::read(), GCTAAeffArf::read(), GCTAPsfVector::read(), read(), GModelSpatialDiffuseCube::read(), GCOMInstChars::read_coeffs(), GSPIResponse::read_energies(), GCOMInstChars::read_selfveto(), GLATMeanPsf::set(), GCOMModelDRBPhibarNodes::set_cache(), GCTAEdispRmf::set_cache(), GCTACubePsf::set_delta_axis(), GLATEventCube::set_energies(), GModelSpectralTable::set_energy_nodes(), GCTACubeBackground::set_eng_axis(), GCTACubeExposure::set_eng_axis(), GCTACubeEdisp::set_eng_axis(), GCTACubePsf::set_eng_axis(), GModelSpectralNodes::set_eval_cache(), GModelSpectralNodes::set_flux_cache(), GArf::set_logetrue(), GCTACubeEdisp::set_migras(), GLATMeanPsf::set_offsets(), and GCOMD2Response::update_response_vector().
double & GNodeArray::at | ( | const int & | index | ) |
Node access operator.
[in] | index | Node index [0,...,size()-1]. |
GException::out_of_range | Node index is out of range. |
Returns a reference to the node with the specified index
. The index
is checked on its validity.
Definition at line 271 of file GNodeArray.cpp.
References G_AT, m_need_setup, m_node, and size().
const double & GNodeArray::at | ( | const int & | index | ) | const |
Node access operator (const version)
[in] | index | Node index [0,...,size()-1]. |
GException::out_of_range | Node index is out of range. |
Returns a reference to the node with the specified index
. The index
is checked on its validity.
Definition at line 300 of file GNodeArray.cpp.
References G_AT, m_need_setup, m_node, and size().
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 143 of file GNodeArray.hpp.
|
virtual |
Clear node array.
Implements GBase.
Definition at line 235 of file GNodeArray.cpp.
References free_members(), and init_members().
Referenced by GModelSpatialRadialProfile::cache_index(), GModelSpatialDiffuseCube::energies(), GCTACubePsf::GCTACubePsf(), GModelSpectralTablePar::init_members(), GCOMInstChars::init_members(), GCOMModelDRBPhibarNodes::init_members(), GCOMD1Response::init_members(), GLATMeanPsf::init_members(), GCTABackgroundPerfTable::init_members(), GCTAAeffPerfTable::init_members(), GCOMD2Response::init_members(), GLATResponseTable::init_members(), GCTACubeBackground::init_members(), GCTAAeffArf::init_members(), GModelTemporalLightCurve::init_members(), GCTAPsfPerfTable::init_members(), GCTAModelSkyCube::init_members(), GCTACubeExposure::init_members(), GCTAPsfVector::init_members(), GLATEventCube::init_members(), GModelSpectralTable::init_members(), GCTAEdispRmf::init_members(), GCTACubePsf::init_members(), GCTACubeEdisp::init_members(), GSPIResponse::init_members(), GArf::init_members(), GCTAEdispPerfTable::init_members(), GModelSpectralFunc::init_members(), GModelSpatialDiffuseCube::init_members(), GModelTemporalPhaseCurve::init_members(), GModelSpectralNodes::init_members(), GCTABackgroundPerfTable::load(), GCTAAeffPerfTable::load(), GCTAPsfPerfTable::load(), GCTAEdispPerfTable::load(), GModelSpatialDiffuseCube::load_cube(), GSPIResponse::load_irfs(), GModelTemporalLightCurve::load_nodes(), GModelSpectralFunc::load_nodes(), GModelTemporalPhaseCurve::load_nodes(), GCOMD1Response::read(), GCOMD2Response::read(), GCTAAeffArf::read(), GCTAPsfVector::read(), read(), GModelSpatialDiffuseCube::read(), GCOMInstChars::read_coeffs(), GSPIResponse::read_energies(), GCOMInstChars::read_selfveto(), GLATMeanPsf::set(), GSPIResponse::set(), GCOMModelDRBPhibarNodes::set_cache(), GCTAEdispRmf::set_cache(), GCTACubePsf::set_delta_axis(), GLATEventCube::set_energies(), GCTACubeBackground::set_eng_axis(), GCTACubeExposure::set_eng_axis(), GCTACubePsf::set_eng_axis(), GCTACubeEdisp::set_eng_axis(), GModelSpectralNodes::set_eval_cache(), GModelSpectralNodes::set_flux_cache(), GArf::set_logetrue(), GCTACubeEdisp::set_migras(), GLATMeanPsf::set_offsets(), and GCOMD2Response::update_response_vector().
|
virtual |
Clone node array.
Implements GBase.
Definition at line 253 of file GNodeArray.cpp.
References GNodeArray().
|
private |
Copy class members.
[in] | array | Node array. |
Definition at line 942 of file GNodeArray.cpp.
References m_has_last_value, m_inx_left, m_inx_right, m_is_linear, m_last_value, m_linear_offset, m_linear_slope, m_need_setup, m_node, m_step, m_wgt_grad_left, m_wgt_grad_right, m_wgt_left, and m_wgt_right.
Referenced by GNodeArray(), and operator=().
void GNodeArray::extend | ( | const GNodeArray & | nodes | ) |
Append node array.
[in] | nodes | Node array. |
Append a node array to the node array.
Definition at line 440 of file GNodeArray.cpp.
References is_empty(), m_node, reserve(), setup(), and size().
|
private |
Delete class members.
Definition at line 968 of file GNodeArray.cpp.
Referenced by clear(), nodes(), operator=(), and ~GNodeArray().
|
private |
Initialise class members.
Definition at line 914 of file GNodeArray.cpp.
References m_has_last_value, m_inx_left, m_inx_right, m_is_linear, m_last_value, m_linear_offset, m_linear_slope, m_need_setup, m_node, m_step, m_wgt_grad_left, m_wgt_grad_right, m_wgt_left, and m_wgt_right.
Referenced by clear(), GNodeArray(), nodes(), and operator=().
void GNodeArray::insert | ( | const int & | index, |
const double & | node | ||
) |
Insert one node into array.
[in] | index | Node index [0,...,size()-1]. |
[in] | node | Node. |
GException::out_of_range | Node index is out of range. |
Inserts a node
into the node array before the node with the specified index
.
Definition at line 376 of file GNodeArray.cpp.
References G_INSERT, is_empty(), m_node, setup(), and size().
Referenced by GModelSpectralFunc::insert().
double GNodeArray::interpolate | ( | const double & | value, |
const std::vector< double > & | vector | ||
) | const |
Interpolate value.
[in] | value | Value \(x\) at which interpolation should be done. |
[in] | vector | Vector \(y_i\) that should be interpolated. |
GException::invalid_value | Not enough nodes for interpolation in node array. |
GException::invalid_argument | Size of node vector does not match the size of vector argument. |
This method performs a linear interpolation of values \(y_i\). The corresponding values \(x_i\) are stored in the node array.
Definition at line 536 of file GNodeArray.cpp.
References G_INTERPOLATE, inx_left(), inx_right(), m_node, set_value(), gammalib::str(), wgt_left(), and wgt_right().
Referenced by GCTAEdispPerfTable::ereco_bounds(), GCTAEdispPerfTable::etrue_bounds(), GModelSpectralFunc::eval(), GModelTemporalLightCurve::eval(), GModelTemporalPhaseCurve::eval(), GCTAAeffPerfTable::max(), GCTAAeffArf::max(), GCOMInstChars::ne213a_mfpath(), GModelTemporalPhaseCurve::normalize_nodes(), GCTAAeffPerfTable::operator()(), GCOMD2Response::operator()(), GCTAAeffArf::operator()(), GCOMInstChars::prob_D1inter(), GCOMInstChars::prob_D2inter(), GCOMInstChars::prob_no_multihit(), GCTABackgroundPerfTable::rate(), GCOMInstChars::read_selfveto(), GCOMInstChars::trans_D1(), GCOMInstChars::trans_D2(), GCOMInstChars::trans_V1(), GCOMInstChars::trans_V23(), GCTAPsfPerfTable::update(), GCTAPsfVector::update(), GCTAEdispPerfTable::update(), GCOMD1Response::update_cache(), GCOMD2Response::update_cache(), GCOMD2Response::update_response_vector(), and GModelTemporalPhaseCurve::value().
|
inline |
Returns left node index.
Returns the left node index to be used for interpolation.
Definition at line 235 of file GNodeArray.hpp.
References m_inx_left.
Referenced by GSPIResponse::compute_irf(), GModelSpatialDiffuseCube::cube_intensity(), GModelSpectralTable::eflux(), GModelSpectralFunc::eflux(), GModelSpectralNodes::eflux(), GLATResponseTable::energies(), GCOMModelDRBPhibarNodes::eval(), GModelSpectralTable::eval(), GCTAModelSkyCube::eval(), GModelSpectralNodes::eval(), GLATMeanPsf::exposure(), GModelSpectralTable::flux(), GModelSpectralFunc::flux(), GModelSpatialDiffuseCube::flux(), GModelSpectralNodes::flux(), GCTAEdisp2D::get_max_edisp(), GLATMeanPsf::integral(), interpolate(), GLATResponse::irf_spatial_bin(), GModelSpectralTable::load_spec(), GCTABackground2D::mc(), GCTABackground3D::mc(), GModelSpatialDiffuseCube::mc(), GModelSpectralFunc::mc_update(), GModelSpectralNodes::mc_update(), GCTAModelSkyCube::npred(), GLATMeanPsf::operator()(), GCTABackground3D::operator()(), GCTABackground2D::operator()(), GArf::operator()(), GCTAEdispRmf::prob_erecobin(), GCTAEdisp2D::prob_erecobin(), GCOMInstChars::prob_no_selfveto(), GLATMeanPsf::psf(), GCTABackground2D::rate(), GCTABackground3D::rate(), GLATResponseTable::set(), GCTAEdisp2D::table_value(), GCTACubeBackground::update(), GCTACubeExposure::update(), GCTAEdispRmf::update(), GModelSpectralTable::update(), GCTACubePsf::update(), GCTACubeEdisp::update(), GCTAResponseTable::update(), and GModelSpectralTable::update_mc().
|
inline |
Returns right node index.
Returns the right node index to be used for interpolation.
Definition at line 249 of file GNodeArray.hpp.
References m_inx_right.
Referenced by GSPIResponse::compute_irf(), GModelSpatialDiffuseCube::cube_intensity(), GLATResponseTable::energies(), GCOMModelDRBPhibarNodes::eval(), GModelSpectralTable::eval(), GCTAModelSkyCube::eval(), GModelSpectralNodes::eval(), GLATMeanPsf::exposure(), GModelSpatialDiffuseCube::flux(), GCTAEdisp2D::get_max_edisp(), GLATMeanPsf::integral(), interpolate(), GLATResponse::irf_spatial_bin(), GModelSpectralTable::load_spec(), GCTABackground2D::mc(), GCTABackground3D::mc(), GModelSpatialDiffuseCube::mc(), GCTAModelSkyCube::npred(), GLATMeanPsf::operator()(), GCTABackground2D::operator()(), GCTABackground3D::operator()(), GArf::operator()(), GCTAEdispRmf::prob_erecobin(), GCTAEdisp2D::prob_erecobin(), GCOMInstChars::prob_no_selfveto(), GLATMeanPsf::psf(), GCTABackground2D::rate(), GCTABackground3D::rate(), GLATResponseTable::set(), GCTAEdisp2D::table_value(), GCTACubeBackground::update(), GCTACubeExposure::update(), GCTAEdispRmf::update(), GModelSpectralTable::update(), GCTACubePsf::update(), GCTACubeEdisp::update(), and GCTAResponseTable::update().
|
inlinevirtual |
Signals if there are no nodes in node array.
Signals if the node array does not contain any node.
Implements GContainer.
Definition at line 206 of file GNodeArray.hpp.
References m_node.
Referenced by extend(), insert(), GModelSpectralTablePar::is_empty(), GModelSpectralFunc::is_empty(), GCOMD1Response::operator()(), and GCOMD2Response::operator()().
void GNodeArray::load | ( | const GFilename & | filename | ) |
Load nodes from FITS file.
[in] | filename | FITS filename. |
Loads the node array from a FITS file.
If no extension name is provided, the node array is loaded from the "NODES" extension.
Definition at line 709 of file GNodeArray.cpp.
References GFits::close(), GFilename::extname(), read(), and GFits::table().
Referenced by GNodeArray().
void GNodeArray::nodes | ( | const int & | num, |
const double * | array | ||
) |
Set node array.
[in] | num | Number of nodes |
[in] | array | Node values \(x_i\). |
Setup node array from an array of double precision values.
Definition at line 325 of file GNodeArray.cpp.
References free_members(), init_members(), m_node, and setup().
Referenced by GNodeArray(), GLATResponseTable::read(), GCOMInstChars::read_selfveto(), set_value(), and setup().
void GNodeArray::nodes | ( | const GVector & | vector | ) |
Set node array from vector.
[in] | vector | Vector from which node array will be built. |
Setup node array from a vector of values.
Definition at line 475 of file GNodeArray.cpp.
References free_members(), init_members(), m_node, setup(), and GVector::size().
void GNodeArray::nodes | ( | const std::vector< double > & | vector | ) |
Set node array from vector.
[in] | vector | Vector from which node array will be built. |
Setup node array from a vector of double precision values.
Definition at line 503 of file GNodeArray.cpp.
References free_members(), init_members(), m_node, and setup().
GNodeArray & GNodeArray::operator= | ( | const GNodeArray & | array | ) |
Assignment operator.
[in] | array | Node array. |
Definition at line 205 of file GNodeArray.cpp.
References copy_members(), free_members(), and init_members().
|
inline |
Node access operator.
[in] | index | Node index [0,...,size()-1]. |
Returns a reference to the node with the specified index
. No range checking is performed on index
. As this operator may change the values of the node array, the setup method needs to be called before doing the interpolation.
Definition at line 161 of file GNodeArray.hpp.
References m_need_setup, and m_node.
|
inline |
Node access operator (const version)
[in] | index | Node index [0,...,size()-1]. |
Returns a reference to the node with the specified index
. No range checking is performed on index
.
Definition at line 178 of file GNodeArray.hpp.
References m_node.
Print nodes.
[in] | chatter | Chattiness (defaults to NORMAL). |
Implements GBase.
Definition at line 850 of file GNodeArray.cpp.
References EXPLICIT, m_inx_left, m_inx_right, m_is_linear, m_linear_offset, m_linear_slope, m_node, m_step, m_wgt_grad_left, m_wgt_grad_right, m_wgt_left, m_wgt_right, gammalib::parformat(), SILENT, size(), gammalib::str(), and VERBOSE.
void GNodeArray::read | ( | const GFitsTable & | table | ) |
Read nodes from FITS table.
[in] | table | FITS table. |
Reads the nodes from a FITS table
.
Definition at line 775 of file GNodeArray.cpp.
References append(), clear(), GFitsTable::nrows(), GFitsTableCol::real(), and setup().
Referenced by load(), GCTACubePsf::read(), and GCTACubeEdisp::read().
|
virtual |
Remove one node into array.
[in] | index | Node index [0,...,size()-1]. |
GException::out_of_range | Node index is out of range. |
Remove node of specified index
from node array.
Implements GContainer.
Definition at line 413 of file GNodeArray.cpp.
References G_REMOVE, m_node, setup(), and size().
Referenced by GModelSpectralFunc::remove().
|
inlinevirtual |
Reserves space for nodes in node array.
[in] | num | Number of nodes. |
Reserves space for num
nodes in the node array.
Implements GContainer.
Definition at line 220 of file GNodeArray.hpp.
References m_node.
Referenced by extend(), GSPIResponse::read_energies(), GModelSpectralFunc::reserve(), GArf::set_logetrue(), and GCOMD2Response::update_response_vector().
void GNodeArray::save | ( | const GFilename & | filename, |
const bool & | clobber = false |
||
) | const |
Save node array into FITS file.
[in] | filename | FITS filename. |
[in] | clobber | Overwrite an existing node array extension? |
Saves node array into a FITS file. If a file with the given filename
does not yet exist it will be created, otherwise the method opens the existing file. Node arrays can only be appended to an existing file if the clobber
flag is set to true
(otherwise an exception is thrown).
The method will append a binary FITS table containing the node array to the FITS file. The extension name can be specified as part of the filename
. For example the filename
myfile.fits[NODE ARRAY]
will save the node array in the NODE ARRAY
extension of the myfile.fits
file. If the extension exists already in the file it will be replaced, otherwise a new extension will be created. If no extension name is provided, the method will use NODES
as the default extension name for the node array.
Definition at line 751 of file GNodeArray.cpp.
References GFilename::extname(), GFilename::url(), and write().
void GNodeArray::set_value | ( | const double & | value | ) | const |
Set indices and weighting factors for interpolation.
[in] | value | Value for which the interpolation should be done. |
GException::invalid_value | No nodes are available for interpolation. |
Set the indices that bound the specified value and the corresponding weighting factors for linear interpolation. If the array has a linear form (i.e. the nodes are equidistant), an analytic formula is used to determine the boundary indices. If the nodes are not equidistant the boundary indices are searched by bisection. If there is only a single node, no interpolation is done and the index of this node is returned.
Note that this method needs to be called after changing the node array to setup the corrected interpolation indices and weights.
Definition at line 587 of file GNodeArray.cpp.
References G_SET_VALUE, m_has_last_value, m_inx_left, m_inx_right, m_is_linear, m_last_value, m_linear_offset, m_linear_slope, m_need_setup, m_node, m_step, m_wgt_grad_left, m_wgt_grad_right, m_wgt_left, m_wgt_right, nodes(), and setup().
Referenced by GSPIResponse::compute_irf(), GModelSpatialDiffuseCube::cube_intensity(), GModelSpectralTable::eflux(), GModelSpectralFunc::eflux(), GModelSpectralNodes::eflux(), GCOMModelDRBPhibarNodes::eval(), GModelSpectralTable::eval(), GCTAModelSkyCube::eval(), GModelSpectralNodes::eval(), GLATMeanPsf::exposure(), GModelSpectralTable::flux(), GModelSpectralFunc::flux(), GModelSpatialDiffuseCube::flux(), GModelSpectralNodes::flux(), GCTAEdisp2D::get_max_edisp(), GLATMeanPsf::integral(), interpolate(), GLATResponse::irf_spatial_bin(), GModelSpectralTable::load_spec(), GCTABackground2D::mc(), GCTABackground3D::mc(), GModelSpatialDiffuseCube::mc(), GModelSpectralFunc::mc_update(), GModelSpectralNodes::mc_update(), GCTAModelSkyCube::npred(), GLATMeanPsf::operator()(), GCTABackground3D::operator()(), GCTABackground2D::operator()(), GArf::operator()(), GCTAEdispRmf::prob_erecobin(), GCTAEdisp2D::prob_erecobin(), GCOMInstChars::prob_no_selfveto(), GLATMeanPsf::psf(), GCTABackground2D::rate(), GCTABackground3D::rate(), GLATResponseTable::set(), GCTAEdisp2D::table_value(), GCTACubeBackground::update(), GCTACubeExposure::update(), GCTAEdispRmf::update(), GModelSpectralTable::update(), GCTACubePsf::update(), GCTACubeEdisp::update(), GCTAResponseTable::update(), and GModelSpectralTable::update_mc().
|
private |
Compute distance array and linear slope/offset.
Precomputes values for fast interpolation. The precomputation requires at least 2 nodes to be present in the node array. If less than two nodes are present, the distance vector m_step will be empty and no computation is done.
Definition at line 983 of file GNodeArray.cpp.
References abs(), m_is_linear, m_linear_offset, m_linear_slope, m_need_setup, m_node, m_step, and nodes().
Referenced by append(), extend(), insert(), nodes(), read(), remove(), and set_value().
|
inlinevirtual |
Return number of nodes in node array.
Returns the number of nodes in the node array.
Implements GContainer.
Definition at line 192 of file GNodeArray.hpp.
References m_node.
Referenced by at(), GCTACubeEdisp::compute_ebounds(), GModelSpatialDiffuseCube::cube_intensity(), GCTACubePsf::delta_max(), GCOMD1Response::emax(), GCOMD2Response::emax(), GCOMD1Response::emin(), GCOMD2Response::emin(), GModelSpatialDiffuseCube::energies(), extend(), GCTACubePsf::fill(), GCTACubeEdisp::fill(), GCTACubePsf::fill_cube(), GCTACubeEdisp::fill_cube(), GModelSpatialDiffuseCube::flux(), GCTAEdisp2D::gaussian_array(), GCTACubeEdisp::GCTACubeEdisp(), GCTACubePsf::GCTACubePsf(), GCTAEdisp2D::get_mean_rms(), insert(), GLATMeanPsf::integral(), GModelSpatialDiffuseCube::mc_cone(), GModelTemporalLightCurve::mc_update(), GCTACubeEdisp::migra_max(), GLATMeanPsf::nenergies(), GModelSpectralFunc::nodes(), GLATMeanPsf::noffsets(), GModelTemporalPhaseCurve::normalize_nodes(), GCTACubeEdisp::offset(), GCTACubePsf::offset(), GModelSpectralTablePar::print(), GCOMInstChars::print(), GCOMD1Response::print(), GCOMD2Response::print(), GModelTemporalLightCurve::print(), GModelSpatialDiffuseCube::print(), GCTAPsfPerfTable::print(), GCTAPsfVector::print(), GModelTemporalPhaseCurve::print(), GCTACubePsf::print(), print(), GCTACubeEdisp::print(), GCTAEdispPerfTable::print(), GCOMInstChars::prob_D1inter(), GCOMInstChars::prob_D2inter(), GCTAEdispRmf::prob_erecobin(), GCTAEdisp2D::prob_erecobin(), GCOMInstChars::prob_no_multihit(), GCOMInstChars::prob_no_selfveto(), GCOMInstChars::read_selfveto(), remove(), GLATMeanPsf::set(), GCTAAeffPerfTable::set_boundaries(), GCTACubePsf::set_delta_axis(), GModelSpatialDiffuseCube::set_energy_boundaries(), GLATMeanPsf::set_map_corrections(), GCTACubePsf::set_to_smooth(), GModelSpectralTablePar::size(), GLATMeanPsf::size(), GCTAAeffPerfTable::size(), GCTAAeffArf::size(), GCOMInstChars::trans_D1(), GCOMInstChars::trans_D2(), GCOMInstChars::trans_V1(), GCOMInstChars::trans_V23(), GCOMD1Response::update_cache(), GCOMD2Response::update_cache(), GModelSpectralTable::update_flux(), GCOMD1Response::write(), GCOMD2Response::write(), GModelSpatialDiffuseCube::write(), and GSPIResponse::write_energies().
|
inline |
Returns left node weight gradient.
Returns the weighting factor gradient with respect to the value for the left node to be used for interpolation.
Definition at line 294 of file GNodeArray.hpp.
References m_wgt_grad_left.
Referenced by GModelSpectralTable::update().
|
inline |
Returns right node weight gradient.
Returns the weighting factor gradient with respect to the value for the right node to be used for interpolation.
Definition at line 309 of file GNodeArray.hpp.
References m_wgt_grad_right.
Referenced by GModelSpectralTable::update().
|
inline |
Returns left node weight.
Returns the weighting factor for the left node to be used for interpolation.
Definition at line 264 of file GNodeArray.hpp.
References m_wgt_left.
Referenced by GSPIResponse::compute_irf(), GModelSpatialDiffuseCube::cube_intensity(), GCOMModelDRBPhibarNodes::eval(), GModelSpectralTable::eval(), GCTAModelSkyCube::eval(), GModelSpectralNodes::eval(), GLATMeanPsf::exposure(), GModelSpatialDiffuseCube::flux(), GLATMeanPsf::integral(), interpolate(), GLATResponse::irf_spatial_bin(), GModelSpectralTable::load_spec(), GModelSpatialDiffuseCube::mc(), GCTAModelSkyCube::npred(), GLATMeanPsf::operator()(), GCTABackground3D::operator()(), GCTABackground2D::operator()(), GArf::operator()(), GCTAEdispRmf::prob_erecobin(), GCTAEdisp2D::prob_erecobin(), GCOMInstChars::prob_no_selfveto(), GLATMeanPsf::psf(), GCTABackground3D::rate(), GCTABackground2D::rate(), GLATResponseTable::set(), GCTAEdisp2D::table_value(), GCTACubeBackground::update(), GCTACubeExposure::update(), GCTAEdispRmf::update(), GCTACubePsf::update(), GModelSpectralTable::update(), GCTACubeEdisp::update(), and GCTAResponseTable::update().
|
inline |
Returns right node weight.
Returns the weighting factor for the right node to be used for interpolation.
Definition at line 279 of file GNodeArray.hpp.
References m_wgt_right.
Referenced by GSPIResponse::compute_irf(), GModelSpatialDiffuseCube::cube_intensity(), GCOMModelDRBPhibarNodes::eval(), GModelSpectralTable::eval(), GCTAModelSkyCube::eval(), GModelSpectralNodes::eval(), GLATMeanPsf::exposure(), GModelSpatialDiffuseCube::flux(), GLATMeanPsf::integral(), interpolate(), GLATResponse::irf_spatial_bin(), GModelSpectralTable::load_spec(), GModelSpatialDiffuseCube::mc(), GCTAModelSkyCube::npred(), GLATMeanPsf::operator()(), GCTABackground3D::operator()(), GCTABackground2D::operator()(), GArf::operator()(), GCTAEdispRmf::prob_erecobin(), GCTAEdisp2D::prob_erecobin(), GCOMInstChars::prob_no_selfveto(), GLATMeanPsf::psf(), GCTABackground3D::rate(), GCTABackground2D::rate(), GLATResponseTable::set(), GCTAEdisp2D::table_value(), GCTACubeBackground::update(), GCTACubeExposure::update(), GCTAEdispRmf::update(), GCTACubePsf::update(), GModelSpectralTable::update(), GCTACubeEdisp::update(), and GCTAResponseTable::update().
void GNodeArray::write | ( | GFits & | fits, |
const std::string & | extname = "NODES" |
||
) | const |
Write nodes into FITS object.
[in] | fits | FITS file. |
[in] | extname | Nodes extension name (defaults to "NODES") |
Writes nodes into FITS object.
Definition at line 812 of file GNodeArray.cpp.
References GFitsTable::append(), GFits::append(), GFits::contains(), GFitsHDU::extname(), m_node, and GFits::remove().
Referenced by save(), GCTACubePsf::write(), and GCTACubeEdisp::write().
|
mutableprivate |
Last value is valid.
Definition at line 123 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), and set_value().
|
mutableprivate |
Index of left node for linear interpolation.
Definition at line 128 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), inx_left(), print(), and set_value().
|
mutableprivate |
Index of right node for linear interpolation.
Definition at line 129 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), inx_right(), print(), and set_value().
|
mutableprivate |
Nodes form a linear array.
Definition at line 122 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), print(), set_value(), and setup().
|
mutableprivate |
Last requested value.
Definition at line 125 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), and set_value().
|
mutableprivate |
Offset for linear array.
Definition at line 127 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), print(), set_value(), and setup().
|
mutableprivate |
Slope for linear array.
Definition at line 126 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), print(), set_value(), and setup().
|
mutableprivate |
Call of setup is required.
Definition at line 121 of file GNodeArray.hpp.
Referenced by at(), copy_members(), init_members(), operator[](), set_value(), and setup().
|
private |
Array of nodes.
Definition at line 118 of file GNodeArray.hpp.
Referenced by append(), at(), copy_members(), extend(), init_members(), insert(), interpolate(), is_empty(), nodes(), operator[](), print(), remove(), reserve(), set_value(), setup(), size(), and write().
|
mutableprivate |
Distance to next node.
Definition at line 124 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), print(), set_value(), and setup().
|
mutableprivate |
Weight gradient for left node.
Definition at line 132 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), print(), set_value(), and wgt_grad_left().
|
mutableprivate |
Weight gradient for right node.
Definition at line 133 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), print(), set_value(), and wgt_grad_right().
|
mutableprivate |
Weight for left node for linear interpolation.
Definition at line 130 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), print(), set_value(), and wgt_left().
|
mutableprivate |
Weight for right node for linear interpolation.
Definition at line 131 of file GNodeArray.hpp.
Referenced by copy_members(), init_members(), print(), set_value(), and wgt_right().