00001 /* 00002 * Copyright (C) 2007 Jolien Creighton, Steve Berukoff 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with with program; see the file COPYING. If not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00017 * MA 02111-1307 USA 00018 */ 00019 00020 /************************************ <lalVerbatim file="ComputeSkyHV"> 00021 Author: Berukoff, S.J., Papa, M.A. 00022 $Id: ComputeSky.h,v 1.10 2007/06/08 14:41:50 bema Exp $ 00023 ************************************* </lalVerbatim> */ 00024 00025 /* <lalLaTeX> 00026 \section{Header \texttt{ComputeSky.h}} 00027 \label{s:ComputeSky.h} 00028 Computes phase coefficients necessary for a correct demodulation. 00029 00030 \subsection*{Synopsis} 00031 \begin{verbatim} 00032 #include <lal/ComputeSky.h> 00033 \end{verbatim} 00034 00035 \noindent This is a short summary of the analytical calculations which form the basis for the code in this routine. 00036 00037 Recall that a demodulated Fourier Transform (DeFT) is given by 00038 \begin{equation} 00039 \hat{x}_b({\vec{\lambda}})= 00040 \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] 00041 \label{e4} 00042 \end{equation} 00043 The index $b$ defines the DeFT frequency bin, the index $\alpha$ loops through 00044 the SFTs that build the DeFT, $k$ runs on all the SFT frequency bins, and $j$ 00045 is a time index that runs on each SFT. As shown in section 00046 \ref{s:LALDemod.h}, the next step in the development of the demodulation 00047 technique involves Taylor expanding the phase model about the temporal 00048 midpoint of each short segment of data, while retaining only first order 00049 terms. The Taylor expansion of $\Phi (t)$ about the temporal midpoint 00050 $t_{\alpha,1/2}$ is 00051 \begin{equation} 00052 \Phi_{\alpha}(t) = \Phi(t_{\alpha,1/2})+\left[t-t_{\alpha,1/2}\right]\frac{d\Phi}{dt}(t_{\alpha,1/2})\label{taylor2} \\ 00053 \end{equation} 00054 For each value of $\alpha$, this expression consist of either constant or linear terms in time. With the particular time discretization chosen in this code, $t=t_{0}+(N\alpha+j)\ T_{obs}/NM$, we have 00055 \begin{equation} 00056 \label{time} 00057 \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), 00058 \end{equation} 00059 where $\mathcal{T}_{s}$ is the short time baseline of the $M$ short FTs. On 00060 the other hand, the phase can also be expressed as a function of SSB time $T$ 00061 (i.e. the time at the solar system barycenter). We will assume the source to 00062 be at rest in this reference frame. Now, if one adopts the notation $\Delta 00063 T_{\alpha}\equiv\left[T(t_{\alpha,1/2})- 00064 T(t_{0})\right]$ and $\dot{T}_{\alpha}\equiv 00065 dT/dt(t_{\alpha,1/2})$ 00066 the phase terms in the above equation are (neglecting constants) 00067 \begin{eqnarray} 00068 \Phi(t_{\alpha,1/2}) & = & f_{0}\Delta T_{\alpha}+\frac{1}{2}f_{1}\Delta T_{\alpha}^{2} 00069 +\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} 00070 +\frac{1}{6}f_{5}\Delta T_{\alpha}^{6} \nonumber\label{phi} \\ 00071 & & \\ 00072 \frac{d\Phi}{dt}(t_{\alpha,1/2}) & = & \dot{T}_{\alpha}\left(f_{0}+ f_{1}\Delta T_{\alpha} 00073 +f_{2}\Delta T_{\alpha}^{2}+f_{3}\Delta T_{\alpha}^{3} 00074 +f_{4}\Delta T_{\alpha}^{4}+f_{5}\Delta T_{\alpha}^{5}\right). \label{dphi} 00075 \end{eqnarray} 00076 These constants, for each value of $\alpha$, require $\dot{T}_{\alpha}$ and 00077 $\Delta T_{\alpha}$, which are calculated by a suitable timing routine. For 00078 this demodulation package, this timing routine is provided by \verb@tdb()@. 00079 Thus, for a given sky position, the timing routine will be called once for 00080 each short time chunk, each call returning a specific $\dot{T}_{\alpha}$ and 00081 $\Delta T_{\alpha}$. By substituting Eq.s \ref{time}, \ref{phi} and 00082 \ref{dphi} in Eq. \ref{taylor2} and grouping together the terms in $j$ (linear 00083 in $t$) in order to save computations, we have 00084 \begin{equation} 00085 \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}, 00086 \label{phasecalc} 00087 \end{equation} 00088 where $n_{spin}$ is the maximum order of spindown parameter. Rather than 00089 store the values of $\dot{T}_{\alpha}$ and $\Delta T_{\alpha}$ for each value 00090 of $\alpha$, it is more efficient to calculate the constants $A_{s\alpha}$ and 00091 $B_{s\alpha}$ only once, and then use these values for every spindown 00092 parameter set used when searching in a given sky position. Analytical 00093 formulae for these constants are easily derived: 00094 \begin{equation} 00095 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} 00096 \end{equation} 00097 \begin{equation} 00098 B_{s \alpha}=\mathcal{T}_{SFT}\dot{T}_{\alpha}\Delta T_{\alpha}^{s} 00099 \end{equation} 00100 00101 </lalLaTeX> */ 00102 00103 00104 00105 00106 #ifndef _COMPUTESKY_H 00107 #define _COMPUTESKY_H 00108 00109 #include <lal/LALStdlib.h> 00110 #include "LALBarycenter.h" 00111 00112 #ifdef __cplusplus 00113 extern "C" { 00114 #endif 00115 00116 NRCSID (COMPUTESKYH, "$Id: ComputeSky.h"); 00117 00118 /* Author-defined error codes */ 00119 /* <lalLaTeX> 00120 \subsection*{Error conditions} 00121 \vspace{0.1in} 00122 \input{ComputeSkyHErrorTable} 00123 00124 </lalLaTeX> */ 00125 00126 /* <lalErrTable file="ComputeSkyHErrorTable"> */ 00127 #define COMPUTESKYH_ENULL 1 00128 #define COMPUTESKYH_ENNUL 2 00129 #define COMPUTESKYH_ENEGA 4 00130 #define COMPUTESKYH_MSGENULL "Null Pointer" 00131 #define COMPUTESKYH_MSGENNUL "Non-Null Pointer" 00132 #define COMPUTESKYH_MSGENEGA "Bad Negative Value" 00133 /* </lalErrTable> */ 00134 00135 /* <lalLaTeX> 00136 \subsection*{Structures} 00137 00138 \begin{verbatim} 00139 struct CSParams 00140 \end{verbatim} 00141 \index{\texttt{CSParams}} 00142 00143 \noindent This structure contains the parameters for the \verb@ComputeSky()@ routine. The parameters are: 00144 00145 \begin{description} 00146 \item[\texttt{INT8 spinDwnOrder}] The maximal number of spindown parameters per spindown parameter set. 00147 \item[\texttt{INT8 mObsSFT}] The number of SFTs in the observation time. 00148 \item[\texttt{REAL8 tSFT}] The timescale of one SFT. 00149 \item[\texttt{LIGOTimeGPS *tGPS}] An array containing the GPS times of the first datum from each SFT. 00150 \item[\texttt{REAL8 *skyPos}] The array containing the sky patch coordinates. 00151 \item[\texttt{CHAR *sw}] A switch which turns modulation on/off. 00152 \item[\texttt{void (*funcName)(REAL8 , REAL8 , REAL8 , REAL8 *, REAL8 *, const CHAR *sw)}] A function pointer, to make the use of different timing routines easy. 00153 \end{description} 00154 00155 </lalLaTeX> */ 00156 00157 typedef struct 00158 tagCSParams 00159 { 00160 INT8 spinDwnOrder; /* max spindown parameter order */ 00161 INT8 mObsSFT; /* number of coherent timescales */ 00162 REAL8 tSFT; /* timescale of SFT */ 00163 LIGOTimeGPS *tGPS; /* GPS time of 1st data sample of each SFT */ 00164 REAL8 *skyPos; /* array of sky positions */ 00165 BarycenterInput *baryinput; 00166 EmissionTime *emit; 00167 EarthState *earth; 00168 EphemerisData *edat; 00169 } 00170 CSParams; 00171 00172 /* <lalLaTeX> 00173 \newpage\input{ComputeSkyHV} 00174 \newpage\input{ComputeSkyC} 00175 </lalLaTeX> */ 00176 00177 void LALComputeSky (LALStatus *status, 00178 REAL8 *skyConst, 00179 INT8 iSkyCoh, 00180 CSParams *params); 00181 00182 00183 #ifdef __cplusplus 00184 } 00185 #endif 00186 00187 #endif /* _COMPUTESKY_H */
1.5.2