Commit aaa3d6265cd58f4b7894e089ad4107285fd7977b

Authored by Jürgen Knödlseder
1 parent 90577754

Update description of available models

doc/source/users/user_manual/getting_started/model_lightcurve.png 0 → 100644

65.4 KB

doc/source/users/user_manual/getting_started/model_phasecurve.png 0 → 100644

26.9 KB

doc/source/users/user_manual/getting_started/models.rst
@@ -47,15 +47,17 @@ Implementation @@ -47,15 +47,17 @@ Implementation
47 The general model is describe in ctools using a model definition XML file. 47 The general model is describe in ctools using a model definition XML file.
48 Below is a simple example of such a file comprising one source and one 48 Below is a simple example of such a file comprising one source and one
49 background model. 49 background model.
50 -Each model is factorised in a spectral (tag ``<spectrum>``) and a  
51 -spatial component (tags ``<spatialModel>`` and ``<radialModel>``): 50 +Each model is factorised into
  51 +a spectral (tag ``<spectrum>``),
  52 +a spatial (tags ``<spatialModel>`` and ``<radialModel>``), and
  53 +a temporal component (tag ``<temporal>``).
52 54
53 .. math:: 55 .. math::
54 - M(x,y,E) = M_{\rm spectral}(E) \times M_{\rm spatial}(x,y) 56 + M(x,y,E,t) = M_{\rm spatial}(x,y|E) \times M_{\rm spectral}(E) \times M_{\rm temporal}(t)
55 57
56 In this specific example, the source component ``Crab`` describes 58 In this specific example, the source component ``Crab`` describes
57 a point source at the location of the Crab nebula with a power law spectral 59 a point source at the location of the Crab nebula with a power law spectral
58 -shape. 60 +shape that is constant in time.
59 The background component ``Background`` is modelled as a radial Gaussian 61 The background component ``Background`` is modelled as a radial Gaussian
60 function in offset angle squared (with the offset angle being defined as 62 function in offset angle squared (with the offset angle being defined as
61 the angle between pointing and measured event direction) and a spectral 63 the angle between pointing and measured event direction) and a spectral
@@ -66,15 +68,18 @@ function that is tabulated in an ASCII file. @@ -66,15 +68,18 @@ function that is tabulated in an ASCII file.
66 <?xml version="1.0" standalone="no"?> 68 <?xml version="1.0" standalone="no"?>
67 <source_library title="source library"> 69 <source_library title="source library">
68 <source name="Crab" type="PointSource"> 70 <source name="Crab" type="PointSource">
  71 + <spatialModel type="PointSource">
  72 + <parameter name="RA" scale="1.0" value="83.6331" min="-360" max="360" free="1"/>
  73 + <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="1"/>
  74 + </spatialModel>
69 <spectrum type="PowerLaw"> 75 <spectrum type="PowerLaw">
70 <parameter name="Prefactor" scale="1e-16" value="5.7" min="1e-07" max="1000.0" free="1"/> 76 <parameter name="Prefactor" scale="1e-16" value="5.7" min="1e-07" max="1000.0" free="1"/>
71 <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/> 77 <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/>
72 <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> 78 <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/>
73 </spectrum> 79 </spectrum>
74 - <spatialModel type="PointSource">  
75 - <parameter name="RA" scale="1.0" value="83.6331" min="-360" max="360" free="1"/>  
76 - <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="1"/>  
77 - </spatialModel> 80 + <temporal type="Constant">
  81 + <parameter name="Normalization" scale="1.0" value="1.0" min="0.0" max="1000.0" free="0"/>
  82 + </temporal>
