25 #include <lal/SSBtimes.h>
26 #include <lal/AVFactories.h>
29 #include <lal/LALGSL.h>
30 #include <gsl/gsl_roots.h>
37 #define SCALAR(u,v) ((u)[0]*(v)[0] + (u)[1]*(v)[1] + (u)[2]*(v)[2])
273 "Length tSSBIn->DeltaT = %d, while tSSBIn->Tdot = %d\n", numSteps, tSSBIn->
Tdot->
length );
277 if ( ( *tSSBOut ) == NULL ) {
279 }
else if ( ( *tSSBOut ) == tSSBIn ) {
280 binaryTimes = ( *tSSBOut );
282 binaryTimes = ( *tSSBOut );
285 "Length (*tSSBOut)->DeltaT = %d, while tSSBIn->DeltaT = %d\n", binaryTimes->
DeltaT->
length, numSteps );
287 "Length tSSBOut->Tdot = %d, while tSSBIn->Tdot = %d\n", binaryTimes->
Tdot->
length, numSteps );
297 REAL8 sqrtome2 = sqrt( 1.0 -
e *
e );
300 REAL8 sinw = sin( argp );
301 REAL8 cosw = cos( argp );
308 REAL8 A =
n * asini * cosw * sqrtome2 -
e;
311 REAL8 Tp = tp + asini * sinw * ( 1 -
e );
314 REAL8 epsabs = maxPhaseErr / ( Freq * Porb );
318 for (
UINT4 i = 0;
i < numSteps;
i++ ) {
320 REAL8 fracOrb_i = fmod( tSSB_i - Tp, Porb ) / Porb;
321 if ( fracOrb_i < 0 ) {
328 const gsl_root_fsolver_type *
T = gsl_root_fsolver_brent;
329 gsl_root_fsolver *
s = gsl_root_fsolver_alloc(
T );
343 status = gsl_root_fsolver_iterate(
s );
345 E_i = gsl_root_fsolver_root(
s );
346 E_lo = gsl_root_fsolver_x_lower(
s );
347 E_hi = gsl_root_fsolver_x_upper(
s );
348 status = gsl_root_test_interval( E_lo, E_hi, epsabs, epsrel );
350 }
while ( (
status == GSL_CONTINUE ) && ( iter < max_iter ) );
352 XLAL_CHECK(
status == GSL_SUCCESS,
XLAL_EMAXITER,
"Eccentric anomaly: failed to converge to epsabs=%g within %d iterations\n", epsabs, max_iter );
353 gsl_root_fsolver_free(
s );
357 REAL8 sinE = sin( E_i );
358 REAL8 cosE = cos( E_i );
360 REAL8 R = asini * ( sinw * ( cosE -
e ) + cosw * sinE * sqrtome2 );
361 REAL8 dtEM_dtSSB = ( 1.0 -
e * cosE ) / ( 1.0 +
A * cosE -
B * sinE );
364 binaryTimes->
Tdot->
data[
i] *= dtEM_dtSSB;
369 ( *tSSBOut ) = binaryTimes;
385 double diff = -
x0 + ( E +
A * sin( E ) +
B * ( cos( E ) - 1.0 ) );
427 if ( ( *multiSSBOut ) == NULL ) {
430 multiBinaryTimes = ( *multiSSBOut );
432 "Inconsistent length (*multiSSBOut)->length = %d, while multiSSBIn->length = %d\n", ( *multiSSBOut )->length,
numDetectors );
443 ( *multiSSBOut ) = multiBinaryTimes;
543 BarycenterBuffer *bBuffer = NULL;
556 vn[2] = sin(
delta );
558 for (
UINT4 i = 0;
i < numSteps;
i++ ) {
574 baryinput.site = DetectorStates->
detector;
576 baryinput.site.location[1] /=
LAL_C_SI;
577 baryinput.site.location[2] /=
LAL_C_SI;
579 baryinput.alpha =
alpha;
580 baryinput.delta =
delta;
583 for (
UINT4 i = 0;
i < numSteps;
i++ ) {
587 baryinput.tgps = state->
tGPS;
602 baryinput.site = DetectorStates->
detector;
604 baryinput.site.location[1] /=
LAL_C_SI;
605 baryinput.site.location[2] /=
LAL_C_SI;
607 baryinput.alpha =
alpha;
608 baryinput.delta =
delta;
611 for (
UINT4 i = 0;
i < numSteps;
i++ ) {
614 baryinput.tgps = state->
tGPS;
631 for (
UINT4 i = 0;
i < numSteps;
i++ ) {
701 if ( !multiSSB || ( multiSSB->
length == 0 ) ) {
720 for (
i = 0;
i < multiSSB->
length;
i++ ) {
738 out->gpsSeconds =
t.gpsSeconds;
739 out->gpsNanoSeconds =
t.gpsNanoSeconds;
764 if ( !multiSSB || ( multiSSB->
length == 0 ) ) {
783 for (
i = 0;
i < multiSSB->
length;
i++ ) {
801 out->gpsSeconds =
t.gpsSeconds;
802 out->gpsNanoSeconds =
t.gpsNanoSeconds;
853 if ( multiSSB->
data ) {
854 for ( X = 0; X < multiSSB->
length; X ++ ) {
#define __func__
log an I/O error, i.e.
static double double delta
#define SCALAR(u, v)
Simple Euklidean scalar product for two 3-dim vectors in cartesian coords.
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...
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 XLAL_INIT_DECL(var,...)
void * XLALCalloc(size_t m, size_t n)
SSBprecision
The precision in calculating the barycentric transformation.
int XLALEarliestMultiSSBtime(LIGOTimeGPS *out, const MultiSSBtimes *multiSSB, const REAL8 Tsft)
Find the earliest timestamp in a multi-SSB data structure.
MultiSSBtimes * XLALGetMultiSSBtimes(const MultiDetectorStateSeries *multiDetStates, SkyPosition skypos, LIGOTimeGPS refTime, SSBprecision precision)
Multi-IFO version of XLALGetSSBtimes().
const UserChoices SSBprecisionChoices
Static array of all SSBprecision choices, for use by the UserInput module parsing routines.
void XLALDestroyMultiSSBtimes(MultiSSBtimes *multiSSB)
Destroy a MultiSSBtimes structure.
void XLALDestroySSBtimes(SSBtimes *tSSB)
Destroy a SSBtimes structure.
SSBtimes * XLALGetSSBtimes(const DetectorStateSeries *DetectorStates, SkyPosition pos, LIGOTimeGPS refTime, SSBprecision precision)
For a given DetectorStateSeries, calculate the time-differences , and their derivatives .
int XLALAddMultiBinaryTimes(MultiSSBtimes **multiSSBOut, const MultiSSBtimes *multiSSBIn, const PulsarDopplerParams *Doppler)
Multi-IFO version of XLALAddBinaryTimes().
static double gsl_E_solver(double E, void *p)
Function implementing Eq.
int XLALLatestMultiSSBtime(LIGOTimeGPS *out, const MultiSSBtimes *multiSSB, const REAL8 Tsft)
Find the latest timestamp in a multi-SSB data structure.
MultiSSBtimes * XLALDuplicateMultiSSBtimes(const MultiSSBtimes *multiSSB)
Duplicate (ie allocate + copy) an input MultiSSBtimes structure.
int XLALAddBinaryTimes(SSBtimes **tSSBOut, const SSBtimes *tSSBIn, const PulsarDopplerParams *Doppler)
Compute extra time-delays for a CW source in a (Keplerian) binary orbital system.
SSBtimes * XLALDuplicateSSBtimes(const SSBtimes *tSSB)
Duplicate (ie allocate + copy) an input SSBtimes structure.
@ SSBPREC_RELATIVISTIC
detailed relativistic:
@ SSBPREC_RELATIVISTICOPT
optimized relativistic, numerically equivalent to SSBPREC_RELATIVISTIC, but faster
@ SSBPREC_NEWTONIAN
simple Newtonian:
@ SSBPREC_DMOFF
switch off all demodulatoin terms
COORDINATESYSTEM_EQUATORIAL
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
#define XLAL_ERROR_NULL(...)
#define XLAL_CHECK(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_NULL(assertion,...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
int XLALGPSCmp(const LIGOTimeGPS *t0, const LIGOTimeGPS *t1)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
p
RUN ANALYSIS SCRIPT ###.
State-info about position, velocity and LMST of a detector together with corresponding EarthState.
EarthState earthState
EarthState information.
REAL8 rDetector[3]
Cartesian coords of detector position in ICRS J2000.
LIGOTimeGPS tGPS
GPS timestamps corresponding to this entry.
Timeseries of DetectorState's, representing the detector-info at different timestamps.
DetectorState * data
array of DetectorState entries
UINT4 length
total number of entries
LALDetector detector
detector-info corresponding to this timeseries
Basic output structure produced by LALBarycenter.c.
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)
Multi-IFO time-series of DetectorStates.
UINT4 length
number of detectors
DetectorStateSeries ** data
vector of pointers to DetectorStateSeries
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, ...
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'