Commit e8f54314eaad702bba8ed0ca2b0c13b8dfaeb405

Authored by Jürgen Knödlseder
1 parent 1c8a6842

Update code documentation

include/GModelSpectralBrokenPlaw.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GModelSpectralBrokenPlaw.hpp - Broken power law spectrum class * 2 * GModelSpectralBrokenPlaw.hpp - Broken power law spectrum class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Anneli Schulz * 4 + * copyright (C) 2013-2017 by Anneli Schulz *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -48,14 +48,19 @@ class GXmlElement; @@ -48,14 +48,19 @@ class GXmlElement;
48 * by 48 * by
49 * 49 *
50 * \f[ 50 * \f[
51 - * S_{\rm E}(E | t) = {\tt m\_norm}  
52 - * \left( \frac{E}{\tt m\_breakenergy} \right)^{\tt m\_index1} 51 + * S_{\rm E}(E | t) = k_0 \times \left \{
  52 + * \begin{eqnarray}
  53 + * \left( \frac{E}{E_b} \right)^{\gamma_1} & {\rm if\,\,} E < E_b \\
  54 + * \left( \frac{E}{E_b} \right)^{\gamma_2} & {\rm otherwise}
  55 + * \end{eqnarray}
  56 + * \right .
53 * \f] 57 * \f]
54 * 58 *
55 * where 59 * where
56 - * - \f${\tt m\_norm}\f$ is the normalization or prefactor,  
57 - * - \f${\tt m\_index1}\f$ is the spectral index1, and  
58 - * - \f${\tt m\_breakenergy}\f$ is the breakenergy energy. 60 + * \f$k_0\f$ is the normalization or prefactor,
  61 + * \f$\gamma_1\f$ is the spectral index before the break,
  62 + * \f$\gamma_2\f$ is the spectral index after the break, and
  63 + * \f$E_b\f$ is the break energy.
59 ***************************************************************************/ 64 ***************************************************************************/
60 class GModelSpectralBrokenPlaw : public GModelSpectral { 65 class GModelSpectralBrokenPlaw : public GModelSpectral {
61 66
include/GModelTemporalLightCurve.hpp
@@ -55,9 +55,9 @@ class GXmlElement; @@ -55,9 +55,9 @@ class GXmlElement;
55 * \f] 55 * \f]
56 * 56 *
57 * where 57 * where
58 - * \f$r(t)$\f is the rate defined by linear interpolation between the nodes 58 + * \f$r(t)\f$ is the rate defined by linear interpolation between the nodes
59 * in a FITS file, and 59 * in a FITS file, and
60 - * \f${\tt m\_norm}$\f is a normalisation constant. 60 + * \f${\tt m\_norm}\f$ is a normalisation constant.
61 ***************************************************************************/ 61 ***************************************************************************/
62 class GModelTemporalLightCurve : public GModelTemporal { 62 class GModelTemporalLightCurve : public GModelTemporal {
63 63
include/GModelTemporalPhaseCurve.hpp
@@ -47,7 +47,7 @@ class GXmlElement; @@ -47,7 +47,7 @@ class GXmlElement;
47 * @brief Temporal phase curve model class 47 * @brief Temporal phase curve model class
48 * 48 *
49 * This class implements a temporal variation based on the phase 49 * This class implements a temporal variation based on the phase
50 - * \f$\Phi(t)$\f that is computed using 50 + * \f$\Phi(t)\f$ that is computed using
51 * 51 *
52 * \f[ 52 * \f[
53 * \Phi(t) = \Phi_0 + f(t-t_0) + \frac{1}{2}\dot{f} (t-t_0)^2 + 53 * \Phi(t) = \Phi_0 + f(t-t_0) + \frac{1}{2}\dot{f} (t-t_0)^2 +
@@ -55,12 +55,12 @@ class GXmlElement; @@ -55,12 +55,12 @@ class GXmlElement;
55 * \f] 55 * \f]
56 * 56 *
57 * where 57 * where
58 - * \f$t_0$\f is a reference time,  
59 - * \f$\Phi_0$\f is the phase at the reference time,  
60 - * \f$f$\f is the variation frequency at the reference time,  
61 - * \f$\dot{f}$\f is the first derivative of the variation frequency at the 58 + * \f$t_0\f$ is a reference time,
  59 + * \f$\Phi_0\f$ is the phase at the reference time,
  60 + * \f$f\f$ is the variation frequency at the reference time,
  61 + * \f$\dot{f}\f$ is the first derivative of the variation frequency at the
62 * reference time, and 62 * reference time, and
63 - * \f$\ddot{f}$\f is the second derivative of the variation frequency at the 63 + * \f$\ddot{f}\f$ is the second derivative of the variation frequency at the
64 * reference time. 64 * reference time.
65 * 65 *
66 * The temporal variation is then computed using 66 * The temporal variation is then computed using
@@ -69,8 +69,8 @@ class GXmlElement; @@ -69,8 +69,8 @@ class GXmlElement;
69 * S_{\rm t}(t) = r(\Phi(t)) \times {\tt m\_norm} 69 * S_{\rm t}(t) = r(\Phi(t)) \times {\tt m\_norm}
70 * \f] 70 * \f]
71 * 71 *
72 - * where \f$r(\Phi(t))$\f is the rate defined by linear interpolation between  
73 - * the nodes in a FITS file, and \f${\tt m\_norm}$\f is a normalisation 72 + * where \f$r(\Phi(t))\f$ is the rate defined by linear interpolation between
  73 + * the nodes in a FITS file, and \f${\tt m\_norm}\f$ is a normalisation
74 * constant. 74 * constant.
75 ***************************************************************************/ 75 ***************************************************************************/
76 class GModelTemporalPhaseCurve : public GModelTemporal { 76 class GModelTemporalPhaseCurve : public GModelTemporal {
@@ -247,9 +247,9 @@ GTime GModelTemporalPhaseCurve::mjd(void) const @@ -247,9 +247,9 @@ GTime GModelTemporalPhaseCurve::mjd(void) const
247 * Sets the reference Modified Julian Day. 247 * Sets the reference Modified Julian Day.
248 ***************************************************************************/ 248 ***************************************************************************/
249 inline 249 inline
250 -void GModelTemporalPhaseCurve::mjd(const GTime& time) 250 +void GModelTemporalPhaseCurve::mjd(const GTime& mjd)
251 { 251 {
252 - m_mjd.value(time.mjd()); 252 + m_mjd.value(mjd.mjd());
253 return; 253 return;
254 } 254 }
255 255
inst/cta/include/GCTAOnOffObservation.hpp
@@ -320,7 +320,7 @@ const GRmf&amp; GCTAOnOffObservation::rmf(void) const @@ -320,7 +320,7 @@ const GRmf&amp; GCTAOnOffObservation::rmf(void) const
320 inline 320 inline
321 int GCTAOnOffObservation::nobserved(void) const 321 int GCTAOnOffObservation::nobserved(void) const
322 { 322 {
323 - return (m_on_spec.counts()); 323 + return ((int)(m_on_spec.counts()+0.5));
324 } 324 }
325 325
326 #endif /* GCTAONOFFOBSERVATION_HPP */ 326 #endif /* GCTAONOFFOBSERVATION_HPP */
src/model/GModelSpectralBrokenPlaw.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GModelSpectralBrokenPlaw.cpp - Broken power law spectrum class * 2 * GModelSpectralBrokenPlaw.cpp - Broken power law spectrum class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Anneli Schulz * 4 + * copyright (C) 2013-2017 by Anneli Schulz *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -294,32 +294,53 @@ GModelSpectralBrokenPlaw* GModelSpectralBrokenPlaw::clone(void) const @@ -294,32 +294,53 @@ GModelSpectralBrokenPlaw* GModelSpectralBrokenPlaw::clone(void) const
294 * Evaluates 294 * Evaluates
295 * 295 *
296 * \f[ 296 * \f[
297 - * S_{\rm E}(E | t) = {\tt m\_norm}  
298 - * \left( \frac{E}{\tt m\_breakenergy} \right)^{\tt m\_index} 297 + * S_{\rm E}(E | t) = k_0 \times \left \{
  298 + * \begin{eqnarray}
  299 + * \left( \frac{E}{E_b} \right)^{\gamma_1} & {\rm if\,\,} E < E_b \\
  300 + * \left( \frac{E}{E_b} \right)^{\gamma_2} & {\rm otherwise}
  301 + * \end{eqnarray}
  302 + * \right .
299 * \f] 303 * \f]
300 * 304 *
301 * where 305 * where
302 - * - \f${\tt m\_norm}\f$ is the normalization or prefactor,  
303 - * - \f${\tt m\_index}\f$ is the spectral index, and  
304 - * - \f${\tt m\_breakenergy}\f$ is the breakenergy energy. 306 + * \f$k_0\f$ is the normalization or prefactor,
  307 + * \f$\gamma_1\f$ is the spectral index before the break,
  308 + * \f$\gamma_2\f$ is the spectral index after the break, and
  309 + * \f$E_b\f$ is the break energy.
305 * 310 *
306 * If the @p gradients flag is true the method will also compute the 311 * If the @p gradients flag is true the method will also compute the
307 * partial derivatives of the model with respect to the parameters using 312 * partial derivatives of the model with respect to the parameters using
308 * 313 *
309 * \f[ 314 * \f[
310 - * \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_norm}} =  
311 - * \frac{S_{\rm E}(E | t)}{{\tt m\_norm}} 315 + * \frac{\delta S_{\rm E}(E | t)}{\delta k_0} =
  316 + * \frac{S_{\rm E}(E | t)}{k_0}
312 * \f] 317 * \f]
313 * 318 *
314 * \f[ 319 * \f[
315 - * \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_index}} =  
316 - * S_{\rm E}(E | t) \, \ln(E/{\tt m_breakenergy}) 320 + * \frac{\delta S_{\rm E}(E | t)}{\delta \gamma_1} = \left \{
  321 + * \begin{eqnarray}
  322 + * S_{\rm E}(E | t) \, \ln(E/E_b) & {\rm if\,\,} E < E_b \\
  323 + * 0 & {\rm otherwise}
  324 + * \end{eqnarray}
  325 + * \right .
317 * \f] 326 * \f]
318 * 327 *
319 * \f[ 328 * \f[
320 - * \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_breakenergy}} =  
321 - * -S_{\rm E}(E | t) \,  
322 - * \left( \frac{{\tt m\_index}}{{\tt m\_breakenergy}} \right) 329 + * \frac{\delta S_{\rm E}(E | t)}{\delta \gamma_2} = \left \{
  330 + * \begin{eqnarray}
  331 + * 0 & {\rm if\,\,} E < E_b \\
  332 + * S_{\rm E}(E | t) \, \ln(E/E_b) & {\rm otherwise}
  333 + * \end{eqnarray}
  334 + * \right .
  335 + * \f]
  336 + *
  337 + * \f[
  338 + * \frac{\delta S_{\rm E}(E | t)}{\delta E_b} = k_0 \times \left \{
  339 + * \begin{eqnarray}
  340 + * -S_{\rm E}(E | t) \, \left( \frac{\gamma_1}{E_b} \right) & {\rm if\,\,} E < E_b \\
  341 + * -S_{\rm E}(E | t) \, \left( \frac{\gamma_2}{E_b} \right) & {\rm otherwise}
  342 + * \end{eqnarray}
  343 + * \right .
323 * \f] 344 * \f]
324 * 345 *
325 * @todo The method expects that energy!=0. Otherwise Inf or NaN may result. 346 * @todo The method expects that energy!=0. Otherwise Inf or NaN may result.