Commit 316ce45f9dd7be112ef676cfb31837b24a777c25
1 parent
ea45cec7
Adapt names: alpha -> lambda, InverseCutoffEnergy.
Showing
5 changed files
with
85 additions
and
85 deletions
doc/source/users/user_manual/modules/model.rst
| ... | ... | @@ -429,14 +429,14 @@ cut-off energy for function parametrisation: |
| 429 | 429 | |
| 430 | 430 | .. math:: |
| 431 | 431 | \frac{dN}{dE} = k_0 \left( \frac{E}{E_0} \right)^{\gamma} |
| 432 | - \exp \left( -\alpha E \right) | |
| 432 | + \exp \left( -\lambda E \right) | |
| 433 | 433 | |
| 434 | 434 | where the parameters in the XML definition have the following mappings: |
| 435 | 435 | |
| 436 | 436 | * :math:`k_0` = ``Prefactor`` |
| 437 | 437 | * :math:`\gamma` = ``Index`` |
| 438 | 438 | * :math:`E_0` = ``PivotEnergy`` |
| 439 | -* :math:`\alpha` = ``InverseCutoff`` | |
| 439 | +* :math:`\lambda` = ``InverseCutoffEnergy`` | |
| 440 | 440 | |
| 441 | 441 | The XML format for specifying an exponentially cut-off power law using this |
| 442 | 442 | alternative parametrisation is: |
| ... | ... | @@ -444,10 +444,10 @@ alternative parametrisation is: |
| 444 | 444 | .. code-block:: xml |
| 445 | 445 | |
| 446 | 446 | <spectrum type="ExponentialInverseCutoffPowerLaw"> |
| 447 | - <parameter name="Prefactor" scale="1e-16" value="5.7" min="1e-07" max="1000.0" free="1"/> | |
| 448 | - <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/> | |
| 449 | - <parameter name="InverseCutoff" scale="1e-6" value="1.0" min="0.0" max="100.0" free="1"/> | |
| 450 | - <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | |
| 447 | + <parameter name="Prefactor" scale="1e-16" value="5.7" min="1e-07" max="1000.0" free="1"/> | |
| 448 | + <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/> | |
| 449 | + <parameter name="InverseCutoffEnergy" scale="1e-6" value="1.0" min="0.0" max="100.0" free="1"/> | |
| 450 | + <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | |
| 451 | 451 | </spectrum> |
| 452 | 452 | |
| 453 | 453 | ... | ... |
include/GModelSpectralExpInvPlaw.hpp
| ... | ... | @@ -51,14 +51,14 @@ class GXmlElement; |
| 51 | 51 | * \f[ |
| 52 | 52 | * S_{\rm E}(E | t) = {\tt m\_norm} |
| 53 | 53 | * \left( \frac{E}{\tt m\_pivot} \right)^{\tt m\_index} |
| 54 | - * \exp \left( -{\tt m\_alpha}*E \right) | |
| 54 | + * \exp \left( -{\tt m\_lambda}*E \right) | |
| 55 | 55 | * \f] |
| 56 | 56 | * |
| 57 | 57 | * where |
| 58 | 58 | * - \f${\tt m\_norm}\f$ is the normalization or prefactor, |
| 59 | 59 | * - \f${\tt m\_pivot}\f$ is the pivot energy, |
| 60 | 60 | * - \f${\tt m\_index}\f$ is the spectral index, and |
| 61 | - * - \f${\tt m\_alpha}\f$ is the cut-off parameter (1/cut-off energy). | |
| 61 | + * - \f${\tt m\_lambda}\f$ is the cut-off parameter (1/cut-off energy). | |
| 62 | 62 | ***************************************************************************/ |
| 63 | 63 | class GModelSpectralExpInvPlaw : public GModelSpectral { |
| 64 | 64 | |
| ... | ... | @@ -68,7 +68,7 @@ public: |
| 68 | 68 | explicit GModelSpectralExpInvPlaw(const double& prefactor, |
| 69 | 69 | const double& index, |
| 70 | 70 | const GEnergy& pivot, |
| 71 | - const double& alpha); | |
| 71 | + const double& lambda); | |
| 72 | 72 | explicit GModelSpectralExpInvPlaw(const double& prefactor, |
| 73 | 73 | const double& index, |
| 74 | 74 | const GEnergy& pivot, |
| ... | ... | @@ -107,7 +107,7 @@ public: |
| 107 | 107 | double index(void) const; |
| 108 | 108 | void index(const double& index); |
| 109 | 109 | double inverse_cutoff(void) const; |
| 110 | - void inverse_cutoff(const double& alpha); | |
| 110 | + void inverse_cutoff(const double& lambda); | |
| 111 | 111 | GEnergy cutoff(void) const; |
| 112 | 112 | void cutoff(const GEnergy& cutoff); |
| 113 | 113 | GEnergy pivot(void) const; |
| ... | ... | @@ -127,17 +127,17 @@ protected: |
| 127 | 127 | flux_kernel(const double& norm, |
| 128 | 128 | const double& index, |
| 129 | 129 | const double& pivot, |
| 130 | - const double& alpha) : | |
| 130 | + const double& lambda) : | |
| 131 | 131 | m_norm(norm), |
| 132 | 132 | m_index(index), |
| 133 | 133 | m_inv_pivot(1.0/pivot), |
| 134 | - m_alpha(alpha) {} | |
| 134 | + m_lambda(lambda) {} | |
| 135 | 135 | double eval(const double& eng); |
| 136 | 136 | protected: |
| 137 | 137 | double m_norm; //!< Normalization |
| 138 | 138 | double m_index; //!< Index |
| 139 | 139 | double m_inv_pivot; //!< 1 / Pivot energy |
| 140 | - double m_alpha; //!< Cut-off parameter | |
| 140 | + double m_lambda; //!< Cut-off parameter | |
| 141 | 141 | }; |
| 142 | 142 | |
| 143 | 143 | // Energy flux integration kernel |
| ... | ... | @@ -146,32 +146,32 @@ protected: |
| 146 | 146 | eflux_kernel(const double& norm, |
| 147 | 147 | const double& index, |
| 148 | 148 | const double& pivot, |
| 149 | - const double& alpha) : | |
| 149 | + const double& lambda) : | |
| 150 | 150 | m_norm(norm), |
| 151 | 151 | m_index(index), |
| 152 | 152 | m_inv_pivot(1.0/pivot), |
| 153 | - m_alpha(alpha) {} | |
| 153 | + m_lambda(lambda) {} | |
| 154 | 154 | double eval(const double& eng); |
| 155 | 155 | protected: |
| 156 | 156 | double m_norm; //!< Normalization |
| 157 | 157 | double m_index; //!< Index |
| 158 | 158 | double m_inv_pivot; //!< 1 / Pivot energy |
| 159 | - double m_alpha; //!< Cut-off parameter | |
| 159 | + double m_lambda; //!< Cut-off parameter | |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | 162 | // Protected members |
| 163 | 163 | GModelPar m_norm; //!< Normalization factor |
| 164 | 164 | GModelPar m_index; //!< Spectral index |
| 165 | - GModelPar m_alpha; //!< Cut-off parameter | |
| 165 | + GModelPar m_lambda; //!< Cut-off parameter | |
| 166 | 166 | GModelPar m_pivot; //!< Pivot energy |
| 167 | 167 | |
| 168 | 168 | // Cached members used for pre-computations |
| 169 | 169 | mutable GEnergy m_last_energy; //!< Last energy value |
| 170 | 170 | mutable double m_last_index; //!< Last index parameter |
| 171 | - mutable double m_last_alpha; //!< Last cut-off parameter | |
| 171 | + mutable double m_last_lambda; //!< Last cut-off parameter | |
| 172 | 172 | mutable double m_last_pivot; //!< Last pivot parameter |
| 173 | 173 | mutable double m_last_e_norm; //!< Last E/Epivot value |
| 174 | - mutable double m_last_e_alpha; //!< Last E*alpha value | |
| 174 | + mutable double m_last_e_lambda; //!< Last E*lambda value | |
| 175 | 175 | mutable double m_last_power; //!< Last power value |
| 176 | 176 | mutable double m_mc_emin; //!< Minimum energy |
| 177 | 177 | mutable double m_mc_emax; //!< Maximum energy |
| ... | ... | @@ -306,21 +306,21 @@ void GModelSpectralExpInvPlaw::pivot(const GEnergy& pivot) |
| 306 | 306 | inline |
| 307 | 307 | double GModelSpectralExpInvPlaw::inverse_cutoff(void) const |
| 308 | 308 | { |
| 309 | - return (m_alpha.value()); | |
| 309 | + return (m_lambda.value()); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
| 313 | 313 | /***********************************************************************//** |
| 314 | 314 | * @brief Set exponential cut-off parameter |
| 315 | 315 | * |
| 316 | - * @param[in] alpha Exponential cut-off parameter. | |
| 316 | + * @param[in] lambda Exponential cut-off parameter. | |
| 317 | 317 | * |
| 318 | 318 | * Sets the exponential cut-off parameter. |
| 319 | 319 | ***************************************************************************/ |
| 320 | 320 | inline |
| 321 | -void GModelSpectralExpInvPlaw::inverse_cutoff(const double& alpha) | |
| 321 | +void GModelSpectralExpInvPlaw::inverse_cutoff(const double& lambda) | |
| 322 | 322 | { |
| 323 | - m_alpha.value(alpha); | |
| 323 | + m_lambda.value(lambda); | |
| 324 | 324 | return; |
| 325 | 325 | } |
| 326 | 326 | |
| ... | ... | @@ -336,7 +336,7 @@ inline |
| 336 | 336 | GEnergy GModelSpectralExpInvPlaw::cutoff(void) const |
| 337 | 337 | { |
| 338 | 338 | GEnergy cutoff; |
| 339 | - cutoff.MeV(1.0/m_alpha.value()); | |
| 339 | + cutoff.MeV(1.0/m_lambda.value()); | |
| 340 | 340 | return cutoff; |
| 341 | 341 | } |
| 342 | 342 | |
| ... | ... | @@ -351,7 +351,7 @@ GEnergy GModelSpectralExpInvPlaw::cutoff(void) const |
| 351 | 351 | inline |
| 352 | 352 | void GModelSpectralExpInvPlaw::cutoff(const GEnergy& cutoff) |
| 353 | 353 | { |
| 354 | - m_alpha.value(1./cutoff.MeV()); | |
| 354 | + m_lambda.value(1./cutoff.MeV()); | |
| 355 | 355 | return; |
| 356 | 356 | } |
| 357 | 357 | ... | ... |
src/model/GModelSpectralExpInvPlaw.cpp
| ... | ... | @@ -80,18 +80,18 @@ GModelSpectralExpInvPlaw::GModelSpectralExpInvPlaw(void) : GModelSpectral() |
| 80 | 80 | * @param[in] prefactor Pre factor normalization (ph/cm2/s/MeV). |
| 81 | 81 | * @param[in] index Power law index. |
| 82 | 82 | * @param[in] pivot Pivot energy. |
| 83 | - * @param[in] alpha Cut-off parameter. | |
| 83 | + * @param[in] lambda Cut-off parameter. | |
| 84 | 84 | * |
| 85 | 85 | * Construct an exponentially cut off power law from |
| 86 | 86 | * - a prefactor value (in units of ph/cm2/s/MeV) |
| 87 | 87 | * - a spectral index, |
| 88 | 88 | * - a pivot energy, and |
| 89 | - * - a cut-off parameter alpha (in units 1/MeV). | |
| 89 | + * - a cut-off parameter lambda (in units 1/MeV). | |
| 90 | 90 | ***************************************************************************/ |
| 91 | 91 | GModelSpectralExpInvPlaw::GModelSpectralExpInvPlaw(const double& prefactor, |
| 92 | 92 | const double& index, |
| 93 | 93 | const GEnergy& pivot, |
| 94 | - const double& alpha) : | |
| 94 | + const double& lambda) : | |
| 95 | 95 | GModelSpectral() |
| 96 | 96 | { |
| 97 | 97 | // Initialise members |
| ... | ... | @@ -100,8 +100,8 @@ GModelSpectralExpInvPlaw::GModelSpectralExpInvPlaw(const double& prefactor, |
| 100 | 100 | // Set parameters |
| 101 | 101 | m_norm.value(prefactor); |
| 102 | 102 | m_index.value(index); |
| 103 | - m_pivot.value(pivot.MeV()); // Internally stored in MeV | |
| 104 | - m_alpha.value(alpha); // Internally stored in 1/MeV | |
| 103 | + m_pivot.value(pivot.MeV()); // Internally stored in MeV | |
| 104 | + m_lambda.value(lambda); // Internally stored in 1/MeV | |
| 105 | 105 | |
| 106 | 106 | // Autoscale parameters |
| 107 | 107 | autoscale(); |
| ... | ... | @@ -138,7 +138,7 @@ GModelSpectralExpInvPlaw::GModelSpectralExpInvPlaw(const double& prefactor, |
| 138 | 138 | m_norm.value(prefactor); |
| 139 | 139 | m_index.value(index); |
| 140 | 140 | m_pivot.value(pivot.MeV()); // Internally stored in MeV |
| 141 | - m_alpha.value(1./cutoff.MeV()); // Internally stored in 1/MeV | |
| 141 | + m_lambda.value(1./cutoff.MeV()); // Internally stored in 1/MeV | |
| 142 | 142 | |
| 143 | 143 | // Autoscale parameters |
| 144 | 144 | autoscale(); |
| ... | ... | @@ -287,14 +287,14 @@ GModelSpectralExpInvPlaw* GModelSpectralExpInvPlaw::clone(void) const |
| 287 | 287 | * \f[ |
| 288 | 288 | * S_{\rm E}(E | t) = {\tt m\_norm} |
| 289 | 289 | * \left( \frac{E}{\tt m\_pivot} \right)^{\tt m\_index} |
| 290 | - * \exp \left( -{\tt m\_alpha}*E \right) | |
| 290 | + * \exp \left( -{\tt m\_lambda}*E \right) | |
| 291 | 291 | * \f] |
| 292 | 292 | * |
| 293 | 293 | * where |
| 294 | 294 | * - \f${\tt m\_norm}\f$ is the normalization or prefactor, |
| 295 | 295 | * - \f${\tt m\_pivot}\f$ is the pivot energy, |
| 296 | 296 | * - \f${\tt m\_index}\f$ is the spectral index, and |
| 297 | - * - \f${\tt m\_alpha}\f$ is the cut-off parameter. | |
| 297 | + * - \f${\tt m\_lambda}\f$ is the cut-off parameter. | |
| 298 | 298 | * |
| 299 | 299 | * @todo The method expects that pivot!=0. Otherwise Inf or NaN |
| 300 | 300 | * may result. We should add a test that prevents using invalid |
| ... | ... | @@ -339,14 +339,14 @@ double GModelSpectralExpInvPlaw::eval(const GEnergy& srcEng, |
| 339 | 339 | * \f[ |
| 340 | 340 | * S_{\rm E}(E | t) = {\tt m\_norm} |
| 341 | 341 | * \left( \frac{E}{\tt m\_pivot} \right)^{\tt m\_index} |
| 342 | - * \exp \left( -{\tt m\_alpha}*E \right) | |
| 342 | + * \exp \left( -{\tt m\_lambda}*E \right) | |
| 343 | 343 | * \f] |
| 344 | 344 | * |
| 345 | 345 | * where |
| 346 | 346 | * - \f${\tt m\_norm}\f$ is the normalization or prefactor, |
| 347 | 347 | * - \f${\tt m\_pivot}\f$ is the pivot energy, |
| 348 | 348 | * - \f${\tt m\_index}\f$ is the spectral index, and |
| 349 | - * - \f${\tt m\_alpha}\f$ is the cut-off parameter. | |
| 349 | + * - \f${\tt m\_lambda}\f$ is the cut-off parameter. | |
| 350 | 350 | * |
| 351 | 351 | * The method also evaluates the partial derivatives of the model with |
| 352 | 352 | * respect to the parameters using |
| ... | ... | @@ -362,7 +362,7 @@ double GModelSpectralExpInvPlaw::eval(const GEnergy& srcEng, |
| 362 | 362 | * \f] |
| 363 | 363 | * |
| 364 | 364 | * \f[ |
| 365 | - * \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_alpha}} = | |
| 365 | + * \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_lambda}} = | |
| 366 | 366 | * S_{\rm E}(E | t) \, \left( -E \right) |
| 367 | 367 | * \f] |
| 368 | 368 | * |
| ... | ... | @@ -392,15 +392,15 @@ double GModelSpectralExpInvPlaw::eval_gradients(const GEnergy& srcEng, |
| 392 | 392 | ? m_norm.scale() * m_last_power : 0.0; |
| 393 | 393 | double g_index = (m_index.is_free()) |
| 394 | 394 | ? value * m_index.scale() * std::log(m_last_e_norm) : 0.0; |
| 395 | - double g_alpha = (m_alpha.is_free()) | |
| 396 | - ? -value * m_alpha.scale() * m_last_energy.MeV() : 0.0; | |
| 395 | + double g_lambda = (m_lambda.is_free()) | |
| 396 | + ? -value * m_lambda.scale() * m_last_energy.MeV() : 0.0; | |
| 397 | 397 | double g_pivot = (m_pivot.is_free()) |
| 398 | 398 | ? -value * m_last_index / m_pivot.factor_value() : 0.0; |
| 399 | 399 | |
| 400 | 400 | // Set gradients |
| 401 | 401 | m_norm.factor_gradient(g_norm); |
| 402 | 402 | m_index.factor_gradient(g_index); |
| 403 | - m_alpha.factor_gradient(g_alpha); | |
| 403 | + m_lambda.factor_gradient(g_lambda); | |
| 404 | 404 | m_pivot.factor_gradient(g_pivot); |
| 405 | 405 | |
| 406 | 406 | // Compile option: Check for NaN/Inf |
| ... | ... | @@ -412,7 +412,7 @@ double GModelSpectralExpInvPlaw::eval_gradients(const GEnergy& srcEng, |
| 412 | 412 | std::cout << " NaN/Inf encountered"; |
| 413 | 413 | std::cout << " (value=" << value; |
| 414 | 414 | std::cout << ", e_norm=" << m_last_e_norm; |
| 415 | - std::cout << ", e_alpha=" << m_last_e_alpha; | |
| 415 | + std::cout << ", e_lambda=" << m_last_e_lambda; | |
| 416 | 416 | std::cout << ", power=" << m_last_power; |
| 417 | 417 | std::cout << ")" << std::endl; |
| 418 | 418 | } |
| ... | ... | @@ -452,7 +452,7 @@ double GModelSpectralExpInvPlaw::flux(const GEnergy& emin, |
| 452 | 452 | |
| 453 | 453 | // Setup integration kernel |
| 454 | 454 | flux_kernel integrand(m_norm.value(), m_index.value(), |
| 455 | - m_pivot.value(), m_alpha.value()); | |
| 455 | + m_pivot.value(), m_lambda.value()); | |
| 456 | 456 | GIntegral integral(&integrand); |
| 457 | 457 | |
| 458 | 458 | // Get integration boundaries in MeV |
| ... | ... | @@ -498,7 +498,7 @@ double GModelSpectralExpInvPlaw::eflux(const GEnergy& emin, |
| 498 | 498 | |
| 499 | 499 | // Setup integration kernel |
| 500 | 500 | eflux_kernel integrand(m_norm.value(), m_index.value(), |
| 501 | - m_pivot.value(), m_alpha.value()); | |
| 501 | + m_pivot.value(), m_lambda.value()); | |
| 502 | 502 | GIntegral integral(&integrand); |
| 503 | 503 | |
| 504 | 504 | // Get integration boundaries in MeV |
| ... | ... | @@ -558,7 +558,7 @@ GEnergy GModelSpectralExpInvPlaw::mc(const GEnergy& emin, |
| 558 | 558 | |
| 559 | 559 | // Initialse acceptance fraction |
| 560 | 560 | double acceptance_fraction; |
| 561 | - double inv_ecut = m_alpha.value(); | |
| 561 | + double inv_ecut = m_lambda.value(); | |
| 562 | 562 | |
| 563 | 563 | // Use rejection method to draw a random energy. We first draw |
| 564 | 564 | // analytically from a power law, and then compare the power law |
| ... | ... | @@ -611,10 +611,10 @@ GEnergy GModelSpectralExpInvPlaw::mc(const GEnergy& emin, |
| 611 | 611 | * elements is |
| 612 | 612 | * |
| 613 | 613 | * <spectrum type="ExponentialInverseCutoffPowerLaw"> |
| 614 | - * <parameter name="Prefactor" scale=".." value=".." min=".." max=".." free=".."/> | |
| 615 | - * <parameter name="Index" scale=".." value=".." min=".." max=".." free=".."/> | |
| 616 | - * <parameter name="InverseCutoff" scale=".." value=".." min=".." max=".." free=".."/> | |
| 617 | - * <parameter name="PivotEnergy" scale=".." value=".." min=".." max=".." free=".."/> | |
| 614 | + * <parameter name="Prefactor" scale=".." value=".." min=".." max=".." free=".."/> | |
| 615 | + * <parameter name="Index" scale=".." value=".." min=".." max=".." free=".."/> | |
| 616 | + * <parameter name="InverseCutoffEnergy" scale=".." value=".." min=".." max=".." free=".."/> | |
| 617 | + * <parameter name="PivotEnergy" scale=".." value=".." min=".." max=".." free=".."/> | |
| 618 | 618 | * </spectrum> |
| 619 | 619 | ***************************************************************************/ |
| 620 | 620 | void GModelSpectralExpInvPlaw::read(const GXmlElement& xml) |
| ... | ... | @@ -628,13 +628,13 @@ void GModelSpectralExpInvPlaw::read(const GXmlElement& xml) |
| 628 | 628 | // Get XML parameters |
| 629 | 629 | const GXmlElement* prefactor = gammalib::xml_get_par(G_READ, xml, "Prefactor"); |
| 630 | 630 | const GXmlElement* index = gammalib::xml_get_par(G_READ, xml, "Index"); |
| 631 | - const GXmlElement* alpha = gammalib::xml_get_par(G_READ, xml, "InverseCutoff"); | |
| 631 | + const GXmlElement* lambda = gammalib::xml_get_par(G_READ, xml, "InverseCutoffEnergy"); | |
| 632 | 632 | const GXmlElement* pivot = gammalib::xml_get_par(G_READ, xml, "PivotEnergy"); |
| 633 | 633 | |
| 634 | 634 | // Read parameters |
| 635 | 635 | m_norm.read(*prefactor); |
| 636 | 636 | m_index.read(*index); |
| 637 | - m_alpha.read(*alpha); | |
| 637 | + m_lambda.read(*lambda); | |
| 638 | 638 | m_pivot.read(*pivot); |
| 639 | 639 | |
| 640 | 640 | // Return |
| ... | ... | @@ -654,10 +654,10 @@ void GModelSpectralExpInvPlaw::read(const GXmlElement& xml) |
| 654 | 654 | * element is |
| 655 | 655 | * |
| 656 | 656 | * <spectrum type="ExponentialInverseCutoffPowerLaw"> |
| 657 | - * <parameter name="Prefactor" scale=".." value=".." min=".." max=".." free=".."/> | |
| 658 | - * <parameter name="Index" scale=".." value=".." min=".." max=".." free=".."/> | |
| 659 | - * <parameter name="InverseCutoff" scale=".." value=".." min=".." max=".." free=".."/> | |
| 660 | - * <parameter name="PivotEnergy" scale=".." value=".." min=".." max=".." free=".."/> | |
| 657 | + * <parameter name="Prefactor" scale=".." value=".." min=".." max=".." free=".."/> | |
| 658 | + * <parameter name="Index" scale=".." value=".." min=".." max=".." free=".."/> | |
| 659 | + * <parameter name="InverseCutoffEnergy" scale=".." value=".." min=".." max=".." free=".."/> | |
| 660 | + * <parameter name="PivotEnergy" scale=".." value=".." min=".." max=".." free=".."/> | |
| 661 | 661 | * </spectrum> |
| 662 | 662 | ***************************************************************************/ |
| 663 | 663 | void GModelSpectralExpInvPlaw::write(GXmlElement& xml) const |
| ... | ... | @@ -676,13 +676,13 @@ void GModelSpectralExpInvPlaw::write(GXmlElement& xml) const |
| 676 | 676 | // Get XML parameters |
| 677 | 677 | GXmlElement* norm = gammalib::xml_need_par(G_WRITE, xml, m_norm.name()); |
| 678 | 678 | GXmlElement* index = gammalib::xml_need_par(G_WRITE, xml, m_index.name()); |
| 679 | - GXmlElement* alpha = gammalib::xml_need_par(G_WRITE, xml, m_alpha.name()); | |
| 679 | + GXmlElement* lambda = gammalib::xml_need_par(G_WRITE, xml, m_lambda.name()); | |
| 680 | 680 | GXmlElement* pivot = gammalib::xml_need_par(G_WRITE, xml, m_pivot.name()); |
| 681 | 681 | |
| 682 | 682 | // Write parameters |
| 683 | 683 | m_norm.write(*norm); |
| 684 | 684 | m_index.write(*index); |
| 685 | - m_alpha.write(*alpha); | |
| 685 | + m_lambda.write(*lambda); | |
| 686 | 686 | m_pivot.write(*pivot); |
| 687 | 687 | |
| 688 | 688 | // Return |
| ... | ... | @@ -754,16 +754,16 @@ void GModelSpectralExpInvPlaw::init_members(void) |
| 754 | 754 | m_index.has_grad(true); |
| 755 | 755 | |
| 756 | 756 | // Initialise cut off parameter |
| 757 | - m_alpha.clear(); | |
| 758 | - m_alpha.name("InverseCutoff"); | |
| 759 | - m_alpha.unit("1/MeV"); | |
| 760 | - m_alpha.scale(1.0); | |
| 761 | - m_alpha.value(0.001); // default: 0.001 | |
| 762 | - m_alpha.min(0.0); // min: 0.0 | |
| 763 | - m_alpha.max(10.0); // max: 10.0 | |
| 764 | - m_alpha.free(); | |
| 765 | - m_alpha.gradient(0.0); | |
| 766 | - m_alpha.has_grad(true); | |
| 757 | + m_lambda.clear(); | |
| 758 | + m_lambda.name("InverseCutoffEnergy"); | |
| 759 | + m_lambda.unit("1/MeV"); | |
| 760 | + m_lambda.scale(1.0); | |
| 761 | + m_lambda.value(0.001); // default: 0.001 | |
| 762 | + m_lambda.min(0.0); // min: 0.0 | |
| 763 | + m_lambda.max(10.0); // max: 10.0 | |
| 764 | + m_lambda.free(); | |
| 765 | + m_lambda.gradient(0.0); | |
| 766 | + m_lambda.has_grad(true); | |
| 767 | 767 | |
| 768 | 768 | // Initialise pivot energy |
| 769 | 769 | m_pivot.clear(); |
| ... | ... | @@ -779,16 +779,16 @@ void GModelSpectralExpInvPlaw::init_members(void) |
| 779 | 779 | m_pars.clear(); |
| 780 | 780 | m_pars.push_back(&m_norm); |
| 781 | 781 | m_pars.push_back(&m_index); |
| 782 | - m_pars.push_back(&m_alpha); | |
| 782 | + m_pars.push_back(&m_lambda); | |
| 783 | 783 | m_pars.push_back(&m_pivot); |
| 784 | 784 | |
| 785 | 785 | // Initialise eval cache |
| 786 | 786 | m_last_energy.clear(); |
| 787 | 787 | m_last_index = 1.0e30; |
| 788 | - m_last_alpha = 1.0e30; | |
| 788 | + m_last_lambda = 1.0e30; | |
| 789 | 789 | m_last_pivot = 1.0e30; |
| 790 | 790 | m_last_e_norm = 0.0; |
| 791 | - m_last_e_alpha = 0.0; | |
| 791 | + m_last_e_lambda = 0.0; | |
| 792 | 792 | m_last_power = 0.0; |
| 793 | 793 | |
| 794 | 794 | // Initialise MC cache |
| ... | ... | @@ -813,23 +813,23 @@ void GModelSpectralExpInvPlaw::copy_members(const GModelSpectralExpInvPlaw& mode |
| 813 | 813 | // Copy members |
| 814 | 814 | m_norm = model.m_norm; |
| 815 | 815 | m_index = model.m_index; |
| 816 | - m_alpha = model.m_alpha; | |
| 816 | + m_lambda = model.m_lambda; | |
| 817 | 817 | m_pivot = model.m_pivot; |
| 818 | 818 | |
| 819 | 819 | // Set parameter pointer(s) |
| 820 | 820 | m_pars.clear(); |
| 821 | 821 | m_pars.push_back(&m_norm); |
| 822 | 822 | m_pars.push_back(&m_index); |
| 823 | - m_pars.push_back(&m_alpha); | |
| 823 | + m_pars.push_back(&m_lambda); | |
| 824 | 824 | m_pars.push_back(&m_pivot); |
| 825 | 825 | |
| 826 | 826 | // Copy eval cache |
| 827 | 827 | m_last_energy = model.m_last_energy; |
| 828 | 828 | m_last_index = model.m_last_index; |
| 829 | - m_last_alpha = model.m_last_alpha; | |
| 829 | + m_last_lambda = model.m_last_lambda; | |
| 830 | 830 | m_last_pivot = model.m_last_pivot; |
| 831 | 831 | m_last_e_norm = model.m_last_e_norm; |
| 832 | - m_last_e_alpha = model.m_last_e_alpha; | |
| 832 | + m_last_e_lambda = model.m_last_e_lambda; | |
| 833 | 833 | m_last_power = model.m_last_power; |
| 834 | 834 | |
| 835 | 835 | // Copy MC cache |
| ... | ... | @@ -866,28 +866,28 @@ void GModelSpectralExpInvPlaw::update_eval_cache(const GEnergy& energy) const |
| 866 | 866 | // Get parameter values (takes 3 multiplications which are difficult |
| 867 | 867 | // to avoid) |
| 868 | 868 | double index = m_index.value(); |
| 869 | - double alpha = m_alpha.value(); | |
| 869 | + double lambda = m_lambda.value(); | |
| 870 | 870 | double pivot = m_pivot.value(); |
| 871 | 871 | |
| 872 | - // If the energy or one of the parameters index, alpha or pivot | |
| 872 | + // If the energy or one of the parameters index, lambda or pivot | |
| 873 | 873 | // energy has changed then recompute the cache |
| 874 | 874 | if ((m_last_energy != energy) || |
| 875 | 875 | (m_last_index != index) || |
| 876 | - (m_last_alpha != alpha) || | |
| 876 | + (m_last_lambda != lambda) || | |
| 877 | 877 | (m_last_pivot != pivot)) { |
| 878 | 878 | |
| 879 | 879 | // Store actual energy and parameter values |
| 880 | 880 | m_last_energy = energy; |
| 881 | 881 | m_last_index = index; |
| 882 | - m_last_alpha = alpha; | |
| 882 | + m_last_lambda = lambda; | |
| 883 | 883 | m_last_pivot = pivot; |
| 884 | 884 | |
| 885 | 885 | // Compute and store value |
| 886 | 886 | double eng = energy.MeV(); |
| 887 | 887 | m_last_e_norm = eng / m_last_pivot; |
| 888 | - m_last_e_alpha = eng * m_last_alpha; | |
| 888 | + m_last_e_lambda = eng * m_last_lambda; | |
| 889 | 889 | m_last_power = std::pow(m_last_e_norm, m_last_index) * |
| 890 | - std::exp(-m_last_e_alpha); | |
| 890 | + std::exp(-m_last_e_lambda); | |
| 891 | 891 | } // endif: recomputation was required |
| 892 | 892 | |
| 893 | 893 | // Return |
| ... | ... | @@ -949,7 +949,7 @@ double GModelSpectralExpInvPlaw::flux_kernel::eval(const double& energy) |
| 949 | 949 | { |
| 950 | 950 | // Evaluate function value |
| 951 | 951 | double e_norm = energy * m_inv_pivot; |
| 952 | - double e_cut = energy * m_alpha; | |
| 952 | + double e_cut = energy * m_lambda; | |
| 953 | 953 | double power = std::pow(e_norm, m_index) * std::exp(-e_cut); |
| 954 | 954 | double value = m_norm * power; |
| 955 | 955 | |
| ... | ... | @@ -967,7 +967,7 @@ double GModelSpectralExpInvPlaw::eflux_kernel::eval(const double& energy) |
| 967 | 967 | { |
| 968 | 968 | // Evaluate function value |
| 969 | 969 | double e_norm = energy * m_inv_pivot; |
| 970 | - double e_cut = energy * m_alpha; | |
| 970 | + double e_cut = energy * m_lambda; | |
| 971 | 971 | double power = std::pow(e_norm, m_index) * std::exp(-e_cut); |
| 972 | 972 | double value = m_norm * power * energy; |
| 973 | 973 | ... | ... |
test/data/model_point_einvplaw.xml
| ... | ... | @@ -2,10 +2,10 @@ |
| 2 | 2 | <source_library title="source library"> |
| 3 | 3 | <source name="Crab" type="PointSource"> |
| 4 | 4 | <spectrum type="ExponentialInverseCutoffPowerLaw"> |
| 5 | - <parameter name="Prefactor" scale="1e-16" value="5.7" min="1e-07" max="1000.0" free="1"/> | |
| 6 | - <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/> | |
| 7 | - <parameter name="InverseCutoff" scale="1e-6" value="1.0" min="0.0" max="100.0" free="1"/> | |
| 8 | - <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | |
| 5 | + <parameter name="Prefactor" scale="1e-16" value="5.7" min="1e-07" max="1000.0" free="1"/> | |
| 6 | + <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/> | |
| 7 | + <parameter name="InverseCutoffEnergy" scale="1e-6" value="1.0" min="0.0" max="100.0" free="1"/> | |
| 8 | + <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | |
| 9 | 9 | </spectrum> |
| 10 | 10 | <spatialModel type="SkyDirFunction"> |
| 11 | 11 | <parameter free="0" max="360" min="-360" name="RA" scale="1" value="83.6331" /> | ... | ... |
test/test_GModel.cpp
| ... | ... | @@ -1809,7 +1809,7 @@ void TestGModel::test_einvplaw(void) |
| 1809 | 1809 | test_value(model.inverse_cutoff(), 4.2e-9); |
| 1810 | 1810 | |
| 1811 | 1811 | // Test operator access |
| 1812 | - const char* strarray[] = {"Prefactor", "Index", "PivotEnergy", "InverseCutoff"}; | |
| 1812 | + const char* strarray[] = {"Prefactor", "Index", "PivotEnergy", "InverseCutoffEnergy"}; | |
| 1813 | 1813 | for (int i = 0; i < 4; ++i) { |
| 1814 | 1814 | std::string keyname(strarray[i]); |
| 1815 | 1815 | model[keyname].remove_range(); // To allow setting of any value | ... | ... |