TimeDelay.c

Go to the documentation of this file.
00001 /*
00002  * $Id: TimeDelay.c,v 1.23 2008/04/29 20:14:26 kipp Exp $
00003  *
00004  * Copyright (C) 2007  Jolien Creighton, and David Chin, and Steven
00005  * Fairhurst, and Kipp Cannon, and Alexander Dietz, and Drew Keppel
00006  *
00007  * This program is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU General Public License as published by the
00009  * Free Software Foundation; either version 2 of the License, or (at your
00010  * option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
00015  * Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License along
00018  * with this program; if not, write to the Free Software Foundation, Inc.,
00019  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020  */
00021 
00022 
00023 /* <lalVerbatim file="TimeDelayCV">
00024 
00025 Author: Chin, David <dwchin@umich.edu> +1-734-709-9119, Kipp Cannon <kipp@gravity.phys.uwm.edu>
00026 $Id: TimeDelay.c,v 1.23 2008/04/29 20:14:26 kipp Exp $
00027 
00028 </lalVerbatim> */
00029 
00030 /* <lalLaTeX>
00031 
00032 \subsection{Module \texttt{TimeDelay.c}}
00033 \label{ss:TimeDelay.c}
00034 
00035 Computes difference in arrival time of the same signal at two different
00036 detectors. 
00037 
00038 \subsubsection*{Prototypes}
00039 \vspace{0.1in}
00040 \input{TimeDelayCP}
00041 \idx{LALTimeDelay()}
00042 
00043 
00044 \subsubsection*{Description}
00045 
00046 The function LALTimeDelay() computes the difference in time of arrival of a
00047 signal at two detectors from the same source.  The two detectors and the source
00048 are passed in a \texttt{TwoDetectorsAndASource} structure.  The time delay is
00049 defined to be $\delta t = t_2 - t_1$ where $t_1$ is the time the signal arrives
00050 at the first detector and $t_2$ is the time the signal arrives at the second
00051 detector.
00052 
00053 The function LALTimeDelayFromEarthCenter() Computes difference in arrival time
00054 of the same signal at detector and at center of Earth-fixed frame.  Equivalent
00055 to LALTimeDelay() with detector 1 set to the geocenter.
00056 
00057 The function XLALLightTravelTime() computes the light travel time between two detectors and returns the answer in \texttt{INT8} nanoseconds.
00058 
00059 The function XLALPopulateAccuracyParams creates an instance of InspiralAccuracyList populated with the light-travel times between the detectors, using just the previous function.
00060 The function XLALPopulateAccuracyParamsExt, however, creates an instance of InspiralAccuracyList populated with the \textbf{real} travel time of a putative signal for the given time and the given sky location (in right ascension and declination, both given in degrees).
00061 
00062 \subsubsection*{Algorithm}
00063 
00064 TBA. See Anderson, \textit{et al.} \cite{tools:Anderson:2000} in the mean time.
00065 
00066 Note that GPS time is passed with both the detectors.  The GPS time of the
00067 second detector is \emph{ignored}, and the GPS time for the first detector
00068 is taken to be the time when the signal arrives at the center of the
00069 Earth.  In practice, this time will be the time of detection of a signal at
00070 the first detector, but, as in Anderson, \textit{et al.}, we make this
00071 approximation as it makes little difference.  This time is used to compute
00072 a GMST which gives us the orientation of the Earth.
00073 
00074 \subsubsection*{Uses}
00075 
00076 
00077 \subsubsection*{Notes}
00078 
00079 \vfill{\footnotesize\input{TimeDelayCV}}
00080 
00081 </lalLaTeX> */
00082 
00083 #include <math.h>
00084 #include <lal/LALConstants.h>
00085 #include <lal/LALStdlib.h>
00086 #include <lal/LALError.h>
00087 #include <lal/Date.h>
00088 #include <lal/SkyCoordinates.h>
00089 #include <lal/TimeDelay.h>
00090 #include <lal/XLALError.h>
00091 
00092 NRCSID( TIMEDELAYC, "$Id: TimeDelay.c,v 1.23 2008/04/29 20:14:26 kipp Exp $" );
00093 
00094 /* scalar product of two 3-vectors */
00095 static double dotprod(const double vec1[3], const double vec2[3])
00096 {
00097         return vec1[0] * vec2[0] + vec1[1] * vec2[1] + vec1[2] * vec2[2];
00098 }
00099 
00100 
00101 /* <lalVerbatim file="TimeDelayCP"> */
00102 double
00103 XLALArrivalTimeDiff(
00104         const double detector1_earthfixed_xyz_metres[3],
00105         const double detector2_earthfixed_xyz_metres[3],
00106         const double source_right_ascension_radians,
00107         const double source_declination_radians,
00108         const LIGOTimeGPS *gpstime
00109 )
00110 { /* </lalVerbatim> */
00111         static const char func[] = "XLALArrivalTimeDiff";
00112         double delta_xyz[3];
00113         double ehat_src[3];
00114         const double greenwich_hour_angle = XLALGreenwichMeanSiderealTime(gpstime) - source_right_ascension_radians;
00115 
00116         if(XLAL_IS_REAL8_FAIL_NAN(greenwich_hour_angle))
00117                 XLAL_ERROR_REAL8(func, XLAL_EFUNC);
00118 
00119         /*
00120          * compute the unit vector pointing from the geocenter to the
00121          * source
00122          */
00123 
00124         ehat_src[0] = cos(source_declination_radians) * cos(greenwich_hour_angle);
00125         ehat_src[1] = cos(source_declination_radians) * -sin(greenwich_hour_angle);
00126         ehat_src[2] = sin(source_declination_radians);
00127 
00128         /*
00129          * position of detector 2 with respect to detector 1
00130          */
00131 
00132         delta_xyz[0] = detector2_earthfixed_xyz_metres[0] - detector1_earthfixed_xyz_metres[0];
00133         delta_xyz[1] = detector2_earthfixed_xyz_metres[1] - detector1_earthfixed_xyz_metres[1];
00134         delta_xyz[2] = detector2_earthfixed_xyz_metres[2] - detector1_earthfixed_xyz_metres[2];
00135 
00136         /*
00137          * Arrival time at detector 1 - arrival time at detector 2.  This
00138          * is positive when the wavefront arrives at detector 1 after
00139          * detector 2 (and so t at detector 1 is greater than t at detector
00140          * 2).
00141          */
00142 
00143         return dotprod(ehat_src, delta_xyz) / LAL_C_SI;
00144 }
00145 
00146 
00147 /* <lalVerbatim file="TimeDelayCP"> */
00148 void
00149 LALTimeDelay(
00150         LALStatus *stat,
00151         REAL8 *p_time_diff,
00152         const TwoDetsTimeAndASource *p_dets_time_and_source
00153 )
00154 { /* </lalVerbatim> */
00155         INITSTATUS(stat, "LALTimeDelay", TIMEDELAYC);
00156         ATTATCHSTATUSPTR(stat);
00157         ASSERT(p_time_diff, stat, TIMEDELAYH_ENUL, TIMEDELAYH_MSGENUL);
00158         ASSERT(p_dets_time_and_source, stat, TIMEDELAYH_ENUL, TIMEDELAYH_MSGENUL);
00159 
00160         XLALPrintDeprecationWarning("LALTimeDelay", "XLALArrivalTimeDiff");
00161 
00162         *p_time_diff = -XLALArrivalTimeDiff(p_dets_time_and_source->p_det_and_time1->p_detector->location, p_dets_time_and_source->p_det_and_time2->p_detector->location, p_dets_time_and_source->p_source->longitude, p_dets_time_and_source->p_source->latitude, p_dets_time_and_source->p_det_and_time1->p_gps);
00163 
00164         ASSERT(!XLAL_IS_REAL8_FAIL_NAN(*p_time_diff), stat, DATEH_ERANGEGPSABS, DATEH_MSGERANGEGPSABS);
00165 
00166         DETATCHSTATUSPTR(stat);
00167         RETURN(stat);
00168 }
00169 
00170 
00171 /* <lalVerbatim file="TimeDelayFromEarthCenterCP"> */
00172 double XLALTimeDelayFromEarthCenter(
00173         const double detector_earthfixed_xyz_metres[3],
00174         double source_right_ascension_radians,
00175         double source_declination_radians,
00176         const LIGOTimeGPS *gpstime
00177 )
00178 {/* </lalVerbatim> */
00179         const double earth_center[3] = {0.0, 0.0, 0.0};
00180 
00181         /*
00182          * This is positive when the wavefront arrives at the detector
00183          * after arriving at the geocentre.
00184          */
00185 
00186         return XLALArrivalTimeDiff(detector_earthfixed_xyz_metres, earth_center, source_right_ascension_radians, source_declination_radians, gpstime);
00187 }
00188 
00189 
00190 /* <lalVerbatim file="TimeDelayFromEarthCenterCP"> */
00191 void LALTimeDelayFromEarthCenter(
00192         LALStatus *stat,
00193         REAL8 *p_time_diff,
00194         const DetTimeAndASource *p_det_time_and_source
00195 )
00196 {/* </lalVerbatim> */
00197         INITSTATUS(stat, "LALTimeDelayFromEarthCenter", TIMEDELAYC);
00198         ATTATCHSTATUSPTR(stat);
00199         ASSERT(p_time_diff, stat, TIMEDELAYH_ENUL, TIMEDELAYH_MSGENUL);
00200         ASSERT(p_det_time_and_source, stat, TIMEDELAYH_ENUL, TIMEDELAYH_MSGENUL);
00201 
00202         XLALPrintDeprecationWarning("LALTimeDelayFromEarthCenter", "XLALTimeDelayFromEarthCenter");
00203 
00204         *p_time_diff = XLALTimeDelayFromEarthCenter(p_det_time_and_source->p_det_and_time->p_detector->location, p_det_time_and_source->p_source->longitude, p_det_time_and_source->p_source->latitude, p_det_time_and_source->p_det_and_time->p_gps);
00205 
00206         ASSERT(!XLAL_IS_REAL8_FAIL_NAN(*p_time_diff), stat, DATEH_ERANGEGPSABS, DATEH_MSGERANGEGPSABS);
00207 
00208         DETATCHSTATUSPTR(stat);
00209         RETURN(stat);
00210 }
00211 
00212 
00213 /* <lalVerbatim file="TimeDelayCP"> */
00214 INT8
00215 XLALLightTravelTime(
00216         const LALDetector *aDet,
00217         const LALDetector *bDet
00218 )
00219 /* </lalVerbatim> */
00220 {
00221         double deltaLoc[3];
00222 
00223         deltaLoc[0] = aDet->location[0] - bDet->location[0];
00224         deltaLoc[1] = aDet->location[1] - bDet->location[1];
00225         deltaLoc[2] = aDet->location[2] - bDet->location[2];
00226 
00227         return (INT8) (1e9 * sqrt(dotprod(deltaLoc, deltaLoc)) / LAL_C_SI);
00228 }

Generated on Sun Oct 12 02:32:40 2008 for LAL by  doxygen 1.5.2