Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALBarycenter.h
Go to the documentation of this file.
1/*
2* Copyright (C) 2012 Miroslav Shaltev, R Prix
3* Copyright (C) 2007 Curt Cutler, Jolien Creighton, Reinhard Prix, Teviet Creighton
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation; either version 2 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with with program; see the file COPYING. If not, write to the
17* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18* MA 02110-1301 USA
19*/
20
21#ifndef _LALBARYCENTER_H /* Protect against double-inclusion */
22#define _LALBARYCENTER_H
23
24#include <stdio.h>
25#include <math.h>
26#include <lal/LALStdio.h>
27#include <lal/LALStdlib.h>
28#include <lal/LALConstants.h>
29#include <lal/DetectorSite.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/**
36 * \defgroup LALBarycenter_h Header LALBarycenter.h
37 * \ingroup lalpulsar_general
38 * \author Curt Cutler
39 * \date 2001
40 *
41 * \brief Provides routines for transforming from arrival time at detector (GPS) to pulse emission time (TDB); ie
42 * for ``barycentering'' the measured astronomical time series.
43 *
44 * ### Synopsis ###
45 *
46 * \code
47 * #include <lal/LALInitBarycenter.h>
48 * #include <lal/LALBarycenter.h>
49 * \endcode
50 *
51 */
52/** @{ */
53
54/**
55 * \brief Enumerated type denoting the time system type to be produced in
56 * the solar system barycentring routines.
57 *
58 * The type denotes the time system in which solar system barycentred times
59 * should be given. \c TIMECORRECTION_TDB and \c TIMECORRECTION_TEMPO will mean
60 * times are in the Barycentric Dynamical Time (TDB) system, where the
61 * conversion has been performed using a time correction ephemeris look-up
62 * table as used by TEMPO2 (\c TIMECORRECTION_TEMPO is so-called because the
63 * pulsar timing software TEMPO uses the TDB time system by default); \c
64 * TIMECORRECTION_ORIGINAL will mean times are in the TDB system, but with the
65 * conversion performed using the original \c XLALBarycenterEarth function; and,
66 * \c TIMECORRECTION_TCB and \c TIMECORRECTION_TEMPO2 will mean times are in the
67 * Coordinate Barycentric Time (TCB) system, where the conversion has been
68 * performed using a time correction ephemeris look-up table as used by TEMPO2
69 * (\c TIMECORRECTION_TEMPO2 is so-called because the pulsar timing software
70 * TEMPO2 uses the TCB time system by default).
71 */
72typedef enum tagTimeCorrectionType {
81
82/**
83 * \brief Enumerated type denoting the JPL solar system ephemeris to be used
84 * in calculating barycentre time corrections.
85 */
86typedef enum tagEphemerisType {
95
96/**
97 * \name Constants from Irwin and Fukushima, A&A, 348, 1999 (taken from TEMPO2)
98 * used for ephemeris conversions.
99 */
100/** @{ */
101#define IFTE_JD0 2443144.5003725 /**< Epoch of TCB, TCG and TT in Julian Days */
102#define IFTE_MJD0 43144.0003725 /**< Epoch of TCB, TCG and TT in Modified Julian Days */
103#define IFTE_TEPH0 -65.564518e-6 /**< Equation 17 of Irwin and Fukushima. */
104#define IFTE_LC 1.48082686742e-8 /**< Equation 20 of Irwin and Fukushima. */
105#define IFTE_KM1 1.55051979176e-8 /**< Value of K-1, defined using the IAU definition of L_B = 1.55051976772e-8 and K=1/(1-L_B) (see TEMPO2). */
106#define IFTE_K (((long double)1.0) + ((long double)IFTE_KM1)) /**< Factor relating ephemeris units for time and distance to corresponding SI units, from Eq. 2 of Irwin and Fukushima. */
107/** @} */
108
109#define JPL_AU_DE405 149597870.6910000 /**< Definition of 1 AU from the JPL DE405 ephemeris in km */
110#define JPL_AU_DE200 149597870.6600000 /**< Definition of 1 AU from the JPL DE200 ephemeris in km */
111#define CURT_AU 149597870.6600 /**< 1 AU from create_solar_system_barycenter.c as used in Curt's original routines */
112
113/** Structure holding a REAL8 time, and a position, velocity and acceleration vector. */
114typedef struct tagPosVelAcc {
115 REAL8 gps; /**< REAL8 timestamp */
116 REAL8 pos[3]; /**< position-vector */
117 REAL8 vel[3]; /**< velocity-vector */
118 REAL8 acc[3]; /**< acceleration-vector */
119}
121
122/**
123 * This structure contains all information about the
124 * center-of-mass positions of the Earth and Sun, listed at regular
125 * time intervals.
126 */
127typedef struct tagEphemerisData {
128 CHAR *filenameE; /**< File containing Earth's position. */
129 CHAR *filenameS; /**< File containing Sun's position. */
130
131#ifdef SWIG /* SWIG interface directives */
132 SWIGLAL( ARRAY_1D( EphemerisData, PosVelAcc, ephemE, INT4, nentriesE ) );
133 SWIGLAL( ARRAY_1D( EphemerisData, PosVelAcc, ephemS, INT4, nentriesS ) );
134#endif /* SWIG */
135 INT4 nentriesE; /**< The number of entries in Earth ephemeris table. */
136 INT4 nentriesS; /**< The number of entries in Sun ephemeris table. */
137
138 REAL8 dtEtable; /**< The spacing in sec between consecutive instants in Earth ephemeris table.*/
139 REAL8 dtStable; /**< The spacing in sec between consecutive instants in Sun ephemeris table.*/
140
141 PosVelAcc *ephemE; /**< Array containing pos,vel,acc of earth, as extracted from earth
142 * ephem file. Units are sec, 1, 1/sec respectively */
143 PosVelAcc *ephemS; /**< Array with pos, vel and acc for the sun (see ephemE) */
144
145 EphemerisType etype; /**< The ephemeris type e.g. DE405 */
146}
148
149
150/**
151 * This structure will contain a vector of time corrections
152 * used during conversion from TT to TDB/TCB/Teph
153 */
154typedef struct tagTimeCorrectionData {
155 CHAR *timeEphemeris; /**< File containing the time ephemeris */
156
157 UINT4 nentriesT; /**< The number of entries in Time ephemeris table. */
158 REAL8 dtTtable; /**< The spacing in sec between consecutive instants in Time ephemeris table.*/
159 REAL8 *timeCorrs; /**< Array of time delays for converting TT to TDB/TCB from the Time table (seconds).*/
160 REAL8 timeCorrStart; /**< The initial GPS time of the time delay table. */
162
163
164/**
165 * Basic output structure of LALBarycenterEarth.c.
166 */
167typedef struct tagEarthState {
168 REAL8 einstein; /**< the einstein delay equiv TDB - TDT or TCB - TDT */
169 REAL8 deinstein; /**< d(einstein)/d(tgps) */
170
171 REAL8 posNow[3]; /**< Cartesian coords of Earth's center at tgps,
172 * extrapolated from JPL DE405 ephemeris; units= sec */
173 REAL8 velNow[3]; /**< dimensionless velocity of Earth's center at tgps,
174 * extrapolated from JPL DE405 ephemeris */
175
176 REAL8 gmstRad; /**< Greenwich Mean Sidereal Time (GMST) in radians, at tgps */
177 REAL8 gastRad; /**< Greenwich Apparent Sidereal Time, in radians, at tgps;
178 * Is basically the angle thru which Earth has spun at
179 * given time; gast is like gmst, but has
180 * additional correction for short-term nutation */
181
182 REAL8 tzeA; /**< variable describing effect of lunisolar precession, at tgps */
183 REAL8 zA; /**< variable describing effect of lunisolar precession, at tgps */
184 REAL8 thetaA; /**< variable describing effect of lunisolar precession, at tgps */
185 REAL8 delpsi; /**< variable describing effect of Earth nutation, at tgps*/
186 REAL8 deleps; /**< variable describing effect of Earth nutation, at tgps*/
187
188 REAL8 se[3]; /**< vector that points from Sun to Earth at instant tgps,
189 * in DE405 coords; units = sec */
190 REAL8 dse[3]; /**< d(se[3])/d(tgps); Dimensionless */
191 REAL8 rse; /**< length of vector se[3]; units = sec */
192 REAL8 drse; /**< d(rse)/d(tgps); dimensionless */
193
194 TimeCorrectionType ttype; /**< Time correction type */
195}
197
198/**
199 * Basic input structure to LALBarycenter.c.
200 */
201typedef struct tagBarycenterInput {
202 LIGOTimeGPS tgps; /**< input GPS arrival time. I use tgps (lower case)
203 * to remind that here the LAL structure is a
204 * field in the larger structure BarycenterInput.
205 * I use tGPS as an input structure (by itself) to
206 * LALBarycenterEarth */
207
208 LALDetector site; /**< detector site info. <b>NOTE:</b>
209 * the <tt>site.location</tt> field must be modified
210 * to give the detector location in units of
211 * <em>seconds</em> (i.e. divide the values normally
212 * stored in <tt>site.location</tt> by <tt>LAL_C_SI</tt> */
213
214 REAL8 alpha; /**< Source right ascension in ICRS J2000 coords (radians). */
215 REAL8 delta; /**< Source declination in ICRS J2000 coords (radians) */
216 REAL8 dInv; /**< 1/(distance to source), in 1/sec.
217 * This is needed to correct Roemer delay for very
218 * nearby sources; correction is about 10 microsec for
219 * source at 100 pc */
220}
222
223/*Curt: probably best to take 1.0 OUT of tDot--ie., output tDot-1.
224But most users would immediately add back the one anyway.
225*/
226
227/*Curt: rem te is ``time pulse would arrive at a GPS clock
228way out in empty space, if you renormalized and zero-ed the latter
229to give, on average, the same arrival time as the GPS clock on Earth'' */
230
231/**
232 * Basic output structure produced by LALBarycenter.c.
233 */
234typedef struct tagEmissionTime {
235 REAL8 deltaT; /**< \f$ t_e \f$ (TDB) - \f$ t_a \f$ (GPS)
236 * + (light-travel-time from source to SSB) */
237
238 LIGOTimeGPS te; /**< pulse emission time (TDB); also sometimes called
239 * ``arrival time (TDB) of same wavefront at SSB'' */
240 REAL8 tDot; /**< d(emission time in TDB)/d(arrival time in GPS) */
241
242 REAL8 rDetector[3]; /**< Cartesian coords (0=x,1=y,2=z) of detector position
243 * at $t_a$ (GPS), in ICRS J2000 coords. Units = sec. */
244
245 REAL8 vDetector[3]; /* Cartesian coords (0=x,1=y,2=z) of detector velocity
246 * at \f$ t_a \f$ (GPS), in ICRS J2000 coords. Dimensionless. */
247
248 REAL8 roemer; /**< the Roemer delay */
249 REAL8 droemer; /**< d(Roemer)/d(tgps) */
250
251 REAL8 shapiro; /**< the Shapiro delay */
252 REAL8 dshapiro; /**< d(Shapiro)/d(tgps) */
253
254 REAL8 erot; /**< Earth rotation delay */
255 REAL8 derot; /**< d(erot)/d(tgps) */
256}
258
259
260/// internal (opaque) buffer type for optimized Barycentering function
261typedef struct tagBarycenterBuffer BarycenterBuffer;
262
263/* Function prototypes. */
264int XLALBarycenterEarth( EarthState *earth, const LIGOTimeGPS *tGPS, const EphemerisData *edat );
265int XLALBarycenter( EmissionTime *emit, const BarycenterInput *baryinput, const EarthState *earth );
266int XLALBarycenterOpt( EmissionTime *emit, const BarycenterInput *baryinput, const EarthState *earth, BarycenterBuffer **buffer );
267
268/* Function that uses time delay look-up tables to calculate time delays */
270 const LIGOTimeGPS *tGPS,
271 const EphemerisData *edat,
273 TimeCorrectionType ttype );
274
275/** @} */
276
277#ifdef __cplusplus
278}
279#endif /* Close C++ protection */
280
281#endif /* Close double-include protection */
int XLALBarycenterOpt(EmissionTime *emit, const BarycenterInput *baryinput, const EarthState *earth, BarycenterBuffer **buffer)
Speed optimized version of XLALBarycenter(), should be fully equivalent except for the additional buf...
EphemerisType
Enumerated type denoting the JPL solar system ephemeris to be used in calculating barycentre time cor...
Definition: LALBarycenter.h:86
int XLALBarycenterEarth(EarthState *earth, const LIGOTimeGPS *tGPS, const EphemerisData *edat)
Computes the position and orientation of the Earth, at some arrival time , specified LIGOTimeGPS inp...
Definition: LALBarycenter.c:78
int XLALBarycenter(EmissionTime *emit, const BarycenterInput *baryinput, const EarthState *earth)
Transforms from detector arrival time in GPS (as specified in the LIGOTimeGPS structure) to pulse em...
int XLALBarycenterEarthNew(EarthState *earth, const LIGOTimeGPS *tGPS, const EphemerisData *edat, const TimeCorrectionData *tdat, TimeCorrectionType ttype)
Computes the position and orientation of the Earth, at some arrival time, but unlike XLALBarycenterEa...
TimeCorrectionType
Enumerated type denoting the time system type to be produced in the solar system barycentring routine...
Definition: LALBarycenter.h:72
@ EPHEM_DE405
Definition: LALBarycenter.h:89
@ EPHEM_DE414
Definition: LALBarycenter.h:90
@ EPHEM_DE421
Definition: LALBarycenter.h:91
@ EPHEM_DE200
Definition: LALBarycenter.h:88
@ EPHEM_DE430
Definition: LALBarycenter.h:92
@ EPHEM_LAST
Definition: LALBarycenter.h:93
@ EPHEM_NONE
Definition: LALBarycenter.h:87
@ TIMECORRECTION_TEMPO2
Definition: LALBarycenter.h:77
@ TIMECORRECTION_LAST
Definition: LALBarycenter.h:79
@ TIMECORRECTION_ORIGINAL
Definition: LALBarycenter.h:78
@ TIMECORRECTION_TCB
Definition: LALBarycenter.h:75
@ TIMECORRECTION_NONE
Definition: LALBarycenter.h:73
@ TIMECORRECTION_TDB
Definition: LALBarycenter.h:74
@ TIMECORRECTION_TEMPO
Definition: LALBarycenter.h:76
double REAL8
char CHAR
uint32_t UINT4
int32_t INT4
pos
Basic input structure to LALBarycenter.c.
REAL8 alpha
Source right ascension in ICRS J2000 coords (radians).
REAL8 dInv
1/(distance to source), in 1/sec.
LIGOTimeGPS tgps
input GPS arrival time.
REAL8 delta
Source declination in ICRS J2000 coords (radians)
LALDetector site
detector site info.
Basic output structure of LALBarycenterEarth.c.
TimeCorrectionType ttype
Time correction type.
REAL8 drse
d(rse)/d(tgps); dimensionless
REAL8 rse
length of vector se[3]; units = sec
REAL8 delpsi
variable describing effect of Earth nutation, at tgps
REAL8 einstein
the einstein delay equiv TDB - TDT or TCB - TDT
REAL8 gmstRad
Greenwich Mean Sidereal Time (GMST) in radians, at tgps.
REAL8 zA
variable describing effect of lunisolar precession, at tgps
REAL8 tzeA
variable describing effect of lunisolar precession, at tgps
REAL8 gastRad
Greenwich Apparent Sidereal Time, in radians, at tgps; Is basically the angle thru which Earth has sp...
REAL8 deinstein
d(einstein)/d(tgps)
REAL8 thetaA
variable describing effect of lunisolar precession, at tgps
REAL8 deleps
variable describing effect of Earth nutation, at tgps
Basic output structure produced by LALBarycenter.c.
REAL8 derot
d(erot)/d(tgps)
REAL8 deltaT
(TDB) - (GPS)
REAL8 roemer
the Roemer delay
REAL8 dshapiro
d(Shapiro)/d(tgps)
REAL8 shapiro
the Shapiro delay
REAL8 erot
Earth rotation delay.
LIGOTimeGPS te
pulse emission time (TDB); also sometimes called `‘arrival time (TDB) of same wavefront at SSB’'
REAL8 tDot
d(emission time in TDB)/d(arrival time in GPS)
REAL8 droemer
d(Roemer)/d(tgps)
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
INT4 nentriesE
The number of entries in Earth ephemeris table.
REAL8 dtStable
The spacing in sec between consecutive instants in Sun ephemeris table.
PosVelAcc * ephemE
Array containing pos,vel,acc of earth, as extracted from earth ephem file.
CHAR * filenameE
File containing Earth's position.
INT4 nentriesS
The number of entries in Sun ephemeris table.
EphemerisType etype
The ephemeris type e.g.
REAL8 dtEtable
The spacing in sec between consecutive instants in Earth ephemeris table.
PosVelAcc * ephemS
Array with pos, vel and acc for the sun (see ephemE)
CHAR * filenameS
File containing Sun's position.
Structure holding a REAL8 time, and a position, velocity and acceleration vector.
REAL8 gps
REAL8 timestamp.
This structure will contain a vector of time corrections used during conversion from TT to TDB/TCB/Te...
CHAR * timeEphemeris
File containing the time ephemeris.
REAL8 * timeCorrs
Array of time delays for converting TT to TDB/TCB from the Time table (seconds).
REAL8 timeCorrStart
The initial GPS time of the time delay table.
REAL8 dtTtable
The spacing in sec between consecutive instants in Time ephemeris table.
UINT4 nentriesT
The number of entries in Time ephemeris table.
internal (opaque) buffer type for optimized Barycentering function
Definition: LALBarycenter.c:45