Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-8a6b96f
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
PulsarTOATest.c
Go to the documentation of this file.
1/* Matt Pitkin 18/10/12
2 Code to check TOA files (generated by TEMPO2) against TOAs calculated from
3 the given parameter file
4
5 Compile with:
6 gcc PulsarTOATest.c -o PulsarTOATest -L${LSCSOFT_LOCATION}/lib -I${LSCSOFT_LOCATION}/include -lm -llalsupport -llal -llalpulsar -std=c99
7 */
8
9#include <stdlib.h>
10#include <stdio.h>
11#include <math.h>
12#include <string.h>
13
14#include <lal/LALStdlib.h>
15#include <lal/LALgetopt.h>
16#include <lal/AVFactories.h>
17#include <lal/LALBarycenter.h>
18#include <lal/LALInitBarycenter.h>
19#include <lal/LALConstants.h>
20#include <lal/Date.h>
21#include <lal/LALString.h>
22
23#include <lal/ReadPulsarParFile.h>
24#include <lal/BinaryPulsarTiming.h>
25
26/* set the allowed error in the phase - 1 degree */
27#define MAX_PHASE_ERR_DEGS 1.0
28
29#define USAGE \
30"Usage: %s [options]\n\n"\
31" --help (-h) display this message\n"\
32" --verbose (-v) display all error messages\n"\
33" --par-file (-p) TEMPO2 parameter (.par) file\n"\
34" --tim-file (-t) TEMPO2 TOA (.tim) file\n"\
35" --ephem (-e) Ephemeris type (DE200, DE405 [default], or DE421)\n"\
36" --clock (-c) Clock correction file (default is none)\n"\
37" --simulated (-s) Set if the TOA file is from simulated data\n\
38 e.g. created with the TEMPO2 'fake' plugin:\n\
39 tempo2 -gr fake -f pulsar.par -ndobs 1 -nobsd 5\n\
40 -start 54832 -end 55562 -ha 8 -randha n -rms 0\n"\
41"\n"
42
43int verbose = 0;
44
45typedef struct tagInputParams {
46 char *parfile;
47 char *timfile;
48 char *ephem;
49 char *clock;
50
53
54void get_input_args( InputParams *pars, int argc, char *argv[] );
55
56int main( int argc, char *argv[] )
57{
58 FILE *fpin = NULL;
59 FILE *fpout = NULL;
60
61 char filestr[256];
62 double radioFreq = 0.0, rf[10000];
63 double TOA[10000];
64 double num1;
65 int telescope;
66 int i = 0, j = 0, k = 0, n = 0, exceedPhaseErr = 0;
67
68 double PPTime[10000]; /* Pulsar proper time - corrected for solar system and binary orbit delay times */
69 const double D = 2.41e-4; /* dispersion constant from TEMPO */
70
71 /* Binary pulsar variables */
75
77
78 /* LAL barycentring variables */
79 BarycenterInput baryinput;
80 EarthState earth;
81 EmissionTime emit;
82 EphemerisData *edat = NULL;
84
85 double MJD_tcorr[10000];
86 double tcorr[10000];
87
88 double T = 0.;
89 double DM;
90 double phase0 = 0.;
91
92 long offset;
93
95
97
98 get_input_args( &par, argc, argv );
99
100 if ( verbose ) {
101 fprintf( stderr, "\n" );
102 fprintf( stderr, "*******************************************************\n" );
103 fprintf( stderr, "** We are assuming that the TOAs where produced with **\n" );
104 fprintf( stderr, "** TEMPO2 and are sited at the Parkes telescope. **\n" );
105 fprintf( stderr, "*******************************************************\n" );
106 }
107 if ( ( fpin = fopen( par.timfile, "r" ) ) == NULL ) {
108 fprintf( stderr, "Error... can't open TOA file!\n" );
109 return 1;
110 }
111
112 /* read in TOA and phase info - assuming in the format output by TEMPO2 .tim
113 file */
114 while ( !feof( fpin ) ) {
115 offset = ftell( fpin );
116 char firstchar[256];
117
118 /* if line starts with FORMAT, MODE, or a C or # then skip it */
119 if ( fscanf( fpin, "%s", firstchar ) != 1 ) {
120 break;
121 }
122 if ( !strcmp( firstchar, "FORMAT" ) || !strcmp( firstchar, "MODE" ) ||
123 firstchar[0] == '#' || firstchar[0] == 'C' ) {
124 if ( fscanf( fpin, "%*[^\n]" ) == EOF ) {
125 break;
126 }
127 continue;
128 } else {
129 fseek( fpin, offset, SEEK_SET );
130
131 /* is data is simulated with TEMPO2 fake plugin then it only has 5 columns */
132 if ( par.simulated ) {
133 fscanf( fpin, "%s%lf%lf%lf%d", filestr, &radioFreq, &TOA[i], &num1, &telescope );
134 } else {
135 char randstr1[256], randstr2[256], randstr3[256];
136 int randnum;
137
138 fscanf( fpin, "%s%lf%lf%lf%d%s%s%s%d", filestr, &radioFreq, &TOA[i], &num1, &telescope, randstr1, randstr2, randstr3, &randnum );
139 }
140 rf[i] = radioFreq;
141
142 i++;
143 }
144 }
145
146 fclose( fpin );
147
148 if ( verbose ) {
149 fprintf( stderr, "I've read in the TOAs\n" );
150 }
151
152 /* read in telescope time corrections from file */
153 if ( par.clock != NULL ) {
154 if ( ( fpin = fopen( par.clock, "r" ) ) == NULL ) {
155 fprintf( stderr, "Error... can't open clock file for reading!\n" );
156 exit( 1 );
157 }
158
159 do {
160 offset = ftell( fpin );
161 char firstchar[256];
162
163 /* if line starts with # then ignore as a comment */
164 fscanf( fpin, "%s", firstchar );
165 if ( firstchar[0] == '#' ) {
166 if ( fscanf( fpin, "%*[^\n]" ) == EOF ) {
167 break;
168 }
169 continue;
170 } else {
171 fseek( fpin, offset, SEEK_SET );
172
173 fscanf( fpin, "%lf%lf", &MJD_tcorr[j], &tcorr[j] );
174 j++;
175 }
176 } while ( !feof( fpin ) );
177
178 fclose( fpin );
179 }
180
181 /* read in binary params from par file */
182 params = XLALReadTEMPOParFile( par.parfile );
183
184 if ( verbose ) {
185 fprintf( stderr, "I've read in the parameter file\n" );
186 }
187
188 /* set telescope location - TEMPO2 defaults to Parkes, so use this x,y,z components are got from tempo */
189 if ( telescope != 7 ) {
190 fprintf( stderr, "Error, TOA file not using the Parkes telescope!\n" );
191 exit( 1 );
192 }
193
194 /* location of the Parkes telescope */
195 baryinput.site.location[0] = -4554231.5 / LAL_C_SI;
196 baryinput.site.location[1] = 2816759.1 / LAL_C_SI;
197 baryinput.site.location[2] = -3454036.3 / LAL_C_SI;
198
199 /* initialise the solar system ephemerides */
200 const char *earthFile = NULL, *sunFile = NULL;
201 if ( par.ephem == NULL ) { /* default to DE405 */
202 earthFile = TEST_PKG_DATA_DIR "earth00-40-DE405.dat.gz";
203 sunFile = TEST_PKG_DATA_DIR "sun00-40-DE405.dat.gz";
204 } else if ( strcmp( par.ephem, "DE200" ) == 0 ) {
205 earthFile = TEST_PKG_DATA_DIR "earth00-40-DE200.dat.gz";
206 sunFile = TEST_PKG_DATA_DIR "sun00-40-DE200.dat.gz";
207 } else if ( strcmp( par.ephem, "DE405" ) == 0 ) {
208 earthFile = TEST_PKG_DATA_DIR "earth00-40-DE405.dat.gz";
209 sunFile = TEST_PKG_DATA_DIR "sun00-40-DE405.dat.gz";
210 } else if ( strcmp( par.ephem, "DE421" ) == 0 ) {
211 earthFile = TEST_PKG_DATA_DIR "earth00-40-DE421.dat.gz";
212 sunFile = TEST_PKG_DATA_DIR "sun00-40-DE421.dat.gz";
213 } else {
214 XLAL_ERROR_MAIN( XLAL_EINVAL, "Invalid ephem='%s', allowed are 'DE200', 'DE405' or 'DE421'\n", par.ephem );
215 }
216
217 edat = XLALInitBarycenter( earthFile, sunFile );
218
219 if ( verbose ) {
220 fprintf( stderr, "I've set up the ephemeris files\n" );
221 }
222
223 if ( verbose ) {
224 fpout = fopen( "pulsarPhase.txt", "w" );
225 }
226
227 DM = PulsarGetREAL8ParamOrZero( params, "DM" );
228
229 if ( PulsarCheckParam( params, "PX" ) ) {
230 baryinput.dInv = ( 3600. / LAL_PI_180 ) * PulsarGetREAL8Param( params, "PX" ) /
232 } else {
233 baryinput.dInv = 0.0; /* no parallax */
234 }
235
236 CHAR *units = NULL;
237 if ( PulsarCheckParam( params, "UNITS" ) ) {
238 units = XLALStringDuplicate( PulsarGetStringParam( params, "UNITS" ) );
239 }
240 if ( units == NULL ) {
241 ttype = TIMECORRECTION_TEMPO2;
242 } else if ( !strcmp( units, "TDB" ) ) {
243 ttype = TIMECORRECTION_TDB;
244 } else if ( !strcmp( units, "TCB" ) ) {
245 ttype = TIMECORRECTION_TCB; /* same as TYPE_TEMPO2 */
246 } else {
247 ttype = TIMECORRECTION_TEMPO2; /*default */
248 }
249 XLALFree( units );
250
251 /* read in the time correction file */
252 const char *tcFile = NULL;
253 if ( ttype == TIMECORRECTION_TEMPO2 || ttype == TIMECORRECTION_TCB ) {
254 tcFile = TEST_PKG_DATA_DIR "te405_2000-2019.dat.gz";
255 } else if ( ttype == TIMECORRECTION_TDB ) {
256 tcFile = TEST_PKG_DATA_DIR "tdb_2000-2019.dat.gz";
257 }
258
259 tdat = XLALInitTimeCorrections( tcFile );
260
261 const REAL8Vector *f0s = PulsarGetREAL8VectorParam( params, "F" );
262 REAL8Vector *f0update = XLALCreateREAL8Vector( f0s->length );
263
264 /* check for glitch parameters */
265 REAL8 *glep = NULL, *glph = NULL, *glf0 = NULL, *glf1 = NULL, *glf2 = NULL, *glf0d = NULL, *gltd = NULL;
266 UINT4 glnum = 0;
267 if ( PulsarCheckParam( params, "GLEP" ) ) {
268 const REAL8Vector *gleppars = PulsarGetREAL8VectorParam( params, "GLEP" );
269 glnum = gleppars->length;
270
271 /* get epochs */
272 glep = XLALCalloc( glnum, sizeof( REAL8 ) ); /* initialise to zeros */
273 for ( j = 0; j < ( INT4 )gleppars->length; j++ ) {
274 glep[j] = gleppars->data[j];
275 }
276
277 /* get phase offsets */
278 glph = XLALCalloc( glnum, sizeof( REAL8 ) ); /* initialise to zeros */
279 if ( PulsarCheckParam( params, "GLPH" ) ) {
280 const REAL8Vector *glpars = PulsarGetREAL8VectorParam( params, "GLPH" );
281 for ( j = 0; j < ( INT4 )glpars->length; j++ ) {
282 glph[j] = glpars->data[j];
283 }
284 }
285
286 /* get frequencies offsets */
287 glf0 = XLALCalloc( glnum, sizeof( REAL8 ) ); /* initialise to zeros */
288 if ( PulsarCheckParam( params, "GLF0" ) ) {
289 const REAL8Vector *glpars = PulsarGetREAL8VectorParam( params, "GLF0" );
290 for ( j = 0; j < ( INT4 )glpars->length; j++ ) {
291 glf0[j] = glpars->data[j];
292 }
293 }
294
295 /* get frequency derivative offsets */
296 glf1 = XLALCalloc( glnum, sizeof( REAL8 ) ); /* initialise to zeros */
297 if ( PulsarCheckParam( params, "GLF1" ) ) {
298 const REAL8Vector *glpars = PulsarGetREAL8VectorParam( params, "GLF1" );
299 for ( j = 0; j < ( INT4 )glpars->length; j++ ) {
300 glf1[j] = glpars->data[j];
301 }
302 }
303
304 /* get second frequency derivative offsets */
305 glf2 = XLALCalloc( glnum, sizeof( REAL8 ) ); /* initialise to zeros */
306 if ( PulsarCheckParam( params, "GLF2" ) ) {
307 const REAL8Vector *glpars = PulsarGetREAL8VectorParam( params, "GLF2" );
308 for ( j = 0; j < ( INT4 )glpars->length; j++ ) {
309 glf2[j] = glpars->data[j];
310 }
311 }
312
313 /* get decaying frequency component offset derivative */
314 glf0d = XLALCalloc( glnum, sizeof( REAL8 ) ); /* initialise to zeros */
315 if ( PulsarCheckParam( params, "GLF0D" ) ) {
316 const REAL8Vector *glpars = PulsarGetREAL8VectorParam( params, "GLF0D" );
317 for ( j = 0; j < ( INT4 )glpars->length; j++ ) {
318 glf0d[j] = glpars->data[j];
319 }
320 }
321
322 /* get decaying frequency component decay time constant */
323 gltd = XLALCalloc( glnum, sizeof( REAL8 ) ); /* initialise to zeros */
324 if ( PulsarCheckParam( params, "GLTD" ) ) {
325 const REAL8Vector *glpars = PulsarGetREAL8VectorParam( params, "GLTD" );
326 for ( j = 0; j < ( INT4 )glpars->length; j++ ) {
327 gltd[j] = glpars->data[j];
328 }
329 }
330 }
331
332 for ( j = 0; j < i; j++ ) {
333 double t; /* DM for current pulsar - make more general */
334 double deltaD_f2;
335 double phase;
336 double tt0;
337 double phaseWave = 0., tWave = 0., phaseGlitch = 0.;
338 double taylorcoeff = 1.;
339
340 if ( par.clock != NULL ) {
341 while ( MJD_tcorr[k] < TOA[j] ) {
342 k++;
343 }
344
345 /* linearly interpolate between corrections */
346 double grad = ( tcorr[k] - tcorr[k - 1] ) / ( MJD_tcorr[k] - MJD_tcorr[k - 1] );
347
348 t = ( TOA[j] - 44244. ) * 86400. + ( tcorr[k - 1] + grad * ( TOA[j] - MJD_tcorr[k - 1] ) );
349 } else {
350 t = ( TOA[j] - 44244.0 ) * 86400.0;
351 }
352
353 /* convert time from UTC to GPS reference */
354 t += ( double )XLALGPSLeapSeconds( ( UINT4 )t );
355
356 /* set pulsar position */
357 REAL8 posepoch = PulsarGetREAL8ParamOrZero( params, "POSEPOCH" );
358 baryinput.delta = PulsarGetREAL8ParamOrZero( params, "DECJ" ) + PulsarGetREAL8ParamOrZero( params, "PMDEC" ) * ( t - posepoch );
359 baryinput.alpha = PulsarGetREAL8ParamOrZero( params, "RAJ" ) + PulsarGetREAL8ParamOrZero( params, "PMRA" ) * ( t - posepoch ) / cos( baryinput.delta );
360
361 /* recalculate the time delay at the dedispersed time */
362 XLALGPSSetREAL8( &baryinput.tgps, t );
363
364 /* calculate solar system barycentre time delay */
365 XLALBarycenterEarthNew( &earth, &baryinput.tgps, edat, tdat, ttype );
366 XLALBarycenter( &emit, &baryinput, &earth );
367
368 /* correct to infinite observation frequency for dispersion measure */
369 rf[j] = rf[j] + rf[j] * ( 1. - emit.tDot );
370
371 deltaD_f2 = DM / ( D * rf[j] * rf[j] );
372 t -= deltaD_f2; /* dedisperse times */
373
374 /* calculate binary barycentre time delay */
375 input.tb = t + ( double )emit.deltaT;
376
377 if ( PulsarCheckParam( params, "BINARY" ) ) {
379
380 PPTime[j] = t + ( ( double )emit.deltaT + output.deltaT );
381 } else {
382 PPTime[j] = t + ( double )emit.deltaT;
383 }
384
385 if ( j == 0 ) {
386 T = PPTime[0] - PulsarGetREAL8ParamOrZero( params, "PEPOCH" );
387 for ( k = 0; k < ( INT4 )f0s->length; k++ ) {
388 f0update->data[k] = f0s->data[k];
389 REAL8 Tupdate = T;
390 taylorcoeff = 1.;
391 for ( n = k + 1; n < ( INT4 )f0s->length; n++ ) {
392 taylorcoeff /= ( REAL8 )( n - k );
393 f0update->data[k] += taylorcoeff * f0s->data[n] * Tupdate;
394 Tupdate *= T;
395 }
396 }
397 }
398
399 tt0 = PPTime[j] - PPTime[0];
400
401 if ( PulsarCheckParam( params, "WAVE_OM" ) ) {
402 REAL8 dtWave = ( XLALGPSGetREAL8( &emit.te ) - PulsarGetREAL8ParamOrZero( params, "WAVEEPOCH" ) ) / 86400.;
403 REAL8 om = PulsarGetREAL8ParamOrZero( params, "WAVE_OM" );
404
405 const REAL8Vector *waveSin = PulsarGetREAL8VectorParam( params, "WAVESIN" );
406 const REAL8Vector *waveCos = PulsarGetREAL8VectorParam( params, "WAVECOS" );
407
408 for ( k = 0; k < ( INT4 )waveSin->length; k++ ) {
409 tWave += waveSin->data[k] * sin( om * ( REAL8 )( k + 1. ) * dtWave ) + waveCos->data[k] * cos( om * ( REAL8 )( k + 1. ) * dtWave );
410 }
411 phaseWave = f0s->data[0] * tWave;
412 }
413
414 /* if glitches are present add on effects of glitch phase */
415 if ( glnum > 0 ) {
416 for ( k = 0; k < ( INT4 )glnum; k++ ) {
417 if ( PPTime[j] >= glep[k] ) {
418 REAL8 dtg = 0, expd = 1.;
419 dtg = PPTime[j] - glep[k]; /* time since glitch */
420 if ( gltd[k] != 0. ) {
421 expd = exp( -dtg / gltd[k] ); /* decaying part of glitch */
422 }
423
424 /* add glitch phase - based on equations in formResiduals.C of TEMPO2 from Eqn 1 of Yu et al (2013) http://ukads.nottingham.ac.uk/abs/2013MNRAS.429..688Y */
425 phaseGlitch += glph[k] + glf0[k] * dtg + 0.5 * glf1[k] * dtg * dtg + ( 1. / 6. ) * glf2[k] * dtg * dtg * dtg + glf0d[k] * gltd[k] * ( 1. - expd );
426 }
427 }
428 }
429
430 phase = 0., taylorcoeff = 1.;
431 REAL8 tt0update = tt0;
432 for ( k = 0; k < ( INT4 )f0update->length; k++ ) {
433 taylorcoeff /= ( REAL8 )( k + 1 );
434 phase += taylorcoeff * f0update->data[k] * tt0update;
435 tt0update *= tt0;
436 }
437
438 phase = fmod( phase + phaseWave + phaseGlitch + 0.5, 1.0 ) - 0.5;
439
440 if ( j == 0 ) {
441 phase0 = phase; /* get first phase */
442 }
443
444 if ( verbose ) {
445 fprintf( fpout, "%.9lf\t%lf\n", tt0, phase - phase0 );
446 }
447
448 /* check the phase error (in degrees) */
449 if ( fabs( phase - phase0 ) * 360. > MAX_PHASE_ERR_DEGS ) {
450 exceedPhaseErr = 1;
451 }
452 }
453
454 if ( verbose ) {
455 fclose( fpout );
456 }
457
458 if ( exceedPhaseErr ) {
459 return 1; /* phase difference is too great, so fail */
460 }
461
462 // ----- clean up memory
465 XLALFree( par.parfile );
466 XLALFree( par.timfile );
467 XLALFree( par.ephem );
468 XLALFree( par.clock );
469 XLALDestroyREAL8Vector( f0update );
470
471 if ( glnum > 0 ) {
472 XLALFree( glph );
473 XLALFree( glep );
474 XLALFree( glf0 );
475 XLALFree( glf1 );
476 XLALFree( glf2 );
477 XLALFree( glf0d );
478 XLALFree( gltd );
479 }
480
482
484
485 return 0;
486
487} // main()
488
489void get_input_args( InputParams *pars, int argc, char *argv[] )
490{
491 struct LALoption long_options[] = {
492 { "help", no_argument, 0, 'h' },
493 { "par-file", required_argument, 0, 'p' },
494 { "tim-file", required_argument, 0, 't' },
495 { "ephemeris", required_argument, 0, 'e' },
496 { "clock", required_argument, 0, 'c' },
497 { "simulated", no_argument, 0, 's' },
498 { "verbose", no_argument, NULL, 'v' },
499 { 0, 0, 0, 0 }
500 };
501
502 char args[] = "hp:t:e:c:sv";
503 char *program = argv[0];
504
505 pars->parfile = NULL;
506 pars->timfile = NULL;
507 pars->ephem = NULL;
508 pars->clock = NULL;
509
510 pars->simulated = 0;
511
512 /* get input arguments */
513 while ( 1 ) {
514 int option_index = 0;
515 int c;
516
517 c = LALgetopt_long( argc, argv, args, long_options, &option_index );
518 if ( c == -1 ) { /* end of options */
519 break;
520 }
521
522 switch ( c ) {
523 case 0: /* if option set a flag, nothing else to do */
524 if ( long_options[option_index].flag ) {
525 break;
526 } else
527 fprintf( stderr, "Error parsing option %s with argument %s\n",
528 long_options[option_index].name, LALoptarg );
529 /* fallthrough */
530 case 'h': /* help message */
531 fprintf( stderr, USAGE, program );
532 exit( 0 );
533 case 'v': /* verbose output */
534 verbose = 1;
535 break;
536 case 'p': /* par file */
538 break;
539 case 't': /* TEMPO2 timing file */
541 break;
542 case 'e': /* ephemeris (DE405/DE200) */
544 break;
545 case 'c': /* clock file */
547 break;
548 case 's': /* simulated data */
549 pars->simulated = 1;
550 break;
551 case '?':
552 fprintf( stderr, "unknown error while parsing options\n" );
553 /* fallthrough */
554 default:
555 fprintf( stderr, "unknown error while parsing options\n" );
556 }
557 }
558
559 if ( pars->parfile == NULL ) {
560 fprintf( stderr, "Error... no .par file supplied!\n" );
561 exit( 1 );
562 }
563
564 if ( pars->timfile == NULL ) {
565 fprintf( stderr, "Error... no .tim file supplied!\n" );
566 exit( 1 );
567 }
568}
void XLALBinaryPulsarDeltaTNew(BinaryPulsarOutput *output, BinaryPulsarInput *input, PulsarParameters *params)
function to calculate the binary system delay using new parameter structure
const char * program
int j
int k
void LALCheckMemoryLeaks(void)
#define c
int LALgetopt_long(int argc, char *const *argv, const char *options, const struct LALoption *long_options, int *opt_index)
char * LALoptarg
#define no_argument
#define required_argument
#define D(j)
int verbose
Definition: PulsarTOATest.c:43
int main(int argc, char *argv[])
Definition: PulsarTOATest.c:56
#define USAGE
Definition: PulsarTOATest.c:29
#define MAX_PHASE_ERR_DEGS
Definition: PulsarTOATest.c:27
void get_input_args(InputParams *pars, int argc, char *argv[])
const REAL8Vector * PulsarGetREAL8VectorParam(const PulsarParameters *pars, const CHAR *name)
Return a REAL8Vector parameter.
REAL8 PulsarGetREAL8ParamOrZero(const PulsarParameters *pars, const CHAR *name)
Return a REAL8 parameter if it exists, otherwise return zero.
int PulsarCheckParam(const PulsarParameters *pars, const CHAR *name)
Check for the existence of the parameter name in the PulsarParameters structure.
PulsarParameters * XLALReadTEMPOParFile(const CHAR *pulsarAndPath)
Read in the parameters from a TEMPO(2) parameter file into a PulsarParameters structure.
REAL8 PulsarGetREAL8Param(const PulsarParameters *pars, const CHAR *name)
Return a REAL8 parameter.
const CHAR * PulsarGetStringParam(const PulsarParameters *pars, const CHAR *name)
Return a string parameter.
void PulsarFreeParams(PulsarParameters *pars)
Function to free memory from pulsar parameters.
const char * name
Definition: SearchTiming.c:93
#define fscanf
#define fprintf
TimeCorrectionData * XLALInitTimeCorrections(const CHAR *timeCorrectionFile)
An XLAL interface for reading a time correction file containing a table of values for converting betw...
EphemerisData * XLALInitBarycenter(const CHAR *earthEphemerisFile, const CHAR *sunEphemerisFile)
XLAL interface to reading ephemeris files 'earth' and 'sun', and return ephemeris-data in old backwar...
void XLALDestroyTimeCorrectionData(TimeCorrectionData *tcd)
Destructor for TimeCorrectionData struct, NULL robust.
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...
void XLALDestroyEphemerisData(EphemerisData *edat)
Destructor for EphemerisData struct, NULL robust.
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
@ TIMECORRECTION_TEMPO2
Definition: LALBarycenter.h:77
@ TIMECORRECTION_TCB
Definition: LALBarycenter.h:75
@ TIMECORRECTION_TDB
Definition: LALBarycenter.h:74
#define LAL_LYR_SI
#define LAL_PI_180
#define LAL_PC_SI
double REAL8
char CHAR
uint32_t UINT4
int32_t INT4
void * XLALCalloc(size_t m, size_t n)
void XLALFree(void *p)
char char * XLALStringDuplicate(const char *s)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
int XLALGPSLeapSeconds(INT4 gpssec)
XLALErrorHandlerType * XLALSetErrorHandler(XLALErrorHandlerType *newHandler)
#define XLAL_ERROR_MAIN(...)
void XLALExitErrorHandler(const char *func, const char *file, int line, int errnum)
XLAL_EINVAL
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
T
n
def phase(point, coeffs, params, ignoreintcheck=False)
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.
structure containing the input parameters for the binary delay function
REAL8 tb
Time of arrival (TOA) at the SSB.
structure containing the output parameters for the binary delay function
Basic output structure of LALBarycenterEarth.c.
Basic output structure produced by LALBarycenter.c.
REAL8 deltaT
(TDB) - (GPS)
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)
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
char * parfile
Definition: PulsarTOATest.c:46
char * timfile
Definition: PulsarTOATest.c:47
char * ephem
Definition: PulsarTOATest.c:48
char * clock
Definition: PulsarTOATest.c:49
REAL8 location[3]
int * flag
The PulsarParameters structure to contain a set of pulsar parameters.
REAL8 * data
This structure will contain a vector of time corrections used during conversion from TT to TDB/TCB/Te...