78 </source> 83 </source>
79 <source name="Background" type="RadialAcceptance" instrument="CTA"> 84 <source name="Background" type="RadialAcceptance" instrument="CTA">
80 <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> 85 <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt">
@@ -102,6 +107,10 @@ After a maximum likelihood fit using :ref:`ctlike`, an @@ -102,6 +107,10 @@ After a maximum likelihood fit using :ref:`ctlike`, an
102 term will be appended to each ``<parameter>`` tag. 107 term will be appended to each ``<parameter>`` tag.
103 108
104 .. note:: 109 .. note::
  110 + For compatibility reasons with the Fermi/LAT XML format the ``<temporal>``
  111 + tag can be omitted for models that are constant in time.
  112 +
  113 +.. note::
105 114
106 XML files are ASCII files and can be edited by hand using any text 115 XML files are ASCII files and can be edited by hand using any text
107 editor. 116 editor.
@@ -124,17 +133,17 @@ term will be appended to each ``&lt;parameter&gt;`` tag. @@ -124,17 +133,17 @@ term will be appended to each ``&lt;parameter&gt;`` tag.
124 syntax used by the Fermi/LAT ScienceTools, but for reasons of clarity and 133 syntax used by the Fermi/LAT ScienceTools, but for reasons of clarity and
125 homogenity of the various model and parameter names we have made some 134 homogenity of the various model and parameter names we have made some
126 modifications. 135 modifications.
127 - Nevertheless, the exact format used by the Fermi/LAT ScienceTools is also 136 + Nevertheless, the format used by the Fermi/LAT ScienceTools is also
128 supported. 137 supported.
129 138
130 139
131 -.. _sec_spatial_models: 140 +.. _sec_spatial_src_models:
132 141
133 -Spatial model components  
134 -~~~~~~~~~~~~~~~~~~~~~~~~ 142 +Spatial source model components
  143 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135 144
136 The following sections present the spatial model components that are available 145 The following sections present the spatial model components that are available
137 -in ctools. 146 +in ctools for gamma-ray sources.
138 147
139 Point source 148 Point source
140 ^^^^^^^^^^^^ 149 ^^^^^^^^^^^^
@@ -289,6 +298,47 @@ Diffuse source @@ -289,6 +298,47 @@ Diffuse source
289 ``Normalization`` can be replaced by ``Value``. 298 ``Normalization`` can be replaced by ``Value``.
290 299
291 300
  301 +Composite model
  302 +^^^^^^^^^^^^^^^
  303 +
  304 + .. code-block:: xml
  305 +
  306 + <source name="Crab" type="CompositeSource">
  307 + <spatialModel type="Composite">
  308 + <spatialModel type="PointSource" component="PointSource">
  309 + <parameter name="RA" scale="1.0" value="83.6331" min="-360" max="360" free="1"/>
  310 + <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="1"/>
  311 + </spatialModel>
  312 + <spatialModel type="RadialGaussian">
  313 + <parameter name="RA" scale="1.0" value="83.6331" min="-360" max="360" free="1"/>
  314 + <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="1"/>
  315 + <parameter name="Sigma" scale="1.0" value="0.20" min="0.01" max="10" free="1"/>
  316 + </spatialModel>
  317 + </spatialModel>
  318 + <spectrum type="...">
  319 + ...
  320 + </spectrum>
  321 + </source>
  322 +
  323 + This spatial model component implements a composite model that is the
  324 + sum of an arbitrary number of spatial models, computed using
  325 +
  326 + .. math::
  327 + M_{\rm spatial}(x,y|E) = \frac{1}{N} \sum_{i=0}^{N-1} M_{\rm spatial}^{(i)}(x,y|E)
  328 +
  329 + where :math:`M_{\rm spatial}^{(i)}(x,y|E)` is any spatial model component
  330 + (including another composite model), and :math:`N` is the number of
  331 + model components that are combined.
  332 +
  333 +
  334 +.. _sec_spatial_bgd_models:
  335 +
  336 +Spatial background model components
  337 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  338 +
  339 +The following sections present the spatial model components that are available
  340 +in ctools for background modelling.
  341 +
