34#include <lal/LALStdlib.h>
35#include <lal/LALConstants.h>
36#include <lal/AVFactories.h>
37#include <lal/SeqFactories.h>
38#include <lal/PulsarDataTypes.h>
39#include <lal/LALInitBarycenter.h>
40#include <lal/GeneratePulsarSignal.h>
41#include <lal/Random.h>
42#include <lal/LALString.h>
43#include <lal/UserInput.h>
44#include <lal/LALPulsarVCSInfo.h>
45#include <lal/TranslateAngles.h>
51#define GBT_LOCATION_X 882589.65
52#define GBT_LOCATION_Y -4924872.32
53#define GBT_LOCATION_Z 3943729.348
55#define NARRABRI_LOCATION_X -4752329.7000
56#define NARRABRI_LOCATION_Y 2790505.9340
57#define NARRABRI_LOCATION_Z -3200483.7470
59#define ARECIBO_LOCATION_X 2390490.0
60#define ARECIBO_LOCATION_Y -5564764.0
61#define ARECIBO_LOCATION_Z 1994727.0
63#define NANSHAN_LOCATION_X -228310.702
64#define NANSHAN_LOCATION_Y 4631922.905
65#define NANSHAN_LOCATION_Z 4367064.059
67#define DSS_43_LOCATION_X -4460892.6
68#define DSS_43_LOCATION_Y 2682358.9
69#define DSS_43_LOCATION_Z -3674756.0
71#define PARKES_LOCATION_X -4554231.5
72#define PARKES_LOCATION_Y 2816759.1
73#define PARKES_LOCATION_Z -3454036.3
75#define JODRELL_LOCATION_X 3822252.643
76#define JODRELL_LOCATION_Y -153995.683
77#define JODRELL_LOCATION_Z 5086051.443
79#define VLA_LOCATION_X -1601192.
80#define VLA_LOCATION_Y -5041981.4
81#define VLA_LOCATION_Z 3554871.4
83#define NANCAY_LOCATION_X 4324165.81
84#define NANCAY_LOCATION_Y 165927.11
85#define NANCAY_LOCATION_Z 4670132.83
87#define EFFELSBERG_LOCATION_X 4033949.5
88#define EFFELSBERG_LOCATION_Y 486989.4
89#define EFFELSBERG_LOCATION_Z 4900430.8
91#define JODRELLM4_LOCATION_X 3822252.643
92#define JODRELLM4_LOCATION_Y -153995.683
93#define JODRELLM4_LOCATION_Z 5086051.443
95#define GB300_LOCATION_X 881856.58
96#define GB300_LOCATION_Y -4925311.86
97#define GB300_LOCATION_Z 3943459.70
99#define GB140_LOCATION_X 882872.57
100#define GB140_LOCATION_Y -4924552.73
101#define GB140_LOCATION_Z 3944154.92
103#define GB853_LOCATION_X 882315.33
104#define GB853_LOCATION_Y -4925191.41
105#define GB853_LOCATION_Z 3943414.05
107#define LA_PALMA_LOCATION_X 5327021.651
108#define LA_PALMA_LOCATION_Y -1719555.576
109#define LA_PALMA_LOCATION_Z 3051967.932
111#define Hobart_LOCATION_X -3950077.96
112#define Hobart_LOCATION_Y 2522377.31
113#define Hobart_LOCATION_Z -4311667.52
115#define Hartebeesthoek_LOCATION_X 5085442.780
116#define Hartebeesthoek_LOCATION_Y 2668263.483
117#define Hartebeesthoek_LOCATION_Z -2768697.034
119#define WSRT_LOCATION_X 3828445.659
120#define WSRT_LOCATION_Y 445223.600000
121#define WSRT_LOCATION_Z 5064921.5677
123#define COE_LOCATION_X 0.0
124#define COE_LOCATION_Y 1.0
125#define COE_LOCATION_Z 0.0
231 CHAR TstartMJDstr[2048], TfinishMJDstr[2048], TOAstr[2048];
236 REAL8 TstartUTCMJDtest;
247 unsigned int seed = uvar.randSeed;
248 if ( uvar.randSeed == 0 ) {
255 CHAR *RAJ = NULL, *DECJ = NULL;
277 REAL8toMJD( &TstartUTCMJD, uvar.TstartUTCMJD );
278 XLALPrintInfo(
"TstartUTCMJD=%f converted to MJD days = %d fracdays = %6.12f\n", uvar.TstartUTCMJD, TstartUTCMJD.
days, TstartUTCMJD.
fracdays );
281 TstartUTCMJDtest =
MJDtoREAL8( TstartUTCMJD );
282 diff = uvar.TstartUTCMJD - TstartUTCMJDtest;
283 if ( fabs( diff ) > 1
e-9 ) {
284 fprintf( stderr,
"ERROR : Time conversion gives discrepancy of %e sec. Exiting.\n", diff );
287 XLALPrintInfo(
"MJD conversion gives discrepancies of %e sec\n", diff );
302 if ( strcmp( uvar.Observatory,
"GBT" ) == 0 ) {
306 sprintf( detcode,
"gbt" );
307 }
else if ( strcmp( uvar.Observatory,
"NARRABRI" ) == 0 ) {
311 sprintf( detcode,
"atca" );
312 }
else if ( strcmp( uvar.Observatory,
"ARECIBO" ) == 0 ) {
316 sprintf( detcode,
"ao" );
317 }
else if ( strcmp( uvar.Observatory,
"NANSHAN" ) == 0 ) {
321 sprintf( detcode,
"nanshan" );
322 }
else if ( strcmp( uvar.Observatory,
"DSS_43" ) == 0 ) {
326 sprintf( detcode,
"tid43" );
327 }
else if ( strcmp( uvar.Observatory,
"PARKES" ) == 0 ) {
331 sprintf( detcode,
"pks" );
332 }
else if ( strcmp( uvar.Observatory,
"JODRELL" ) == 0 ) {
336 sprintf( detcode,
"jb" );
337 }
else if ( strcmp( uvar.Observatory,
"VLA" ) == 0 ) {
341 sprintf( detcode,
"vla" );
342 }
else if ( strcmp( uvar.Observatory,
"NANCAY" ) == 0 ) {
346 sprintf( detcode,
"ncy" );
347 }
else if ( strcmp( uvar.Observatory,
"EFFELSBERG" ) == 0 ) {
351 sprintf( detcode,
"eff" );
352 }
else if ( strcmp( uvar.Observatory,
"JODRELLM4" ) == 0 ) {
356 sprintf( detcode,
"jbm4" );
357 }
else if ( strcmp( uvar.Observatory,
"GB300" ) == 0 ) {
361 sprintf( detcode,
"gb300" );
362 }
else if ( strcmp( uvar.Observatory,
"GB140" ) == 0 ) {
366 sprintf( detcode,
"gb140" );
367 }
else if ( strcmp( uvar.Observatory,
"GB853" ) == 0 ) {
371 sprintf( detcode,
"gb853" );
372 }
else if ( strcmp( uvar.Observatory,
"LA_PALMA" ) == 0 ) {
376 sprintf( detcode,
"lap" );
377 }
else if ( strcmp( uvar.Observatory,
"Hobart" ) == 0 ) {
381 sprintf( detcode,
"hob" );
382 }
else if ( strcmp( uvar.Observatory,
"Hartebeesthoek" ) == 0 ) {
386 sprintf( detcode,
"hart" );
387 }
else if ( strcmp( uvar.Observatory,
"WSRT" ) == 0 ) {
391 sprintf( detcode,
"wsrt" );
392 }
else if ( strcmp( uvar.Observatory,
"COE" ) == 0 ) {
396 sprintf( detcode,
"coe" );
397 }
else if ( strcmp( uvar.Observatory,
"SSB" ) != 0 ) {
398 fprintf( stderr,
"ERROR. Unknown Observatory %s. Exiting.\n", uvar.Observatory );
401 XLALPrintInfo(
"selected observatory %s - observatoryt code = %s\n", uvar.Observatory, detcode );
402 XLALPrintInfo(
"baryinput location = %6.12f %6.12f %6.12f\n", baryinput.site.location[0], baryinput.site.location[1], baryinput.site.location[2] );
410 deltaMJD( &MJDdiff, &MJDtest, &TstartUTCMJD );
412 if ( fabs( diff ) > 1
e-9 ) {
413 fprintf( stderr,
"ERROR : Time conversion gives discrepancy of %e sec. Exiting.\n", diff );
416 XLALPrintInfo(
"MJD conversion gives discrepancies of %e sec\n", diff );
428 deltaMJD( &MJDdiff, &MJDtest, &TrefTDBMJD );
430 if ( fabs( diff ) > 1
e-9 ) {
431 fprintf( stderr,
"ERROR : Time conversion gives discrepancy of %e sec. Exiting.\n", diff );
434 XLALPrintInfo(
"MJD conversion gives discrepancies of %e sec\n", diff );
439 site->location[0] = baryinput.site.location[0];
440 site->location[1] = baryinput.site.location[1];
441 site->location[2] = baryinput.site.location[2];
454 temp = uvar.DurationMJD * 86400.0;
464 dt = uvar.DeltaTMJD * 86400.0;
465 n = (
INT4 )ceil( uvar.DurationMJD / uvar.DeltaTMJD );
474 for (
i = 0;
i <
n;
i++ ) {
475 REAL8 dtref, fnow, cyclefrac, dtcor;
491 while ( dtcor > 1
e-9 ) {
494 cyclefrac = fmod( uvar.f0 * dtref + 0.5 * uvar.fdot * dtref * dtref, 1.0 );
498 fnow = uvar.f0 + uvar.fdot * dtref;
502 dtcor = cyclefrac / fnow;
509 TSSB[
i] = TrefSSB_TDB_GPS;
515 for (
i = 0;
i <
n;
i++ ) {
531 if ( fabs( diff ) > 1
e-9 ) {
532 fprintf( stderr,
"ERROR : Time conversion gives discrepancy of %e sec. Exiting.\n", diff );
535 XLALPrintInfo(
"SSB -> detector conversion gives discrepancies of %e sec\n", diff );
548 if ( fabs( diff ) > 1
e-9 ) {
549 fprintf( stderr,
"ERROR. Time conversion gives discrepancy of %e sec. Exiting.\n", diff );
552 XLALPrintInfo(
"MJD time conversion gives discrepancies of %e sec\n", diff );
560 snprintf( tempstr,
sizeof( tempstr ),
"%1.13f", TOA[0].fracdays );
561 tempstr2 = tempstr + 2;
562 snprintf( TstartMJDstr,
sizeof( TstartMJDstr ),
"%d.%s", TOA[0].days, tempstr2 );
563 XLALPrintInfo(
"Converted initial TOA MJD %d %6.12f to the string %s\n", TOA[0].days, TOA[0].fracdays, TstartMJDstr );
565 snprintf( tempstr,
sizeof( tempstr ),
"%1.13f", TOA[
n - 1].fracdays );
566 tempstr2 = tempstr + 2;
567 snprintf( TfinishMJDstr,
sizeof( TfinishMJDstr ),
"%d.%s", TOA[
n - 1].days, tempstr2 );
568 XLALPrintInfo(
"*** Converted MJD to a string %s\n", TfinishMJDstr );
569 XLALPrintInfo(
"Converted final TOA MJD %d %6.12f to the string %s\n", TOA[
n - 1].days, TOA[
n - 1].fracdays, TfinishMJDstr );
572 sprintf(
parfile,
"%s.par", uvar.PSRJ );
573 sprintf( timfile,
"%s.tim", uvar.PSRJ );
576 if ( (
fp = fopen(
parfile,
"w" ) ) == NULL ) {
577 fprintf( stderr,
"ERROR. Could not open file %s. Exiting.\n",
parfile );
583 fprintf(
fp,
"PEPOCH\t%6.12f\n", uvar.TrefTDBMJD );
584 fprintf(
fp,
"POSEPOCH\t%6.12f\n", uvar.TrefTDBMJD );
585 fprintf(
fp,
"DMEPOCH\t%6.12f\n", uvar.TrefTDBMJD );
587 fprintf(
fp,
"F0\t%6.16f\t1\n", uvar.f0 );
588 fprintf(
fp,
"F1\t%6.16f\t0\n", uvar.fdot );
589 fprintf(
fp,
"START\t%s\n", TstartMJDstr );
590 fprintf(
fp,
"FINISH\t%s\n", TfinishMJDstr );
601 if ( (
fp = fopen( timfile,
"w" ) ) == NULL ) {
602 fprintf( stderr,
"ERROR. Could not open file %s. Exiting.\n", timfile );
607 for (
i = 0;
i <
n;
i++ ) {
609 snprintf( tempstr,
sizeof( tempstr ),
"%1.16f", TOA[
i].fracdays );
610 tempstr2 = tempstr + 2;
611 snprintf( TOAstr,
sizeof( TOAstr ),
"%d.%s", TOA[
i].days, tempstr2 );
612 fprintf(
fp,
"blank.dat\t1000.0\t%s\t1.0\t%s\n", TOAstr, detcode );
613 XLALPrintInfo(
"Converting MJD time %d %6.16f to string %s\n", TOA[
i].days, TOA[
i].fracdays, TOAstr );
671 XLALRegisterUvarMember( Observatory,
STRING,
'O', OPTIONAL,
"TEMPO observatory name (GBT,ARECIBO,NARRABRI,NANSHAN,DSS_43,PARKES,JODRELL,VLA,NANCAY,COE,SSB)" );
715 z.
days =
x->days -
y->days;
734 REAL8 fracdays = 0.0;
742 fracdays = fmod(
temp, 1.0 );
762 if ( MJDtemp < 44244. ) {
763 fprintf( stderr,
"Input time is not in range.\n" );
768 Tdiff = MJDtemp + ( 2400000.5 - 2451545.0 );
772 dtrel = 0.0016568 * sin( ( 357.5 + 0.98560028 * Tdiff ) *
LAL_PI_180 ) +
773 0.0000224 * sin( ( 246.0 + 0.90251882 * Tdiff ) *
LAL_PI_180 ) +
774 0.0000138 * sin( ( 355.0 + 1.97121697 * Tdiff ) *
LAL_PI_180 ) +
775 0.0000048 * sin( ( 25.0 + 0.08309103 * Tdiff ) *
LAL_PI_180 ) +
776 0.0000047 * sin( ( 230.0 + 0.95215058 * Tdiff ) *
LAL_PI_180 );
796 REAL8 Tdiff, TDBtoTT;
799 INT4 tempsec, tempnano;
807 if ( MJDtemp < 44244. ) {
808 fprintf( stderr,
"Input time is not in range.\n" );
812 Tdiff = MJDtemp + ( 2400000.5 - 2451545.0 );
817 TDBtoTT = 0.0016568 * sin( ( 357.5 + 0.98560028 * Tdiff ) *
LAL_PI_180 ) +
818 0.0000224 * sin( ( 246.0 + 0.90251882 * Tdiff ) *
LAL_PI_180 ) +
819 0.0000138 * sin( ( 355.0 + 1.97121697 * Tdiff ) *
LAL_PI_180 ) +
820 0.0000048 * sin( ( 25.0 + 0.08309103 * Tdiff ) *
LAL_PI_180 ) +
821 0.0000047 * sin( ( 230.0 + 0.95215058 * Tdiff ) *
LAL_PI_180 );
826 tempsec = ( MJD.
days - 44244 ) * 86400;
853 INT4 tempsec = ( MJD.
days - 44244 ) * 86400 + leap;
901 }
while ( diff >= 2
e-9 );
void LALCheckMemoryLeaks(void)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
static double double delta
#define Hartebeesthoek_LOCATION_Z
#define ARECIBO_LOCATION_X
#define JODRELLM4_LOCATION_X
int main(int argc, char *argv[])
#define LA_PALMA_LOCATION_Y
#define DSS_43_LOCATION_X
#define PARKES_LOCATION_Y
#define NANCAY_LOCATION_Z
#define NANSHAN_LOCATION_X
void AddIntervaltoMJD(double interval, MJDTime *MJDout, MJDTime MJDin)
#define Hobart_LOCATION_Z
void TDBMJDtoGPS(LIGOTimeGPS *GPS, MJDTime MJD)
void GPStoTDBMJD(MJDTime *TDBMJD, LIGOTimeGPS GPS)
#define Hartebeesthoek_LOCATION_Y
#define EFFELSBERG_LOCATION_X
void deltaMJD(MJDTime *deltaMJD, MJDTime *x, MJDTime *y)
int initUserVars(int argc, char *argv[], UserVariables_t *uvar)
register all "user-variables"
#define JODRELLM4_LOCATION_Y
#define DSS_43_LOCATION_Y
#define PARKES_LOCATION_Z
void UTCGPStoMJD(MJDTime *MJD, LIGOTimeGPS *GPS, INT4 leap)
#define NANCAY_LOCATION_X
#define NANSHAN_LOCATION_Y
#define LA_PALMA_LOCATION_Z
int UTCMJDtoGPS(LIGOTimeGPS *GPS, MJDTime MJD, INT4 leap)
void REAL8toMJD(MJDTime *MJD, REAL8 x)
#define NANSHAN_LOCATION_Z
#define NARRABRI_LOCATION_Z
#define PARKES_LOCATION_X
#define JODRELL_LOCATION_Z
#define EFFELSBERG_LOCATION_Z
int vrbflg
defined in lal/lib/std/LALError.c
#define NARRABRI_LOCATION_X
void TDBGPStoMJD(MJDTime *MJD, LIGOTimeGPS GPS, INT4 leap)
#define DSS_43_LOCATION_Z
#define JODRELL_LOCATION_Y
#define NARRABRI_LOCATION_Y
#define EFFELSBERG_LOCATION_Y
#define JODRELLM4_LOCATION_Z
#define NANCAY_LOCATION_Y
#define ARECIBO_LOCATION_Z
#define Hartebeesthoek_LOCATION_X
#define ARECIBO_LOCATION_Y
#define Hobart_LOCATION_X
#define LA_PALMA_LOCATION_X
#define Hobart_LOCATION_Y
REAL8 MJDtoREAL8(MJDTime MJD)
#define JODRELL_LOCATION_X
int XLALConvertGPS2SSB(LIGOTimeGPS *SSBout, LIGOTimeGPS GPSin, const PulsarSignalParams *params)
Convert earth-frame GPS time into barycentric-frame SSB time for given source.
int XLALConvertSSB2GPS(LIGOTimeGPS *GPSout, LIGOTimeGPS SSBin, const PulsarSignalParams *params)
Convert barycentric frame SSB time into earth-frame GPS time.
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 XLALDestroyEphemerisData(EphemerisData *edat)
Destructor for EphemerisData struct, NULL robust.
#define XLAL_INIT_DECL(var,...)
char char * XLALStringDuplicate(const char *s)
COORDINATESYSTEM_EQUATORIAL
int XLALTranslateHMStoRAD(REAL8 *radians, const CHAR *hms)
CHAR * XLALTranslateRADtoHMS(REAL8 radians)
int XLALTranslateDMStoRAD(REAL8 *radians, const CHAR *dms)
CHAR * XLALTranslateRADtoDMS(REAL8 radians)
int XLALGPSLeapSeconds(INT4 gpssec)
int int int XLALPrintInfo(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
Input parameters to GeneratePulsarSignal(), defining the source and the time-series.
SkyPosition position
source location (in radians)
const EphemerisData * ephemerides
Earth and Sun ephemerides.
struct PulsarSignalParams::@3 pulsar
const LALDetector * site
detector location and orientation
CHAR * ephemSun
Sun ephemeris file to use.
INT4 randSeed
allow user to specify random-number seed for reproducible noise-realizations
CHAR * ephemEarth
Earth ephemeris file to use.