diff --git a/include/GModelSpectralBrokenPlaw.hpp b/include/GModelSpectralBrokenPlaw.hpp index 6a8e535..f3bc526 100644 --- a/include/GModelSpectralBrokenPlaw.hpp +++ b/include/GModelSpectralBrokenPlaw.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * GModelSpectralBrokenPlaw.hpp - Broken power law spectrum class * * ----------------------------------------------------------------------- * - * copyright (C) 2013-2016 by Anneli Schulz * + * copyright (C) 2013-2017 by Anneli Schulz * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -48,14 +48,19 @@ class GXmlElement; * by * * \f[ - * S_{\rm E}(E | t) = {\tt m\_norm} - * \left( \frac{E}{\tt m\_breakenergy} \right)^{\tt m\_index1} + * S_{\rm E}(E | t) = k_0 \times \left \{ + * \begin{eqnarray} + * \left( \frac{E}{E_b} \right)^{\gamma_1} & {\rm if\,\,} E < E_b \\ + * \left( \frac{E}{E_b} \right)^{\gamma_2} & {\rm otherwise} + * \end{eqnarray} + * \right . * \f] * * where - * - \f${\tt m\_norm}\f$ is the normalization or prefactor, - * - \f${\tt m\_index1}\f$ is the spectral index1, and - * - \f${\tt m\_breakenergy}\f$ is the breakenergy energy. + * \f$k_0\f$ is the normalization or prefactor, + * \f$\gamma_1\f$ is the spectral index before the break, + * \f$\gamma_2\f$ is the spectral index after the break, and + * \f$E_b\f$ is the break energy. ***************************************************************************/ class GModelSpectralBrokenPlaw : public GModelSpectral { diff --git a/include/GModelTemporalLightCurve.hpp b/include/GModelTemporalLightCurve.hpp index e07804d..d7dff2d 100644 --- a/include/GModelTemporalLightCurve.hpp +++ b/include/GModelTemporalLightCurve.hpp @@ -55,9 +55,9 @@ class GXmlElement; * \f] * * where - * \f$r(t)$\f is the rate defined by linear interpolation between the nodes + * \f$r(t)\f$ is the rate defined by linear interpolation between the nodes * in a FITS file, and - * \f${\tt m\_norm}$\f is a normalisation constant. + * \f${\tt m\_norm}\f$ is a normalisation constant. ***************************************************************************/ class GModelTemporalLightCurve : public GModelTemporal { diff --git a/include/GModelTemporalPhaseCurve.hpp b/include/GModelTemporalPhaseCurve.hpp index a872d5d..c63aeb3 100644 --- a/include/GModelTemporalPhaseCurve.hpp +++ b/include/GModelTemporalPhaseCurve.hpp @@ -47,7 +47,7 @@ class GXmlElement; * @brief Temporal phase curve model class * * This class implements a temporal variation based on the phase - * \f$\Phi(t)$\f that is computed using + * \f$\Phi(t)\f$ that is computed using * * \f[ * \Phi(t) = \Phi_0 + f(t-t_0) + \frac{1}{2}\dot{f} (t-t_0)^2 + @@ -55,12 +55,12 @@ class GXmlElement; * \f] * * where - * \f$t_0$\f is a reference time, - * \f$\Phi_0$\f is the phase at the reference time, - * \f$f$\f is the variation frequency at the reference time, - * \f$\dot{f}$\f is the first derivative of the variation frequency at the + * \f$t_0\f$ is a reference time, + * \f$\Phi_0\f$ is the phase at the reference time, + * \f$f\f$ is the variation frequency at the reference time, + * \f$\dot{f}\f$ is the first derivative of the variation frequency at the * reference time, and - * \f$\ddot{f}$\f is the second derivative of the variation frequency at the + * \f$\ddot{f}\f$ is the second derivative of the variation frequency at the * reference time. * * The temporal variation is then computed using @@ -69,8 +69,8 @@ class GXmlElement; * S_{\rm t}(t) = r(\Phi(t)) \times {\tt m\_norm} * \f] * - * where \f$r(\Phi(t))$\f is the rate defined by linear interpolation between - * the nodes in a FITS file, and \f${\tt m\_norm}$\f is a normalisation + * where \f$r(\Phi(t))\f$ is the rate defined by linear interpolation between + * the nodes in a FITS file, and \f${\tt m\_norm}\f$ is a normalisation * constant. ***************************************************************************/ class GModelTemporalPhaseCurve : public GModelTemporal { @@ -247,9 +247,9 @@ GTime GModelTemporalPhaseCurve::mjd(void) const * Sets the reference Modified Julian Day. ***************************************************************************/ inline -void GModelTemporalPhaseCurve::mjd(const GTime& time) +void GModelTemporalPhaseCurve::mjd(const GTime& mjd) { - m_mjd.value(time.mjd()); + m_mjd.value(mjd.mjd()); return; } diff --git a/inst/cta/include/GCTAOnOffObservation.hpp b/inst/cta/include/GCTAOnOffObservation.hpp index 81e62ed..dec7fb1 100644 --- a/inst/cta/include/GCTAOnOffObservation.hpp +++ b/inst/cta/include/GCTAOnOffObservation.hpp @@ -320,7 +320,7 @@ const GRmf& GCTAOnOffObservation::rmf(void) const inline int GCTAOnOffObservation::nobserved(void) const { - return (m_on_spec.counts()); + return ((int)(m_on_spec.counts()+0.5)); } #endif /* GCTAONOFFOBSERVATION_HPP */ diff --git a/src/model/GModelSpectralBrokenPlaw.cpp b/src/model/GModelSpectralBrokenPlaw.cpp index 7e2856e..9d56b74 100644 --- a/src/model/GModelSpectralBrokenPlaw.cpp +++ b/src/model/GModelSpectralBrokenPlaw.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * GModelSpectralBrokenPlaw.cpp - Broken power law spectrum class * * ----------------------------------------------------------------------- * - * copyright (C) 2013-2016 by Anneli Schulz * + * copyright (C) 2013-2017 by Anneli Schulz * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -294,32 +294,53 @@ GModelSpectralBrokenPlaw* GModelSpectralBrokenPlaw::clone(void) const * Evaluates * * \f[ - * S_{\rm E}(E | t) = {\tt m\_norm} - * \left( \frac{E}{\tt m\_breakenergy} \right)^{\tt m\_index} + * S_{\rm E}(E | t) = k_0 \times \left \{ + * \begin{eqnarray} + * \left( \frac{E}{E_b} \right)^{\gamma_1} & {\rm if\,\,} E < E_b \\ + * \left( \frac{E}{E_b} \right)^{\gamma_2} & {\rm otherwise} + * \end{eqnarray} + * \right . * \f] * * where - * - \f${\tt m\_norm}\f$ is the normalization or prefactor, - * - \f${\tt m\_index}\f$ is the spectral index, and - * - \f${\tt m\_breakenergy}\f$ is the breakenergy energy. + * \f$k_0\f$ is the normalization or prefactor, + * \f$\gamma_1\f$ is the spectral index before the break, + * \f$\gamma_2\f$ is the spectral index after the break, and + * \f$E_b\f$ is the break energy. * * If the @p gradients flag is true the method will also compute the * partial derivatives of the model with respect to the parameters using * * \f[ - * \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_norm}} = - * \frac{S_{\rm E}(E | t)}{{\tt m\_norm}} + * \frac{\delta S_{\rm E}(E | t)}{\delta k_0} = + * \frac{S_{\rm E}(E | t)}{k_0} * \f] * * \f[ - * \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_index}} = - * S_{\rm E}(E | t) \, \ln(E/{\tt m_breakenergy}) + * \frac{\delta S_{\rm E}(E | t)}{\delta \gamma_1} = \left \{ + * \begin{eqnarray} + * S_{\rm E}(E | t) \, \ln(E/E_b) & {\rm if\,\,} E < E_b \\ + * 0 & {\rm otherwise} + * \end{eqnarray} + * \right . * \f] * * \f[ - * \frac{\delta S_{\rm E}(E | t)}{\delta {\tt m\_breakenergy}} = - * -S_{\rm E}(E | t) \, - * \left( \frac{{\tt m\_index}}{{\tt m\_breakenergy}} \right) + * \frac{\delta S_{\rm E}(E | t)}{\delta \gamma_2} = \left \{ + * \begin{eqnarray} + * 0 & {\rm if\,\,} E < E_b \\ + * S_{\rm E}(E | t) \, \ln(E/E_b) & {\rm otherwise} + * \end{eqnarray} + * \right . + * \f] + * + * \f[ + * \frac{\delta S_{\rm E}(E | t)}{\delta E_b} = k_0 \times \left \{ + * \begin{eqnarray} + * -S_{\rm E}(E | t) \, \left( \frac{\gamma_1}{E_b} \right) & {\rm if\,\,} E < E_b \\ + * -S_{\rm E}(E | t) \, \left( \frac{\gamma_2}{E_b} \right) & {\rm otherwise} + * \end{eqnarray} + * \right . * \f] * * @todo The method expects that energy!=0. Otherwise Inf or NaN may result.