31#include <lal/AVFactories.h>
32#include <lal/PulsarDataTypes.h>
33#include <lal/ExtrapolatePulsarSpins.h>
35#define RELERROR(x, y) fabs( 2.0 * ((x) - (y)) / ( (x) + (y) ) )
45 REAL8 tolerance = 1.0e-12;
46 REAL8 tolerancePhi = 1.0e-6;
52 const LIGOTimeGPS epoch1 = {714180733 + 94608000, 0};
53 const LIGOTimeGPS epoch2 = {714180733 - 94608000, 0};
67 result[0] = 2.809011145986047e+02;
68 result[1] = -4.529256832000000e-07;
69 result[2] = -8.460800000000001e-15;
70 result[3] = -1.000000000000000e-22;
73 printf(
" \n ----- Test1: XLALExtrapolatePulsarSpinsTODO() ----- \n" );
74 printf(
"Input @ tau0 = %d.%09d : [%.10g, %.10g, %.10g, %.10g ]\n",
76 fkdot0[0], fkdot0[1], fkdot0[2], fkdot0[3] );
80 printf(
"Output2@ tau1 = %d.%09d : [%.10g, %.10g, %.10g, %.10g]\n",
82 fkdot1[0], fkdot1[1], fkdot1[2], fkdot1[3] );
84 printf(
"Reference-result: : [%.10g, %.10g, %.10g, %.10g]\n",
85 result[0], result[1], result[2], result[3] );
87 if ( (
RELERROR( fkdot1[0], result[0] ) > tolerance ) ||
88 (
RELERROR( fkdot1[1], result[1] ) > tolerance ) ||
89 (
RELERROR( fkdot1[2], result[2] ) > tolerance ) ||
90 (
RELERROR( fkdot1[3], result[3] ) > tolerance ) ) {
91 XLAL_ERROR_MAIN(
XLAL_ETOL,
"\nRelative error of XLALExtrapolatePulsarSpins() exceeds tolerance of %g \n\n", tolerance );
93 printf(
"\n ==> OK. XLALExtrapolatePulsarSpins() lies within %g of the reference-result!\n", tolerance );
98 REAL8 phi1Result = 3.951107892803490;
104 printf(
"\nExtrapolated phase phi1 = %.16f, Reference-result = %.16f\n",
phi1, phi1Result );
106 XLAL_ERROR_MAIN(
XLAL_ETOL,
"\nRelative error of XLALExtrapolatePulsarPhase() exceeds tolerance of %g \n\n", tolerancePhi );
108 printf(
"\n ==> OK. XLALExtrapolatePulsarPhase() lies within %g of the reference-result!\n", tolerancePhi );
116 range0.
fkdot[0] = fkdot0[0];
117 range0.
fkdot[1] = fkdot0[1];
118 range0.
fkdot[2] = fkdot0[2];
119 range0.
fkdot[3] = fkdot0[3];
132 rangeResult.
fkdot[0] = 3.280495590653952e+02;
133 rangeResult.
fkdot[1] = -1.284283366400000e-06;
134 rangeResult.
fkdot[2] = 1.046080000000000e-14;
135 rangeResult.
fkdot[3] = -2.000000000000000e-22;
138 rangeResult.
fkdotBand[0] = 2.804955906539521e+01;
139 rangeResult.
fkdotBand[1] = 6.421416832000000e-07;
140 rangeResult.
fkdotBand[2] = 1.046080000000000e-14;
141 rangeResult.
fkdotBand[3] = 1.000000000000000e-22;
143 printf(
" \n ----- Test2: XLALExtrapolatePulsarSpinRangeTODO() ----- \n" );
145 printf(
"Input: fkdot = [%.10g, %.10g, %.10g, %.10g ]\n",
147 printf(
"Input: fkdotBand = [%.10g, %.10g, %.10g, %.10g ]\n",
154 printf(
"Output: fkdot = [%.10g, %.10g, %.10g, %.10g ]\n",
156 printf(
"Output: fkdotBand = [%.10g, %.10g, %.10g, %.10g ]\n",
160 printf(
"Octave : fkdot = [%.10g, %.10g, %.10g, %.10g ]\n",
162 printf(
"Octave : fkdotBand = [%.10g, %.10g, %.10g, %.10g ]\n",
180 XLAL_ERROR_MAIN(
XLAL_ETOL,
"\nRelative error of XLALExtrapolatePulsarSpinRange() exceeds tolerance of %g \n", tolerance );
182 printf(
"\n ==> OK. XLALExtrapolatePulsarSpinRange() lies within %g of the reference-result!\n\n", tolerance );
void LALCheckMemoryLeaks(void)
REAL8 PulsarSpins[PULSAR_MAX_SPINS]
Typedef for fixed-size array holding GW frequency and derivatives fk = d^k Freq/dt^k|(tau_ref)
#define XLAL_CHECK_MAIN(assertion,...)
#define XLAL_ERROR_MAIN(...)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
Contains a "spin-range", ie spins and corresponding bands at a given (SSB) reference GPS-time .
PulsarSpins fkdot
Vector of spin-values .
LIGOTimeGPS refTime
SSB reference GPS-time at which spin-range is defined.
PulsarSpins fkdotBand
Vector of spin-bands , MUST be same length as fkdot.