LALPulsar  6.1.0.1-b72065a
ComputeSky.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 Jolien Creighton, Steve Berukoff
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19 
20 /**
21  * \author Berukoff, S.J., Papa, M.A.
22  * \file
23  * \ingroup lalpulsar_inject
24  *
25  * \brief Computes phase coefficients necessary for a correct demodulation.
26  *
27  * ### Synopsis ###
28  *
29  * \code
30  * #include <lal/ComputeSky.h>
31  * \endcode
32  *
33  * This is a short summary of the analytical calculations which form the basis for the code in this routine.
34  *
35  * Recall that a demodulated Fourier Transform (DeFT) is given by
36  * \f{equation}{
37  * \label{eq_e4a}
38  * \hat{x}_b({\vec{\lambda}})=
39  * \sum_{\alpha =0}^{M-1}\sum_{k=0}^{N-1}\tilde{x}_{\alpha k}\left[\frac{1}{N}\sum_{j=0}^{N-1}e^{-2\pi i(\Phi_{\alpha jb}(\vec{\lambda})-\frac{jk}{N})}\right]
40  * \f}
41  * The index \f$ b \f$ defines the DeFT frequency bin, the index \f$ \alpha \f$ loops through
42  * the SFTs that build the DeFT, \f$ k \f$ runs on all the SFT frequency bins, and \f$ j \f$
43  * is a time index that runs on each SFT. The next step in the development of the demodulation
44  * technique involves Taylor expanding the phase model about the temporal
45  * midpoint of each short segment of data, while retaining only first order
46  * terms. The Taylor expansion of \f$ \Phi (t) \f$ about the temporal midpoint
47  * \f$ t_{\alpha,1/2} \f$ is
48  * \f{equation}{
49  * \label{eq_taylor2}
50  * \Phi_{\alpha}(t) = \Phi(t_{\alpha,1/2})+\left[t-t_{\alpha,1/2}\right]\frac{d\Phi}{dt}(t_{\alpha,1/2}) \\
51  * \f}
52  * For each value of \f$ \alpha \f$ , this expression consist of either constant or linear terms in time. With the particular time discretization chosen in this code, \f$ t=t_{0}+(N\alpha+j)\ T_{obs}/NM \f$ , we have
53  * \f{equation}{
54  * \label{eq_time}
55  * \left[t-t_{\alpha,1/2}\right]=\frac{\ T_{obs}}{M}\left(\frac{j}{N}-\frac{1}{2}\right)=\mathcal{T}_{s}\left(\frac{j}{N}-\frac{1}{2}\right),
56  * \f}
57  * where \f$ \mathcal{T}_{s} \f$ is the short time baseline of the \f$ M \f$ short FTs. On
58  * the other hand, the phase can also be expressed as a function of SSB time \f$ T \f$
59  * (i.e. the time at the solar system barycenter). We will assume the source to
60  * be at rest in this reference frame. Now, if one adopts the notation \f$ \Delta
61  * T_{\alpha}\equiv\left[T(t_{\alpha,1/2})-
62  * T(t_{0})\right] \f$ and \f$ \dot{T}_{\alpha}\equiv
63  * dT/dt(t_{\alpha,1/2}) \f$
64  * the phase terms in the above equation are (neglecting constants)
65  * \f{eqnarray}{
66  * \label{eq_phi}
67  * \Phi(t_{\alpha,1/2}) & = & f_{0}\Delta T_{\alpha}+\frac{1}{2}f_{1}\Delta T_{\alpha}^{2}
68  * +\frac{1}{3}f_{2}\Delta T_{\alpha}^{3}+\frac{1}{4}f_{3}\Delta T_{\alpha}^{4}+\frac{1}{5}f_{4}\Delta T_{\alpha}^{5}
69  * +\frac{1}{6}f_{5}\Delta T_{\alpha}^{6} \\
70  * & & \\
71  * \label{eq_dphi}
72  * \frac{d\Phi}{dt}(t_{\alpha,1/2}) & = & \dot{T}_{\alpha}\left(f_{0}+ f_{1}\Delta T_{\alpha}
73  * +f_{2}\Delta T_{\alpha}^{2}+f_{3}\Delta T_{\alpha}^{3}
74  * +f_{4}\Delta T_{\alpha}^{4}+f_{5}\Delta T_{\alpha}^{5}\right).
75  * \f}
76  * These constants, for each value of \f$ \alpha \f$ , require \f$ \dot{T}_{\alpha} \f$ and
77  * \f$ \Delta T_{\alpha} \f$ , which are calculated by a suitable timing routine. For
78  * this demodulation package, this timing routine is provided by <tt>tdb()</tt>.
79  * Thus, for a given sky position, the timing routine will be called once for
80  * each short time chunk, each call returning a specific \f$ \dot{T}_{\alpha} \f$ and
81  * \f$ \Delta T_{\alpha} \f$ . By substituting \eqref{eq_time}, \eqref{eq_phi} and
82  * \eqref{eq_dphi} in \eqref{eq_taylor2} and grouping together the terms in \f$ j \f$ (linear
83  * in \f$ t \f$ ) in order to save computations, we have
84  * \f{equation}{
85  * \label{eq_phasecalc}
86  * \Phi_{\alpha}(t)=\sum_{s=0}^{n_{spin}}f_{s}A_{s\alpha}+\frac{j}{N}\sum_{s=0}^{n_{spin}}f_{s}B_{s\alpha},
87  * \f}
88  * where \f$ n_{spin} \f$ is the maximum order of spindown parameter. Rather than
89  * store the values of \f$ \dot{T}_{\alpha} \f$ and \f$ \Delta T_{\alpha} \f$ for each value
90  * of \f$ \alpha \f$ , it is more efficient to calculate the constants \f$ A_{s\alpha} \f$ and
91  * \f$ B_{s\alpha} \f$ only once, and then use these values for every spindown
92  * parameter set used when searching in a given sky position. Analytical
93  * formulae for these constants are easily derived:
94  * \f{equation}{
95  * A_{s \alpha}=\frac{1}{s+1}\Delta T_{\alpha}^{s+1}-\frac{1}{2}\mathcal{T}_{SFT}\dot{T}_{\alpha}\Delta T_{\alpha}^{s}
96  * \f}
97  * \f{equation}{
98  * B_{s \alpha}=\mathcal{T}_{SFT}\dot{T}_{\alpha}\Delta T_{\alpha}^{s}
99  * \f}
100  *
101  */
102 
103 
104 
105 
106 #ifndef _COMPUTESKY_H
107 #define _COMPUTESKY_H
108 
109 #include <lal/LALStdlib.h>
110 #include <lal/LALBarycenter.h>
111 
112 #ifdef __cplusplus
113 extern "C" {
114 #endif
115 
116 /**\name Error Codes */ /** @{ */
117 #define COMPUTESKYH_ENULL 1
118 #define COMPUTESKYH_ENNUL 2
119 #define COMPUTESKYH_ENEGA 4
120 #define COMPUTESKYH_MSGENULL "Null Pointer"
121 #define COMPUTESKYH_MSGENNUL "Non-Null Pointer"
122 #define COMPUTESKYH_MSGENEGA "Bad Negative Value"
123 /** @} */
124 
125 /**
126  * This structure contains the parameters for the LALComputeSky() routine.
127  */
128 #ifdef SWIG /* SWIG interface directives */
129 SWIGLAL( IMMUTABLE_MEMBERS( tagCSParams, edat ) );
130 #endif /* SWIG */
131 typedef struct tagCSParams {
132  INT8 spinDwnOrder; /**< The maximal number of spindown parameters per spindown parameter set */
133  INT8 mObsSFT; /**< The number of SFTs in the observation time */
134  REAL8 tSFT; /**< The timescale of one SFT */
135  LIGOTimeGPS *tGPS; /**< An array containing the GPS times of the first datum from each SFT */
136  REAL8 *skyPos; /**< The array containing the sky patch coordinates */
137  BarycenterInput *baryinput; /**< A switch which turns modulation on/off */
138  EmissionTime *emit; /**< TO BE DOCUMENTED */
139  EarthState *earth; /**< TO BE DOCUMENTED */
140  const EphemerisData *edat; /**< ephemeris data */
141 }
142 CSParams;
143 
144 
146  REAL8 *skyConst,
147  INT8 iSkyCoh,
148  CSParams *params );
149 
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 
155 #endif /* _COMPUTESKY_H */
void LALComputeSky(LALStatus *status, REAL8 *skyConst, INT8 iSkyCoh, CSParams *params)
Given an input index which refers to the sky patch under consideration, this routine returns the phas...
Definition: ComputeSky.c:65
double REAL8
int64_t INT8
Basic input structure to LALBarycenter.c.
This structure contains the parameters for the LALComputeSky() routine.
Definition: ComputeSky.h:131
EmissionTime * emit
TO BE DOCUMENTED.
Definition: ComputeSky.h:138
INT8 spinDwnOrder
The maximal number of spindown parameters per spindown parameter set.
Definition: ComputeSky.h:132
LIGOTimeGPS * tGPS
An array containing the GPS times of the first datum from each SFT.
Definition: ComputeSky.h:135
REAL8 tSFT
The timescale of one SFT.
Definition: ComputeSky.h:134
EarthState * earth
TO BE DOCUMENTED.
Definition: ComputeSky.h:139
BarycenterInput * baryinput
A switch which turns modulation on/off.
Definition: ComputeSky.h:137
REAL8 * skyPos
The array containing the sky patch coordinates.
Definition: ComputeSky.h:136
const EphemerisData * edat
ephemeris data
Definition: ComputeSky.h:140
INT8 mObsSFT
The number of SFTs in the observation time.
Definition: ComputeSky.h:133
Basic output structure of LALBarycenterEarth.c.
Basic output structure produced by LALBarycenter.c.
This structure contains all information about the center-of-mass positions of the Earth and Sun,...