24#include <lal/LALPulsarVCSInfo.h>
25#include <lal/ComputeFstat.h>
26#include <lal/LALgetopt.h>
27#include <lal/LALInitBarycenter.h>
28#include <lal/FindRoot.h>
29#include <lal/UserInput.h>
49#define GPS2REAL8(gps) (1.0 * (gps).gpsSeconds + 1.e-9 * (gps).gpsNanoSeconds )
60typedef struct tagBinaryOrbitParams {
79main(
int argc,
char *argv[] )
100 REAL8 startTimeREAL8 = 714180733;
103 char earthEphem[] = TEST_PKG_DATA_DIR
"earth00-40-DE405.dat.gz";
104 char sunEphem[] = TEST_PKG_DATA_DIR
"sun00-40-DE405.dat.gz";
131 const char *sites[3] = {
"H1",
"L1",
"V1" };
138 XLAL_CHECK( det != NULL,
XLAL_EFUNC,
"XLALGetSiteInfo ('%s') failed for detector X=%d\n", sites[X], X );
139 multiIFO.
sites[X] = ( *det );
174 memset( &doppler, 0,
sizeof( doppler ) );
175 doppler.
fkdot[0] = 100;
176 doppler.
tp = orbit.
tp;
184 REAL8 err_DeltaT, err_Tdot;
189 XLALPrintWarning(
"INFO: err(DeltaT) = %g, err(Tdot) = %g\n", err_DeltaT, err_Tdot );
191 XLAL_CHECK( err_DeltaT < tolerance,
XLAL_ETOL,
"error(DeltaT) = %g exceeds tolerance of %g\n", err_DeltaT, tolerance );
192 XLAL_CHECK( err_Tdot < tolerance,
XLAL_ETOL,
"error(Tdot) = %g exceeds tolerance of %g\n", err_Tdot, tolerance );
224 REAL8 max_DeltaT = 0;
229 REAL8 DeltaT_X, Tdot_X;
231 max_DeltaT =
fmax( max_DeltaT, DeltaT_X );
232 max_Tdot =
fmax( max_Tdot, Tdot_X );
235 ( *err_DeltaT ) = max_DeltaT;
236 ( *err_Tdot ) = max_Tdot;
257 UINT4 numSteps =
t1->DeltaT->length;
262 REAL8 max_DeltaT = 0;
265 for (
UINT4 i = 0;
i < numSteps;
i ++ ) {
266 REAL8 DeltaT_i = fabs(
t1->DeltaT->data[
i] -
t2->DeltaT->data[
i] );
267 REAL8 Tdot_i = fabs(
t1->Tdot->data[
i] -
t2->Tdot->data[
i] );
269 max_DeltaT =
fmax( max_DeltaT, DeltaT_i );
270 max_Tdot =
fmax( max_Tdot, Tdot_i );
274 ( *err_DeltaT ) = max_DeltaT;
275 ( *err_Tdot ) = max_Tdot;
285#define COMPUTEFSTATC_ENULL 1
286#define COMPUTEFSTATC_ENONULL 2
287#define COMPUTEFSTATC_EINPUT 3
288#define COMPUTEFSTATC_EMEM 4
289#define COMPUTEFSTATC_EXLAL 5
290#define COMPUTEFSTATC_EIEEE 6
292#define COMPUTEFSTATC_MSGENULL "Arguments contained an unexpected null pointer"
293#define COMPUTEFSTATC_MSGENONULL "Output pointer is non-NULL"
294#define COMPUTEFSTATC_MSGEINPUT "Invalid input"
295#define COMPUTEFSTATC_MSGEMEM "Out of memory. Bad."
296#define COMPUTEFSTATC_MSGEXLAL "XLAL function call failed"
297#define COMPUTEFSTATC_MSGEIEEE "Floating point failure"
333 numSteps = DetectorStates->
length;
348 Porb = binaryparams->
period;
349 e = binaryparams->
ecc;
350 asini = binaryparams->
asini;
351 sinw = sin( binaryparams->
argp );
352 cosw = cos( binaryparams->
argp );
357 A = (
LAL_TWOPI / Porb ) * cosw * asini * sqrt( 1.0 -
e *
e ) -
e;
360 REAL8 Tp = tp + asini * sinw * ome;
366 for (
i = 0;
i < numSteps;
i++ ) {
369 tSSB_now = refTimeREAL8 + ( tSSB->
DeltaT->
data[
i] );
390 tBinary->
DeltaT->
data[
i] = tSSB->
DeltaT->
data[
i] - ( asini * sinw * ( cos( E ) -
e ) + asini * cosw * sqrt( 1.0 -
e *
e ) * sin( E ) );
393 tBinary->
Tdot->
data[
i] = tSSB->
Tdot->
data[
i] * ( ( 1.0 -
e * cos( E ) ) / ( 1.0 +
A * cos( E ) -
B * sin( E ) ) );
417 ( *tr ) = - ( *(
REAL8 * )x0 ) + ( lE +
A * sin( lE ) +
B * ( cos( lE ) - 1.0 ) );
451 if ( ( ret =
LALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
465 BinarytimesX = ret->
data[X];
474 if (
status->statusPtr->statusCode ) {
475 XLALPrintError(
"\nCall to LALGetBinarytimes() has failed ... \n\n" );
490 ABORT(
status, -1,
"LALGetMultiBinarytimes failed" );
493 ( *multiBinary ) = ret;
int main(int argc, char *argv[])
int XLALCompareMultiSSBtimes(REAL8 *err_DeltaT, REAL8 *err_Tdot, const MultiSSBtimes *m1, const MultiSSBtimes *m2)
Compare 2 MultiSSBtimes vectors and return the maximal difference in DeltaT in s, and in Tdot (dimens...
static void LALGetBinarytimes(LALStatus *, SSBtimes *tBinary, const SSBtimes *tSSB, const DetectorStateSeries *DetectorStates, const BinaryOrbitParams *binaryparams, LIGOTimeGPS refTime)
For a given OrbitalParams, calculate the time-differences , and their derivatives .
#define COMPUTEFSTATC_MSGENULL
int XLALCompareSSBtimes(REAL8 *err_DeltaT, REAL8 *err_Tdot, const SSBtimes *t1, const SSBtimes *t2)
Compare 2 SSBtimes vectors and return the maximal difference in DeltaT in s, and in Tdot (dimensionle...
#define COMPUTEFSTATC_EMEM
#define COMPUTEFSTATC_MSGEMEM
static void LALGetMultiBinarytimes(LALStatus *, MultiSSBtimes **multiBinary, const MultiSSBtimes *multiSSB, const MultiDetectorStateSeries *multiDetStates, const BinaryOrbitParams *binaryparams, LIGOTimeGPS refTime)
Multi-IFO version of LALGetBinarytimes().
#define COMPUTEFSTATC_ENONULL
#define COMPUTEFSTATC_MSGEINPUT
#define COMPUTEFSTATC_MSGENONULL
static void EccentricAnomoly(LALStatus *status, REAL8 *tr, REAL8 lE, void *x0)
For a given set of binary parameters we solve the following function for the eccentric anomoly E.
#define COMPUTEFSTATC_ENULL
#define COMPUTEFSTATC_EINPUT
void LALCheckMemoryLeaks(void)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
#define ABORT(statusptr, code, mesg)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
void XLALDestroyMultiDetectorStateSeries(MultiDetectorStateSeries *mdetStates)
Helper function to get rid of a multi-IFO DetectorStateSeries Note, this is "NULL-robust" in the sens...
MultiDetectorStateSeries * XLALGetMultiDetectorStates(const MultiLIGOTimeGPSVector *multiTS, const MultiLALDetector *multiIFO, const EphemerisData *edat, REAL8 tOffset)
Get the detector-time series for the given MultiLIGOTimeGPSVector.
void LALDBracketRoot(LALStatus *status, DFindRootIn *inout, void *params)
void LALDBisectionFindRoot(LALStatus *status, REAL8 *root, DFindRootIn *input, void *params)
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,...)
void * XLALCalloc(size_t m, size_t n)
const LALDetector * XLALGetSiteInfo(const CHAR *name)
Find the site geometry-information 'LALDetector' for given a detector name (or prefix).
LIGOTimeGPSVector * XLALMakeTimestamps(LIGOTimeGPS tStart, REAL8 Tspan, REAL8 Tsft, REAL8 Toverlap)
Given a start-time, Tspan, Tsft and Toverlap, returns a list of timestamps covering this time-stretch...
void XLALDestroyMultiTimestamps(MultiLIGOTimeGPSVector *multiTS)
Destroy a MultiLIGOTimeGPSVector timestamps vector.
MultiSSBtimes * XLALGetMultiSSBtimes(const MultiDetectorStateSeries *multiDetStates, SkyPosition skypos, LIGOTimeGPS refTime, SSBprecision precision)
Multi-IFO version of XLALGetSSBtimes().
void XLALDestroyMultiSSBtimes(MultiSSBtimes *multiSSB)
Destroy a MultiSSBtimes structure.
int XLALAddMultiBinaryTimes(MultiSSBtimes **multiSSBOut, const MultiSSBtimes *multiSSBIn, const PulsarDopplerParams *Doppler)
Multi-IFO version of XLALAddBinaryTimes().
@ SSBPREC_RELATIVISTICOPT
optimized relativistic, numerically equivalent to SSBPREC_RELATIVISTIC, but faster
COORDINATESYSTEM_EQUATORIAL
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
#define XLAL_CHECK(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
void(* function)(LALStatus *s, REAL8 *y, REAL8 x, void *p)
Timeseries of DetectorState's, representing the detector-info at different timestamps.
UINT4 length
total number of entries
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
Multi-IFO time-series of DetectorStates.
UINT4 length
number of detectors
DetectorStateSeries ** data
vector of pointers to DetectorStateSeries
array of detectors definitions 'LALDetector'
UINT4 length
number of detectors
LALDetector sites[PULSAR_MAX_DETECTORS]
array of site information
A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
Multi-IFO container for SSB timings.
SSBtimes ** data
array of SSBtimes (pointers)
UINT4 length
number of IFOs
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
REAL8 period
Binary: orbital period (sec)
LIGOTimeGPS tp
Binary: time of observed periapsis passage (in SSB)
PulsarSpins fkdot
Intrinsic spins: [Freq, f1dot, f2dot, ... ] where fkdot = d^kFreq/dt^k.
REAL8 ecc
Binary: orbital eccentricity.
REAL8 asini
Binary: projected, normalized orbital semi-major axis (s).
REAL8 argp
Binary: argument of periapsis (radians)
Simple container for two REAL8-vectors, namely the SSB-timings DeltaT_alpha and Tdot_alpha,...
REAL8Vector * Tdot
dT/dt : time-derivative of SSB-time wrt local time for SFT-alpha
REAL8Vector * DeltaT
Time-difference of SFT-alpha - tau0 in SSB-frame.
LIGOTimeGPS refTime
reference-time 'tau0'