292 CTA radial background 342 CTA radial background
293 ^^^^^^^^^^^^^^^^^^^^^ 343 ^^^^^^^^^^^^^^^^^^^^^
294 344
@@ -400,7 +450,7 @@ Constant @@ -400,7 +450,7 @@ Constant
400 This spectral model component implements the constant function 450 This spectral model component implements the constant function
401 451
402 .. math:: 452 .. math::
403 - \frac{dN}{dE} = N_0 453 + M_{\rm spectral}(E) = N_0
404 454
405 where 455 where
406 456
@@ -428,7 +478,7 @@ Power law @@ -428,7 +478,7 @@ Power law
428 This spectral model component implements the power law function 478 This spectral model component implements the power law function
429 479
430 .. math:: 480 .. math::
431 - \frac{dN}{dE} = k_0 \left( \frac{E}{E_0} \right)^{\gamma} 481 + M_{\rm spectral}(E) = k_0 \left( \frac{E}{E_0} \right)^{\gamma}
432 482
433 where 483 where
434 484
@@ -462,8 +512,8 @@ Power law @@ -462,8 +512,8 @@ Power law
462 This spectral model component implements the power law function 512 This spectral model component implements the power law function
463 513
464 .. math:: 514 .. math::
465 - \frac{dN}{dE} = \frac{N(\gamma+1)E^{\gamma}}  
466 - {E_{\rm max}^{\gamma+1} - E_{\rm min}^{\gamma+1}} 515 + M_{\rm spectral}(E) = \frac{N(\gamma+1)E^{\gamma}}
  516 + {E_{\rm max}^{\gamma+1} - E_{\rm min}^{\gamma+1}}
467 517
468 where 518 where
469 519
@@ -506,8 +556,8 @@ Exponentially cut-off power law @@ -506,8 +556,8 @@ Exponentially cut-off power law
506 function 556 function
507 557
508 .. math:: 558 .. math::
509 - \frac{dN}{dE} = k_0 \left( \frac{E}{E_0} \right)^{\gamma}  
510 - \exp \left( \frac{-E}{E_{\rm cut}} \right) 559 + M_{\rm spectral}(E) = k_0 \left( \frac{E}{E_0} \right)^{\gamma}
  560 + \exp \left( \frac{-E}{E_{\rm cut}} \right)
511 561
512 where 562 where
513 563
@@ -548,10 +598,10 @@ Super exponentially cut-off power law @@ -548,10 +598,10 @@ Super exponentially cut-off power law
548 law function 598 law function
549 599
550 .. math:: 600 .. math::
551 - \frac{dN}{dE} = k_0 \left( \frac{E}{E_0} \right)^{\gamma}  
552 - \exp \left(  
553 - -\left( \frac{E}{E_{\rm cut}} \right)^{\alpha}  
554 - \right) 601 + M_{\rm spectral}(E) = k_0 \left( \frac{E}{E_0} \right)^{\gamma}
  602 + \exp \left(
  603 + -\left( \frac{E}{E_{\rm cut}} \right)^{\alpha}
  604 + \right)
