29 #include <gsl/gsl_block.h>
30 #include <gsl/gsl_vector.h>
31 #include <gsl/gsl_matrix.h>
32 #include <gsl/gsl_linalg.h>
33 #include <gsl/gsl_blas.h>
34 #include <gsl/gsl_integration.h>
35 #include <gsl/gsl_eigen.h>
37 #include <lal/GetEarthTimes.h>
38 #include <lal/ComputeFstat.h>
39 #include <lal/XLALGSL.h>
40 #include <lal/Factorial.h>
41 #include <lal/LogPrintf.h>
42 #include <lal/MetricUtils.h>
44 #include <lal/FstatisticTools.h>
45 #include <lal/UniversalDopplerMetric.h>
46 #include <lal/MetricUtils.h>
48 #include <lal/GSLHelpers.h>
60 #define POW2(a) ( (a) * (a) )
61 #define POW3(a) ( (a) * (a) * (a) )
62 #define POW4(a) ( (a) * (a) * (a) * (a) )
63 #define POW5(a) ( (a) * (a) * (a) * (a) * (a) )
68 #define SCALE_R (LAL_AU_SI)
69 #define SCALE_T (LAL_YRSID_SI)
81 #define DETMOTION_NAMES(orbit_type, spin_orbit_name, nospin_orbit_name) \
82 {DETMOTION_SPIN | orbit_type, "spin" spin_orbit_name}, \
83 {DETMOTION_SPINZ | orbit_type, "spinz" spin_orbit_name}, \
84 {DETMOTION_SPINXY | orbit_type, "spinxy" spin_orbit_name}, \
85 {orbit_type, nospin_orbit_name}
91 #undef DETMOTION_NAMES
98 const char *
const name;
139 [
DOPPLERCOORD_ASINI] = {
"asini", 1,
"Projected semimajor axis of binary orbit in small-eccentricy limit (ELL1 model) [Units: light seconds]."},
140 [
DOPPLERCOORD_TASC] = {
"tasc", 1,
"Time of ascension (neutron star crosses line of nodes moving away from observer) for binary orbit (ELL1 model) [Units: GPS seconds]."},
141 [
DOPPLERCOORD_PORB] = {
"porb", 1,
"Period of binary orbit (ELL1 model) [Units: s]."},
142 [
DOPPLERCOORD_KAPPA] = {
"kappa", 1,
"Lagrange parameter 'kappa = ecc * cos(argp)', ('ecc' = eccentricity, 'argp' = argument of periapse) of binary orbit (ELL1 model) [Units: none]."},
143 [
DOPPLERCOORD_ETA] = {
"eta", 1,
"Lagrange parameter 'eta = ecc * sin(argp) of binary orbit (ELL1 model) [Units: none]."},
145 [
DOPPLERCOORD_DASC] = {
"dasc", 1,
"Distance traversed on the arc of binary orbit (ELL1 model) 'dasc = 2 * pi * (ap/porb) * tasc' [Units: light second]."},
146 [
DOPPLERCOORD_VP] = {
"vp", 1,
"Rescaled (by asini) differential-coordinate 'dvp = asini * dOMEGA', ('OMEGA' = 2 * pi/'porb') of binary orbit (ELL1 model) [Units: (light second)/(GPS second)]."},
147 [
DOPPLERCOORD_KAPPAP] = {
"kappap", 1,
"Rescaled (by asini) differential-coordinate 'dkappap = asini * dkappa' [Units: light seconds]."},
148 [
DOPPLERCOORD_ETAP] = {
"etap", 1,
"Rescaled (by asini) differential-coordinate 'detap = asini * deta' [Units: light seconds]."}
157 #define GET_COORD_ID(coordSys, coord) ( (coord) >= 0 ? (coordSys)->coordIDs[(coord)] : DOPPLERCOORD_NONE )
160 #define GET_COORD_NAME(coordSys, coord) ( (coord) >= 0 ? DopplerCoordinates[GET_COORD_ID(coordSys, coord)].name : "(none)" )
161 #define GET_COORD_SCALE(coordSys, coord) ( (coord) >= 0 ? DopplerCoordinates[GET_COORD_ID(coordSys, coord)].scale : 1.0 )
164 #define COPY_VECT(dst,src) do { (dst)[0] = (src)[0]; (dst)[1] = (src)[1]; (dst)[2] = (src)[2]; } while(0)
167 #define DOT_VECT(u,v) ((u)[0]*(v)[0] + (u)[1]*(v)[1] + (u)[2]*(v)[2])
170 #define CROSS_VECT_0(u,v) ((u)[1]*(v)[2] - (u)[2]*(v)[1])
171 #define CROSS_VECT_1(u,v) ((u)[2]*(v)[0] - (u)[0]*(v)[2])
172 #define CROSS_VECT_2(u,v) ((u)[0]*(v)[1] - (u)[1]*(v)[0])
173 #define CROSS_VECT(x,u,v) do { (x)[0] = CROSS_VECT_0(u,v); (x)[1] = CROSS_VECT_1(u,v); (x)[2] = CROSS_VECT_2(u,v); } while (0)
176 #define ZERO_VECT(v) do{ (v)[0] = 0; (v)[1] = 0; (v)[2] = 0; } while(0)
177 #define NORMSQ_VECT(v) DOT_VECT(v,v)
178 #define NORM_VECT(v) sqrt(NORMSQ_VECT(v))
179 #define MULT_VECT(v,lam) do{ (v)[0] *= (lam); (v)[1] *= (lam); (v)[2] *= (lam); } while(0)
180 #define ADD_VECT(dst,src) do { (dst)[0] += (src)[0]; (dst)[1] += (src)[1]; (dst)[2] += (src)[2]; } while(0)
181 #define SUB_VECT(dst,src) do { (dst)[0] -= (src)[0]; (dst)[1] -= (src)[1]; (dst)[2] -= (src)[2]; } while(0)
184 #define EQU_VECT_TO_ECL(dst,src) do { \
185 (dst)[0] = (src)[0]; \
186 (dst)[1] = (src)[1]*LAL_COSIEARTH + (src)[2]*LAL_SINIEARTH; \
187 (dst)[2] = (src)[2]*LAL_COSIEARTH - (src)[1]*LAL_SINIEARTH; \
191 #define ECL_VECT_TO_EQU(dst,src) do { \
192 (dst)[0] = (src)[0]; \
193 (dst)[1] = (src)[1]*LAL_COSIEARTH - (src)[2]*LAL_SINIEARTH; \
194 (dst)[2] = (src)[2]*LAL_COSIEARTH + (src)[1]*LAL_SINIEARTH; \
197 #define SQUARE(x) ((x) * (x))
200 #define GPS2REAL8(gps) (1.0 * (gps).gpsSeconds + 1.e-9 * (gps).gpsNanoSeconds )
202 #define MYMAX(a,b) ( (a) > (b) ? (a) : (b) )
203 #define MYMIN(a,b) ( (a) < (b) ? (a) : (b) )
205 #define RELERR(dx,x) ( (x) == 0 ? (dx) : ( (dx) / (x) ) )
208 #define MAX_SPDNORDER 4
211 #define DERIV5P_1(pm2,pm1,p0,pp1,pp2,h) ( ( (pm2) - 8.0 * (pm1) + 8.0 * (pp1) - (pp2)) / ( 12.0 * (h) ) )
212 #define DERIV5P_2(pm2,pm1,p0,pp1,pp2,h) ( (-(pm2) + 16.0 * (pm1) - 30.0 * (p0) + 16.0 * (pp1) - (pp2) ) / ( 12.0 * (h) * (h) ) )
213 #define DERIV5P_3(pm2,pm1,p0,pp1,pp2,h) ( (-(pm2) + 2.0 * (pm1) - 2.0 * (pp1) + (pp2) ) / ( 2.0 * (h) * (h) * (h) ) )
214 #define DERIV5P_4(pm2,pm1,p0,pp1,pp2,h) ( ( (pm2) - 4.0 * (pm1) + 6.0 * (p0) - 4.0 * (pp1) + (pp2) ) / ( (h) * (h) * (h) * (h) ) )
255 #define rOrb_c (LAL_AU_SI / LAL_C_SI)
256 #define rEarth_c (LAL_REARTH_SI / LAL_C_SI)
257 #define vOrb_c (LAL_TWOPI * LAL_AU_SI / LAL_C_SI / LAL_YRSID_SI)
288 gsl_function integrand;
289 double epsrel =
params->epsrel;
290 double epsabs =
params->epsabs;
291 const size_t limit = 512;
292 gsl_integration_workspace *wksp = NULL;
295 integrand.params = (
void * )&
par;
298 const REAL8 dT = 1.0 / intN;
304 wksp = gsl_integration_workspace_alloc( limit );
311 for (
UINT4 n = 0;
n < intN;
n ++ ) {
316 XLAL_CALLGSL(
stat = gsl_integration_qag( &integrand, ti, tf, epsabs, epsrel, limit, GSL_INTEG_GAUSS61, wksp, &res_n, &err_n ) );
321 XLALPrintWarning(
"\n%s: GSL-integration 'gsl_integration_qag()' of <am1_am2_Phi_i Phi_j> did not reach requested precision!\n",
__func__ );
322 XLALPrintWarning(
"xlalErrno=%i, Segment n=%d, Result = %g, abserr=%g ==> relerr = %.2e > %.2e\n",
323 par.errnum,
n, res_n, err_n, fabs( err_n / res_n ), epsrel );
331 abserr2 +=
SQUARE( err_n );
335 REAL8 relerr =
RELERR( sqrt( abserr2 ), fabs( res ) );
337 ( *relerr_max ) = relerr;
340 gsl_integration_workspace_free( wksp );
366 REAL8 am1, am2, phi_i, phi_j, ret;
382 ttSI =
par->startTime + tt *
par->Tspan;
389 GSL_ERROR_VAL(
"Failure in CW_am1_am2_Phi_i_Phi_j", GSL_EFAILED, GSL_NAN );
423 ret = am1 * am2 * phi_i * phi_j;
426 "amcomp1=%d amcomp2=%d coord1='%s' coord2='%s' tt=%f am1=%f am2=%f phi_i=%f phi_j=%f ret=%f\n",
427 par->amcomp1,
par->amcomp2,
429 tt, am1, am2, phi_i, phi_j, ret );
451 .coordIDs = { coordID },
458 .coordSys = &coordSys,
459 .dopplerPoint = dopplerPoint,
465 .approxPhase = includeRoemer,
503 const REAL8 cosa = cos(
par->dopplerPoint->Alpha );
504 const REAL8 sina = sin(
par->dopplerPoint->Alpha );
505 const REAL8 cosd = cos(
par->dopplerPoint->Delta );
506 const REAL8 sind = sin(
par->dopplerPoint->Delta );
509 nn_equ[0] = cosd * cosa;
510 nn_equ[1] = cosd * sina;
535 COPY_VECT( posvel.pos, spin_posvel.pos );
536 ADD_VECT( posvel.pos, orbit_posvel.pos );
537 COPY_VECT( posvel.vel, spin_posvel.vel );
538 ADD_VECT( posvel.vel, orbit_posvel.vel );
545 const REAL8 Freq =
par->dopplerPoint->fkdot[0];
557 if ( !
par->approxPhase ) {
572 const double tauSI = tau *
SCALE_T;
573 for (
n = 0;
n <
par->rOrb_n->length;
n ++ ) {
578 for (
i = 0;
i < 3;
i++ ) {
579 rr_ord_Equ[
i] -= pre_n *
par->rOrb_n->data[
n][
i];
587 REAL8 orb_asini =
par->dopplerPoint->asini;
589 REAL8 orb_kappa =
par->dopplerPoint->ecc * cos(
par->dopplerPoint->argp );
590 REAL8 orb_eta =
par->dopplerPoint->ecc * sin(
par->dopplerPoint->argp );
593 REAL8 sinPsi = sin( orb_phase );
594 REAL8 cosPsi = cos( orb_phase );
595 REAL8 sin2Psi = sin( 2.0 * orb_phase );
596 REAL8 cos2Psi = cos( 2.0 * orb_phase );
599 REAL8 phase_deriv = 0.0;
600 for (
int coord = 0; coord < (
int )
par->coordSys->dim; ++coord ) {
604 if (
par->coordTransf != NULL ) {
605 coeff = gsl_matrix_get(
par->coordTransf,
par->coord, coord );
606 }
else if (
par->coord == coord ) {
609 if (
coeff == 0.0 ) {
641 nDeriv_i[0] = - cosd * sina;
642 nDeriv_i[1] = cosd * cosa;
647 nDeriv_i[0] = - sind * cosa;
648 nDeriv_i[1] = - sind * sina;
654 ret =
LAL_TWOPI * Freq * ( rr_ord_Equ[0] - ( nn_equ[0] / nn_equ[2] ) * rr_ord_Equ[2] );
657 ret =
LAL_TWOPI * Freq * ( rr_ord_Equ[1] - ( nn_equ[1] / nn_equ[2] ) * rr_ord_Equ[2] );
661 ret =
LAL_TWOPI * Freq * ( rr_ord_Ecl[0] - ( nn_ecl[0] / nn_ecl[2] ) * rr_ord_Ecl[2] );
664 ret =
LAL_TWOPI * Freq * ( rr_ord_Ecl[1] - ( nn_ecl[1] / nn_ecl[2] ) * rr_ord_Ecl[2] );
688 ret =
LAL_TWOPI * Freq * spin_posvel.pos[0];
691 ret =
LAL_TWOPI * Freq * spin_posvel.pos[1];
695 ret =
LAL_TWOPI * Freq * ecl_orbit_pos[0];
698 ret =
LAL_TWOPI * Freq * ecl_orbit_pos[1];
701 ret =
LAL_TWOPI * Freq * ecl_orbit_pos[2];
707 ret = -
LAL_TWOPI * Freq * ( sinPsi + 0.5 * orb_kappa * sin2Psi - 0.5 * orb_eta * cos2Psi );
710 ret =
LAL_TWOPI * Freq * orb_asini * orb_Omega * ( cosPsi + orb_kappa * cos2Psi + orb_eta * sin2Psi );
713 ret = Freq * orb_asini * orb_Omega * orb_phase * ( cosPsi + orb_kappa * cos2Psi + orb_eta * sin2Psi );
716 ret = -
LAL_PI * Freq * orb_asini * sin2Psi;
719 ret =
LAL_PI * Freq * orb_asini * cos2Psi;
724 ret =
LAL_TWOPI * Freq * ( cosPsi + orb_kappa * cos2Psi + orb_eta * sin2Psi );
728 ret = -
LAL_TWOPI * Freq * ( orb_phase / orb_Omega ) * ( cosPsi + orb_kappa * cos2Psi + orb_eta * sin2Psi );
732 ret = -
LAL_PI * Freq * sin2Psi;
736 ret =
LAL_PI * Freq * cos2Psi;
748 phase_deriv +=
coeff * ret;
787 baryinput.tgps = *tGPS;
788 baryinput.site = *
site;
789 baryinput.site.location[0] /=
LAL_C_SI;
790 baryinput.site.location[1] /=
LAL_C_SI;
791 baryinput.site.location[2] /=
LAL_C_SI;
851 if ( orbit_posvel ) {
890 REAL8 tMidnight, tAutumn;
892 REAL8 sinOrb, cosOrb;
894 if ( !posvel || !tGPS ) {
902 sinOrb = sin( phiOrb );
903 cosOrb = cos( phiOrb );
956 weights[X] = haveNoiseWeights ? multiNoiseFloor->
sqrtSn[X] : 1.0;
964 const double epsrel =
params->epsrel;
965 const double epsabs =
params->epsabs;
966 const size_t limit = 512;
974 gsl_integration_workspace *wksp ;
982 InputOutputInfo *intInOut[Nseg][
numDet];
985 for (
size_t k = 0;
k < Nseg; ++
k ) {
986 for (
size_t X = 0; X <
numDet; ++X ) {
1004 intInOut[
k][X] =
XLALCalloc( intN[
k][X],
sizeof( *intInOut[
k][X] ) );
1008 for (
size_t n = 0;
n < intN[
k][X]; ++
n ) {
1010 InputOutputInfo *io = &intInOut[
k][X][
n];
1014 const double dT = 1.0 / intN[
k][X];
1015 io->ti = 1.0 *
n * dT;
1016 io->tf =
MYMIN( (
n + 1.0 ) * dT, 1.0 );
1028 gsl_error_handler_t *saveGSLErrorHandler;
1029 saveGSLErrorHandler = gsl_set_error_handler_off();
1034 size_t index_max = 0;
1035 for (
size_t k = 0;
k < Nseg; ++
k ) {
1036 for (
size_t X = 0; X <
numDet; ++X ) {
1037 index_max += intN[
k][X];
1040 #pragma omp parallel for schedule(static)
1041 for (
size_t indx = 0; indx < index_max; ++indx ) {
1043 size_t k = 0, X = 0,
n = 0, index_break = indx + 1;
1044 for (
k = 0;
k < Nseg; ++
k ) {
1045 for ( X = 0; X <
numDet; ++X ) {
1046 if ( index_break > intN[
k][X] ) {
1047 index_break -= intN[
k][X];
1049 n = index_break - 1;
1054 if ( index_break == 0 ) {
1059 InputOutputInfo *io = &intInOut[
k][X][
n];
1061 gsl_function integrand;
1062 integrand.params = (
void * ) & ( io->par );
1067 const double scale1 =
GET_COORD_SCALE( io->par.coordSys, io->par.coord1 );
1068 const double scale2 =
GET_COORD_SCALE( io->par.coordSys, io->par.coord2 );
1069 const double scale12 = scale1 * scale2;
1073 stat = gsl_integration_qag( &integrand, io->ti, io->tf, epsabs, epsrel, limit, GSL_INTEG_GAUSS61, io->wksp, &res, &abserr );
1075 XLALPrintWarning(
"\n%s: GSL-integration 'gsl_integration_qag()' of <Phi_i Phi_j> did not reach requested precision!\n",
__func__ );
1076 XLALPrintWarning(
"xlalErrno=%i, seg=%zu, av_ij_n=%g, abserr=%g\n", io->par.errnum,
n, res, abserr );
1077 io->av_ij = GSL_NAN;
1079 io->av_ij = scale12 * res;
1080 io->av_ij_err_sq =
SQUARE( scale12 * abserr );
1085 io->par.coord = io->par.coord1;
1086 stat = gsl_integration_qag( &integrand, io->ti, io->tf, epsabs, epsrel, limit, GSL_INTEG_GAUSS61, io->wksp, &res, &abserr );
1088 XLALPrintWarning(
"\n%s: GSL-integration 'gsl_integration_qag()' of <Phi_i> did not reach requested precision!\n",
__func__ );
1089 XLALPrintWarning(
"xlalErrno=%i, seg=%zu, av_i_n=%g, abserr=%g\n", io->par.errnum,
n, res, abserr );
1092 io->av_i = scale1 * res;
1093 io->av_i_err_sq =
SQUARE( scale1 * abserr );
1098 io->par.coord = io->par.coord2;
1099 stat = gsl_integration_qag( &integrand, io->ti, io->tf, epsabs, epsrel, limit, GSL_INTEG_GAUSS61, io->wksp, &res, &abserr );
1101 XLALPrintWarning(
"\n%s: GSL-integration 'gsl_integration_qag()' of <Phi_j> did not reach requested precision!\n",
__func__ );
1102 XLALPrintWarning(
"xlalErrno=%i, seg=%zu, av_j_n=%g, abserr=%g\n", io->par.errnum,
n, res, abserr );
1105 io->av_j = scale2 * res;
1106 io->av_j_err_sq =
SQUARE( scale2 * abserr );
1113 gsl_set_error_handler( saveGSLErrorHandler );
1117 double ret = 0, relerr_max_sq = 0;
1120 for (
UINT4 k = 0;
k < Nseg;
k ++ ) {
1122 double av_ij = 0, av_ij_err_sq = 0;
1123 double av_i = 0, av_i_err_sq = 0;
1124 double av_j = 0, av_j_err_sq = 0;
1128 for (
size_t n = 0;
n < intN[
k][X]; ++
n ) {
1130 const InputOutputInfo *io = &intInOut[
k][X][
n];
1133 av_ij +=
weights[X] * io->av_ij;
1134 av_ij_err_sq +=
weights[X] * io->av_ij_err_sq;
1137 av_i +=
weights[X] * io->av_i;
1138 av_i_err_sq +=
weights[X] * io->av_i_err_sq;
1141 av_j +=
weights[X] * io->av_j;
1142 av_j_err_sq +=
weights[X] * io->av_j_err_sq;
1149 av_ij /= total_weight;
1150 av_i /= total_weight;
1151 av_j /= total_weight;
1152 av_ij_err_sq /= total_weight;
1153 av_i_err_sq /= total_weight;
1154 av_j_err_sq /= total_weight;
1157 const double av_ij_relerr =
RELERR( sqrt( av_ij_err_sq ), fabs( av_ij ) );
1158 const double av_i_relerr =
RELERR( sqrt( av_i_err_sq ), fabs( av_i ) );
1159 const double av_j_relerr =
RELERR( sqrt( av_j_err_sq ), fabs( av_j ) );
1160 const double relerr_max_k =
MYMAX( av_ij_relerr,
MYMAX( av_i_relerr, av_j_relerr ) );
1162 ret += av_ij - av_i * av_j;
1163 relerr_max_sq +=
SQUARE( relerr_max_k );
1168 relerr_max_sq /= Nseg;
1171 ( *relerr_max ) = sqrt( relerr_max_sq );
1176 for (
size_t k = 0;
k < Nseg; ++
k ) {
1177 for (
size_t X = 0; X <
numDet; ++X ) {
1178 for (
size_t n = 0;
n < intN[
k][X]; ++
n ) {
1179 InputOutputInfo *io = &intInOut[
k][X][
n];
1180 gsl_integration_workspace_free( io->wksp );
1218 for (
UINT4 i = 0;
i < dim;
i ++ ) {
1224 XLAL_CHECK_NULL( !( at_equator && have_n2xy ),
XLAL_EINVAL,
"Can't use 'n2x_equ','n2y_equ' at equator (Delta=0): metric is singular there" );
1241 if ( ( metric->
g_ij = gsl_matrix_calloc( dim, dim ) ) == NULL ) {
1247 intparams.coordSys = coordSys;
1248 intparams.edat =
edat;
1252 intparams.approxPhase = metricParams->
approxPhase;
1259 if ( maxorder > 0 ) {
1268 fprintf( stderr,
"%s: rOrb_n(%d) = [ ",
__func__, intparams.dopplerPoint->refTime.gpsSeconds );
1269 for (
UINT4 n = 0;
n < intparams.rOrb_n->length;
n++ ) {
1270 fprintf( stderr,
"[%g, %g, %g]%s", intparams.rOrb_n->data[
n][0], intparams.rOrb_n->data[
n][1], intparams.rOrb_n->data[
n][2],
1271 ( n < intparams.rOrb_n->length - 1 ) ?
", " :
" ]\n" );
1283 gsl_matrix *transform = gsl_matrix_alloc( dim, dim );
1285 gsl_matrix_set_identity( transform );
1286 intparams.coordTransf = transform;
1288 for (
size_t n = 1;
n <= dim; ++
n ) {
1294 intparams.epsrel = 1
e-6;
1296 intparams.epsabs = 1
e-3;
1310 gsl_matrix *cholesky = gsl_matrix_alloc(
n,
n );
1314 gsl_matrix_view g_ij_n = gsl_matrix_submatrix( metric->
g_ij, 0, 0,
n,
n );
1315 gsl_matrix_view transform_n = gsl_matrix_submatrix( transform, 0, 0,
n,
n );
1318 const size_t max_tries = 64;
1320 while ( ++tries <= max_tries ) {
1323 for (
size_t i = 0;
i <
n; ++
i ) {
1324 const size_t j =
n - 1;
1327 intparams.coord1 =
i;
1328 intparams.coord2 =
j;
1332 gsl_matrix_set( &g_ij_n.matrix,
i,
j, gg );
1333 gsl_matrix_set( &g_ij_n.matrix,
j,
i, gg );
1340 gsl_vector_view
D = gsl_matrix_diagonal( cholesky );
1343 fprintf( stdout,
"%s: n=%zu, try=%zu, Cholesky diagonal =",
__func__,
n, tries );
1348 if ( ( tries > 1 ) && ( gsl_vector_min( &
D.vector ) > 0.0 ) ) {
1354 gsl_matrix_view cholesky_nm1 = gsl_matrix_submatrix( cholesky, 0, 0,
n - 1,
n );
1355 gsl_matrix_set_identity( &cholesky_nm1.matrix );
1359 gsl_blas_dtrsm( CblasLeft, CblasLower, CblasNoTrans, CblasUnit, 1.0, cholesky, &transform_n.matrix );
1363 intparams.epsrel = intparams.epsrel * 0.9;
1369 intparams.epsabs = intparams.epsabs * 0.9;
1374 intparams.intT =
MYMAX( 900, intparams.intT * 0.9 );
1380 gsl_matrix_free( cholesky );
1385 gsl_matrix_transpose( transform );
1402 for (
size_t n = 1;
n <= dim; ++
n ) {
1403 gsl_matrix_view g_ij_n = gsl_matrix_submatrix( metric->
g_ij, 0, 0,
n,
n );
1414 metric->
meta = ( *metricParams );
1418 gsl_matrix_free( transform );
1433 gsl_matrix_free( metric->
g_ij );
1477 for (
UINT4 i = 0;
i < dim;
i ++ ) {
1483 XLAL_CHECK_NULL( !( at_equator && have_n2xy ),
XLAL_EINVAL,
"Can't use 'n2x_equ','n2y_equ' at equator (Delta=0): metric is singular there" );
1486 XLAL_CHECK_NULL( Nseg >= 1,
XLAL_EINVAL,
"Got empty segment list metricParams->segmentList, needs to contain at least 1 segments\n" );
1495 segList_k.
segs = &segment_k;
1500 for (
UINT4 k = 0;
k < Nseg;
k ++ ) {
1540 if ( metric == NULL ) {
1545 gsl_matrix_add( metric->
gF_ij, metric_k->
gF_ij );
1547 gsl_matrix_add( metric->
m1_ij, metric_k->
m1_ij );
1548 gsl_matrix_add( metric->
m2_ij, metric_k->
m2_ij );
1549 gsl_matrix_add( metric->
m3_ij, metric_k->
m3_ij );
1566 const double scale = 1.0 / Nseg;
1597 metric->
meta = ( *metricParams );
1612 gsl_matrix_free( metric->
gF_ij );
1613 gsl_matrix_free( metric->
gFav_ij );
1614 gsl_matrix_free( metric->
m1_ij );
1615 gsl_matrix_free( metric->
m2_ij );
1616 gsl_matrix_free( metric->
m3_ij );
1644 REAL8 max_relerr = 0;
1645 REAL8 relerr_thresh = 1
e-2;
1648 if ( !metricParams || !
edat ) {
1668 coordSys = &( metricParams->
coordSys );
1680 intparams.coordSys = coordSys;
1685 intparams.Tspan =
Tspan;
1686 intparams.edat =
edat;
1692 intparams.epsrel = 1
e-4;
1693 intparams.epsabs = 0;
1704 if ( maxorder > 0 ) {
1715 REAL8 sum_weights = 0;
1717 for ( X = 0; X <
numDet; X ++ ) {
1719 sum_weights += weight;
1723 intparams.coord1 = -1;
1724 intparams.coord2 = -1;
1730 max_relerr =
MYMAX( max_relerr, relerr );
1740 max_relerr =
MYMAX( max_relerr, relerr );
1750 max_relerr =
MYMAX( max_relerr, relerr );
1758 REAL8 norm_weight = 1.0 / sum_weights;
1769 for (
i = 0;
i < dim;
i ++ ) {
1770 for (
j = 0;
j <=
i;
j ++ ) {
1771 REAL8 a_a_i_j, b_b_i_j, a_b_i_j;
1772 REAL8 a_a_i, b_b_i, a_b_i;
1774 a_a_i_j = b_b_i_j = a_b_i_j = 0;
1775 a_a_i = b_b_i = a_b_i = 0;
1777 for ( X = 0; X <
numDet; X ++ ) {
1783 intparams.coord1 =
i;
1784 intparams.coord2 =
j;
1790 max_relerr =
MYMAX( max_relerr, relerr );
1794 a_a_i_j += weight * av;
1800 max_relerr =
MYMAX( max_relerr, relerr );
1804 b_b_i_j += weight * av;
1810 max_relerr =
MYMAX( max_relerr, relerr );
1814 a_b_i_j += weight * av;
1817 intparams.coord1 =
i;
1818 intparams.coord2 = -1;
1824 max_relerr =
MYMAX( max_relerr, relerr );
1828 a_a_i += weight * av;
1834 max_relerr =
MYMAX( max_relerr, relerr );
1838 b_b_i += weight * av;
1844 max_relerr =
MYMAX( max_relerr, relerr );
1848 a_b_i += weight * av;
1852 gsl_vector_set( ret->
a_a_i,
i, a_a_i * norm_weight );
1853 gsl_vector_set( ret->
a_b_i,
i, a_b_i * norm_weight );
1854 gsl_vector_set( ret->
b_b_i,
i, b_b_i * norm_weight );
1856 gsl_matrix_set( ret->
a_a_i_j,
i,
j, a_a_i_j * norm_weight );
1857 gsl_matrix_set( ret->
a_a_i_j,
j,
i, a_a_i_j * norm_weight );
1859 gsl_matrix_set( ret->
a_b_i_j,
i,
j, a_b_i_j * norm_weight );
1860 gsl_matrix_set( ret->
a_b_i_j,
j,
i, a_b_i_j * norm_weight );
1862 gsl_matrix_set( ret->
b_b_i_j,
i,
j, b_b_i_j * norm_weight );
1863 gsl_matrix_set( ret->
b_b_i_j,
j,
i, b_b_i_j * norm_weight );
1876 if ( max_relerr > relerr_thresh ) {
1877 XLALPrintError(
"Maximal relative F-metric error too high: %.2e > %.2e\n", max_relerr, relerr_thresh );
1881 XLALPrintInfo(
"\nMaximal relative error in F-metric: %.2e\n", max_relerr );
1888 XLALPrintError(
"%s: XLALAverage_am1_am2_Phi_i_Phi_j() FAILED with errno = %d: am1 = %d, am2 = %d, coord1 = '%s', coord2 = '%s'\n",
1913 XLAL_ERROR(
XLAL_EINVAL,
"Could not parse '%s' into a valid detector-motion type!", detMotionString );
1958 XLALPrintError(
"\nCould not parse '%s' into a valid coordinate-ID!\n\n", coordName );
1974 if ( !coordSys || !coordNames ) {
1979 for (
i = 0;
i < coordNames->
length;
i++ ) {
1998 for (
int i = 0;
i < ( (
int )coordSys->
dim ); ++
i ) {
1999 if ( coordSys->
coordIDs[
i] == coordID ) {
2057 UINT4 i, len, maxlen = 0;
2061 #define HEADER "Doppler-coordinate names and explanations:\n--------------------------------------------------\n"
2065 strcpy( helpstr,
HEADER );
2066 len = strlen( helpstr );
2073 maxlen =
MYMAX( maxlen, strlen(
name ) );
2074 sprintf(
fmt,
"%%-%ds: %%s\n", maxlen + 2 );
2086 snprintf( buf,
sizeof( buf ) - 1,
fmt,
name,
help );
2087 len += strlen( buf ) + 1;
2088 if ( ( helpstr =
XLALRealloc( helpstr, len ) ) == NULL ) {
2092 helpstr = strcat( helpstr, buf );
2110 if ( atoms->
a_a_i ) {
2111 gsl_vector_free( atoms->
a_a_i );
2113 if ( atoms->
a_b_i ) {
2114 gsl_vector_free( atoms->
a_b_i );
2116 if ( atoms->
b_b_i ) {
2117 gsl_vector_free( atoms->
b_b_i );
2121 gsl_matrix_free( atoms->
a_a_i_j );
2124 gsl_matrix_free( atoms->
a_b_i_j );
2127 gsl_matrix_free( atoms->
b_b_i_j );
2149 REAL8 alpha1, alpha2, alpha3, eta2, cos2psi, sin2psi;
2161 dim = atoms->
a_a_i->size;
2164 if ( ( metric =
XLALCalloc( 1,
sizeof( *metric ) ) ) == NULL ) {
2168 metric->
gF_ij = gsl_matrix_calloc( dim, dim );
2169 metric->
gFav_ij = gsl_matrix_calloc( dim, dim );
2170 metric->
m1_ij = gsl_matrix_calloc( dim, dim );
2171 metric->
m2_ij = gsl_matrix_calloc( dim, dim );
2172 metric->
m3_ij = gsl_matrix_calloc( dim, dim );
2175 XLALPrintError(
"%s: failed to gsl_matrix_calloc(%d,%d) for gF_ij, gFav_ij, m1_ij, m2_ij, m3_ij\n\n",
__func__, dim, dim );
2188 cos2psi = cos( 2.0 * psi );
2189 sin2psi = sin( 2.0 * psi );
2192 alpha3 = 0.25 *
SQUARE( 1.0 - eta2 ) * sin2psi * cos2psi;
2194 metric->
rho2 = alpha1 *
A + alpha2 *
B + 2.0 * alpha3 *
C;
2199 for (
i = 0;
i < dim;
i ++ ) {
2200 REAL8 a_a_i, b_b_i, a_b_i;
2202 a_a_i = gsl_vector_get( atoms->
a_a_i,
i );
2203 a_b_i = gsl_vector_get( atoms->
a_b_i,
i );
2204 b_b_i = gsl_vector_get( atoms->
b_b_i,
i );
2206 for (
j = 0;
j <=
i;
j ++ ) {
2207 REAL8 a_a_i_j, b_b_i_j, a_b_i_j;
2208 REAL8 a_a_j, b_b_j, a_b_j;
2210 REAL8 P1_ij, P2_ij, P3_ij;
2211 REAL8 Q1_ij, Q2_ij, Q3_ij;
2214 a_a_j = gsl_vector_get( atoms->
a_a_i,
j );
2215 a_b_j = gsl_vector_get( atoms->
a_b_i,
j );
2216 b_b_j = gsl_vector_get( atoms->
b_b_i,
j );
2218 a_a_i_j = gsl_matrix_get( atoms->
a_a_i_j,
i,
j );
2219 a_b_i_j = gsl_matrix_get( atoms->
a_b_i_j,
i,
j );
2220 b_b_i_j = gsl_matrix_get( atoms->
b_b_i_j,
i,
j );
2228 Q1_ij =
A * a_b_i * a_b_j +
B * a_a_i * a_a_j -
C * ( a_a_i * a_b_j + a_a_j * a_b_i );
2231 Q2_ij =
A * b_b_i * b_b_j +
B * a_b_i * a_b_j -
C * ( a_b_i * b_b_j + a_b_j * b_b_i );
2234 Q3_ij = 0.5 *
A * ( a_b_i * b_b_j + a_b_j * b_b_i )
2235 + 0.5 *
B * ( a_b_i * a_a_j + a_b_j * a_a_i )
2236 - 0.5 *
C * ( b_b_i * a_a_j + b_b_j * a_a_i + 2.0 * a_b_i * a_b_j );
2241 gsl_matrix_set( metric->
m1_ij,
i,
j, gg );
2242 gsl_matrix_set( metric->
m1_ij,
j,
i, gg );
2245 gsl_matrix_set( metric->
m2_ij,
i,
j, gg );
2246 gsl_matrix_set( metric->
m2_ij,
j,
i, gg );
2249 gsl_matrix_set( metric->
m3_ij,
i,
j, gg );
2250 gsl_matrix_set( metric->
m3_ij,
j,
i, gg );
2254 gg = alpha1 * gsl_matrix_get( metric->
m1_ij,
i,
j ) + alpha2 * gsl_matrix_get( metric->
m2_ij,
i,
j )
2255 + 2.0 * alpha3 * gsl_matrix_get( metric->
m3_ij,
i,
j );
2258 gsl_matrix_set( metric->
gF_ij,
i,
j, gg );
2259 gsl_matrix_set( metric->
gF_ij,
j,
i, gg );
2262 gg =
B * gsl_matrix_get( metric->
m1_ij,
i,
j ) +
A * gsl_matrix_get( metric->
m2_ij,
i,
j )
2263 - 2.0 *
C * gsl_matrix_get( metric->
m3_ij,
i,
j );
2266 gsl_matrix_set( metric->
gFav_ij,
i,
j, gg );
2267 gsl_matrix_set( metric->
gFav_ij,
j,
i, gg );
2285 gsl_matrix *fisher = NULL;
2287 UINT4 dimDoppler, dimFull,
i,
j;
2288 REAL8 al1, al2, al3;
2301 REAL8 A1, A2, A3, A4;
2315 dimDoppler = atoms->
a_a_i->size;
2316 dimFull = 4 + dimDoppler;
2318 if ( ( fisher = gsl_matrix_calloc( dimFull, dimFull ) ) == NULL ) {
2330 gsl_matrix_set( fisher, 0, 0,
A );
2331 gsl_matrix_set( fisher, 2, 2,
A );
2333 gsl_matrix_set( fisher, 1, 1,
B );
2334 gsl_matrix_set( fisher, 3, 3,
B );
2336 gsl_matrix_set( fisher, 0, 1,
C );
2337 gsl_matrix_set( fisher, 1, 0,
C );
2338 gsl_matrix_set( fisher, 2, 3,
C );
2339 gsl_matrix_set( fisher, 3, 2,
C );
2345 al2 = A1 * A2 + A3 * A4;
2348 for (
i = 0;
i < dimDoppler;
i ++ ) {
2349 for (
j = 0;
j <=
i;
j ++ ) {
2350 REAL8 gg, a_a_i_j, a_b_i_j, b_b_i_j;
2352 a_a_i_j = gsl_matrix_get( atoms->
a_a_i_j,
i,
j );
2353 a_b_i_j = gsl_matrix_get( atoms->
a_b_i_j,
i,
j );
2354 b_b_i_j = gsl_matrix_get( atoms->
b_b_i_j,
i,
j );
2356 gg = al1 * a_a_i_j + 2.0 * al2 * a_b_i_j + al3 * b_b_i_j;
2358 gsl_matrix_set( fisher, 4 +
i, 4 +
j, gg );
2359 gsl_matrix_set( fisher, 4 +
j, 4 +
i, gg );
2366 for (
i = 0;
i < dimDoppler;
i ++ ) {
2367 REAL8 a_a_i, a_b_i, b_b_i;
2371 a_a_i = gsl_vector_get( atoms->
a_a_i,
i );
2372 a_b_i = gsl_vector_get( atoms->
a_b_i,
i );
2373 b_b_i = gsl_vector_get( atoms->
b_b_i,
i );
2375 AR[0] = A3 * a_a_i + A4 * a_b_i;
2376 AR[1] = A3 * a_b_i + A4 * b_b_i;
2377 AR[2] = -A1 * a_a_i - A2 * a_b_i;
2378 AR[3] = -A1 * a_b_i - A2 * b_b_i;
2380 for (
mu = 0;
mu < 4;
mu ++ ) {
2381 gsl_matrix_set( fisher,
mu, 4 +
i, AR[
mu] );
2382 gsl_matrix_set( fisher, 4 +
i,
mu, AR[
mu] );
2397 static mat33_t rotEqu2Ecl = { { 1.0, 0, 0 },
2410 static mat33_t rotEcl2Equ = { { 1.0, 0, 0 },
2425 for (
i = 0;
i < 3;
i ++ ) {
2427 for (
j = 0;
j < 3;
j ++ ) {
2453 REAL8 h = 0.5 * 86400.0;
2454 vect3D_t r0m2h, r0mh, r0, r0_h, r0_2h;
2492 ti.
gpsSeconds = ( *tGPS ).gpsSeconds - 2 * h;
2508 ti.
gpsSeconds = ( *tGPS ).gpsSeconds + 2 * h;
2519 for (
i = 0;
i < 3;
i ++ ) {
2520 rdn[1][
i] =
DERIV5P_1( r0m2h[
i], r0mh[
i], r0[
i], r0_h[
i], r0_2h[
i], h );
2521 rdn[2][
i] =
DERIV5P_2( r0m2h[
i], r0mh[
i], r0[
i], r0_h[
i], r0_2h[
i], h );
2522 rdn[3][
i] =
DERIV5P_3( r0m2h[
i], r0mh[
i], r0[
i], r0_h[
i], r0_2h[
i], h );
2523 rdn[4][
i] =
DERIV5P_4( r0m2h[
i], r0mh[
i], r0[
i], r0_h[
i], r0_2h[
i], h );
2527 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2531 ret->
length = maxorder + 1;
2539 for (
n = 0;
n <= maxorder;
n ++ ) {
2576 for (
i = 0;
i < coordSys->
dim;
i ++ ) {
#define __func__
log an I/O error, i.e.
#define GET_COORD_SCALE(coordSys, coord)
#define COPY_VECT(dst, src)
copy 3 components of Euklidean vector
#define DERIV5P_2(pm2, pm1, p0, pp1, pp2, h)
const double scale
multiplicative scaling factor of the coordinate
#define DERIV5P_1(pm2, pm1, p0, pp1, pp2, h)
5-point derivative formulas (eg see http://math.fullerton.edu/mathews/articles/2003NumericalDiffFormu...
const DetectorMotionType type
#define DERIV5P_4(pm2, pm1, p0, pp1, pp2, h)
#define ZERO_VECT(v)
Operations on 3-dim vectors
#define SUB_VECT(dst, src)
static const struct @10 DopplerCoordinates[DOPPLERCOORD_LAST]
Array of descriptor structs for each Doppler coordinate name.
static const struct @9 DetectorMotionNames[]
Array of symbolic 'names' for various detector-motions.
#define DOT_VECT(u, v)
Simple Euklidean scalar product for two 3-dim vectors in cartesian coords.
const char *const help
help string explaining the coordinate's meaning and units
#define EQU_VECT_TO_ECL(dst, src)
Convert 3-D vector from equatorial into ecliptic coordinates.
#define DETMOTION_NAMES(orbit_type, spin_orbit_name, nospin_orbit_name)
const char *const name
coordinate name
#define ADD_VECT(dst, src)
#define MULT_VECT(v, lam)
AM_comp_t
components of antenna-pattern function: q_l = {a(t), b(t)}
@ AMCOMP_NONE
no antenna pattern function: (equivalent "a = 1")
#define GET_COORD_NAME(coordSys, coord)
#define GET_COORD_ID(coordSys, coord)
#define DERIV5P_3(pm2, pm1, p0, pp1, pp2, h)
#define XLAL_CALLGSL(statement)
REAL8 coeff(qfvars *vars, REAL8 x)
const LALDetector lalCachedDetectors[LAL_NUM_DETECTORS]
static const REAL8 LAL_FACT_INV[]
int XLALGetEarthTimes(const LIGOTimeGPS *tepoch, REAL8 *tMidnight, REAL8 *tAutumn)
This function takes a GPS time from tepoch and uses it to assign tAutumn and tMidnight,...
int XLALBarycenterEarth(EarthState *earth, const LIGOTimeGPS *tGPS, const EphemerisData *edat)
Computes the position and orientation of the Earth, at some arrival time , specified LIGOTimeGPS inp...
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...
int XLALComputeAntennaPatternCoeffs(REAL8 *ai, REAL8 *bi, const SkyPosition *skypos, const LIGOTimeGPS *tGPS, const LALDetector *site, const EphemerisData *edat)
Compute single time-stamp antenna-pattern coefficients a(t), b(t) Note: this function uses REAL8 prec...
#define XLAL_INIT_DECL(var,...)
void * XLALCalloc(size_t m, size_t n)
void * XLALRealloc(void *p, size_t n)
void void int XLALfprintfGSLmatrix(FILE *fp, const char *fmt, const gsl_matrix *gij) _LAL_GCC_VPRINTF_FORMAT_(2)
int XLALfprintfGSLvector(FILE *fp, const char *fmt, const gsl_vector *vect) _LAL_GCC_VPRINTF_FORMAT_(2)
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
int XLALChangeMetricReferenceTime(gsl_matrix **p_gpr_ij, gsl_matrix **p_transform, const gsl_matrix *g_ij, const DopplerCoordinateSystem *coordSys, const double Dtau)
Compute the transform which changes the metric reference time .
int XLALProjectMetric(gsl_matrix **p_gpr_ij, const gsl_matrix *g_ij, const UINT4 c)
Calculate the projected metric onto the subspace orthogonal to coordinate-axis c, namely ,...
int XLALCholeskyLDLTDecompMetric(gsl_matrix **p_cholesky, const gsl_matrix *g_ij)
Decompose a metric as , where is a lower-triangular matrix with unit diagonal, and is a diagonal ...
int XLALInverseTransformMetric(gsl_matrix **p_gpr_ij, const gsl_matrix *transform, const gsl_matrix *g_ij)
Apply the inverse of a transform to a metric such that , or equivalently .
double XLALMetricDeterminant(const gsl_matrix *g_ij)
Compute the determinant of a metric .
REAL8 PulsarAmplitudeVect[4]
Struct for 'canonical' coordinates in amplitude-params space A^mu = {A1, A2, A3, A4}.
int XLALSegListInit(LALSegList *seglist)
int XLALSegListIsInitialized(const LALSegList *seglist)
COORDINATESYSTEM_EQUATORIAL
int XLALDetectorPosVel(PosVel3D_t *spin_posvel, PosVel3D_t *orbit_posvel, const LIGOTimeGPS *tGPS, const LALDetector *site, const EphemerisData *edat, DetectorMotionType detMotionType)
Given a GPS time and detector, return the current position (and velocity) of the detector.
static double XLALAverage_am1_am2_Phi_i_Phi_j(const intparams_t *params, double *relerr_max)
Integrate a general quadruple product CW_am1_am2_Phi_i_Phi_j() from 0 to 1.
int XLALDopplerCoordinateNames2System(DopplerCoordinateSystem *coordSys, const LALStringVector *coordNames)
Given a LALStringVector of coordinate-names, parse them into a 'DopplerCoordinateSystem',...
const CHAR * XLALDetectorMotionName(DetectorMotionType detMotionType)
Provide a pointer to a static string containing the DopplerCoordinate-name cooresponding to the enum ...
static double XLALCovariance_Phi_ij(const MultiLALDetector *multiIFO, const MultiNoiseFloor *multiNoiseFloor, const LALSegList *segList, const intparams_t *params, double *relerr_max)
Compute a pure phase-deriv covariance which gives a component of the "phase metric".
REAL8 vect3D_t[3]
3D vector
static UINT4 findHighestGCSpinOrder(const DopplerCoordinateSystem *coordSys)
Return the highest 'global-correlation' spindown order found in this coordinate system.
DopplerCoordinateID
enum listing symbolic 'names' for all Doppler Coordinates supported by the metric codes in FstatMetri...
CHAR * XLALDopplerCoordinateHelpAll(void)
Return a string (allocated here) containing a full name - helpstring listing for all doppler-coordina...
static gsl_matrix * XLALComputeFisherFromAtoms(const FmetricAtoms_t *atoms, PulsarAmplitudeParams Amp)
Function to compute full 4+n dimensional Fisher matric for the full CW parameter-space of Amplitude +...
static double CW_am1_am2_Phi_i_Phi_j(double tt, void *params)
For gsl-integration: general quadruple product between two antenna-pattern functions am1,...
void XLALDestroyFmetricAtoms(FmetricAtoms_t *atoms)
Free a FmetricAtoms_t structure, allowing any pointers to be NULL.
DetectorMotionType
Bitfield of different types of detector-motion to use in order to compute the Doppler-metric.
void XLALeclipticVect2equatorial(vect3D_t out, const vect3D_t in)
Convert 3-D vector from ecliptic into equatorial coordinates.
static DopplerFstatMetric * XLALComputeFmetricFromAtoms(const FmetricAtoms_t *atoms, REAL8 cosi, REAL8 psi)
Compute the 'F-metric' gF_ij (and also gFav_ij, m1_ij, m2_ij, m3_ij) from the given FmetricAtoms and ...
REAL8 XLALComputePhaseDerivative(REAL8 t, const PulsarDopplerParams *dopplerPoint, DopplerCoordinateID coordID, const EphemerisData *edat, const LALDetector *site, BOOLEAN includeRoemer)
FmetricAtoms_t * XLALComputeAtomsForFmetric(const DopplerMetricParams *metricParams, const EphemerisData *edat)
Function to the compute the FmetricAtoms_t, from which the F-metric and Fisher-matrix can be computed...
int XLALFindDopplerCoordinateInSystem(const DopplerCoordinateSystem *coordSys, const DopplerCoordinateID coordID)
Given a coordinate ID 'coordID', return its dimension within the given coordinate system 'coordSys',...
void XLALDestroyDopplerFstatMetric(DopplerFstatMetric *metric)
Free a DopplerFstatMetric structure.
const CHAR * XLALDopplerCoordinateHelp(DopplerCoordinateID coordID)
Provide a pointer to a static string containing the a descriptive 'help-string' describing the coordi...
static double CW_Phi_i(double tt, void *params)
Partial derivative of continuous-wave (CW) phase, with respect to Doppler coordinate 'i' := intparams...
void XLALmatrix33_in_vect3(vect3D_t out, mat33_t mat, const vect3D_t in)
compute matrix product mat .
void XLALDestroyDopplerPhaseMetric(DopplerPhaseMetric *metric)
Free a DopplerPhaseMetric structure.
REAL8 mat33_t[3][3]
3x3 matrix, useful for spatial 3D vector operations
const CHAR * XLALDopplerCoordinateName(DopplerCoordinateID coordID)
Provide a pointer to a static string containing the DopplerCoordinate-name cooresponding to the enum ...
void XLALequatorialVect2ecliptic(vect3D_t out, const vect3D_t in)
Convert 3-D vector from equatorial into ecliptic coordinates.
vect3Dlist_t * XLALComputeOrbitalDerivatives(UINT4 maxorder, const LIGOTimeGPS *tGPS, const EphemerisData *edat)
Compute time-derivatives up to 'maxorder' of the Earths' orbital position vector .
int XLALParseDetectorMotionString(const CHAR *detMotionString)
Parse a detector-motion type string into the corresponding enum-number,.
DopplerFstatMetric * XLALComputeDopplerFstatMetric(const DopplerMetricParams *metricParams, const EphemerisData *edat)
Calculate the general (single-segment coherent, or multi-segment semi-coherent) full (multi-IFO) Fsta...
#define POW2(a)
Function to compute the full F-statistic metric, including antenna-pattern functions from multi-detec...
int XLALPtolemaicPosVel(PosVel3D_t *posvel, const LIGOTimeGPS *tGPS)
Compute position and velocity assuming a purely "Ptolemaic" orbital motion (i.e.
void XLALDestroyVect3Dlist(vect3Dlist_t *list)
int XLALParseDopplerCoordinateString(const CHAR *coordName)
Parse a DopplerCoordinate-name into the corresponding DopplerCoordinateID.
DopplerPhaseMetric * XLALComputeDopplerPhaseMetric(const DopplerMetricParams *metricParams, const EphemerisData *edat)
Calculate an approximate "phase-metric" with the specified parameters.
@ DOPPLERCOORD_N3SX_EQU
X spin-component of unconstrained super-sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_N2X_ECL
X component of contrained sky position in ecliptic coordinates [Units: none].
@ DOPPLERCOORD_ETA
Lagrange parameter 'eta = ecc * sin(argp) of binary orbit (ELL1 model) [Units: none].
@ DOPPLERCOORD_N3X_ECL
X component of unconstrained super-sky position in ecliptic coordinates [Units: none].
@ DOPPLERCOORD_KAPPA
Lagrange parameter 'kappa = ecc * cos(argp)', ('ecc' = eccentricity, 'argp' = argument of periapse) o...
@ DOPPLERCOORD_TASC
Time of ascension (neutron star crosses line of nodes moving away from observer) for binary orbit (EL...
@ DOPPLERCOORD_N3X_EQU
X component of unconstrained super-sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_N3OY_ECL
Y orbit-component of unconstrained super-sky position in ecliptic coordinates [Units: none].
@ DOPPLERCOORD_ETAP
Rescaled (by asini) differential-coordinate 'detap = asini * deta' [Units: light seconds].
@ DOPPLERCOORD_KAPPAP
Rescaled (by asini) differential-coordinate 'dkappap = asini * dkappa' [Units: light seconds].
@ DOPPLERCOORD_ASINI
Projected semimajor axis of binary orbit in small-eccentricy limit (ELL1 model) [Units: light seconds...
@ DOPPLERCOORD_N3Z_EQU
Z component of unconstrained super-sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_GC_NU4
Global correlation fourth spindown [Units: Hz/s^4].
@ DOPPLERCOORD_F2DOT
Second spindown [Units: Hz/s^2].
@ DOPPLERCOORD_DASC
Distance traversed on the arc of binary orbit (ELL1 model) 'dasc = 2 * pi * (ap/porb) * tasc' [Units:...
@ DOPPLERCOORD_N2X_EQU
X component of contrained sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_DELTA
Declination [Units: radians].
@ DOPPLERCOORD_N2Y_ECL
Y component of contrained sky position in ecliptic coordinates [Units: none].
@ DOPPLERCOORD_GC_NU1
Global correlation first spindown [Units: Hz/s].
@ DOPPLERCOORD_GC_NU0
Global correlation frequency [Units: Hz].
@ DOPPLERCOORD_N3OZ_ECL
Z orbit-component of unconstrained super-sky position in ecliptic coordinates [Units: none].
@ DOPPLERCOORD_N3Y_EQU
Y component of unconstrained super-sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_F1DOT
First spindown [Units: Hz/s].
@ DOPPLERCOORD_N2Y_EQU
Y component of contrained sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_F4DOT
Fourth spindown [Units: Hz/s^4].
@ DOPPLERCOORD_GC_NU2
Global correlation second spindown [Units: Hz/s^2].
@ DOPPLERCOORD_GC_NU3
Global correlation third spindown [Units: Hz/s^3].
@ DOPPLERCOORD_ALPHA
Right ascension [Units: radians].
@ DOPPLERCOORD_NONE
No Doppler component.
@ DOPPLERCOORD_VP
Rescaled (by asini) differential-coordinate 'dvp = asini * dOMEGA', ('OMEGA' = 2 * pi/'porb') of bina...
@ DOPPLERCOORD_N3Y_ECL
Y component of unconstrained super-sky position in ecliptic coordinates [Units: none].
@ DOPPLERCOORD_PORB
Period of binary orbit (ELL1 model) [Units: s].
@ DOPPLERCOORD_F3DOT
Third spindown [Units: Hz/s^3].
@ DOPPLERCOORD_N3OX_ECL
X orbit-component of unconstrained super-sky position in ecliptic coordinates [Units: none].
@ DOPPLERCOORD_N3Z_ECL
Z component of unconstrained super-sky position in ecliptic coordinates [Units: none].
@ DOPPLERCOORD_N3SY_EQU
Y spin-component of unconstrained super-sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_FREQ
Frequency [Units: Hz].
@ DETMOTION_SPIN
Full spin motion.
@ DETMOTION_MASKSPIN
Mask for spin motion bits.
@ DETMOTION_PTOLEORBIT
Ptolemaic (circular) orbital motion.
@ DETMOTION_SPINXY
Ecliptic-X+Y components of spin motion only.
@ DETMOTION_MASKORBIT
Mask for orbital motion bits.
@ DETMOTION_SPINZ
Ecliptic-Z component of spin motion only.
@ DETMOTION_ORBIT
Ephemeris-based orbital motion.
#define XLAL_ERROR_REAL8(...)
#define XLAL_ERROR_NULL(...)
int int int XLALPrintInfo(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK(assertion,...)
#define XLAL_TRY(statement, errnum)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_REAL8(assertion,...)
#define XLAL_CHECK_NULL(assertion,...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
type describing a Doppler coordinate system: lists the number of dimensions and the symbolic names of...
DopplerCoordinateID coordIDs[DOPPLERMETRIC_MAX_DIM]
coordinate 'names'
UINT4 dim
number of dimensions covered
Struct to hold the output of XLALComputeDopplerFstatMetric(), including meta-info on the number of di...
gsl_matrix * m3_ij
Fstat-metric sub components.
double maxrelerr
estimate for largest relative error in Fmetric component integrations
gsl_matrix * gFav_ij
'average' Fstat-metric
gsl_matrix * gF_ij
full F-statistic metric gF_ij, including antenna-pattern effects (see )
DopplerMetricParams meta
"meta-info" describing/specifying the type of Doppler metric
REAL8 rho2
signal SNR rho^2 = A^mu M_mu_nu A^nu
gsl_matrix * Fisher_ab
Full 4+n dimensional Fisher matrix, ie amplitude + Doppler space.
meta-info specifying a Doppler-metric
MultiLALDetector multiIFO
detectors to compute metric for
DetectorMotionType detMotionType
the type of detector-motion assumed: full spin+orbit, pure orbital, Ptole, ...
BOOLEAN approxPhase
use an approximate phase-model, neglecting Roemer delay in spindown coordinates
PulsarParams signalParams
parameter-space point to compute metric for (doppler + amplitudes)
INT4 projectCoord
project metric onto subspace orthogonal to this axis (-1 = none, 0 = 1st coordinate,...
LALSegList segmentList
segment list: Nseg segments of the form (startGPS endGPS numSFTs)
MultiNoiseFloor multiNoiseFloor
and associated per-detector noise-floors to be used for weighting.
DopplerCoordinateSystem coordSys
number of dimensions and coordinate-IDs of Doppler-metric
Struct to hold the output of XLALComputeDopplerPhaseMetric(), including meta-info on the number of di...
double maxrelerr
estimate for largest relative error in phase-metric component integrations
gsl_matrix * g_ij
symmetric matrix holding the phase-metric, averaged over segments
DopplerMetricParams meta
"meta-info" describing/specifying the type of Doppler metric
Basic output structure of LALBarycenterEarth.c.
REAL8 velNow[3]
dimensionless velocity of Earth's center at tgps, extrapolated from JPL DE405 ephemeris
REAL8 posNow[3]
Cartesian coords of Earth's center at tgps, extrapolated from JPL DE405 ephemeris; units= sec.
Basic output structure produced by LALBarycenter.c.
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
Struct to hold the 'atoms', ie weighted phase-derivative averages like from which the F-metric is co...
double maxrelerr
estimate for largest relative error in metric component integrations
array of detectors definitions 'LALDetector'
UINT4 length
number of detectors
LALDetector sites[PULSAR_MAX_DETECTORS]
array of site information
array of detector-specific 'noise floors' (ie PSD values), assumed constant over the frequency-band o...
REAL8 sqrtSn[PULSAR_MAX_DETECTORS]
per-IFO sqrt(PSD) values , where
UINT4 length
number of detectors
Small Container to hold two 3D vectors: position and velocity.
Type containing the JKS 'amplitude parameters' {h0, cosi, phi0, psi}.
REAL8 aCross
Signal amplitude (cross)
REAL8 psi
polarization angle psi
REAL8 aPlus
Signal amplitude (plus)
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
REAL8 Delta
Sky position: DEC (latitude) in equatorial coords and radians.
LIGOTimeGPS refTime
Reference time of pulsar parameters (in SSB!)
PulsarAmplitudeParams Amp
'Amplitude-parameters': h0, cosi, phi0, psi
PulsarDopplerParams Doppler
'Phase-evolution parameters': {skypos, fkdot, orbital params }
parameters for metric-integration
const DopplerCoordinateSystem * coordSys
Doppler coordinate system in use.
REAL8 startTime
GPS start time of observation.
int coord
coordinate index of the component for single phase-derivative Phi_i compute
double intT
length of integration time segments for phase integrals
double epsabs
absolute error tolerance for GSL integration routines
const PulsarDopplerParams * dopplerPoint
Doppler params to compute metric for.
BOOLEAN approxPhase
use an approximate phase-model, neglecting Roemer delay in spindown coordinates (or orders >= 1)
DetectorMotionType detMotionType
which detector-motion to use in metric integration
double epsrel
relative error tolerance for GSL integration routines
vect3Dlist_t * rOrb_n
list of orbital-radius derivatives at refTime of order n = 0, 1, ...
const EphemerisData * edat
ephemeris data
int errnum
store XLAL error of any failures within integrator
const gsl_matrix * coordTransf
coordinate transform to apply to coordinate system
const LALDetector * site
detector site to compute metric for
REAL8 Tspan
length of observation time in seconds
REAL8 refTime
GPS reference time for pulsar parameters.
variable-length list of 3D vectors
vect3D_t * data
array of 3D vectors
UINT4 length
number of elements