22 #include <lal/LALBarycenter.h>
24 #define OBLQ 0.40909280422232891e0; ;
27 typedef struct tagfixed_sky {
35 typedef struct tagfixed_site {
109 if ( !earth || !tGPS || !
edat || !
edat->ephemE || !
edat->ephemS ) {
110 XLALPrintError(
"%s: invalid NULL input 'earth', 'tGPS', 'edat', 'edat->ephemE' or 'edat->ephemS'\n",
__func__ );
117 tinitE =
edat->ephemE[0].gps;
118 tinitS =
edat->ephemS[0].gps;
120 t0e = tgps[0] - tinitE;
121 ientryE = floor( ( t0e /
edat->dtEtable ) + 0.5e0 );
123 t0s = tgps[0] - tinitS;
124 ientryS = floor( ( t0s /
edat->dtStable ) + 0.5e0 );
129 if ( ( ientryE < 0 ) || ( ientryE >=
edat->nentriesE ) ) {
130 XLALPrintError(
"%s: input GPS time %f outside of Earth ephem range [%f, %f]\n",
__func__, tgps[0], tinitE, tinitE +
edat->nentriesE *
edat->dtEtable );
133 if ( ( ientryS < 0 ) || ( ientryS >=
edat->nentriesS ) ) {
134 XLALPrintError(
"%s: input GPS time %f outside of Sun ephem range [%f, %f]\n",
__func__, tgps[0], tinitS, tinitS +
edat->nentriesS *
edat->dtStable );
138 tdiffE = t0e -
edat->dtEtable * ientryE + tgps[1] * 1.e-9;
140 tdiff2E = tdiffE * tdiffE;
142 tdiffS = t0s -
edat->dtStable * ientryS + tgps[1] * 1.e-9;
143 tdiff2S = tdiffS * tdiffS;
158 for (
j = 0;
j < 3;
j++ ) {
159 earth->
posNow[
j] =
pos[
j] + vel[
j] * tdiffE + 0.5 * acc[
j] * tdiff2E;
160 earth->
velNow[
j] = vel[
j] + acc[
j] * tdiffE;
189 INT4 ut1secSince1Jan2000, fullUt1days;
190 REAL8 daysSinceJ2000;
206 ut1secSince1Jan2000 = tuInt - leapsSince2000;
208 tuJC = ( ut1secSince1Jan2000 + tgps[1] * 1.e-9 - 43200 ) / ( 8.64e4 * 36525 );
212 fullUt1days = floor( ut1secSince1Jan2000 / 8.64e4 );
216 tu0JC = ( fullUt1days - 0.5e0 ) / 36525.0;
222 daysSinceJ2000 = ( tuInt - 43200 ) / 8.64e4;
232 gmst0 = 24110.54841e0 + tu0JC * ( 8640184.812866e0 + tu0JC * ( 0.093104e0
233 - tu0JC * 6.2e-6 ) );
248 gmst = gmst0 + dtu * ( 8.64e4 * 36525 + 8640184.812866e0
249 + 0.093104e0 * ( tuJC + tu0JC )
250 - 6.2e-6 * ( tuJC * tuJC + tuJC * tu0JC + tu0JC * tu0JC ) );
252 gmstRad = gmst *
LAL_PI / 43200;
262 earth->
tzeA = tuJC * ( 2306.2181e0 + ( 0.30188e0 + 0.017998e0 * tuJC ) * tuJC )
265 earth->
zA = tuJC * ( 2306.2181e0 + ( 1.09468e0 + 0.018203e0 * tuJC ) * tuJC )
268 earth->
thetaA = tuJC * ( 2004.3109e0 - ( 0.42665e0 + 0.041833 * tuJC ) * tuJC )
287 sin( ( 125.e0 - 0.05295e0 * daysSinceJ2000 ) *
LAL_PI / 180.e0 )
288 - ( 4.e-4 *
LAL_PI / 180.e0 ) *
289 sin( ( 200.9e0 + 1.97129e0 * daysSinceJ2000 ) *
LAL_PI / 180.e0 );
293 cos( ( 125.e0 - 0.05295e0 * daysSinceJ2000 ) *
LAL_PI / 180.e0 )
294 + ( 2.e-4 *
LAL_PI / 180.e0 ) *
295 cos( ( 200.9e0 + 1.97129e0 * daysSinceJ2000 ) *
LAL_PI / 180.e0 );
313 REAL8 jedtdt = -7300.5e0 + ( tgps[0] + 51.184e0 + tgps[1] * 1.e-9 ) / 8.64e4;
314 REAL8 jt = jedtdt / 3.6525e5;
317 1656.674564e0 * sin( 6283.075849991e0 * jt + 6.240054195e0 ) +
318 22.417471e0 * sin( 5753.384884897e0 * jt + 4.296977442e0 ) +
319 13.839792e0 * sin( 12566.151699983e0 * jt + 6.196904410e0 ) +
320 4.770086e0 * sin( 529.690965095e0 * jt + 0.444401603e0 ) +
321 4.676740e0 * sin( 6069.776754553e0 * jt + 4.021195093e0 ) +
322 2.256707e0 * sin( 213.299095438e0 * jt + 5.543113262e0 ) +
323 1.694205e0 * sin( -3.523118349e0 * jt + 5.025132748e0 ) +
324 1.554905e0 * sin( 77713.771467920e0 * jt + 5.198467090e0 ) +
325 1.276839e0 * sin( 7860.419392439e0 * jt + 5.988822341e0 ) +
326 1.193379e0 * sin( 5223.693919802e0 * jt + 3.649823730e0 ) +
327 1.115322e0 * sin( 3930.209696220e0 * jt + 1.422745069e0 ) +
328 0.794185e0 * sin( 11506.769769794e0 * jt + 2.322313077e0 ) +
329 0.447061e0 * sin( 26.298319800e0 * jt + 3.615796498e0 ) +
330 0.435206e0 * sin( -398.149003408e0 * jt + 4.349338347e0 ) +
331 0.600309e0 * sin( 1577.343542448e0 * jt + 2.678271909e0 ) +
332 0.496817e0 * sin( 6208.294251424e0 * jt + 5.696701824e0 ) +
333 0.486306e0 * sin( 5884.926846583e0 * jt + 0.520007179e0 ) +
334 0.432392e0 * sin( 74.781598567e0 * jt + 2.435898309e0 ) +
335 0.468597e0 * sin( 6244.942814354e0 * jt + 5.866398759e0 ) +
336 0.375510e0 * sin( 5507.553238667e0 * jt + 4.103476804e0 )
341 0.243085 * sin( -775.522611324 * jt + 3.651837925 ) +
342 0.173435 * sin( 18849.227549974 * jt + 6.153743485 ) +
343 0.230685 * sin( 5856.477659115 * jt + 4.773852582 ) +
344 0.203747 * sin( 12036.460734888 * jt + 4.333987818 ) +
345 0.143935 * sin( -796.298006816 * jt + 5.957517795 ) +
346 0.159080 * sin( 10977.078804699 * jt + 1.890075226 ) +
347 0.119979 * sin( 38.133035638 * jt + 4.551585768 ) +
348 0.118971 * sin( 5486.777843175 * jt + 1.914547226 ) +
349 0.116120 * sin( 1059.381930189 * jt + 0.873504123 ) +
350 0.137927 * sin( 11790.629088659 * jt + 1.135934669 ) +
351 0.098358 * sin( 2544.314419883 * jt + 0.092793886 ) +
352 0.101868 * sin( -5573.142801634 * jt + 5.984503847 ) +
353 0.080164 * sin( 206.185548437 * jt + 2.095377709 ) +
354 0.079645 * sin( 4694.002954708 * jt + 2.949233637 ) +
355 0.062617 * sin( 20.775395492 * jt + 2.654394814 ) +
356 0.075019 * sin( 2942.463423292 * jt + 4.980931759 ) +
357 0.064397 * sin( 5746.271337896 * jt + 1.280308748 ) +
358 0.063814 * sin( 5760.498431898 * jt + 4.167901731 ) +
359 0.048042 * sin( 2146.165416475 * jt + 1.495846011 ) +
360 0.048373 * sin( 155.420399434 * jt + 2.251573730 )
369 1656.674564e0 * 6283.075849991e0 *
370 cos( 6283.075849991e0 * jt + 6.240054195e0 ) +
372 22.417471e0 * 5753.384884897e0 *
373 cos( 5753.384884897e0 * jt + 4.296977442e0 ) +
375 13.839792e0 * 12566.151699983e0 *
376 cos( 12566.151699983e0 * jt + 6.196904410e0 ) +
382 4.676740e0 * 6069.776754553e0 *
383 cos( 6069.776754553e0 * jt + 4.021195093e0 ) +
393 1.554905e0 * 77713.771467920e0 *
394 cos( 77713.771467920e0 * jt + 5.198467090e0 )
434 ) / ( 8.64e4 * 3.6525e5 );
446 REAL8 *sunPos =
edat->ephemS[ientryS].pos;
447 REAL8 *sunVel =
edat->ephemS[ientryS].vel;
448 REAL8 *sunAcc =
edat->ephemS[ientryS].acc;
449 REAL8 sunPosNow[3], sunVelNow[3];
451 rse2 = earth->
drse = 0.0;
452 for (
j = 0;
j < 3;
j++ ) {
453 sunPosNow[
j] = sunPos[
j] + sunVel[
j] * tdiffS + 0.5 * sunAcc[
j] * tdiff2S;
454 sunVelNow[
j] = sunVel[
j] + sunAcc[
j] * tdiffS;
458 rse2 += earth->
se[
j] * earth->
se[
j];
461 earth->
rse = sqrt( rse2 );
494 earth->
ttype = ttype;
529 if ( !earth || !tGPS || !
edat || !
edat->ephemE || !
edat->ephemS || !
tdat || !
tdat->timeCorrs ) {
530 XLALPrintError(
"%s: invalid NULL input 'earth', 'tGPS', 'edat', 'edat->ephemE', 'edat->ephemS', 'tdat' or 'tdat->timeCorrs'\n",
__func__ );
536 tinitE =
edat->ephemE[0].gps;
537 tinitS =
edat->ephemS[0].gps;
539 t0e = tgps[0] - tinitE;
540 ientryE = floor( ( t0e /
edat->dtEtable ) + 0.5e0 );
542 t0s = tgps[0] - tinitS;
543 ientryS = floor( ( t0s /
edat->dtStable ) + 0.5e0 );
546 if ( ( ientryE < 0 ) || ( ientryE >=
edat->nentriesE ) ) {
547 XLALPrintError(
"%s: input GPS time %f outside of Earth ephem range [%f, %f]\n",
__func__, tgps[0], tinitE, tinitE +
edat->nentriesE *
edat->dtEtable );
550 if ( ( ientryS < 0 ) || ( ientryS >=
edat->nentriesS ) ) {
551 XLALPrintError(
"%s: input GPS time %f outside of Sun ephem range [%f, %f]\n",
__func__, tgps[0], tinitS, tinitS +
edat->nentriesS *
edat->dtStable );
555 tdiffE = t0e -
edat->dtEtable * ientryE + tgps[1] * 1.e-9;
557 tdiff2E = tdiffE * tdiffE;
559 tdiffS = t0s -
edat->dtStable * ientryS + tgps[1] * 1.e-9;
560 tdiff2S = tdiffS * tdiffS;
581 for (
j = 0;
j < 3;
j++ ) {
582 earth->
posNow[
j] = scorr * (
pos[
j] + vel[
j] * tdiffE + 0.5 * acc[
j] * tdiff2E );
583 earth->
velNow[
j] = scorr * ( vel[
j] + acc[
j] * tdiffE );
612 INT4 ut1secSince1Jan2000, fullUt1days;
613 REAL8 daysSinceJ2000;
629 ut1secSince1Jan2000 = tuInt - leapsSince2000;
631 tuJC = ( ut1secSince1Jan2000 + tgps[1] * 1.e-9 - 43200 ) / ( 8.64e4 * 36525 );
635 fullUt1days = floor( ut1secSince1Jan2000 / 8.64e4 );
638 tu0JC = ( fullUt1days - 0.5e0 ) / 36525.0;
644 daysSinceJ2000 = ( tuInt - 43200. ) / 8.64e4;
654 gmst0 = 24110.54841e0 + tu0JC * ( 8640184.812866e0 + tu0JC * ( 0.093104e0 - tu0JC * 6.2e-6 ) );
669 gmst = gmst0 + dtu * ( 8.64e4 * 36525. + 8640184.812866e0
670 + 0.093104e0 * ( tuJC + tu0JC )
671 - 6.2e-6 * ( tuJC * tuJC + tuJC * tu0JC + tu0JC * tu0JC ) );
673 gmstRad = gmst *
LAL_PI / 43200.;
683 earth->
tzeA = tuJC * ( 2306.2181e0 + ( 0.30188e0 + 0.017998e0 * tuJC ) * tuJC )
686 earth->
zA = tuJC * ( 2306.2181e0 + ( 1.09468e0 + 0.018203e0 * tuJC ) * tuJC )
689 earth->
thetaA = tuJC * ( 2004.3109e0 - ( 0.42665e0 + 0.041833 * tuJC ) * tuJC )
707 sin( ( 125.e0 - 0.05295e0 * daysSinceJ2000 ) *
LAL_PI / 180.e0 )
708 - ( 4.e-4 *
LAL_PI / 180.e0 ) *
709 sin( ( 200.9e0 + 1.97129e0 * daysSinceJ2000 ) *
LAL_PI / 180.e0 );
712 cos( ( 125.e0 - 0.05295e0 * daysSinceJ2000 ) *
LAL_PI / 180.e0 )
713 + ( 2.e-4 *
LAL_PI / 180.e0 ) *
714 cos( ( 200.9e0 + 1.97129e0 * daysSinceJ2000 ) *
LAL_PI / 180.e0 );
732 INT4 cidx = floor( ( ( tgps[0] + tgps[1] * 1.e-9 ) -
tdat->timeCorrStart ) /
tdat->dtTtable );
734 if ( cidx < 0 || cidx > (
INT4 )
tdat->nentriesT - 2 ) {
739 REAL8 dtidx = ( tgps[0] + tgps[1] * 1.e-9 ) - (
tdat->timeCorrStart + (
REAL8 )cidx *
tdat->dtTtable );
740 REAL8 grad = (
tdat->timeCorrs[cidx + 1] -
tdat->timeCorrs[cidx] ) /
tdat->dtTtable;
744 REAL8 correctionTT_Teph;
753 earth->
einstein = correctionTT_Teph;
759 REAL8 mjdtt = 44244. + ( ( tgps[0] + tgps[1] * 1.e-9 ) + 51.184 ) / 86400.;
768 REAL8 jedtdt = -7300.5e0 + ( tgps[0] + 51.184e0 + tgps[1] * 1.e-9 ) / 8.64e4;
769 REAL8 jt = jedtdt / 3.6525e5;
776 1656.674564e0 * 6283.075849991e0 * cos( 6283.075849991e0 * jt + 6.240054195e0 ) +
777 22.417471e0 * 5753.384884897e0 * cos( 5753.384884897e0 * jt + 4.296977442e0 ) +
778 13.839792e0 * 12566.151699983e0 * cos( 12566.151699983e0 * jt + 6.196904410e0 ) +
779 4.676740e0 * 6069.776754553e0 * cos( 6069.776754553e0 * jt + 4.021195093e0 ) +
780 1.554905e0 * 77713.771467920e0 * cos( 77713.771467920e0 * jt + 5.198467090e0 )
781 ) / ( 8.64e4 * 3.6525e5 );
791 REAL8 *sunPos =
edat->ephemS[ientryS].pos;
792 REAL8 *sunVel =
edat->ephemS[ientryS].vel;
793 REAL8 *sunAcc =
edat->ephemS[ientryS].acc;
794 REAL8 sunPosNow[3], sunVelNow[3];
796 rse2 = earth->
drse = 0.0;
797 for (
j = 0;
j < 3;
j++ ) {
798 sunPosNow[
j] = scorr * ( sunPos[
j] + sunVel[
j] * tdiffS + 0.5 * sunAcc[
j] * tdiff2S );
799 sunVelNow[
j] = scorr * ( sunVel[
j] + sunAcc[
j] * tdiffS );
803 rse2 += earth->
se[
j] * earth->
se[
j];
806 earth->
rse = sqrt( rse2 );
837 REAL8 longitude, latitude, rd;
851 REAL8 roemer, droemer;
854 REAL8 shapiro, dshapiro;
855 REAL8 finiteDistCorr, dfiniteDistCorr;
862 if ( !emit || !baryinput || !earth ) {
881 s[1] = sinTheta * sin(
alpha );
882 s[0] = sinTheta * cos(
alpha );
900 roemer = droemer = 0.0;
901 for (
j = 0;
j < 3;
j++ ) {
915 for (
j = 0;
j < 3;
j++ ) {
916 obsTerm += obsEarth[
j] * earth->
velNow[
j];
936 REAL8 cosDeltaSinAlphaMinusZA, cosDeltaCosAlphaMinusZA, sinDelta;
939 REAL8 delXNut, delYNut, delZNut, NdotDNut;
942 cosDeltaSinAlphaMinusZA = sin(
alpha + earth->
tzeA ) * cos(
delta );
944 cosDeltaCosAlphaMinusZA = cos(
alpha + earth->
tzeA ) * cos( earth->
thetaA )
957 NdotD = sin( latitude ) * sinDelta + cos( latitude ) * (
958 cos( earth->
gastRad + longitude - earth->
zA ) * cosDeltaCosAlphaMinusZA
959 + sin( earth->
gastRad + longitude - earth->
zA ) * cosDeltaSinAlphaMinusZA );
963 derot =
OMEGA * rd * cos( latitude ) * (
964 - sin( earth->
gastRad + longitude - earth->
zA ) * cosDeltaCosAlphaMinusZA
965 + cos( earth->
gastRad + longitude - earth->
zA ) * cosDeltaSinAlphaMinusZA );
987 + sin(
delta ) * sin( eps0 ) );
996 NdotDNut = sin( latitude ) * delZNut
997 + cos( latitude ) * cos( earth->
gastRad + longitude ) * delXNut
998 + cos( latitude ) * sin( earth->
gastRad + longitude ) * delYNut;
1000 erot = erot + rd * NdotDNut;
1002 derot = derot +
OMEGA * rd * (
1003 -cos( latitude ) * sin( earth->
gastRad + longitude ) * delXNut
1004 + cos( latitude ) * cos( earth->
gastRad + longitude ) * delYNut );
1007 emit->
derot = derot;
1025 REAL8 seDotN, dseDotN, b, db;
1026 REAL8 rsun = 2.322e0;
1027 seDotN = earth->
se[2] * sin(
delta ) + ( earth->
se[0] * cos(
alpha )
1032 b = sqrt( earth->
rse * earth->
rse - seDotN * seDotN );
1033 db = ( earth->
rse * earth->
drse - seDotN * dseDotN ) / b;
1036 if ( ( b < rsun ) && ( seDotN < 0.e0 ) ) {
1038 ( seDotN + sqrt( rsun * rsun + seDotN * seDotN ) ) )
1039 + 19.704e-6 * ( 1.e0 - b / rsun );
1040 dshapiro = - 19.704e-6 * db / rsun;
1043 dshapiro = -9.852e-6 * ( earth->
drse + dseDotN ) / ( earth->
rse + seDotN );
1058 if ( baryinput->
dInv > 1.0e-11 ) {
1059 for (
j = 0;
j < 3;
j++ ) {
1063 finiteDistCorr = -0.5e0 * (
r2 - roemer * roemer ) * baryinput->
dInv;
1064 dfiniteDistCorr = -( 0.5e0 * dr2 - roemer * droemer ) * baryinput->
dInv;
1066 finiteDistCorr = 0.e0;
1067 dfiniteDistCorr = 0.e0;
1081 emit->
deltaT = roemer + erot + obsTerm + earth->
einstein - shapiro + finiteDistCorr;
1083 emit->
tDot = 1.e0 + droemer + derot + earth->
deinstein - dshapiro + dfiniteDistCorr;
1087 if ( ( 1.e-9 * tgps[1] + emit->
deltaT - deltaTint ) >= 1.e0 ) {
1090 + emit->
deltaT - deltaTint - 1.e0 ) );
1094 + emit->
deltaT - deltaTint ) );
1098 for (
j = 0;
j < 3;
j++ ) {
1107 emit->
rDetector[0] += rd * cos( latitude ) * cos( longitude + earth->
gastRad );
1109 sin( longitude + earth->
gastRad );
1110 emit->
rDetector[1] += rd * cos( latitude ) * sin( longitude + earth->
gastRad );
1112 cos( longitude + earth->
gastRad );
1113 emit->
rDetector[2] += rd * sin( latitude );
1139 BarycenterBuffer **buffer
1151 const REAL8 sinEps0 = 0.397777155931914;
1152 const REAL8 cosEps0 = 0.917482062069182;
1163 REAL8 sinAlpha, cosAlpha, sinDelta, cosDelta;
1171 BarycenterBuffer *myBuffer = NULL;
1172 if ( ( buffer ) && ( *buffer ) ) {
1173 myBuffer = ( *buffer );
1181 if ( myBuffer->active && (
alpha == myBuffer->alpha ) && (
delta == myBuffer->delta ) ) {
1182 sinDelta = myBuffer->fixed_sky.sinDelta;
1183 cosDelta = myBuffer->fixed_sky.cosDelta;
1184 sinAlpha = myBuffer->fixed_sky.sinAlpha;
1185 cosAlpha = myBuffer->fixed_sky.cosAlpha;
1186 n[0] = myBuffer->fixed_sky.n[0];
1187 n[1] = myBuffer->fixed_sky.n[1];
1188 n[2] = myBuffer->fixed_sky.n[2];
1196 sinAlpha = sin(
alpha );
1197 cosAlpha = cos(
alpha );
1199 n[0] = cosDelta * cosAlpha;
1200 n[1] = cosDelta * sinAlpha;
1204 myBuffer->alpha =
alpha;
1205 myBuffer->delta =
delta;
1206 myBuffer->fixed_sky.sinDelta = sinDelta;
1207 myBuffer->fixed_sky.cosDelta = cosDelta;
1208 myBuffer->fixed_sky.sinAlpha = sinAlpha;
1209 myBuffer->fixed_sky.cosAlpha = cosAlpha;
1210 myBuffer->fixed_sky.n[0] =
n[0];
1211 myBuffer->fixed_sky.n[1] =
n[1];
1212 myBuffer->fixed_sky.n[2] =
n[2];
1213 myBuffer->active = 1;
1218 REAL8 longitude, latitude;
1219 REAL8 sinLat, cosLat;
1220 REAL8 rd_sinLat, rd_cosLat;
1223 if ( myBuffer->active && ( memcmp( &baryinput->
site, &myBuffer->site,
sizeof( myBuffer->site ) ) == 0 ) ) {
1224 rd = myBuffer->fixed_site.rd;
1225 longitude = myBuffer->fixed_site.longitude;
1226 latitude = myBuffer->fixed_site.latitude;
1227 sinLat = myBuffer->fixed_site.sinLat;
1228 cosLat = myBuffer->fixed_site.cosLat;
1229 rd_sinLat = myBuffer->fixed_site.rd_sinLat;
1230 rd_cosLat = myBuffer->fixed_site.rd_cosLat;
1243 sinLat = sin( latitude );
1244 cosLat = cos( latitude );
1245 rd_sinLat = rd * sinLat;
1246 rd_cosLat = rd * cosLat;
1249 memcpy( &myBuffer->site, &baryinput->
site,
sizeof( myBuffer->site ) );
1250 myBuffer->fixed_site.rd = rd;
1251 myBuffer->fixed_site.longitude = longitude;
1252 myBuffer->fixed_site.latitude = latitude;
1253 myBuffer->fixed_site.sinLat = sinLat;
1254 myBuffer->fixed_site.cosLat = cosLat;
1255 myBuffer->fixed_site.rd_sinLat = rd_sinLat;
1256 myBuffer->fixed_site.rd_cosLat = rd_cosLat;
1257 myBuffer->active = 1;
1280 obsTerm += obsEarth[
j] * earth->
velNow[
j];
1296 REAL8 cosDeltaSinAlphaMinusZA = sinAlphaMinusZA * cosDelta;
1298 REAL8 cosDeltaCosAlphaMinusZA = cosAlphaMinusZA * cosThetaA * cosDelta - sinThetaA * sinDelta;
1300 REAL8 sinDeltaCurt = cosAlphaMinusZA * sinThetaA * cosDelta + cosThetaA * sinDelta;
1311 REAL8 rd_NdotD = rd_sinLat * sinDeltaCurt + rd_cosLat * ( cosGastZA * cosDeltaCosAlphaMinusZA + sinGastZA * cosDeltaSinAlphaMinusZA );
1314 emit->
erot = rd_NdotD;
1315 emit->
derot =
OMEGA * rd_cosLat * ( - sinGastZA * cosDeltaCosAlphaMinusZA + cosGastZA * cosDeltaSinAlphaMinusZA );
1334 REAL8 delXNut = - earth->
delpsi * ( cosDelta * sinAlpha * cosEps0 + sinDelta * sinEps0 );
1336 REAL8 delYNut = cosDelta * cosAlpha * cosEps0 * earth->
delpsi - sinDelta * earth->
deleps;
1338 REAL8 delZNut = cosDelta * cosAlpha * sinEps0 * earth->
delpsi + cosDelta * sinAlpha * earth->
deleps;
1343 REAL8 rd_NdotDNut = rd_sinLat * delZNut + rd_cosLat * cosGastLong * delXNut + rd_cosLat * sinGastLong * delYNut;
1345 emit->
erot += rd_NdotDNut;
1346 emit->
derot +=
OMEGA * ( - rd_cosLat * sinGastLong * delXNut + rd_cosLat * cosGastLong * delYNut );
1364 REAL8 seDotN = earth->
se[2] * sinDelta + ( earth->
se[0] * cosAlpha + earth->
se[1] * sinAlpha ) * cosDelta;
1365 REAL8 dseDotN = earth->
dse[2] * sinDelta + ( earth->
dse[0] * cosAlpha + earth->
dse[1] * sinAlpha ) * cosDelta;
1367 REAL8 b = sqrt( earth->
rse * earth->
rse - seDotN * seDotN );
1368 REAL8 db = ( earth->
rse * earth->
drse - seDotN * dseDotN ) / b;
1371 if ( ( b < rsun ) && ( seDotN < 0 ) ) {
1372 emit->
shapiro = 9.852e-6 * log( (
LAL_AU_SI /
LAL_C_SI ) / ( seDotN + sqrt( rsun * rsun + seDotN * seDotN ) ) ) + 19.704e-6 * ( 1.0 - b / rsun );
1373 emit->
dshapiro = - 19.704e-6 * db / rsun;
1376 emit->
dshapiro = -9.852e-6 * ( earth->
drse + dseDotN ) / ( earth->
rse + seDotN );
1387 REAL8 finiteDistCorr, dfiniteDistCorr;
1389 if ( baryinput->
dInv > 1.0e-11 ) {
1395 dfiniteDistCorr = - ( 0.5 * dr2 - emit->
roemer * emit->
droemer ) * baryinput->
dInv;
1398 dfiniteDistCorr = 0;
1413 if ( ( 1
e-9 * tgps[1] + emit->
deltaT - deltaTint ) >= 1.e0 ) {
1432 emit->
rDetector[0] += rd_cosLat * cosGastLong;
1434 emit->
rDetector[1] += rd_cosLat * sinGastLong;
1441 if ( buffer && ( *buffer == NULL ) ) {
1442 ( *buffer ) = myBuffer;
1445 if ( buffer == NULL ) {
1470 static const REAL8 par_zeta[3] = {2306.2181, 0.30188, 0.017998};
1471 static const REAL8 par_z[3] = {2306.2181, 1.09468, 0.018203};
1472 static const REAL8 par_theta[3] = {2004.3109, -0.42665, -0.041833};
1475 REAL8 czeta, szeta, cz,
sz, ctheta, stheta;
1477 REAL8 nut[3][3], prc[3][3];
1480 const REAL8 ceps = 0.917482062069182;
1481 const REAL8 seps = 0.397777155931914;
1483 t = ( mjd - 51544.5 ) / 36525.0;
1484 trad =
t / seconds_per_rad;
1486 zeta = trad * ( par_zeta[0] +
t * ( par_zeta[1] +
t * par_zeta[2] ) );
1487 z = trad * ( par_z[0] +
t * ( par_z[1] +
t * par_z[2] ) );
1488 theta = trad * ( par_theta[0] +
t * ( par_theta[1] +
t * par_theta[2] ) );
1490 czeta = cos(
zeta );
1491 szeta = sin(
zeta );
1494 ctheta = cos(
theta );
1495 stheta = sin(
theta );
1497 prc[0][0] = czeta * ctheta * cz - szeta *
sz;
1498 prc[1][0] = czeta * ctheta *
sz + szeta * cz;
1499 prc[2][0] = czeta * stheta;
1500 prc[0][1] = -szeta * ctheta * cz - czeta *
sz;
1501 prc[1][1] = -szeta * ctheta *
sz + czeta * cz;
1502 prc[2][1] = -szeta * stheta;
1503 prc[0][2] = -stheta * cz;
1504 prc[1][2] = -stheta *
sz;
1508 nut[0][1] = -dpsi * ceps;
1509 nut[0][2] = -dpsi * seps;
1510 nut[1][0] = -nut[0][1];
1513 nut[2][0] = -nut[0][2];
1514 nut[2][1] = -nut[1][2];
1517 for (
i = 0;
i < 3;
i++ )
1518 for (
j = 0;
j < 3;
j++ ) {
1519 prn[
j][
i] = nut[
i][0] * prc[0][
j] + nut[
i][1] * prc[1][
j] + nut[
i][2] * prc[2][
j];
1547 if ( erad == 0.0 ) {
1550 hlt = asin( det.
location[2] / erad );
1555 static REAL8 siteCoord[3];
1556 REAL8 eeq[3], prn[3][3];
1558 siteCoord[0] = erad * cos( hlt );
1559 siteCoord[1] = siteCoord[0] * tan( hlt );
1560 siteCoord[2] = alng;
1563 REAL8 toblq = ( tmjd - 5.15445e4 ) / 36525.0;
1564 REAL8 oblq = ( ( ( 1.813e-3 * toblq - 5.9e-4 ) * toblq - 4.6815e1 ) * toblq + 84381.448 ) *
LAL_PI_180 / 3600.0;
1566 REAL8 pc = cos( oblq + deps ) * dpsi;
1569 REAL8 ph = gmst +
pc - siteCoord[2];
1572 eeq[0] = siteCoord[0] * cos( ph );
1573 eeq[1] = siteCoord[0] * sin( ph );
1574 eeq[2] = siteCoord[1];
1579 for (
j = 0;
j < 3 ;
j++ ) {
1580 obsEarth[
j] = prn[
j][0] * eeq[0] + prn[
j][1] * eeq[1] + prn[
j][2] * eeq[2];
#define __func__
log an I/O error, i.e.
static double double delta
ParConversion pc[NUM_PARS]
Initialise conversion structure with most allowed TEMPO2 parameter names and conversion functions (co...
#define IFTE_MJD0
Epoch of TCB, TCG and TT in Modified Julian Days.
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...
static void observatoryEarth(REAL8 obsearth[3], const LALDetector det, const LIGOTimeGPS *tgps, REAL8 gmst, REAL8 dpsi, REAL8 deps)
Function to get the observatory site location with respect to the centre of the Earth,...
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...
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...
#define IFTE_LC
Equation 20 of Irwin and Fukushima.
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...
static void precessionMatrix(REAL8 prn[3][3], REAL8 mjd, REAL8 dpsi, REAL8 deps)
Function to calculate the precession matrix give Earth nutation values depsilon and dpsi for a given ...
@ TIMECORRECTION_ORIGINAL
void * XLALCalloc(size_t m, size_t n)
int XLALGPSLeapSeconds(INT4 gpssec)
#define XLAL_CHECK(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
Basic output structure of LALBarycenterEarth.c.
REAL8 velNow[3]
dimensionless velocity of Earth's center at tgps, extrapolated from JPL DE405 ephemeris
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 se[3]
vector that points from Sun to Earth at instant tgps, in DE405 coords; units = sec
REAL8 posNow[3]
Cartesian coords of Earth's center at tgps, extrapolated from JPL DE405 ephemeris; units= sec.
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 dse[3]
d(se[3])/d(tgps); Dimensionless
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 rDetector[3]
Cartesian coords (0=x,1=y,2=z) of detector position at $t_a$ (GPS), in ICRS J2000 coords.
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,...
This structure will contain a vector of time corrections used during conversion from TT to TDB/TCB/Te...
REAL8 latitude
geocentric (not geodetic!!) longitude of detector vertex
REAL8 sinLat
geocentric latitude of detector vertex
REAL8 rd_cosLat
rd * sin(latitude)
REAL8 rd_sinLat
cos(latitude);
REAL8 cosLat
sin(latitude)
REAL8 longitude
distance 'rd' from center of Earth, in light seconds
-------— internal buffer type for optimized Barycentering function -------—
internal (opaque) buffer type for optimized Barycentering function
fixed_site_t fixed_site
buffered detector site
REAL8 delta
buffered sky-location: right-ascension in rad
fixed_sky_t fixed_sky
buffered sky-location: declination in rad
BOOLEAN active
fixed-site buffered quantities
LALDetector site
fixed-sky buffered quantities