PulsarTimes.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 David M. Whitbeck, Jolien Creighton, Ian Jones, Reinhard Prix, Teviet Creighton
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="PulsarTimesHV">
00021 Author: Creighton, T. D.
00022 $Id: PulsarTimes.h,v 1.12 2007/10/29 19:01:37 reinhard Exp $
00023 **************************************************** </lalVerbatim> */
00024 
00025 /********************************************************** <lalLaTeX>
00026 
00027 \section{Header \texttt{PulsarTimes.h}}
00028 \label{s:PulsarTimes.h}
00029 
00030 Provides routines to transform among various time coordinates used in
00031 a pulsar search.
00032 
00033 \subsection*{Synopsis}
00034 \begin{verbatim}
00035 #include <lal/PulsarTimes.h>
00036 \end{verbatim}
00037 
00038 \noindent This header covers routines that computes time coordinate
00039 transformations, and derivatives of these transformations with respect
00040 to their parameters.  The motivation is to provide a number of useful
00041 transformations for doing pulsar searches.  For instance, one
00042 transformation might take you from the time measured at a point on
00043 Earth to the time measured in an inertial frame, synchronized
00044 according to a signal arriving from a particular direction in space.
00045 Another might transform from the inertial time coordinate to the
00046 proper time coordinate of a pulsar in a binary system.  Another might
00047 gradually stretch the proper time coordinate of a pulsar that is
00048 spinning down, so that it appears to be at a constant frequency.
00049 Other transformations might be compositions of these, allowing you to
00050 go straight from detector time to the canonical rotation-defined time
00051 of the pulsar.
00052 
00053 Mathematically, the transformation from one time $t$ to another $\tau$
00054 is written as a function $\tau(t)$.  In general this function will
00055 depend on other parameters, such as the right ascension and
00056 declination of the source on the sky, or the latitude and longitude of
00057 the observer.  Since in pulsar searches one is often concerned with
00058 how the transformation depends on these parameters, it is necessary to
00059 specify which parameters are allowed to vary and which will be treated
00060 as constants.  We write the transformation as:
00061 $$
00062 \tau(t,\vec\lambda,\{p\}) \; ,
00063 $$
00064 where $\vec\lambda=(\lambda^1,\ldots,\lambda^n)$ are the parameters
00065 that we will allow to vary, while $\{p\}$ are the parameters that will
00066 be treated as constant.  As the notation suggests, the variable
00067 parameters must be representable in a real vector space, while the
00068 constant parameters need not be real numbers; they may be integers,
00069 names, flags, or anything else required by the transformation
00070 function.
00071 
00072 The modules under this header will typically provide function pairs of
00073 the form:
00074 \begin{verbatim}
00075 void LALTau( LALStatus             *,
00076              REAL8                 *tau,
00077              REAL8Vector           *variables,
00078              PulsarTimesParamStruc *constants );
00079 
00080 void LALDTau( LALStatus             *,
00081               REAL8Vector           *dTau,
00082               REAL8Vector           *variables,
00083               PulsarTimesParamStruc *constants );
00084 \end{verbatim}
00085 The actual function names will be different; these are just examples.
00086 The function \verb@LALTau()@ computes the transformation, while
00087 \verb@LALDTau()@ computes the transformation \emph{and} its
00088 derivatives with respect to the parameters in \verb@*variables@.  The
00089 arguments are described below:
00090 \begin{description}
00091 \item[\texttt{*stat}] This is the universal status structure required
00092 by all LAL functions.
00093 
00094 \item[\texttt{*tau}] This stores the returned value of
00095 $\tau(t,\vec\lambda,\{p\})$.
00096 
00097 \item[\texttt{*variables}] This is a length $n+1$ vector storing the
00098 arguments of $\tau$ that are considered to be ``variable''; that is,
00099 $t$ and $\vec\lambda$.  They are stored as follows:
00100         \begin{description}
00101         \item[\texttt{variables->data[0]}]$=t$,
00102         \item[\texttt{variables->data[}$i$\texttt{]}]$=\lambda^i$,
00103         where $i=1,\ldots,n$.
00104         \end{description}
00105 
00106 \item[\texttt{*constants}] This stores the constant parameters
00107 $\{p\}$, in a format described in the Structures section below.
00108 
00109 \item[\texttt{*dTau}] This is a length $n+2$ vector storing the value
00110 of $\tau(t,\vec\lambda,\{p\})$ and its derivatives with respect to its
00111 variable arguments, in the following format:
00112         \begin{description}
00113         \item[\texttt{dTau->data[0]}]$=\tau$
00114         \item[\texttt{dTau->data[1]}]$=\partial\tau/\partial t$
00115         \item[\texttt{dTau->data[}$i+1$\texttt{]}]$=\partial\tau/
00116         \partial\lambda^i$, where $i=1,\ldots,n$.
00117         \end{description}
00118 \end{description}
00119 
00120 It may seem redundant that both \verb@LALTau()@ and \verb@LALDTau()@
00121 compute and return the value of $\tau$, especially since returning
00122 $\tau$ in \verb@*dTau@ messes up an otherwise elegant indexing scheme.
00123 The reason is that many of the calculations involved in computing the
00124 derivatives of $\tau$ are also used in calculating $\tau$ itself, and
00125 it would be inefficient to have to repeat them by calling both
00126 functions.  \verb@LALTau()@ is provided simply as a shortcut for those
00127 occasions when you do not need the derivatives.
00128 
00129 It is also worth noting that different pulsar searches may involve the
00130 same transformations but vary different sets of parameters.  There are
00131 two approches to dealing with this.  The simplest is usually to use a
00132 function that treats all of the parameters as variable, and then
00133 ignore (or set to zero) the derivatives that aren't used.  The more
00134 computationally efficient approach is to write separate pairs of
00135 routines that place different parameters in \verb@*variables@ and
00136 \verb@*constants@, although this may require recompiling the library.
00137 
00138 ******************************************************* </lalLaTeX> */
00139 
00140 #ifndef _PULSARTIMES_H
00141 #define _PULSARTIMES_H
00142 
00143 #include <lal/LALStdlib.h>
00144 
00145 #include <lal/LALBarycenter.h>
00146 
00147 #ifdef __cplusplus
00148 extern "C" {
00149 #endif
00150 
00151 NRCSID(PULSARTIMESH,"$Id: PulsarTimes.h,v 1.12 2007/10/29 19:01:37 reinhard Exp $");
00152 
00153 /********************************************************** <lalLaTeX>
00154 \subsection*{Error conditions}
00155 ****************************************** </lalLaTeX><lalErrTable> */
00156 #define PULSARTIMESH_ENUL 1
00157 #define PULSARTIMESH_EBAD 2
00158 
00159 #define PULSARTIMESH_MSGENUL "Null pointer"
00160 #define PULSARTIMESH_MSGEBAD "Bad parameter values"
00161 /******************************************** </lalErrTable><lalLaTeX>
00162 
00163 \subsection*{Types}
00164 
00165 \subsubsection*{Structure \texttt{PulsarTimesParamStruc}}
00166 \idx[Type]{PulsarTimesParamStruc}
00167 
00168 \noindent This structure stores a superset of all constant parameters
00169 required by the functions provided by this header
00170 \verb@PulsarTimes.h@.  Although the structure is quite large, it is
00171 supposed to store only constants, so only one structure need be
00172 allocated for each transformation type used in the overall algorithm.
00173 It is passed by pointer, so its size entails no overhead.  A basic
00174 description of the current fields is given below, but a detailed
00175 discussion of those fields must be deferred to the documentation of
00176 the individual modules that use those particular fields.  The fields
00177 are:
00178 
00179 \begin{description}
00180 \item[\texttt{LIGOTimeGPS epoch}] A reference detector time.  All
00181 other times in the transformation are represented as \verb@REAL8@
00182 numbers, giving the time in seconds since \verb@epoch@.
00183 
00184 \item[\texttt{REAL8 t0}] A reference time for a particular
00185 transformation, normally defined such that $\tau($\verb@t0@$)=0$.
00186 
00187 \item[\texttt{REAL8 tAutumn}] Time of the first autumnal equinox
00188 following \verb@epoch@.
00189 
00190 \item[\texttt{REAL8 tMidnight}] Time of the first sidereal midnight
00191 following \verb@epoch@.
00192 
00193 \item[\texttt{REAL8 latitude}] Detector north latitude, in radians.
00194 
00195 \item[\texttt{REAL8 longitude}] Detector east longitude (i.e.\
00196 counterclockwise about the north pole), in radians.
00197 
00198 \item[\texttt{EphemerisData ephemeris}] Ephemeris data containing positions, 
00199 velocities, etc... of Earth and Sun for the year under consideration.
00200 
00201 \item[\texttt{LALDetector site}] The particular detector under consideration.
00202 
00203 
00204 \end{description}
00205 The following fields are used by the module \verb@TComp.c@, which
00206 composes two transformations $t_1(t)$ and $t_2(t)$ into an overall
00207 transformation $t_c(t)=t_2(t_1(t))$.
00208 \begin{description}
00209 \item[\texttt{void *t1( LALStatus *, REAL8 *, REAL8Vector *,
00210 PulsarTimesParamStruc * )}] The first of the pair of transformations
00211 to be composed.
00212 
00213 \item[\texttt{void *t2( LALStatus *, REAL8 *, REAL8Vector *,
00214 PulsarTimesParamStruc * )}] The second of the pair of transformations
00215 to be composed.
00216 
00217 \item[\texttt{void *dt1( LALStatus *, REAL8Vector *, REAL8Vector *,
00218 PulsarTimesParamStruc * )}] The time derivative function corresponding
00219 to \verb@*t1()@.
00220 
00221 \item[\texttt{void *dt2( LALStatus *, REAL8Vector *, REAL8Vector *,
00222 PulsarTimesParamStruc * )}] The time derivative function corresponding
00223 to \verb@*t2()@.
00224 
00225 \item[\texttt{PulsarTimesParamStruc *constants1}] The constant
00226 parameters used by \verb@*t1()@.
00227 
00228 \item[\texttt{PulsarTimesParamStruc *constants2}] The constant
00229 parameters used by \verb@*t2()@.
00230 
00231 \item[\texttt{UINT4 nArgs}] The number of variable parameters
00232 $\lambda^k$ to be sent to the function \verb@*t1()@.
00233 \end{description}
00234 
00235 ******************************************************* </lalLaTeX> */
00236 
00237 typedef struct tagPulsarTimesParamStruc {
00238   LIGOTimeGPS epoch; /* A reference detector time.  All other times in
00239                         the transformation are represented as REAL8
00240                         numbers, giving the time in seconds since
00241                         epoch. */
00242   REAL8 t0; /* A reference time for a particular transformation,
00243                normally defined such that tau=0. */
00244   REAL8 tAutumn; /* Time of the first autumnal equinox following
00245                     epoch. */
00246   REAL8 tMidnight; /* Time of the first sidereal midnight following
00247                       epoch */
00248   REAL8 latitude; /* Detector north latitude, in radians. */
00249   REAL8 longitude; /* Detector east longitude (i.e. counterclockwise
00250                       about the north pole), in radians. */
00251   const EphemerisData *ephemeris; /* Ephemeris data containing positions, */
00252                            /* velocities, etc... of Earth and Sun */
00253   const LALDetector *site;        /* The particular detector under consideration */
00254 
00255   void (*t1)( LALStatus *, REAL8 *, REAL8Vector *,
00256               struct tagPulsarTimesParamStruc * );
00257   /* The first of the pair of transformations to be composed. */
00258   void (*t2)( LALStatus *, REAL8 *, REAL8Vector *,
00259               struct tagPulsarTimesParamStruc * );
00260   /* The second of the pair of transformations to be composed. */
00261   void (*dt1)( LALStatus *, REAL8Vector *, REAL8Vector *,
00262                struct tagPulsarTimesParamStruc * );
00263   /* The time derivative function corresponding to *t1(). */
00264   void (*dt2)( LALStatus *, REAL8Vector *, REAL8Vector *,
00265                struct tagPulsarTimesParamStruc * );
00266   /* The time derivative function corresponding to *t2(). */
00267   struct tagPulsarTimesParamStruc *constants1;
00268   /* The constant parameters used by *t1(). */
00269   struct tagPulsarTimesParamStruc *constants2;
00270   /* The constant parameters used by *t2(). */
00271   UINT4 nArgs;
00272   /* The number of variable parameters to be sent to *t1(). */
00273 } PulsarTimesParamStruc;
00274 
00275 /* Function prototypes. */
00276 
00277 /* <lalLaTeX>
00278 \newpage\input{GetEarthTimesC}
00279 </lalLaTeX> */
00280 void
00281 LALGetEarthTimes( LALStatus *, PulsarTimesParamStruc *times );
00282 
00283 /* <lalLaTeX>
00284 \newpage\input{TBaryPtolemaicC}
00285 </lalLaTeX> */
00286 void
00287 LALTBaryPtolemaic( LALStatus             *,
00288                    REAL8                 *tBary,
00289                    REAL8Vector           *variables,
00290                    PulsarTimesParamStruc *constants );
00291 
00292 void
00293 LALDTBaryPtolemaic( LALStatus             *,
00294                     REAL8Vector           *dtBary,
00295                     REAL8Vector           *variables,
00296                     PulsarTimesParamStruc *constants );
00297 
00298 /* <lalLaTeX>
00299 \newpage\input{TSpinC}
00300 </lalLaTeX> */
00301 void
00302 LALTSpin( LALStatus             *,
00303           REAL8                 *tSpin,
00304           REAL8Vector           *variables,
00305           PulsarTimesParamStruc *constants );
00306 
00307 void
00308 LALDTSpin( LALStatus             *,
00309            REAL8Vector           *dtSpin,
00310            REAL8Vector           *variables,
00311            PulsarTimesParamStruc *constants );
00312 
00313 /* <lalLaTeX>
00314 \newpage\input{TCompC}
00315 </lalLaTeX> */
00316 void
00317 LALTComp( LALStatus             *,
00318           REAL8                 *tComp,
00319           REAL8Vector           *variables,
00320           PulsarTimesParamStruc *constants );
00321 
00322 void
00323 LALDTComp( LALStatus             *,
00324            REAL8Vector           *dtComp,
00325            REAL8Vector           *variables,
00326            PulsarTimesParamStruc *constants );
00327 
00328 /* <lalLaTeX>
00329 \newpage\input{DTEphemerisC}
00330 </lalLaTeX> */
00331 void
00332 LALDTEphemeris( LALStatus             *,
00333                 REAL8Vector           *tBary,
00334                 REAL8Vector           *variables,
00335                 PulsarTimesParamStruc *constants );
00336 
00337 void
00338 LALTEphemeris(LALStatus *,
00339               REAL8 *tBary,
00340               REAL8Vector *variables,
00341               PulsarTimesParamStruc *constants);
00342 
00343 #ifdef __cplusplus
00344 }
00345 #endif
00346 
00347 #endif

Generated on Tue Oct 14 02:32:14 2008 for LAL by  doxygen 1.5.2