LALBarycenter.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Curt Cutler, Jolien Creighton, 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="LALBarycenterHV">
00021 Author: Cutler, C.
00022 $Id: LALBarycenter.h,v 1.12 2007/06/08 14:41:50 bema Exp $
00023 *********************************** </lalVerbatim> */
00024 
00025 /**
00026  * \author Curt Cutler
00027  * \date 2001
00028  * \file 
00029  * \ingroup moduleBarycenter
00030  * \brief This header defines the API for LALBarycenter.c.
00031  *
00032  * $Id: LALBarycenter.h,v 1.12 2007/06/08 14:41:50 bema Exp $
00033  */
00034 
00035 /* <lalLaTeX>
00036 
00037 \section{Header \texttt{LALBarycenter.h}}
00038 \label{s:LALBarycenter.h}
00039 
00040 Provides routines for transforming from arrival time
00041 at detector (GPS) to pulse emission time (TDB); i.e.,
00042 for ``barycentering'' the measured astronomical time series.
00043 
00044 \subsection*{Synopsis}
00045 
00046 \begin{verbatim}
00047 #include <lal/LALBarycenter.h>
00048 \end{verbatim}
00049 
00050 \noindent This header covers the routine
00051 \verb@LALBarycenter.c@.
00052 
00053 </lalLaTeX> */
00054 
00055 
00056 
00057 #ifndef _LALBARYCENTER_H    /* Protect against double-inclusion */
00058 #define _LALBARYCENTER_H
00059 
00060 #include <stdio.h>
00061 #include <math.h>
00062 #include <lal/LALStdio.h>
00063 #include <lal/LALStdlib.h>
00064 #include <lal/LALConstants.h>
00065 #include <lal/DetectorSite.h>
00066 
00067 #ifdef  __cplusplus
00068 extern "C" {
00069 #endif
00070 
00071 NRCSID (LALBARYCENTERH,"$Id: LALBarycenter.h,v 1.12 2007/06/08 14:41:50 bema Exp $");
00072 
00073 /* <lalErrTable file="LALBarycenterHErrorTable"> */
00074 #define LALBARYCENTERH_ENULL  2
00075 #define LALBARYCENTERH_EOUTOFRANGEE  4
00076 #define LALBARYCENTERH_EOUTOFRANGES  8
00077 #define LALBARYCENTERH_EBADSOURCEPOS 16
00078 
00079 #define LALBARYCENTERH_MSGENULL  "Null input to Barycenter routine."
00080 #define LALBARYCENTERH_MSGEOUTOFRANGEE  "tgps not in range of earth.dat file"
00081 #define LALBARYCENTERH_MSGEOUTOFRANGES  "tgps not in range of sun.dat file"  
00082 #define LALBARYCENTERH_MSGEBADSOURCEPOS "source position not in standard range"
00083 
00084 /* </lalErrTable> */
00085 
00086 /* <lalLaTeX>
00087 \subsection*{Error conditions}
00088 \vspace{0.1in}
00089 \input{LALBarycenterHErrorTable}
00090 </lalLaTeX> */
00091 
00092 
00093 /* Structures. */
00094 
00095 /* <lalLaTeX>
00096 \subsection*{Structures}
00097 
00098 \begin{verbatim}
00099 struct EphemerisFilenames
00100 \end{verbatim}
00101 \idx[Type]{EphemerisFilenames}
00102 \noindent This structure contains two pointers
00103 to data files containing arrays of center-of-mass
00104 positions for the Earth and Sun, respectively.
00105 The tables are derived from the JPL ephemeris.
00106 
00107 \noindent Files tabulate positions for one calendar year 
00108 (actually, a little more than one year, to deal 
00109 with overlaps).  The first line of each table summarizes
00110 what is in it. Subsequent lines give the time (GPS) and the
00111 Earth's position $(x,y,z)$,
00112 velocity $(v_x, v_y, v_z)$, and acceleration $(a_x, a_y, a_z)$
00113 at that instant.  All in units of seconds; e.g. positions have
00114 units of seconds, and accelerations have units 1/sec.
00115 
00116 \begin{description}
00117 \item[\texttt{CHAR *earthEphemeris}] File containing Earth's position. 
00118 
00119 \item[\texttt{CHAR *sunEphemeris}] File containing Sun's position. 
00120 \end{description}
00121 
00122 
00123 \begin{verbatim}
00124 struct EphemerisData
00125 \end{verbatim}
00126 \idx[Type]{EphemerisData}
00127 \noindent This structure contains all information about the
00128 center-of-mass positions of the Earth and Sun, listed at regular
00129 time intervals. The fields are
00130 
00131 \begin{description}
00132 \item[\texttt{EphemerisFilenames ephiles}] Stucture giving names of
00133 the two files containing positions of Earth and Sun, resp., at evenly 
00134 spaced times.
00135 
00136 \item[\texttt{INT2  leap}]  The number of leap seconds that have
00137 been inserted into UTC between Jan. 6, 1980 (= start of GPS calendar) 
00138 and the current time tgps. But it's perfectly OK to approximate this by 
00139 number of leap sec inserted between Jan. 6, 1980 and Jan. 2 of year covered by 
00140 this ephemeris file; e.g. leap = 13 for year 2000.
00141 
00142 \item[\texttt{INT4  nentriesE}]  The number of entries in Earth ephemeris 
00143 table.
00144 
00145 \item[\texttt{INT4  nentriesS}]  The number of entries in Sun ephemeris 
00146 table.
00147 
00148 \item[\texttt{REAL8  dtEtable}]  The spacing in sec. between consecutive
00149 intants in Earth ephemeris table.
00150 
00151 \item[\texttt{REAL8  dtStable}]  The spacing in sec. between consecutive
00152 intants in Sun ephemeris table.
00153 
00154 \item[\texttt{PosVelAcc *ephemE}] Array containing pos,vel,acc. of earth, as
00155 extracted from earth ephem file. Units are sec, 1, 1/sec.
00156 
00157 \item[\texttt{PosVelAcc *ephemS}] Array containing pos,vel,acc. of sun, as
00158 extracted from sun ephem file. Units are sec, 1, 1/sec.
00159 \end{description}
00160   
00161 \begin{verbatim}
00162 struct EarthState
00163 \end{verbatim}
00164 \idx[Type]{EarthState}
00165 \noindent Basic output structure of LALBarycenterEarth.c.
00166 \begin{description}
00167 \item[\texttt{REAL8  einstein}] the einstein delay equiv TDB - TDT 
00168 \item[\texttt{REAL8 deinstein}] d(einstein)/d(tgps) 
00169 
00170 \item[\texttt{REAL8 posNow[3]}] Cartesian coords of Earth's center at tgps, extrapolated from JPL DE405 ephemeris; units= sec.
00171 
00172 \item[\texttt{REAL8 velNow[3]}] dimensionless velocity of Earth's center at 
00173 tgps, extrapolated from JPL DE405 ephemeris 
00174 
00175 \item[\texttt{REAL8 gastRad}] Greenwich Apparent Sidereal Time, 
00176 in radians, at tgps. Its basically the angle thru which Earth has 
00177 spun at given time. gast is like gmst, but has additional correction 
00178 for short-term nutation. 
00179 
00180 \item[\texttt{REAL8 tzeA}] variable describing effect of lunisolar precession, at tgps; see Explan. Supp. Astron. Almanac, pp.104-5.
00181 \item[\texttt{REAL8 zA}] variable describing effect of lunisolar precession, at tgps
00182 \item[\texttt{REAL8 thetaA}] variable describing effect of lunisolar precession, at tgps
00183 \item[\texttt{REAL8 delpsi}] variable describing effect of Earth nutation, at tgps; see Explan. Supp. Astron. Almanac, pp.120. 
00184 \item[\texttt{REAL8 deleps}] variable describing effect of Earth nutation, at tgps
00185 \item[\texttt{REAL8 se[3]}] vector that points from Sun to Earth at instant tgps, in DE405 coords; units = sec 
00186 \item[\texttt{REAL8 dse[3]}] d(se[3])/d(tgps). Dimensionless
00187 \item[\texttt{REAL8 rse}] length of vector se[3]; units = sec 
00188 \item[\texttt{REAL8 drse}] d(rse)/d(tgps); dimensionless 
00189 \end{description}
00190 
00191 \begin{verbatim}
00192 struct BarycenterInput
00193 \end{verbatim}
00194 \idx[Type]{BarycenterInput}
00195 \noindent Basic input structure to LALBarycenter.c.
00196 \begin{description}
00197 \item[\texttt{LIGOTimeGPS  tgps}] input GPS arrival time. 
00198 
00199 \item[\texttt{LALDetector site}] detector site info.  \textbf{NOTE:}
00200 the \verb@site.location@ field must be modified to give the detector
00201 location in units of \emph{seconds} (i.e.\ divide the values normally
00202 stored in \verb@site.location@ by \verb@LAL_C_SI@).
00203 
00204 \item[\texttt{REAL8 alpha}] Source right ascension in ICRS J2000 
00205 coords (radians).
00206 
00207 \item[\texttt{REAL8 delta}] Source declination in ICRS J2000 coords (radians).
00208 
00209 \item[\texttt{REAL8 dInv}] 1/(distance to source), in 1/sec.
00210 \end{description}
00211 
00212 \begin{verbatim}
00213 struct EmissionTime
00214 \end{verbatim}
00215 \idx[Type]{EmissionTime}
00216 \noindent Basic output structure produced by LALBarycenter.c.
00217 \begin{description}
00218 \item[\texttt{  REAL8  deltaT}] $t_e$(TDB) - $t_a$(GPS) (+ constant = ``light-travel-time from source to SSB'') 
00219 
00220 \item[\texttt{  LIGOTimeGPS te}]   pulse emission time $t_e$ in TDB (plus constant =
00221 ``light-travel-time from source to SSB''), in format of LIGOTImeGPS structure.
00222 
00223 \item[\texttt{  REAL8 tDot}]   d(emission time in TDB)/d(arrival time in GPS)  
00224 
00225 \item[\texttt{  REAL8 rDetector[3]}]  Cartesian coords (0=x,1=y,2=z) of 
00226 detector position at $t_a$ (GPS), in ICRS J2000 coords. Units = sec. 
00227 
00228 \item[\texttt{  REAL8 vDetector[3]}] Cartesian coords (0=x,1=y,2=z) of 
00229 detector velocity at $t_a$ (GPS), in ICRS J2000 coords. Dimensionless. 
00230 \end{description}
00231 </lalLaTeX> */
00232 
00233 
00234 /** This structure contains two pointers to data files containing arrays 
00235  * of center-of-mass positions for the Earth and Sun, respectively.
00236  * The tables are derived from the JPL ephemeris.
00237  * 
00238  * Files tabulate positions for one calendar year 
00239  * (actually, a little more than one year, to deal 
00240  * with overlaps).  The first line of each table summarizes
00241  * what is in it. Subsequent lines give the time (GPS) and the
00242  * Earth's position \f$(x,y,z)\f$,
00243  * velocity \f$(v_x, v_y, v_z)\f$, and acceleration \f$(a_x, a_y, a_z)\f$
00244  * at that instant.  All in units of seconds; e.g. positions have
00245  * units of seconds, and accelerations have units 1/sec.
00246  */
00247 typedef struct
00248 {
00249   CHAR *earthEphemeris;         /**< File containing Earth's position.  */
00250   CHAR *sunEphemeris;           /**< File containing Sun's position. */
00251 }
00252 EphemerisFilenames;
00253 
00254 /** Structure holding a REAL8 time, and a position, velocity and 
00255  * acceleration vector. */
00256 typedef struct
00257 {
00258   REAL8 gps;            /**< REAL8 timestamp */
00259   REAL8 pos[3];         /**< position-vector */
00260   REAL8 vel[3];         /**< velocity-vector */
00261   REAL8 acc[3];         /**< acceleration-vector */
00262 }
00263 PosVelAcc;
00264 
00265 /** This structure contains all information about the
00266  * center-of-mass positions of the Earth and Sun, listed at regular
00267  * time intervals. 
00268  */
00269 typedef struct
00270 {
00271   EphemerisFilenames ephiles; /**< Names of the two files containing positions of 
00272                                * Earth and Sun, respectively at evenly spaced times. */
00273   INT2  leap;           /**< The number of leap seconds that have
00274                          * been inserted into UTC between Jan 6, 1980 (= start of GPS calendar) 
00275                          * and the current time tgps. But its perfectly OK to approximate this by 
00276                          * number of leap sec inserted between Jan 6, 1980 and Jan 2 of year 
00277                          * covered by this ephemeris file; eg leap = 13 for year 2000. */
00278   INT4  nentriesE;      /**< The number of entries in Earth ephemeris table. */
00279   INT4  nentriesS;      /**< The number of entries in Sun ephemeris table. */
00280   REAL8 dtEtable;       /**< The spacing in sec between consecutive intants in Earth ephemeris table.*/
00281   REAL8 dtStable;       /**< The spacing in sec between consecutive intants in Sun ephemeris table.*/
00282   PosVelAcc *ephemE;    /**< Array containing pos,vel,acc of earth, as extracted from earth 
00283                          * ephem file. Units are sec, 1, 1/sec respectively */
00284   PosVelAcc *ephemS;    /**< Array with pos, vel and acc for the sun (see ephemE) */
00285 }
00286 EphemerisData;
00287 
00288 /** Basic output structure of LALBarycenterEarth.c.
00289  */
00290 typedef struct
00291 {
00292   REAL8  einstein;      /**<  the einstein delay equiv TDB - TDT */
00293   REAL8 deinstein;      /**< d(einstein)/d(tgps) */
00294 
00295   REAL8 posNow[3];      /**< Cartesian coords of Earth's center at tgps, 
00296                          * extrapolated from JPL DE405 ephemeris; units= sec */
00297   REAL8 velNow[3];      /**< dimensionless velocity of Earth's center at tgps, 
00298                          * extrapolated from JPL DE405 ephemeris */
00299 
00300   REAL8 gmstRad;        /**< Greenwich Mean Sidereal Time (GMST) in radians, at tgps */
00301   REAL8 gastRad;        /**< Greenwich Apparent Sidereal Time, in radians, at tgps;
00302                          * Is basically the angle thru which Earth has spun at 
00303                          * given time; gast is like gmst, but has 
00304                          * additional correction for short-term nutation */
00305 
00306   REAL8 tzeA;           /**< variable describing effect of lunisolar precession, at tgps */
00307   REAL8 zA;             /**< variable describing effect of lunisolar precession, at tgps */
00308   REAL8 thetaA;         /**< variable describing effect of lunisolar precession, at tgps */
00309   REAL8 delpsi;         /**< variable describing effect of Earth nutation, at tgps*/
00310   REAL8 deleps;         /**< variable describing effect of Earth nutation, at tgps*/
00311 
00312   REAL8 se[3];          /**< vector that points from Sun to Earth at instant tgps, 
00313                          * in DE405 coords; units = sec */
00314   REAL8 dse[3];         /**< d(se[3])/d(tgps); Dimensionless */
00315   REAL8 rse;            /**< length of vector se[3]; units = sec */
00316   REAL8 drse;           /**< d(rse)/d(tgps); dimensionless */
00317 }
00318 EarthState;
00319 
00320 /** Basic input structure to LALBarycenter.c.
00321  */
00322 typedef struct
00323 {
00324   LIGOTimeGPS  tgps;    /**< input GPS arrival time. I use tgps (lower case)
00325                          * to remind that here the LAL structure is a
00326                          * field in the larger structure BarycenterInput.
00327                          * I use tGPS as an input structure (by itself) to 
00328                          * LALBarycenterEarth */
00329                        
00330   LALDetector site;     /**< detector site info.  <b>NOTE:</b>
00331                          * the <tt>site.location</tt> field must be modified 
00332                          * to give the detector location in units of 
00333                          * <em>seconds</em> (i.e. divide the values normally
00334                          * stored in <tt>site.location</tt> by <tt>LAL_C_SI</tt> */
00335 
00336   REAL8 alpha;          /**<  Source right ascension in ICRS J2000 coords (radians). */
00337   REAL8 delta;          /**< Source declination in ICRS J2000 coords (radians) */
00338   REAL8 dInv;           /**< 1/(distance to source), in 1/sec. 
00339                          * This is needed to correct Roemer delay for very 
00340                          * nearby sources; correction is about 10 microsec for
00341                          * source at 100 pc */
00342 }
00343 BarycenterInput;
00344 
00345 /**  Basic output structure produced by LALBarycenter.c.
00346  */
00347 typedef struct
00348 {
00349   REAL8 deltaT;         /**< \f$t_e\f$(TDB) - \f$t_a\f$(GPS)  
00350                          * + (light-travel-time from source to SSB) */
00351 
00352   LIGOTimeGPS te;       /**< pulse emission time (TDB); also sometimes called
00353                          * ``arrival time (TDB) of same wavefront at SSB'' */
00354   REAL8 tDot;           /**< d(emission time in TDB)/d(arrival time in GPS)  */
00355 
00356   REAL8 rDetector[3];   /**< Cartesian coords (0=x,1=y,2=z) of detector position
00357                          * at $t_a$ (GPS), in ICRS J2000 coords. Units = sec. */
00358 
00359   REAL8 vDetector[3];   /* Cartesian coords (0=x,1=y,2=z) of detector velocity
00360                          * at \f$t_a\f$ (GPS), in ICRS J2000 coords. Dimensionless. */
00361 }
00362 EmissionTime;
00363 
00364 
00365 /*Curt: probably best to take 1.0 OUT of tDot--ie., output tDot-1. 
00366 But most users would immediately add back the one anyway.
00367 */
00368 
00369 /*Curt: rem te is ``time pulse would arrive at a GPS clock 
00370 way out in empty space, if you renormalized  and zero-ed the latter
00371 to give, on average, the same arrival time as the GPS clock on Earth'' */
00372 
00373 
00374 /* Function prototypes. */
00375 
00376 void LALBarycenterEarth(LALStatus *, EarthState *, const LIGOTimeGPS *, const EphemerisData *);
00377 
00378 void LALBarycenter(LALStatus *, EmissionTime *, const BarycenterInput *, const EarthState *);
00379 
00380 
00381 /********************************************************** <lalLaTeX>
00382 \vfill{\footnotesize\input{LALBarycenterHV}}
00383 \newpage\input{LALBarycenterC}
00384 ******************************************************* </lalLaTeX> */
00385 
00386 /* <lalLaTeX>
00387 \section{Header \texttt{LALInitBarycenter.h}}
00388 
00389 This header and its associated module have been moved into the
00390 \verb@support@ package.
00391 
00392 \newpage\input{LALBarycenterTestC}
00393 </lalLaTeX> */
00394 
00395 #ifdef  __cplusplus
00396 }
00397 #endif      /* Close C++ protection */
00398 
00399 #endif      /* Close double-include protection */

Generated on Sat Sep 6 03:07:06 2008 for LAL by  doxygen 1.5.2