555 605
556 where 606 where
557 607
@@ -598,12 +648,12 @@ Broken power law @@ -598,12 +648,12 @@ Broken power law
598 648
599 .. math:: 649 .. math::
600 650
601 - \frac{dN}{dE} = k_0 \times \left \{  
602 - \begin{eqnarray}  
603 - \left( \frac{E}{E_b} \right)^{\gamma_1} & {\rm if\,\,} E < E_b \\  
604 - \left( \frac{E}{E_b} \right)^{\gamma_2} & {\rm otherwise}  
605 - \end{eqnarray}  
606 - \right . 651 + M_{\rm spectral}(E) = k_0 \times \left \{
  652 + \begin{eqnarray}
  653 + \left( \frac{E}{E_b} \right)^{\gamma_1} & {\rm if\,\,} E < E_b \\
  654 + \left( \frac{E}{E_b} \right)^{\gamma_2} & {\rm otherwise}
  655 + \end{eqnarray}
  656 + \right .
607 657
608 where 658 where
609 659
@@ -616,14 +666,14 @@ Broken power law @@ -616,14 +666,14 @@ Broken power law
616 666
617 .. warning:: 667 .. warning::
618 668
619 - Note that the ``BreakEnergy`` parameter may be poorly constrained if  
620 - there is no clear spectral cut-off in the spectrum.  
621 - This model may lead to complications in the maximum likelihood fitting. 669 + Note that the ``BreakEnergy`` parameter may be poorly constrained if
  670 + there is no clear spectral cut-off in the spectrum.
  671 + This model may lead to complications in the maximum likelihood fitting.
622 672
623 .. note:: 673 .. note::
624 674
625 - For compatibility with the Fermi/LAT ScienceTools the parameters  
626 - ``BreakEnergy`` can be replaced by ``BreakValue``. 675 + For compatibility with the Fermi/LAT ScienceTools the parameters
  676 + ``BreakEnergy`` can be replaced by ``BreakValue``.
627 677
628 678
629 Log parabola 679 Log parabola
@@ -641,7 +691,7 @@ Log parabola @@ -641,7 +691,7 @@ Log parabola
641 This spectral model component implements the log parabola function 691 This spectral model component implements the log parabola function
642 692
643 .. math:: 693 .. math::
644 - \frac{dN}{dE} = k_0 \left( \frac{E}{E_0} \right)^{\gamma+\eta \ln(E/E_0)} 694 + M_{\rm spectral}(E) = k_0 \left( \frac{E}{E_0} \right)^{\gamma+\eta \ln(E/E_0)}
645 695
646 where 696 where
647 697
@@ -654,7 +704,7 @@ Log parabola @@ -654,7 +704,7 @@ Log parabola
654 704
655 .. warning:: 705 .. warning::
656 706
657 - The ``PivotEnergy`` parameter is not intended to be fitted. 707 + The ``PivotEnergy`` parameter is not intended to be fitted.
658 708
659 An alternative XML format is supported for compatibility with the Fermi/LAT 709 An alternative XML format is supported for compatibility with the Fermi/LAT
660 XML format: 710 XML format:
@@ -688,8 +738,8 @@ Gaussian @@ -688,8 +738,8 @@ Gaussian
688 This spectral model component implements the gaussian function 738 This spectral model component implements the gaussian function
689 739
690 .. math:: 740 .. math::
691 - \frac{dN}{dE} = \frac{N_0}{\sqrt{2\pi}\sigma}  
692 - \exp \left( \frac{-(E-\bar{E})^2}{2 \sigma^2} \right) 741 + M_{\rm spectral}(E) = \frac{N_0}{\sqrt{2\pi}\sigma}
  742 + \exp \left( \frac{-(E-\bar{E})^2}{2 \sigma^2} \right)
693 743
694 where 744 where
695 745
@@ -721,7 +771,7 @@ File function @@ -721,7 +771,7 @@ File function
721 The only parameter is a multiplicative normalization: 771 The only parameter is a multiplicative normalization:
722 772
723 .. math:: 773 .. math::
724 - \frac{dN}{dE} = N_0 \left. \frac{dN}{dE} \right\rvert_{\rm file} 774 + M_{\rm spectral}(E) = N_0 \left. \frac{dN}{dE} \right\rvert_{\rm file}
725 775
726 where 776 where
727 777
@@ -729,11 +779,11 @@ File function @@ -729,11 +779,11 @@ File function
729 779
730 .. warning:: 780 .. warning::
731 781
732 - If the file name is given without a path it is expected that the file  
733 - resides in the same directory than the XML file.  
734 - If the file resides in a different directory, an absolute path name should  
735 - be specified.  
736 - Any environment variable present in the path name will be expanded. 782 + If the file name is given without a path it is expected that the file
  783 + resides in the same directory than the XML file.
  784 + If the file resides in a different directory, an absolute path name should
  785 + be specified.
  786 + Any environment variable present in the path name will be expanded.
737 787
738 788
739 Node function 789 Node function
@@ -741,16 +791,16 @@ Node function @@ -741,16 +791,16 @@ Node function
741 791
742 .. code-block:: xml 792 .. code-block:: xml
743 793
744 - <spectrum type="NodeFunction">  
745 - <node>  
746 - <parameter name="Energy" scale="1.0" value="1.0" min="0.1" max="1.0e20" free="0"/>  
747 - <parameter name="Intensity" scale="1e-07" value="1.0" min="1e-07" max="1000.0" free="1"/>  
748 - </node>  
749 - <node>  
750 - <parameter name="Energy" scale="10.0" value="1.0" min="0.1" max="1.0e20" free="0"/>  
751 - <parameter name="Intensity" scale="1e-08" value="1.0" min="1e-07" max="1000.0" free="1"/>  
752 - </node>  
753 - </spectrum> 794 + <spectrum type="NodeFunction">
  795 + <node>
  796 + <parameter name="Energy" scale="1.0" value="1.0" min="0.1" max="1.0e20" free="0"/>
  797 + <parameter name="Intensity" scale="1e-07" value="1.0" min="1e-07" max="1000.0" free="1"/>
  798 + </node>
  799 + <node>
  800 + <parameter name="Energy" scale="10.0" value="1.0" min="0.1" max="1.0e20" free="0"/>
  801 + <parameter name="Intensity" scale="1e-08" value="1.0" min="1e-07" max="1000.0" free="1"/>
  802 + </node>
  803 + </spectrum>
754 804
755 This spectral model component implements a generalised broken 805 This spectral model component implements a generalised broken
756 power law which is defined by a set of energy and intensity values 806 power law which is defined by a set of energy and intensity values
@@ -762,14 +812,73 @@ Node function @@ -762,14 +812,73 @@ Node function
762 812
763 .. warning:: 813 .. warning::
764 814
765 - An arbitrary number of energy-intensity nodes can be defined in a node  
766 - function.  
767 - The nodes need to be sorted by increasing energy.  
768 - Although the fitting of the ``Energy`` parameters is formally possible  
769 - it may lead to numerical complications.  
770 - If ``Energy`` parameters are to be fitted make sure that the ``min``  
771 - and ``max`` attributes are set in a way that avoids inversion of the energy  
772 - ordering. 815 + An arbitrary number of energy-intensity nodes can be defined in a node
  816 + function.
  817 + The nodes need to be sorted by increasing energy.
  818 + Although the fitting of the ``Energy`` parameters is formally possible
  819 + it may lead to numerical complications.
  820 + If ``Energy`` parameters are to be fitted make sure that the ``min``
  821 + and ``max`` attributes are set in a way that avoids inversion of the energy
  822 + ordering.
  823 +
  824 +
  825 +Composite model
  826 +^^^^^^^^^^^^^^^
  827 +
  828 + .. code-block:: xml
  829 +
  830 + <spectrum type="Composite">
  831 + <spectrum type="PowerLaw" component="SoftComponent">
  832 + <parameter name="Prefactor" scale="1e-17" value="3" min="1e-07" max="1000.0" free="1"/>
  833 + <parameter name="Index" scale="-1" value="3.5" min="0.0" max="+5.0" free="1"/>
  834 + <parameter name="PivotEnergy" scale="1e6" value="1" min="0.01" max="1000.0" free="0"/>
  835 + </spectrum>
  836 + <spectrum type="PowerLaw" component="HardComponent">
  837 + <parameter name="Prefactor" scale="1e-17" value="5" min="1e-07" max="1000.0" free="1"/>
  838 + <parameter name="Index" scale="-1" value="2.0" min="0.0" max="+5.0" free="1"/>
  839 + <parameter name="PivotEnergy" scale="1e6" value="1" min="0.01" max="1000.0" free="0"/>
  840 + </spectrum>
  841 + </spectrum>
  842 +
  843 + This spectral model component implements a composite model that is the
  844 + sum of an arbitrary number of spectral models, computed using
  845 +
  846 + .. math::
  847 + M_{\rm spectral}(E) = \sum_{i=0}^{N-1} M_{\rm spectral}^{(i)}(E)
  848 +
  849 + where :math:`M_{\rm spectral}^{(i)}(E)` is any spectral model component
  850 + (including another composite model), and :math:`N` is the number of
  851 + model components that are combined.
  852 +
  853 +
  854 +Multiplicative model
  855 +^^^^^^^^^^^^^^^^^^^^
  856 +
  857 + .. code-block:: xml
  858 +
  859 + <spectrum type="Multiplicative">
  860 + <spectrum type="PowerLaw" component="PowerLawComponent">
  861 + <parameter name="Prefactor" scale="1e-17" value="1.0" min="1e-07" max="1000.0" free="1"/>
  862 + <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/>
  863 + <parameter name="PivotEnergy" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  864 + </spectrum>
  865 + <spectrum type="ExponentialCutoffPowerLaw" component="CutoffComponent">
  866 + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-07" max="1000.0" free="0"/>
  867 + <parameter name="Index" scale="1.0" value="0.0" min="-2.0" max="+2.0" free="0"/>
  868 + <parameter name="CutoffEnergy" scale="1e6" value="1.0" min="0.01" max="1000.0" free="1"/>
  869 + <parameter name="PivotEnergy" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  870 + </spectrum>
  871 + </spectrum>
  872 +
  873 + This spectral model component implements a composite model that is the
  874 + product of an arbitrary number of spectral models, computed using
  875 +
  876 + .. math::
  877 + M_{\rm spectral}(E) = \prod_{i=0}^{N-1} M_{\rm spectral}^{(i)}(E)
  878 +
  879 + where :math:`M_{\rm spectral}^{(i)}(E)` is any spectral model component
  880 + (including another composite model), and :math:`N` is the number of
  881 + model components that are multiplied.
773 882
774 883
775 .. _sec_temporal_models: 884 .. _sec_temporal_models:
@@ -785,6 +894,121 @@ Constant @@ -785,6 +894,121 @@ Constant
785 894
786 .. code-block:: xml 895 .. code-block:: xml
787 896
788 - <temporalModel type="Constant">  
789 - <parameter name="Normalization" scale="1.0" value="1.0" min="0.1" max="10.0" free="0"/>  
790 - </temporalModel> 897 + <temporal type="Constant">
  898 + <parameter name="Normalization" scale="1.0" value="1.0" min="0.1" max="10.0" free="0"/>
  899 + </temporal>
  900 +
  901 + This temporal model component implements a constant source
  902 +
  903 + .. math::
  904 +
  905 + M_{\rm temporal}(t) = N_0
  906 +
  907 + where
  908 +
  909 + * :math:`N_0` = ``Normalization``
  910 +
  911 +
  912 +Light Curve
  913 +^^^^^^^^^^^
  914 +
  915 + .. code-block:: xml
  916 +
  917 + <temporal type="LightCurve" file="model_temporal_lightcurve.fits">
  918 + <parameter name="Normalization" scale="1" value="1.0" min="0.0" max="1000.0" free="0"/>
  919 + </temporal>
  920 +
  921 + This temporal model component implements a light curve :math:`r(t)`
  922 +
  923 + .. math::
  924 + M_{\rm temporal}(t) = N_0 \times r(t)
  925 +
  926 + where
  927 +
  928 + * :math:`N_0` = ``Normalization``
  929 +
  930 + The light curve is defined by nodes in a FITS file that specify the relative
  931 + flux normalization as function of time (file ``model_temporal_lightcurve.fits``
  932 + in the example above). The structure of the light curve FITS
  933 + file is shown in the figure below. The light curve is defined in the first
  934 + extension of the FITS file and consists of a binary table with the columns
  935 + ``TIME`` and ``NORM``. Times in the ``TIME`` columns are given in seconds
  936 + and are counted with respect to a time reference that is defined in the
  937 + header of the binary table. Times need to be specified in ascending order.
  938 + The values in the ``NORM`` column specify :math:`r(t)` at times :math:`t`,
  939 + and should be comprised between 0 and 1.
  940 +
  941 + .. _fig_model_lightcurve:
  942 +
  943 + .. figure:: model_lightcurve.png
  944 + :align: center
  945 + :width: 100%
  946 +
  947 + *Structure of light curve FITS file*
  948 +
  949 + .. warning::
  950 + Fitting of light curves only makes sense for an unbinned maximum likelihood
  951 + analysis, since in a binned or stacked analysis the times of individual
  952 + events are dropped.
  953 +
  954 +
  955 +Phase Curve
  956 +^^^^^^^^^^^
  957 +
  958 + .. code-block:: xml
  959 +
  960 + <temporal type="PhaseCurve" file="model_temporal_phasecurve.fits">
  961 + <parameter name="Normalization" scale="1" value="1.0" min="0.0" max="1000.0" free="0"/>
  962 + <parameter name="MJD" scale="1" value="51544.5" min="0.0" max="100000.0" free="0"/>
  963 + <parameter name="Phase" scale="1" value="0.0" min="0.0" max="1.0" free="0"/>
  964 + <parameter name="F0" scale="1" value="1.0" min="0.0" max="1000.0" free="0"/>
  965 + <parameter name="F1" scale="1" value="0.1" min="0.0" max="1000.0" free="0"/>
  966 + <parameter name="F2" scale="1" value="0.01" min="0.0" max="1000.0" free="0"/>
  967 + </temporal>
  968 +
  969 + This temporal model component implements a phase curve :math:`r(\Phi(t))`
  970 +
  971 + .. math::
  972 + M_{\rm temporal}(t) = N_0 \times r(\Phi(t))
  973 +
  974 + where the phase as function of time is computed using
  975 +
  976 + .. math::
  977 + \Phi(t) = \Phi_0 + f(t-t_0) + \frac{1}{2}\dot{f} (t-t_0)^2 +
  978 + \frac{1}{6}\ddot{f} (t-t_0)^3
  979 +
  980 + and
  981 +
  982 + * :math:`N_0` = ``Normalization``
  983 + * :math:`t_0` = ``MJD``
  984 + * :math:`\Phi_0` = ``Phase``
  985 + * :math:`f` = ``F0``
  986 + * :math:`\dot{f}` = ``F1``
  987 + * :math:`\ddot{f}` = ``F2``
  988 +
  989 + The phase curve is defined by nodes in a FITS file that specify the relative
  990 + flux normalization as function of phase (file ``model_temporal_phasecurve.fits``
  991 + in the example above). The structure of the phase curve
  992 + FITS file is shown in the figure below. The phase curve is defined in the
  993 + first extension of the FITS file and consists of a binary table with the
  994 + columns ``PHASE`` and ``NORM``. Phase values in the ``PHASE`` column need to
  995 + be comprised between 0 and 1 and need to be given in ascending order. The
  996 + values in the ``NORM`` column specify :math:`r(\Phi(t))` at phases
  997 + :math:`\Phi(t)`, and should be comprised between 0 and 1.
  998 +
  999 + .. _fig_model_phasecurve:
  1000 +
  1001 + .. figure:: model_phasecurve.png
  1002 + :align: center
  1003 + :width: 40%
  1004 +
  1005 + *Structure of phase curve FITS file*
  1006 +
  1007 + .. warning::
  1008 + Fitting of phase curves only makes sense for an unbinned maximum likelihood
  1009 + analysis, since in a binned or stacked analysis the times of individual
  1010 + events are dropped.
  1011 +
  1012 + .. warning::
  1013 + Fitting of phase curve parameters may not properly work for pulsar
  1014 + frequencies.