54#define G_CONST "GModelSpectralTable(GEbounds&, GModelSpectralTablePars&, "\
56#define G_FLUX "GModelSpectralTable::flux(GEnergy&, GEnergy&)"
57#define G_EFLUX "GModelSpectralTable::eflux(GEnergy&, GEnergy&)"
58#define G_MC "GModelSpectralTable::mc(GEnergy&, GEnergy&, GTime&, GRan&)"
59#define G_READ "GModelSpectralTable::read(GXmlElement&)"
60#define G_WRITE "GModelSpectralTable::write(GXmlElement&)"
61#define G_LOAD "GModelSpectralTable::load(GFilename&)"
62#define G_TABLE_PAR "GModelSpectralTable::table_par(int&)"
63#define G_ENERGY_SCALE "GModelSpectralTable::energy_scale(std::string&)"
64#define G_LOAD_PAR "GModelSpectralTable::load_par(GFits&)"
65#define G_PAR_INDEX "GModelSpectralTable::par_index(std::string&)"
66#define G_UPDATE "GModelSpectralTable::update()"
108 const double&
norm) :
148 if (spectra.
dim() != pars.
size()+1) {
150 " dimensions but an array with "+
152 "expected. Please specify a spectra array with the "
153 "correct dimension.";
158 for (
int i = 0; i < pars.
size(); ++i) {
159 int npars = pars[i]->
size();
160 int nspec = spectra.
shape()[i];
161 if (npars != nspec) {
162 std::string msg =
"Parameter \""+pars[i]->par().name()+
"\" has "+
166 "array with the correct number of spectra.";
173 int nspec = spectra.
shape()[pars.
size()];
174 if (nebins != nspec) {
175 std::string msg =
"Spectra array has "+
gammalib::str(nspec)+
" energy "
177 " energy boundaries. Please specify a spectra "
178 "array with the correct number of energy bins.";
268 if (
this != &model) {
378 const GTime& srcTime,
379 const bool& gradients)
const
387 double log10energy = srcEng.
log10MeV();
390 #if defined(G_DEBUG_ESCALE)
391 std::cout <<
"GModelSpectralTable::eval";
392 std::cout <<
" " << srcEng.
log10MeV();
393 std::cout <<
" " << log10energy << std::endl;
405 double func = wgt_left * val_left + wgt_right * val_right;
421 for (
int i = 0; i < dim; ++i) {
438 (wgt_left * grad_left + wgt_right * grad_right) *
443 grad = (wgt_left * grad_left + wgt_right * grad_right) *
456 #if defined(G_NAN_CHECK)
458 std::cout <<
"*** ERROR: GModelSpectralTable::eval";
459 std::cout <<
"(srcEng=" << srcEng;
460 std::cout <<
", srcTime=" << srcTime <<
"):";
461 std::cout <<
" NaN/Inf encountered";
462 std::cout <<
" (value=" << value;
463 std::cout <<
", norm=" <<
norm();
464 std::cout <<
", func=" << func;
465 std::cout <<
")" << std::endl;
505 double e_min = emin.
MeV();
506 double e_max = emax.
MeV();
519 if (inx_emin == inx_emax) {
534 int i_start = (e_min <
m_lin_nodes[0]) ? inx_emin : inx_emin+1;
544 for (
int i = i_start; i < inx_emax; ++i) {
598 double e_min = emin.
MeV();
599 double e_max = emax.
MeV();
612 if (inx_emin == inx_emax) {
628 int i_start = (e_min <
m_lin_nodes[0]) ? inx_emin : inx_emin+1;
639 for (
int i = i_start; i < inx_emax; ++i) {
695 for (inx =
m_mc_cum.size()-1; inx > 0; --inx) {
707 double eng = (u > 0.0)
708 ? std::exp(std::log(u * (e_max - e_min) + e_min) /
m_mc_exp[inx])
716 double eng = std::exp(u * (e_max - e_min) + e_min);
879 const bool& clobber)
const
896 primary->
card(
"CONTENT",
"MODEL",
"Spectrum file");
898 primary->
card(
"ORIGIN", PACKAGE_NAME,
"Origin of FITS file");
899 primary->
card(
"MODLNAME",
"model",
"Model name");
900 primary->
card(
"MODLUNIT",
"photons/cm^2/s/MeV",
"Model units");
901 primary->
card(
"REDSHIFT",
false,
"If true then redshift will be included as a par");
902 primary->
card(
"ADDMODEL",
true,
"If true then this is an additive table model");
903 primary->
card(
"HDUCLASS",
"OGIP",
"Format conforms to OGIP standard");
904 primary->
card(
"HDUCLAS1",
"XSPEC TABLE MODEL",
"Model spectra for XSPEC");
905 primary->
card(
"HDUVERS",
"1.0.0",
"Version of format");
957 if (index < 0 || index >=
size()) {
976 if (index < 0 || index >=
size()) {
1037 if (par.
name() == name) {
1045 std::string msg =
"\"energyscale\" attribute specified but "
1046 "parameter \""+name+
"\" not found in the "
1047 "table model. Please specify one of the "
1048 "table model parameters as energy scale.";
1053 #if defined(G_DEBUG_ESCALE)
1054 std::cout <<
"GModelSpectralTable::energy_scale(): ";
1055 std::cout <<
"energyscale=" <<
m_escale_par << std::endl;
1083 result.append(
"=== GModelSpectralTable ===");
1090 for (
int i = 0; i <
size(); ++i) {
1103 for (
int k = 0; k <
size; ++k) {
1115 result.append(
" (linear)");
1118 result.append(
" (logarithmic)");
1125 result.append(
" [");
1127 result.append(
", ");
1285 #if defined(G_DEBUG_CALLTREE)
1286 std::cout <<
"GModelSpectralTable::set_par_pointers()" << std::endl;
1311 #if defined(G_DEBUG_CALLTREE)
1312 std::cout <<
"GModelSpectralTable::set_energy_nodes()";
1329 for (
int i = 0; i < nebins; ++i) {
1331 double log10_energy_MeV = std::log10(energy_MeV);
1339 for (
int i = 0; i < nebins; ++i) {
1362 #if defined(G_DEBUG_CALLTREE)
1363 std::cout <<
"GModelSpectralTable::scale_energy()";
1366 #elif defined(G_DEBUG_ESCALE)
1367 std::cout <<
"GModelSpectralTable::scale_energy(): entry" << std::endl;
1378 if (escales.
size() > 0) {
1393 #if defined(G_DEBUG_ESCALE)
1394 std::cout <<
" Largest energy scale: " << escale0;
1395 std::cout <<
" MeV" << std::endl;
1399 for (
int ispectrum = 0; ispectrum <
nspectra; ++ispectrum) {
1406 double log10escale = std::log10(escale);
1409 #if defined(G_DEBUG_ESCALE)
1410 std::cout <<
" " << ispectrum;
1411 std::cout <<
" " << ispec[ipar];
1412 std::cout <<
" " << escale;
1413 std::cout <<
" MeV" << std::endl;
1417 std::vector<double> spectrum(nebins,0.0);
1420 std::vector<int> index(npars+1,0);
1421 for (
int k = 0; k < npars; ++k) {
1422 index[k] = ispec[k];
1426 for (
int iebin = 0; iebin < nebins; ++iebin) {
1439 spectrum[iebin] = wgt_left * val_left + wgt_right * val_right;
1445 for (
int iebin = 0; iebin < nebins; ++iebin, ++index[npars]) {
1452 for (
int iebin = 0; iebin < nebins; ++iebin) {
1465 #if defined(G_DEBUG_ESCALE)
1466 std::cout <<
"GModelSpectralTable::update(): exit" << std::endl;
1504 for (
int i = 0; i < nrows; ++i) {
1524 for (
int i = 0; i < nrows; ++i) {
1530 col_name(i) = par.
name();
1532 col_initial(i) = (float)par.
value();
1536 col_delta(i) = -1.0;
1546 double min_value = 0.0;
1547 double max_value = 0.0;
1553 if (value < min_value) {
1556 if (value > max_value) {
1559 col_value(i,k) = value;
1565 if (par.
min() < min_value) {
1566 col_minimum(i) = (float)par.
min();
1567 col_bottom(i) = min_value;
1570 col_minimum(i) = (float)par.
min();
1571 col_bottom(i) = (float)par.
min();
1575 col_minimum(i) = min_value;
1576 col_bottom(i) = min_value;
1581 if (par.
max() > max_value) {
1582 col_top(i) = max_value;
1583 col_maximum(i) = (float)par.
max();
1586 col_top(i) = (float)par.
max();
1587 col_maximum(i) = (float)par.
max();
1591 col_top(i) = max_value;
1592 col_maximum(i) = max_value;
1602 table.
append(col_method);
1603 table.
append(col_initial);
1605 table.
append(col_minimum);
1606 table.
append(col_bottom);
1608 table.
append(col_maximum);
1609 table.
append(col_numbvals);
1616 table.
card(
"HDUCLASS",
"OGIP",
"Format conforms to OGIP standard");
1617 table.
card(
"HDUCLAS1",
"XSPEC TABLE MODEL",
"Model spectra for XSPEC");
1618 table.
card(
"HDUCLAS2",
"PARAMETERS",
"Extension containing parameter info");
1619 table.
card(
"HDUVERS",
"1.0.0",
"Version of format");
1620 table.
card(
"NINTPARM", nrows,
"Number of interpolation parameters");
1621 table.
card(
"NADDPARM", 0,
"Number of additional parameters");
1663 table.
card(
"HDUCLASS",
"OGIP",
"Format conforms to OGIP standard");
1664 table.
card(
"HDUCLAS1",
"XSPEC TABLE MODEL",
"Model spectra for XSPEC");
1665 table.
card(
"HDUCLAS2",
"ENERGIES",
"Extension containing energy bin info");
1666 table.
card(
"HDUVERS",
"1.0.0",
"Version of format");
1703 col_spec.
unit(
"ph cm-2 s-1 MeV-1");
1706 std::vector<int> inx(npars+1,0);
1707 for (
int i = 0; i < nrows; ++i) {
1710 for (
int k = 0; k < npars; ++k) {
1715 std::vector<int> index = inx;
1718 for (
int k = 0; k < nebins; ++k, ++index[npars]) {
1733 }
while (ipar >= 0);
1748 table.
card(
"HDUCLASS",
"OGIP",
"Format conforms to OGIP standard");
1749 table.
card(
"HDUCLAS1",
"XSPEC TABLE MODEL",
"Model spectra for XSPEC");
1750 table.
card(
"HDUCLAS2",
"MODEL SPECTRA",
"Extension containing model spectra");
1751 table.
card(
"HDUVERS",
"1.0.0",
"Version of format");
1777 int npars = table.
integer(
"NAXIS2");
1780 for (
int i = 0; i < npars; ++i) {
1783 GModelPar par(table[
"NAME"]->
string(i), table[
"INITIAL"]->real(i));
1800 if (table[
"DELTA"]->real(i) < 0.0) {
1810 std::vector<double> values;
1811 for (
int k = 0; k < table[
"NUMBVALS"]->
integer(i); ++k) {
1814 double value = table[
"VALUE"]->
real(i,k);
1835 values.push_back(value);
1843 table_model_par.
method(table[
"METHOD"]->integer(i));
1873 int nebins = table.
integer(
"NAXIS2");
1879 std::string emin_unit = table[
"ENERG_LO"]->unit();
1880 std::string emax_unit = table[
"ENERG_HI"]->unit();
1881 if (emin_unit.empty()) {
1884 if (emax_unit.empty()) {
1889 for (
int i = 0; i < nebins; ++i) {
1890 GEnergy emin(table[
"ENERG_LO"]->real(i), emin_unit);
1891 GEnergy emax(table[
"ENERG_HI"]->real(i), emax_unit);
1914 int npars = fits.
table(
"PARAMETERS")->
integer(
"NAXIS2");
1915 int nebins = fits.
table(
"ENERGIES")->
integer(
"NAXIS2");
1918 std::vector<int> naxis(npars+1, 0);
1919 for (
int i = 0; i < npars; ++i) {
1920 naxis[i] = (*fits.
table(
"PARAMETERS"))[
"NUMBVALS"]->integer(i);
1922 naxis[npars] = nebins;
1931 int nrows = table.
integer(
"NAXIS2");
1934 for (
int i = 0; i < nrows; ++i) {
1937 std::vector<int> index(npars+1, 0);
1940 std::vector<double> parval(npars, 0.0);
1941 for (
int k = 0; k < npars; ++k) {
1947 nodes.
set_value(table[
"PARAMVAL"]->real(i,k));
1959 #if defined(G_DEBUG_LOAD_SPEC)
1960 std::cout << i <<
": (";
1961 for (
int k = 0; k < index.size(); ++k) {
1965 std::cout << index[k];
1967 std::cout <<
")" << std::endl;
1971 for (
int k = 0; k < nebins; ++k, ++index[npars]) {
2003 std::string msg =
"Parameter name \""+name+
"\" not found in spectral "
2004 "table. Please specify one of the following parameter "
2085 bool need_update =
false;
2096 for (
int i = 0; i <
m_npars; ++i) {
2108 #if defined(G_DEBUG_UPDATE)
2109 std::cout <<
"GModelSpectralTable::update() required" << std::endl;
2113 std::vector<double> weights(2*
m_npars, 0.0);
2114 std::vector<double> weight_gradients(2*
m_npars, 0.0);
2115 std::vector<int> indices(2*
m_npars, 0);
2119 for (
int i = 0; i <
m_npars; ++i) {
2126 double value = par->
value();
2162 #if defined(G_DEBUG_UPDATE)
2163 std::cout <<
" wgt_l=" << weights[il];
2164 std::cout <<
" wgt_r=" << weights[ir];
2165 std::cout <<
" wgt_grad_l=" << weight_gradients[il];
2166 std::cout <<
" wgt_grad_r=" << weight_gradients[ir];
2167 std::cout <<
" inx_l=" << indices[il];
2168 std::cout <<
" inx_r=" << indices[ir] << std::endl;
2174 int combinations = 1 <<
m_npars;
2181 #if defined(G_DEBUG_UPDATE)
2182 double weight_sum = 0.0;
2186 for (
int i = 0; i < combinations; ++i) {
2189 #if defined(G_DEBUG_UPDATE)
2190 std::cout <<
" " << i <<
": ";
2194 double weight = 1.0;
2195 std::vector<double> grad_weight(
m_npars, 1.0);
2198 std::vector<int> index_shape(
m_npars+1,0);
2201 for (
int k = 0, div = 1; k <
m_npars; ++k, div *= 2) {
2204 int index = i/div % 2 + k * 2;
2207 weight *= weights[index];
2210 index_shape[k] = indices[index];
2213 for (
int j = 0; j <
m_npars; ++j) {
2215 grad_weight[j] *= weight_gradients[index];
2218 grad_weight[j] *= weights[index];
2223 #if defined(G_DEBUG_UPDATE)
2225 std::cout <<
" (" << weights[index];
2226 std::cout <<
" @ " << indices[index] <<
") ";
2232 #if defined(G_DEBUG_UPDATE)
2233 std::cout <<
": wgt=" << weight;
2235 for (
int k = 0; k <
m_npars; ++k) {
2239 std::cout << grad_weight[k];
2241 std::cout <<
"]" << std::endl;
2242 weight_sum += weight;
2246 for (
int iebin = 0; iebin <
m_nebins; ++iebin) {
2258 for (
int j = 0; j <
m_npars; ++j) {
2279 #if defined(G_DEBUG_UPDATE)
2280 std::cout <<
" sum(wgt)=" << weight_sum << std::endl;
2313 double epivot = std::sqrt(emin*emax);
2318 double prefactor = 0.0;
2321 if ((fmin > 0.0) && (fmax > 0.0)) {
2322 gamma = std::log(fmin/fmax) / std::log(emin/emax);
2323 prefactor = fmin / std::pow(emin/epivot, gamma);
2373 double e_min = emin.
MeV();
2374 double e_max = emax.
MeV();
2377 if (e_max > e_min) {
2392 if (inx_emin == inx_emax) {
2411 int i_start = (e_min <
m_lin_nodes[0]) ? inx_emin : inx_emin+1;
2425 for (
int i = i_start; i < inx_emax; ++i) {
2447 for (
int i = 1; i <
m_mc_cum.size(); ++i) {
2452 for (
int i = 0; i <
m_mc_cum.size(); ++i) {
2458 for (
int i = 0; i <
m_mc_cum.size(); ++i) {
2461 double exponent =
m_mc_exp[i] + 1.0;
2464 if (std::abs(exponent) > 1.0e-11) {
2468 if (exponent < -50.0) {
2476 else if (exponent > +50.0) {
Energy value class definition.
Exception handler interface definition.
FITS binary table class definition.
FITS table float column class interface definition.
FITS table long integer column class interface definition.
FITS table string column class interface definition.
FITS file class interface definition.
Mathematical function definitions.
Spectral model registry class definition.
Spectral table model parameter class definition.
Spectral table model parameter container class definition.
const GModelSpectralTable g_spectral_table_seed
Spectral table model class definition.
Random number generator class definition.
double norm(const GVector &vector)
Computes vector norm.
double min(const GVector &vector)
Computes minimum vector element.
double max(const GVector &vector)
Computes maximum vector element.
Energy boundaries container class.
const GEnergy & emax(void) const
Return maximum energy of all intervals.
void append(const GEnergy &emin, const GEnergy &emax)
Append energy interval.
int size(void) const
Return number of energy boundaries.
void clear(void)
Clear energy boundaries.
GEnergy elogmean(const int &index) const
Returns logarithmic mean energy for a given energy interval.
const GEnergy & emin(void) const
Return minimum energy of all intervals.
Class that handles energies in a unit independent way.
double keV(void) const
Return energy in keV.
double MeV(void) const
Return energy in MeV.
double log10MeV(void) const
Return log10 of energy in MeV.
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
void clear(void)
Clear instance.
std::string url(void) const
Return Uniform Resource Locator (URL)
bool is_empty(void) const
Signal if filename is empty.
void clear(void)
Clear file name.
Abstract FITS extension base class.
const std::string & extname(void) const
Return extension name.
double real(const std::string &keyname) const
Return card value as double precision.
GFitsHeaderCard & card(const int &cardno)
Return header card.
int integer(const std::string &keyname) const
Return card value as integer.
void unit(const std::string &unit)
Set column unit.
FITS table long integer column.
FITS table string column.
Abstract interface for FITS table.
GFitsTableCol * append(const GFitsTableCol &column)
Append column to the table.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
GFitsHDU * append(const GFitsHDU &hdu)
Append HDU to FITS file.
void close(void)
Close FITS file.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
Interface definition for the spectral model registry class.
Spectral table model parameter class.
const GNodeArray & values(void) const
Return reference to table model parameter values as node array.
const int & method(void) const
Return reference to table model parameter interpolation method.
Spectral table model parameter container class.
GModelSpectralTablePar * append(const GModelSpectralTablePar &par)
Append table model parameter to container.
void clear(void)
Clear table model parameters.
int size(void) const
Return number of table model parameters in container.
Spectral table model class.
void scale_energy(void)
Scale energy.
GModelSpectralTable(void)
Void constructor.
virtual void write(GXmlElement &xml) const
Write model into XML element.
std::string m_escale_par
Energy scaling parameter.
std::vector< double > m_mc_cum
Cumulative distribution.
virtual double eval(const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const
Evaluate spectral table model.
virtual void read(const GXmlElement &xml)
Read model from XML element.
std::vector< double > m_mc_min
Lower boundary for MC.
void save(const GFilename &filename, const bool &clobber=false) const
Save table into file.
GModelPar m_norm
Normalization factor.
void load_par(const GFits &fits)
Load data from PARAMETERS extension.
void load_spec(const GFits &fits)
Load data from SPECTRA extension.
GModelSpectralTablePar & table_par(const int &index)
Return reference to table parameter.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print table model information.
GEnergy m_mc_emax
Maximum energy.
GEbounds m_ebounds
Energy boundaries.
GNodeArray m_log_nodes
log10(Energy) nodes of function
virtual GEnergy mc(const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
Returns MC energy between [emin, emax].
std::vector< double > m_epivot
Power-law pivot energies.
virtual std::string type(void) const
Return model type.
void init_members(void)
Initialise class members.
double m_escale
Energy scale.
GFilename m_filename
Filename of table.
void set_par_pointers(void)
Set parameter pointers.
int nspectra(void) const
Return number of spectra in table model.
int par_index(const std::string &name) const
Return index for parameter name.
void set_energy_nodes(void)
Set energy nodes from energy boundaries.
void free_members(void)
Delete class members.
std::vector< double > m_mc_exp
Exponent for MC.
virtual double eflux(const GEnergy &emin, const GEnergy &emax) const
Returns model energy flux between [emin, emax] (units: erg/cm2/s)
int m_nebins
Number of energy bins.
bool has_energy_scale(void) const
Signal that energy scale was set.
void energy_scale(const std::string &name)
Set energy scale.
GNdarray m_log_values
log10(Function) values and grad's
GEnergy m_mc_emin
Minimum energy.
virtual ~GModelSpectralTable(void)
Destructor.
double norm(void) const
Return normalization factor.
GNodeArray m_lin_nodes
Energy nodes of function.
std::vector< double > m_flux
Photon fluxes.
void update_mc(const GEnergy &emin, const GEnergy &emax) const
Update MC cache.
void update(void) const
Update cache for spectral table model computation.
GNdarray m_lin_values
Function values and grad's.
GFitsBinTable create_eng_table(void) const
Create ENERGIES FITS table.
const GEbounds & ebounds(void) const
Return reference to energy boundaries.
virtual void clear(void)
Clear table model.
virtual GModelSpectralTable * clone(void) const
Clone table model.
void load(const GFilename &filename)
Load table from file.
double m_log10escale
log10 of energy scale
std::vector< double > m_mc_max
Upper boundary for MC.
std::vector< double > m_last_values
Last parameter values.
void copy_members(const GModelSpectralTable &model)
Copy class members.
GFitsBinTable create_par_table(void) const
Create PARAMETERS FITS table.
void update_flux(void) const
Update flux cache.
std::vector< double > m_prefactor
Power-law normalisations.
int m_npars
Number of parameters.
void load_eng(const GFits &fits)
Load data from ENERGIES extension.
virtual GModelSpectralTable & operator=(const GModelSpectralTable &model)
Assignment operator.
std::vector< double > m_gamma
Power-law indices.
GModelSpectralTablePars m_table_pars
Table model parameters.
GNdarray m_spectra
Spectra.
virtual double flux(const GEnergy &emin, const GEnergy &emax) const
Returns model photon flux between [emin, emax] (units: ph/cm2/s)
const GFilename & filename(void) const
Return file name.
GFitsBinTable create_spec_table(void) const
Create SPECTRA FITS table.
std::vector< double > m_eflux
Energy fluxes.
Abstract spectral model base class.
void free_members(void)
Delete class members.
virtual GModelSpectral & operator=(const GModelSpectral &model)
Assignment operator.
std::vector< GModelPar * > m_pars
Parameter pointers.
int size(void) const
Return number of parameters.
void init_members(void)
Initialise class members.
N-dimensional array class.
void clear(void)
Clear array.
int dim(void) const
Return dimension of array.
const std::vector< int > & shape(void) const
Return shape of array.
int index(const std::vector< int > &i) const
Compute array element index.
void set_value(const double &value) const
Set indices and weighting factors for interpolation.
const double & wgt_grad_left(void) const
Returns left node weight gradient.
const int & inx_right(void) const
Returns right node index.
const int & inx_left(void) const
Returns left node index.
const double & wgt_grad_right(void) const
Returns right node weight gradient.
const double & wgt_right(void) const
Returns right node weight.
const double & wgt_left(void) const
Returns left node weight.
void clear(void)
Clear node array.
int size(void) const
Return number of nodes in node array.
void append(const double &node)
Append one node to array.
const double & factor_value(void) const
Return parameter factor value.
bool is_free(void) const
Signal if parameter is free.
void free(void)
Free a parameter.
const double & scale(void) const
Return parameter scale.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
void range(const double &min, const double &max)
Set minimum and maximum parameter boundaries.
bool has_min(void) const
Signal if parameter has minimum boundary.
double max(void) const
Return parameter maximum boundary.
bool is_fixed(void) const
Signal if parameter is fixed.
double min(void) const
Return parameter minimum boundary.
void remove_range(void)
Removes minimum and maximum boundary.
const double & factor_gradient(void) const
Return parameter factor gradient.
void fix(void)
Fix a parameter.
bool has_max(void) const
Signal if parameter has maximum boundary.
void factor_range(const double &min, const double &max)
Set minimum and maximum parameter boundary factors.
double gradient(void) const
Return parameter gradient.
void clear(void)
Clear parameter.
double value(void) const
Return parameter value.
const std::string & name(void) const
Return parameter name.
Random number generator class.
double uniform(void)
Returns random double precision floating value in range 0 to 1.
const GXmlAttribute * attribute(const int &index) const
Return attribute.
bool has_attribute(const std::string &name) const
Check if element has a given attribute.
void check_energy_interval(const std::string &origin, const GEnergy &emin, const GEnergy &emax)
Checks energy interval.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
bool is_infinite(const double &x)
Signal if argument is infinite.
double plaw_photon_flux(const double &emin, const double &emax, const double &epivot, const double &gamma)
Compute photon flux between two energies for a power law.
bool is_notanumber(const double &x)
Signal if argument is not a number.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
const GXmlElement * xml_get_par(const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
GFilename xml_file_reduce(const GXmlElement &xml, const std::string &filename)
Reduce file name provided for writing as XML attribute.
double plaw_energy_flux(const double &emin, const double &emax, const double &epivot, const double &gamma)
Compute energy flux between two energies for a power law.
bool xml_has_par(const GXmlElement &xml, const std::string &name)
Checks if parameter with given name in XML element exists.
GFilename xml_file_expand(const GXmlElement &xml, const std::string &filename)
Expand file name provided as XML attribute for loading.
void xml_check_type(const std::string &origin, GXmlElement &xml, const std::string &type)
Checks the model type.