27 #include <gsl/gsl_math.h>
28 #include <gsl/gsl_blas.h>
29 #include <gsl/gsl_linalg.h>
30 #include <gsl/gsl_eigen.h>
31 #include <gsl/gsl_roots.h>
33 #include <lal/SuperskyMetrics.h>
34 #include <lal/LALConstants.h>
35 #include <lal/LogPrintf.h>
36 #include <lal/MetricUtils.h>
37 #include <lal/ExtrapolatePulsarSpins.h>
39 #include <lal/GSLHelpers.h>
42 #define UNUSED __attribute__ ((unused))
48 #define SQR(x) ((x)*(x))
51 #define RE_SQRT(x) sqrt(GSL_MAX(DBL_EPSILON, (x)))
54 #define DOT2(x,y) ((x)[0]*(y)[0] + (x)[1]*(y)[1])
55 #define DOT3(x,y) ((x)[0]*(y)[0] + (x)[1]*(y)[1] + (x)[2]*(y)[2])
58 #define MAX_SKY_OFFSETS PULSAR_MAX_SPINS
75 #define CHECK_RSSKY_METRIC_TRANSF(M, RT) \
76 ((M) != NULL && CHECK_RSSKY_TRANSF(RT) && (M)->size1 == (RT)->ndim && (M)->size2 == (RT)->ndim)
77 #define CHECK_RSSKY_TRANSF(RT) \
78 ((RT) != NULL && (RT)->ndim > 0 && (RT)->fiducial_freq > 0 && (RT)->nsky_offsets == 1 + (RT)->nspins)
81 #define RSSKY_FKDOT_OFFSET(RT, S) (((S) == 0) ? ((RT)->SMAX) : ((size_t)((S) - 1)))
82 #define RSSKY_FKDOT_DIM(RT, S) (2 + RSSKY_FKDOT_OFFSET(RT, S))
91 typedef struct tagSM_CallbackParam {
95 typedef struct tagSM_CallbackOut {
98 double min_rssky2_array[32];
100 double max_rssky2_array[32];
136 par.coordSys = *coords;
139 par.detMotionType = detector_motion;
147 par.segmentList = segments;
151 if ( detector_weights != NULL ) {
152 par.multiNoiseFloor = *detector_weights;
154 par.multiNoiseFloor.length = 0;
165 par.projectCoord = -1;
175 gsl_matrix *g_ij = NULL;
193 gsl_matrix *fitted_ssky_metric,
194 SuperskyTransformData *rssky_transf,
195 const gsl_matrix *ussky_metric,
196 const gsl_matrix *orbital_metric,
213 gsl_matrix *GAMAT( tmp, 3 + rssky_transf->SMAX, 3 + rssky_transf->SMAX );
214 gsl_vector *GAVEC( tmpv, 1 + rssky_transf->SMAX );
221 gsl_matrix *orb_metric = NULL, *mid_time_transf = NULL, *diag_norm_transf = NULL;
231 gsl_matrix *GAMAT( fitA, 3 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
233 gsl_matrix_view orb_metric_fspin = gsl_matrix_submatrix( orb_metric, 0, 2, 3 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
234 gsl_matrix_memcpy( fitA, &orb_metric_fspin.matrix );
238 gsl_matrix *GAMAT( fitAt_fitA, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
239 gsl_blas_dgemm( CblasTrans, CblasNoTrans, 1.0, fitA, fitA, 0.0, fitAt_fitA );
242 gsl_matrix *GAMAT( svd_U, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
243 gsl_matrix *GAMAT( svd_V, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
244 gsl_vector *GAVEC( svd_S, 1 + rssky_transf->SMAX );
245 gsl_matrix_memcpy( svd_U, fitAt_fitA );
251 gsl_matrix *GAMAT( fitc, 1 + rssky_transf->SMAX, 2 );
252 for (
size_t j = 0;
j < 2; ++
j ) {
253 gsl_vector_view orb_metric_j = gsl_matrix_column( orb_metric,
j );
254 gsl_vector_view fitc_j = gsl_matrix_column( fitc,
j );
255 gsl_blas_dgemv( CblasTrans, 1.0, fitA, &orb_metric_j.vector, 0.0, tmpv );
272 gsl_matrix *GAMAT( subtract_orb, 3 + rssky_transf->SMAX, 3 + rssky_transf->SMAX );
274 gsl_matrix_set_identity( subtract_orb );
275 gsl_matrix_view subtract_orb_fspin_sky = gsl_matrix_submatrix( subtract_orb, 2, 0, 1 + rssky_transf->SMAX, 2 );
276 gsl_matrix_memcpy( &subtract_orb_fspin_sky.matrix, fitc );
277 gsl_matrix_scale( &subtract_orb_fspin_sky.matrix, -1.0 );
282 gsl_blas_dgemm( CblasNoTrans, CblasNoTrans, 1.0, diag_norm_transf, subtract_orb, 0.0, tmp );
283 gsl_blas_dgemm( CblasNoTrans, CblasNoTrans, 1.0, mid_time_transf, tmp, 0.0, subtract_orb );
299 gsl_matrix *GAMAT( subtract_ussky, 4 + rssky_transf->SMAX, 4 + rssky_transf->SMAX );
301 gsl_matrix_set_identity( subtract_ussky );
302 gsl_matrix_view subtract_ussky_fspin_sky = gsl_matrix_submatrix( subtract_ussky, 3, 0, 1 + rssky_transf->SMAX, 3 );
303 gsl_matrix_view subtract_orb_fspin_sky = gsl_matrix_submatrix( subtract_orb, 2, 0, 1 + rssky_transf->SMAX, 2 );
305 gsl_vector_view subtract_ussky_fspin_sky_col = gsl_matrix_column( &subtract_ussky_fspin_sky.matrix, 0 );
306 gsl_vector_view subtract_orb_fspin_sky_col = gsl_matrix_column( &subtract_orb_fspin_sky.matrix, 0 );
307 gsl_vector_memcpy( &subtract_ussky_fspin_sky_col.vector, &subtract_orb_fspin_sky_col.vector );
310 gsl_vector_view subtract_ussky_fspin_sky_col = gsl_matrix_column( &subtract_ussky_fspin_sky.matrix, 1 );
311 gsl_vector_view subtract_orb_fspin_sky_col = gsl_matrix_column( &subtract_orb_fspin_sky.matrix, 1 );
312 gsl_vector_memcpy( &subtract_ussky_fspin_sky_col.vector, &subtract_orb_fspin_sky_col.vector );
313 gsl_vector_scale( &subtract_ussky_fspin_sky_col.vector,
LAL_COSIEARTH );
316 gsl_vector_view subtract_ussky_fspin_sky_col = gsl_matrix_column( &subtract_ussky_fspin_sky.matrix, 2 );
317 gsl_vector_view subtract_orb_fspin_sky_col = gsl_matrix_column( &subtract_orb_fspin_sky.matrix, 1 );
318 gsl_vector_memcpy( &subtract_ussky_fspin_sky_col.vector, &subtract_orb_fspin_sky_col.vector );
319 gsl_vector_scale( &subtract_ussky_fspin_sky_col.vector,
LAL_SINIEARTH );
328 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
329 gsl_matrix_view subtract_ussky_fspin_sky = gsl_matrix_submatrix( subtract_ussky, 3, 0, 1 + rssky_transf->SMAX, 3 );
330 gsl_matrix_sub( &sky_offsets.matrix, &subtract_ussky_fspin_sky.matrix );
334 GFMAT( diag_norm_transf, fitA, fitAt_fitA, fitc, mid_time_transf, orb_metric, subtract_orb, subtract_ussky, svd_U, svd_V, tmp );
335 GFVEC( svd_S, tmpv );
347 gsl_matrix *decoupled_ssky_metric,
348 SuperskyTransformData *rssky_transf,
349 const gsl_matrix *fitted_ssky_metric
359 gsl_matrix_memcpy( decoupled_ssky_metric, fitted_ssky_metric );
362 gsl_matrix_view sky_sky = gsl_matrix_submatrix( decoupled_ssky_metric, 0, 0, 3, 3 );
363 gsl_matrix_view sky_fspin = gsl_matrix_submatrix( decoupled_ssky_metric, 0, 3, 3, 1 + rssky_transf->SMAX );
364 gsl_matrix_view fspin_sky = gsl_matrix_submatrix( decoupled_ssky_metric, 3, 0, 1 + rssky_transf->SMAX, 3 );
365 gsl_matrix_view fspin_fspin = gsl_matrix_submatrix( decoupled_ssky_metric, 3, 3, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
368 gsl_matrix *fspin_fspin_dnorm = NULL, *fspin_fspin_dnorm_transf = NULL;
372 gsl_matrix *GAMAT( fspin_fspin_dnorm_LU, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
373 gsl_matrix *GAMAT( fspin_fspin_dnorm_inv, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
374 gsl_permutation *GAPERM( fspin_fspin_dnorm_LU_perm, 1 + rssky_transf->SMAX );
375 int fspin_fspin_dnorm_LU_sign = 0;
376 gsl_matrix_memcpy( fspin_fspin_dnorm_LU, fspin_fspin_dnorm );
377 XLAL_CHECK( gsl_linalg_LU_decomp( fspin_fspin_dnorm_LU, fspin_fspin_dnorm_LU_perm, &fspin_fspin_dnorm_LU_sign ) == 0,
XLAL_EFAILED );
378 XLAL_CHECK( gsl_linalg_LU_invert( fspin_fspin_dnorm_LU, fspin_fspin_dnorm_LU_perm, fspin_fspin_dnorm_inv ) == 0,
XLAL_EFAILED );
383 gsl_matrix *GAMAT( decouple_sky_offsets, 1 + rssky_transf->SMAX, 3 );
384 gsl_blas_dtrmm( CblasLeft, CblasUpper, CblasNoTrans, CblasNonUnit, 1.0, fspin_fspin_dnorm_transf, &fspin_sky.matrix );
385 gsl_blas_dgemm( CblasNoTrans, CblasNoTrans, 1.0, fspin_fspin_dnorm_inv, &fspin_sky.matrix, 0.0, decouple_sky_offsets );
386 gsl_blas_dtrmm( CblasLeft, CblasUpper, CblasNoTrans, CblasNonUnit, 1.0, fspin_fspin_dnorm_transf, decouple_sky_offsets );
389 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
390 gsl_matrix_add( &sky_offsets.matrix, decouple_sky_offsets );
394 gsl_blas_dgemm( CblasNoTrans, CblasNoTrans, -1.0, &sky_fspin.matrix, decouple_sky_offsets, 1.0, &sky_sky.matrix );
397 gsl_matrix_set_zero( &sky_fspin.matrix );
398 gsl_matrix_set_zero( &fspin_sky.matrix );
401 GFPERM( fspin_fspin_dnorm_LU_perm );
402 GFMAT( fspin_fspin_dnorm, fspin_fspin_dnorm_LU, fspin_fspin_dnorm_inv, fspin_fspin_dnorm_transf, decouple_sky_offsets );
414 gsl_matrix *aligned_ssky_metric,
415 SuperskyTransformData *rssky_transf,
416 const gsl_matrix *decoupled_ssky_metric
426 gsl_matrix *GAMAT( tmp, 1 + rssky_transf->SMAX, 3 );
429 gsl_matrix_memcpy( aligned_ssky_metric, decoupled_ssky_metric );
432 gsl_vector *GAVEC( sky_eval, 3 );
433 gsl_matrix *GAMAT( sky_evec, 3, 3 );
434 gsl_eigen_symmv_workspace *GALLOC( wksp, gsl_eigen_symmv_alloc( 3 ) );
435 gsl_matrix_view sky_sky = gsl_matrix_submatrix( aligned_ssky_metric, 0, 0, 3, 3 );
442 gsl_matrix_set_zero( &sky_sky.matrix );
443 gsl_vector_view sky_sky_diag = gsl_matrix_diagonal( &sky_sky.matrix );
444 gsl_vector_memcpy( &sky_sky_diag.vector, sky_eval );
448 for (
size_t j = 0;
j < 3; ++
j ) {
449 gsl_vector_view col = gsl_matrix_column( sky_evec,
j );
450 if ( gsl_vector_get( &col.vector,
j ) < 0.0 ) {
451 gsl_vector_scale( &col.vector, -1.0 );
456 gsl_matrix_view align_sky = gsl_matrix_view_array( &rssky_transf->align_sky[0][0], 3, 3 );
457 gsl_matrix_transpose_memcpy( &align_sky.matrix, sky_evec );
461 gsl_permutation *GAPERM( LU_perm, 3 );
464 if ( gsl_linalg_LU_det( sky_evec, LU_sign ) < 0.0 ) {
465 gsl_vector_view col = gsl_matrix_column( &align_sky.matrix, 2 );
466 gsl_vector_scale( &col.vector, -1.0 );
471 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
472 gsl_matrix_memcpy( tmp, &sky_offsets.matrix );
473 gsl_blas_dgemm( CblasNoTrans, CblasTrans, 1.0, tmp, &align_sky.matrix, 0.0, &sky_offsets.matrix );
476 gsl_eigen_symmv_free( wksp );
477 GFMAT( sky_evec, tmp );
489 gsl_matrix **rssky_metric,
490 SuperskyTransformData **rssky_transf,
491 const size_t spindowns,
492 const gsl_matrix *ussky_metric,
494 const gsl_matrix *orbital_metric,
516 GAMAT( *rssky_metric, orbital_metric->size1, orbital_metric->size1 );
517 *rssky_transf =
XLALCalloc( 1,
sizeof( **rssky_transf ) );
519 gsl_matrix *GAMAT( assky_metric, 1 + orbital_metric->size1, 1 + orbital_metric->size1 );
522 ( *rssky_transf )->ndim = ( *rssky_metric )->size1;
523 ( *rssky_transf )->ref_time = *ref_time;
525 ( *rssky_transf )->nspins = spindowns;
526 ( *rssky_transf )->nsky_offsets = 1 + spindowns;
537 for (
size_t i = ifreq;
i + 1 < assky_metric->size1; ++
i ) {
538 gsl_matrix_swap_rows( assky_metric,
i,
i + 1 );
539 gsl_matrix_swap_columns( assky_metric,
i,
i + 1 );
543 const int isky_offset_freq = ifreq - 3;
544 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &( *rssky_transf )->sky_offsets[0][0], ( *rssky_transf )->nsky_offsets, 3 );
545 for (
size_t i = isky_offset_freq;
i + 1 < sky_offsets.matrix.size1; ++
i ) {
546 gsl_matrix_swap_rows( &sky_offsets.matrix,
i,
i + 1 );
552 for (
size_t i = inc;
i + 1 < assky_metric->size1; ++
i ) {
553 gsl_matrix_swap_rows( assky_metric,
i,
i + 1 );
554 gsl_matrix_swap_columns( assky_metric,
i,
i + 1 );
559 gsl_matrix_view extract_rssky_metric = gsl_matrix_submatrix( assky_metric, 0, 0, ( *rssky_metric )->size1, ( *rssky_metric )->size1 );
560 gsl_matrix_memcpy( *rssky_metric, &extract_rssky_metric.matrix );
563 for (
size_t i = 0;
i < ( *rssky_metric )->size1; ++
i ) {
564 for (
size_t j =
i + 1;
j < ( *rssky_metric )->size1; ++
j ) {
565 const double gij = gsl_matrix_get( *rssky_metric,
i,
j );
566 const double gji = gsl_matrix_get( *rssky_metric,
j,
i );
567 const double g = 0.5 * ( gij + gji );
568 gsl_matrix_set( *rssky_metric,
i,
j, g );
569 gsl_matrix_set( *rssky_metric,
j,
i, g );
574 for (
size_t s = 1;
s <= ( *rssky_metric )->size1; ++
s ) {
575 gsl_matrix_view rssky_metric_s = gsl_matrix_submatrix( *rssky_metric, 0, 0,
s,
s );
577 XLAL_CHECK( det_s > 0,
XLAL_EFAILED,
"Reduced supersky metric is not positive definite (s=%zu, det_s=%0.3e)",
s, det_s );
581 GFMAT( assky_metric );
589 const size_t spindowns,
592 const double fiducial_freq,
627 if ( spindowns >= 1 ) {
631 if ( spindowns >= 2 ) {
635 if ( spindowns >= 3 ) {
639 if ( spindowns >= 4 ) {
656 gsl_matrix *GAMAT_NULL( ussky_metric_avg, 4 + spindowns, 4 + spindowns );
657 gsl_matrix *GAMAT_NULL( orbital_metric_avg, 3 + spindowns, 3 + spindowns );
667 gsl_matrix_add( ussky_metric_avg, ussky_metric_seg );
672 gsl_matrix_add( orbital_metric_avg, orbital_metric_seg );
675 XLAL_CHECK_NULL(
SM_ComputeReducedSuperskyMetric( &metrics->
coh_rssky_metric[
n], &metrics->
coh_rssky_transf[
n], spindowns, ussky_metric_seg, &ucoords, orbital_metric_seg, &ocoords, ref_time, start_time_seg, end_time_seg ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
679 GFMAT( ussky_metric_seg, orbital_metric_seg );
684 gsl_matrix_scale( ussky_metric_avg, 1.0 / metrics->
num_segments );
685 gsl_matrix_scale( orbital_metric_avg, 1.0 / metrics->
num_segments );
690 XLAL_CHECK_NULL(
SM_ComputeReducedSuperskyMetric( &metrics->
semi_rssky_metric, &metrics->
semi_rssky_transf, spindowns, ussky_metric_avg, &ucoords, orbital_metric_avg, &ocoords, ref_time, start_time_avg, end_time_avg ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
697 GFMAT( ussky_metric_avg, orbital_metric_avg );
746 if ( metrics != NULL ) {
797 for ( idx[2] = 0; idx[2] < dims[2]; ++idx[2] ) {
839 *metrics =
XLALCalloc( 1,
sizeof( **metrics ) );
847 ( *metrics )->num_segments = dims[2];
848 ( *metrics )->coh_rssky_metric =
XLALCalloc( ( *metrics )->num_segments,
sizeof( *( *metrics )->coh_rssky_metric ) );
851 for ( idx[2] = 0; idx[2] < dims[2]; ++idx[2] ) {
862 ( *metrics )->coh_rssky_transf =
XLALCalloc( ( *metrics )->num_segments,
sizeof( *( *metrics )->coh_rssky_transf ) );
864 for (
size_t i = 0;
i < ( *metrics )->num_segments; ++
i ) {
865 ( *metrics )->coh_rssky_transf[
i] =
XLALCalloc( 1,
sizeof( *( *metrics )->coh_rssky_transf[
i] ) );
883 ( *metrics )->semi_rssky_transf =
XLALCalloc( 1,
sizeof( *( *metrics )->semi_rssky_transf ) );
907 if ( spindowns != NULL ) {
919 gsl_matrix *rssky_metric,
920 SuperskyTransformData *rssky_transf,
921 const double new_fiducial_freq
930 const double fiducial_scale = new_fiducial_freq / rssky_transf->fiducial_freq;
931 gsl_matrix_view sky_sky = gsl_matrix_submatrix( rssky_metric, 0, 0, 2, 2 );
932 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
933 gsl_matrix_scale( &sky_sky.matrix,
SQR( fiducial_scale ) );
934 gsl_matrix_scale( &sky_offsets.matrix, fiducial_scale );
937 rssky_transf->fiducial_freq = new_fiducial_freq;
945 const double new_fiducial_freq
970 const double coh_max_mismatch,
971 const double semi_max_mismatch
988 double max_gff_d_mu = gsl_matrix_get( metrics->
semi_rssky_metric, ifreq, ifreq ) / semi_max_mismatch;
990 const double coh_gff_d_mu = gsl_matrix_get( metrics->
coh_rssky_metric[
n], ifreq, ifreq ) / coh_max_mismatch;
991 if ( max_gff_d_mu < coh_gff_d_mu ) {
992 max_gff_d_mu = coh_gff_d_mu;
1001 const double semi_gff_d_mu = gsl_matrix_get( metrics->
semi_rssky_metric, ifreq, ifreq ) / semi_max_mismatch;
1002 const double scale = sqrt( max_gff_d_mu / semi_gff_d_mu );
1005 gsl_vector_view rssky_metric_f_row = gsl_matrix_row( metrics->
semi_rssky_metric, ifreq );
1006 gsl_vector_scale( &rssky_metric_f_row.vector,
scale );
1008 gsl_vector_view rssky_metric_f_col = gsl_matrix_column( metrics->
semi_rssky_metric, ifreq );
1009 gsl_vector_scale( &rssky_metric_f_col.vector,
scale );
1013 const double coh_gff_d_mu = gsl_matrix_get( metrics->
coh_rssky_metric[
n], ifreq, ifreq ) / coh_max_mismatch;
1014 const double scale = sqrt( max_gff_d_mu / coh_gff_d_mu );
1017 gsl_vector_view rssky_metric_f_row = gsl_matrix_row( metrics->
coh_rssky_metric[
n], ifreq );
1018 gsl_vector_scale( &rssky_metric_f_row.vector,
scale );
1020 gsl_vector_view rssky_metric_f_col = gsl_matrix_column( metrics->
coh_rssky_metric[
n], ifreq );
1021 gsl_vector_scale( &rssky_metric_f_col.vector,
scale );
1031 const SuperskyTransformData *rssky_transf
1040 out_phys->
refTime = rssky_transf->ref_time;
1077 const gsl_vector *rss,
1081 const double A = GSL_SIGN( hemi ) * gsl_vector_get( rss, 0 ) - 1;
1082 const double B = gsl_vector_get( rss, 1 );
1083 const double R = sqrt(
SQR(
A ) +
SQR(
B ) );
1084 const double Rmax = GSL_MAX( 1.0, R );
1087 as[2] = GSL_SIGN( hemi ) *
RE_SQRT( 1.0 -
DOT2( as, as ) );
1099 const double r = sqrt(
DOT3( as, as ) );
1100 const double A = GSL_SIGN( as[2] ) * ( ( as[0] /
r ) + 1.0 );
1101 const double B = as[1] /
r;
1102 gsl_vector_set( rss, 0,
A );
1103 gsl_vector_set( rss, 1,
B );
1107 gsl_vector *out_rssky,
1109 const SuperskyTransformData *rssky_transf
1127 double intm[4 + rssky_transf->SMAX];
1128 gsl_vector_view intm_sky2 = gsl_vector_view_array( &intm[0], 2 );
1129 gsl_vector_view intm_sky3 = gsl_vector_view_array( &intm[0], 3 );
1130 gsl_vector_view intm_fspin = gsl_vector_view_array( &intm[3], 1 + rssky_transf->SMAX );
1134 const double cos_Delta = cos( in_phys_ref.
Delta );
1135 intm[0] = cos( in_phys_ref.
Alpha ) * cos_Delta;
1136 intm[1] = sin( in_phys_ref.
Alpha ) * cos_Delta;
1137 intm[2] = sin( in_phys_ref.
Delta );
1141 intm[3 + rssky_transf->SMAX] = in_phys_ref.
fkdot[0];
1142 for (
size_t s = 1;
s <= rssky_transf->SMAX; ++
s ) {
1143 intm[2 +
s] = in_phys_ref.
fkdot[
s];
1149 gsl_vector_view asky_v = gsl_vector_view_array( asky, 3 );
1150 gsl_matrix_const_view align_sky = gsl_matrix_const_view_array( &rssky_transf->align_sky[0][0], 3, 3 );
1151 gsl_blas_dgemv( CblasNoTrans, 1.0, &align_sky.matrix, &intm_sky3.vector, 0.0, &asky_v.vector );
1156 gsl_matrix_const_view sky_offsets = gsl_matrix_const_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
1157 gsl_blas_dgemv( CblasNoTrans, 1.0, &sky_offsets.matrix, &asky_v.vector, 1.0, &intm_fspin.vector );
1164 gsl_vector_view out_sky2 = gsl_vector_subvector( out_rssky, 0, 2 );
1165 gsl_vector_view out_fspin = gsl_vector_subvector( out_rssky, 2, 1 + rssky_transf->SMAX );
1166 gsl_vector_memcpy( &out_sky2.vector, &intm_sky2.vector );
1167 gsl_vector_memcpy( &out_fspin.vector, &intm_fspin.vector );
1176 const gsl_vector *in_rssky,
1177 const gsl_vector *ref_rssky,
1178 const SuperskyTransformData *rssky_transf
1190 out_phys->
refTime = rssky_transf->ref_time;
1193 double intm[4 + rssky_transf->SMAX];
1194 gsl_vector_view intm_sky2 = gsl_vector_view_array( &intm[0], 2 );
1195 gsl_vector_view intm_sky3 = gsl_vector_view_array( &intm[0], 3 );
1196 gsl_vector_view intm_fspin = gsl_vector_view_array( &intm[3], 1 + rssky_transf->SMAX );
1200 gsl_vector_const_view in_sky2 = gsl_vector_const_subvector( in_rssky, 0, 2 );
1201 gsl_vector_const_view in_fspin = gsl_vector_const_subvector( in_rssky, 2, 1 + rssky_transf->SMAX );
1202 gsl_vector_memcpy( &intm_sky2.vector, &in_sky2.vector );
1203 gsl_vector_memcpy( &intm_fspin.vector, &in_fspin.vector );
1207 const double A = gsl_vector_get( ref_rssky != NULL ? ref_rssky : in_rssky, 0 );
1210 gsl_vector_view asky_v = gsl_vector_view_array( asky, 3 );
1215 gsl_matrix_const_view sky_offsets = gsl_matrix_const_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
1216 gsl_blas_dgemv( CblasNoTrans, -1.0, &sky_offsets.matrix, &asky_v.vector, 1.0, &intm_fspin.vector );
1220 gsl_matrix_const_view align_sky = gsl_matrix_const_view_array( &rssky_transf->align_sky[0][0], 3, 3 );
1221 gsl_blas_dgemv( CblasTrans, 1.0, &align_sky.matrix, &asky_v.vector, 0.0, &intm_sky3.vector );
1224 out_phys->
fkdot[0] = intm[3 + rssky_transf->SMAX];
1225 for (
size_t s = 1;
s <= rssky_transf->SMAX; ++
s ) {
1226 out_phys->
fkdot[
s] = intm[2 +
s];
1230 out_phys->
Alpha = atan2( intm[1], intm[0] );
1231 out_phys->
Delta = atan2( intm[2], sqrt(
SQR( intm[0] ) +
SQR( intm[1] ) ) );
1239 gsl_vector *out_rssky,
1240 const SuperskyTransformData *out_rssky_transf,
1241 const gsl_vector *in_rssky,
1242 const gsl_vector *ref_rssky,
1243 const SuperskyTransformData *in_rssky_transf
1265 gsl_matrix **out_rssky,
1266 const gsl_matrix *in_phys,
1267 const SuperskyTransformData *rssky_transf
1278 if ( *out_rssky != NULL ) {
1279 if ( ( *out_rssky )->size1 != in_phys->size1 || ( *out_rssky )->size2 != in_phys->size2 ) {
1280 GFMAT( *out_rssky );
1284 if ( *out_rssky == NULL ) {
1285 GAMAT( *out_rssky, in_phys->size1, in_phys->size2 );
1289 for (
size_t j = 0;
j < in_phys->size2; ++
j ) {
1293 in_phys_j.refTime = rssky_transf->ref_time;
1294 in_phys_j.Alpha = gsl_matrix_get( in_phys, 0,
j );
1295 in_phys_j.Delta = gsl_matrix_get( in_phys, 1,
j );
1296 for (
size_t s = 0;
s <= rssky_transf->SMAX; ++
s ) {
1297 in_phys_j.fkdot[
s] = gsl_matrix_get( in_phys, 2 +
s,
j );
1301 gsl_vector_view out_rssky_j = gsl_matrix_column( *out_rssky,
j );
1311 gsl_matrix **out_phys,
1312 const gsl_matrix *in_rssky,
1313 const SuperskyTransformData *rssky_transf
1324 if ( *out_phys != NULL ) {
1325 if ( ( *out_phys )->size1 != in_rssky->size1 || ( *out_phys )->size2 != in_rssky->size2 ) {
1330 if ( *out_phys == NULL ) {
1331 GAMAT( *out_phys, in_rssky->size1, in_rssky->size2 );
1335 for (
size_t j = 0;
j < in_rssky->size2; ++
j ) {
1338 gsl_vector_const_view in_rssky_j = gsl_matrix_const_column( in_rssky,
j );
1343 gsl_matrix_set( *out_phys, 0,
j, out_phys_j.Alpha );
1344 gsl_matrix_set( *out_phys, 1,
j, out_phys_j.Delta );
1345 for (
size_t s = 0;
s <= rssky_transf->SMAX; ++
s ) {
1346 gsl_matrix_set( *out_phys, 2 +
s,
j, out_phys_j.fkdot[
s] );
1356 const size_t dim UNUSED,
1357 const gsl_vector *point,
1363 const double A = gsl_vector_get( point, 0 );
1368 for (
size_t i = 0;
i < 3; ++
i ) {
1369 gsl_vector_set(
cache,
i, as[
i] );
1395 const size_t dim UNUSED,
1396 const gsl_matrix *
cache UNUSED,
1397 const gsl_vector *point
1406 const double A = gsl_vector_get( point, 0 );
1407 const double rssky[2] = {
A, 0 };
1408 gsl_vector_const_view rssky_view = gsl_vector_const_view_array( rssky, 2 );
1411 const double na = as[0];
1414 const double limit =
RE_SQRT( 1 -
SQR( na ) );
1417 double bound = GSL_NAN;
1418 if ( A <= psbd->min_A ) {
1420 }
else if (
A >= psbd->
max_A ) {
1427 if (
A <=
p.max_A ) {
1429 if (
p.type != 0 ) {
1432 bound =
p.type * limit;
1438 const double c = ( na -
p.na0 ) /
p.r;
1439 double angle = asin( GSL_MAX( -1, GSL_MIN(
c, 1 ) ) );
1444 bound =
p.C * cos( angle ) +
p.S * sin( angle ) +
p.Z;
1455 return GSL_MAX( -limit, GSL_MIN( bound, limit ) );
1460 LatticeTiling *tiling,
1461 gsl_matrix *rssky_metric,
1462 SuperskyTransformData *rssky_transf,
1463 const double alpha1,
1464 const double alpha2,
1465 const double delta1,
1477 gsl_matrix_view align_sky = gsl_matrix_view_array( &rssky_transf->align_sky[0][0], 3, 3 );
1478 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
1482 "|alpha1 - alpha2| and |delta1 - delta2| must either be both zero, or both nonzero" );
1483 if ( fabs( alpha1 - alpha2 ) >=
LAL_TWOPI ) {
1485 "If |alpha1 - alpha2| covers the whole sky, then |delta1| == |delta2| == PI/2 is required" );
1488 "If |alpha1 - alpha2| does not cover the whole sky, then |alpha1 - alpha2| <= PI is required" );
1490 "If |alpha1 - alpha2| does not cover the whole sky, then -PI/2 <= delta1 <= PI/2 is required" );
1492 "If |alpha1 - alpha2| does not cover the whole sky, then -PI/2 <= delta2 <= PI/2 is required" );
1500 if ( alpha1 == alpha2 && delta1 == delta2 ) {
1503 double rssky_point[rssky_metric->size1];
1504 gsl_vector_view rssky_point_view = gsl_vector_view_array( rssky_point, rssky_metric->size1 );
1506 phys_point.Alpha = alpha1;
1507 phys_point.Delta = delta1;
1511 for (
size_t dim = 0; dim < 2; ++dim ) {
1524 data_lower.pieces[
i].max_A = data_upper.pieces[
i].max_A = GSL_NEGINF;
1532 if ( fabs( alpha1 - alpha2 ) >=
LAL_TWOPI ) {
1535 data_lower.min_A = data_upper.min_A = -2;
1536 data_lower.min_A_bound = data_upper.min_A_bound = 0;
1537 data_lower.max_A = data_upper.max_A = 2;
1538 data_lower.max_A_bound = data_upper.max_A_bound = 0;
1539 data_lower.pieces[0] = lower_circular;
1540 data_lower.pieces[0].
max_A = GSL_POSINF;
1541 data_upper.pieces[0] = upper_circular;
1542 data_upper.pieces[0].
max_A = GSL_POSINF;
1578 const double alpha = GSL_MIN( alpha1, alpha2 );
1579 const double cos_alpha = cos(
alpha );
1580 const double sin_alpha = sin(
alpha );
1581 const double Q_na_0 = gsl_matrix_get( &align_sky.matrix, 0, 0 );
1582 const double Q_na_1 = gsl_matrix_get( &align_sky.matrix, 0, 1 );
1583 const double Q_nb_0 = gsl_matrix_get( &align_sky.matrix, 1, 0 );
1584 const double Q_nb_1 = gsl_matrix_get( &align_sky.matrix, 1, 1 );
1585 const double na = Q_na_0 * cos_alpha + Q_na_1 * sin_alpha;
1586 const double nb = Q_nb_0 * cos_alpha + Q_nb_1 * sin_alpha;
1587 phi = atan2( -nb, na );
1588 const double na_rot = na * cos( phi ) + nb * sin( phi );
1591 }
else if ( na_rot > 0 ) {
1595 const double cos_phi = cos( phi );
1596 const double sin_phi = sin( phi );
1605 for (
size_t j = 0;
j < 3; ++
j ) {
1606 const double Q_na_j = gsl_matrix_get( &align_sky.matrix, 0,
j );
1607 const double Q_nb_j = gsl_matrix_get( &align_sky.matrix, 1,
j );
1608 const double Q_na_j_rot = Q_na_j * cos_phi - Q_nb_j * sin_phi;
1609 const double Q_nb_j_rot = Q_nb_j * cos_phi + Q_na_j * sin_phi;
1610 gsl_matrix_set( &align_sky.matrix, 0,
j, Q_na_j_rot );
1611 gsl_matrix_set( &align_sky.matrix, 1,
j, Q_nb_j_rot );
1613 for (
size_t i = 0;
i < sky_offsets.matrix.size1; ++
i ) {
1614 const double Delta_0 = gsl_matrix_get( &sky_offsets.matrix,
i, 0 );
1615 const double Delta_1 = gsl_matrix_get( &sky_offsets.matrix,
i, 1 );
1616 const double Delta_0_rot = Delta_0 * cos_phi - Delta_1 * sin_phi;
1617 const double Delta_1_rot = Delta_1 * cos_phi + Delta_0 * sin_phi;
1618 gsl_matrix_set( &sky_offsets.matrix,
i, 0, Delta_0_rot );
1619 gsl_matrix_set( &sky_offsets.matrix,
i, 1, Delta_1_rot );
1632 const double g_na_na = gsl_matrix_get( rssky_metric, 0, 0 );
1633 const double g_nb_nb = gsl_matrix_get( rssky_metric, 1, 1 );
1634 const double g_na_na_rot = g_na_na *
SQR( cos_phi ) + g_nb_nb *
SQR( sin_phi );
1635 const double g_na_nb_rot = ( g_na_na - g_nb_nb ) * cos_phi * sin_phi;
1636 const double g_nb_nb_rot = g_na_na *
SQR( sin_phi ) + g_nb_nb *
SQR( cos_phi );
1637 gsl_matrix_set( rssky_metric, 0, 0, g_na_na_rot );
1638 gsl_matrix_set( rssky_metric, 0, 1, g_na_nb_rot );
1639 gsl_matrix_set( rssky_metric, 1, 0, g_na_nb_rot );
1640 gsl_matrix_set( rssky_metric, 1, 1, g_nb_nb_rot );
1644 const double Q_na[3] = { gsl_matrix_get( &align_sky.matrix, 0, 0 ), gsl_matrix_get( &align_sky.matrix, 0, 1 ), gsl_matrix_get( &align_sky.matrix, 0, 2 ) };
1645 const double Q_nb[3] = { gsl_matrix_get( &align_sky.matrix, 1, 0 ), gsl_matrix_get( &align_sky.matrix, 1, 1 ), gsl_matrix_get( &align_sky.matrix, 1, 2 ) };
1646 const double Q_nc[3] = { gsl_matrix_get( &align_sky.matrix, 2, 0 ), gsl_matrix_get( &align_sky.matrix, 2, 1 ), gsl_matrix_get( &align_sky.matrix, 2, 2 ) };
1649 const double alphas[2] = { GSL_MIN( alpha1, alpha2 ), GSL_MAX( alpha1, alpha2 ) };
1650 const double deltas[2] = { GSL_MIN( delta1, delta2 ), GSL_MAX( delta1, delta2 ) };
1660 for (
size_t i = 0;
i < 2; ++
i ) {
1662 const_alpha[
i].
type = 0;
1663 const double cos_alpha = cos( alphas[
i] );
1664 const double sin_alpha = sin( alphas[
i] );
1665 const double x = Q_na[2];
1666 const double y = Q_na[0] * cos_alpha + Q_na[1] * sin_alpha;
1667 const_alpha[
i].
na0 = 0;
1668 const_alpha[
i].
r = sqrt(
SQR(
x ) +
SQR(
y ) );
1670 const_alpha[
i].
C = Q_nb[0] * cos_alpha + Q_nb[1] * sin_alpha;
1671 const_alpha[
i].
S = Q_nb[2];
1672 const_alpha[
i].
Z = 0;
1683 for (
size_t j = 0;
j < 2; ++
j ) {
1685 const_delta[
j].
type = 0;
1686 const double cos_delta = cos( deltas[
j] );
1687 const double sin_delta = sin( deltas[
j] );
1688 const double x = Q_na[1] * cos_delta;
1689 const double y = Q_na[0] * cos_delta;
1690 const_delta[
j].
na0 = Q_na[2] * sin_delta;
1691 const_delta[
j].
r = sqrt(
SQR(
x ) +
SQR(
y ) );
1693 const_delta[
j].
C = Q_nb[0] * cos_delta;
1694 const_delta[
j].
S = Q_nb[1] * cos_delta;
1695 const_delta[
j].
Z = Q_nb[2] * sin_delta;
1700 double corner_A[2][2], corner_B[2][2];
1701 for (
size_t i = 0;
i < 2; ++
i ) {
1702 for (
size_t j = 0;
j < 2; ++
j ) {
1703 double rssky_point[rssky_metric->size1];
1704 gsl_vector_view rssky_point_view = gsl_vector_view_array( rssky_point, rssky_metric->size1 );
1706 phys_point.Alpha = alphas[
i];
1707 phys_point.Delta = deltas[
j];
1709 corner_A[
i][
j] = rssky_point[0];
1710 corner_B[
i][
j] = rssky_point[1];
1715 data_lower.min_A = data_upper.min_A = GSL_NEGINF;
1716 data_lower.max_A = data_upper.max_A = GSL_POSINF;
1717 if ( corner_A[1][0] < 0 && corner_A[1][1] <= 0 ) {
1719 if ( corner_A[1][1] < corner_A[1][0] ) {
1735 data_lower.min_A = data_upper.min_A = corner_A[1][1];
1736 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[1][1];
1737 data_lower.max_A = data_upper.max_A = corner_A[0][1];
1738 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[0][1];
1739 data_lower.pieces[0] = const_delta[1];
1740 data_lower.pieces[0].
max_A = GSL_POSINF;
1741 data_upper.pieces[0] = const_alpha[1];
1742 data_upper.pieces[0].
max_A = corner_A[1][0];
1743 data_upper.pieces[1] = const_delta[0];
1744 data_upper.pieces[1].
max_A = corner_A[0][0];
1745 data_upper.pieces[2] = const_alpha[0];
1746 data_upper.pieces[2].
max_A = GSL_POSINF;
1747 data_upper.pieces[2].altroot =
true;
1765 data_lower.min_A = data_upper.min_A = corner_A[1][0];
1766 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[1][0];
1767 data_lower.max_A = data_upper.max_A = corner_A[0][1];
1768 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[0][1];
1769 data_lower.pieces[0] = const_alpha[1];
1770 data_lower.pieces[0].
max_A = corner_A[1][1];
1771 data_lower.pieces[0].altroot =
true;
1772 data_lower.pieces[1] = const_delta[1];
1773 data_lower.pieces[1].
max_A = GSL_POSINF;
1774 data_upper.pieces[0] = const_delta[0];
1775 data_upper.pieces[0].
max_A = corner_A[0][0];
1776 data_upper.pieces[1] = const_alpha[0];
1777 data_upper.pieces[1].
max_A = GSL_POSINF;
1778 data_upper.pieces[1].altroot =
true;
1782 }
else if ( 0 <= corner_A[1][0] && 0 < corner_A[1][1] ) {
1784 if ( corner_A[1][1] < corner_A[1][0] ) {
1800 data_lower.min_A = data_upper.min_A = corner_A[0][0];
1801 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[0][0];
1802 data_lower.max_A = data_upper.max_A = corner_A[1][0];
1803 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[1][0];
1804 data_lower.pieces[0] = const_delta[0];
1805 data_lower.pieces[0].
max_A = GSL_POSINF;
1806 data_upper.pieces[0] = const_alpha[0];
1807 data_upper.pieces[0].
max_A = corner_A[0][1];
1808 data_upper.pieces[1] = const_delta[1];
1809 data_upper.pieces[1].
max_A = corner_A[1][1];
1810 data_upper.pieces[2] = const_alpha[1];
1811 data_upper.pieces[2].
max_A = GSL_POSINF;
1812 data_upper.pieces[2].altroot =
true;
1830 data_lower.min_A = data_upper.min_A = corner_A[0][0];
1831 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[0][0];
1832 data_lower.max_A = data_upper.max_A = corner_A[1][1];
1833 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[1][1];
1834 data_lower.pieces[0] = const_delta[0];
1835 data_lower.pieces[0].
max_A = corner_A[1][0];
1836 data_lower.pieces[1] = const_alpha[1];
1837 data_lower.pieces[1].
max_A = GSL_POSINF;
1838 data_upper.pieces[0] = const_alpha[0];
1839 data_upper.pieces[0].
max_A = corner_A[0][1];
1840 data_upper.pieces[1] = const_delta[1];
1841 data_upper.pieces[1].
max_A = GSL_POSINF;
1852 const double cos_alpha_split = cos( alphas[1] );
1853 const double sin_alpha_split = sin( alphas[1] );
1854 const double delta_split = -1 * atan2( Q_nc[0] * cos_alpha_split + Q_nc[1] * sin_alpha_split, Q_nc[2] );
1855 const double na_split = ( Q_na[0] * cos_alpha_split + Q_na[1] * sin_alpha_split ) * cos( delta_split ) + Q_na[2] * sin( delta_split );
1856 const double split_A[2] = { -1 - na_split, 1 + na_split };
1857 const double split_B = -1 *
RE_SQRT( 1 -
SQR( na_split ) );
1859 if ( split_A[0] < corner_A[1][0] ) {
1860 if ( corner_A[1][1] < split_A[1] ) {
1876 data_lower.min_A = data_upper.min_A = split_A[0];
1877 data_lower.min_A_bound = data_upper.min_A_bound = split_B;
1878 data_lower.max_A = data_upper.max_A = split_A[1];
1879 data_lower.max_A_bound = data_upper.max_A_bound = split_B;
1880 data_lower.pieces[0] = lower_circular;
1881 data_lower.pieces[0].
max_A = GSL_POSINF;
1882 data_upper.pieces[0] = const_alpha[1];
1883 data_upper.pieces[0].
max_A = corner_A[1][0];
1884 data_upper.pieces[1] = const_delta[0];
1885 data_upper.pieces[1].
max_A = corner_A[0][0];
1886 data_upper.pieces[2] = const_alpha[0];
1887 data_upper.pieces[2].
max_A = 0;
1888 data_upper.pieces[2].altroot =
true;
1889 data_upper.pieces[3] = const_alpha[0];
1890 data_upper.pieces[3].
max_A = corner_A[0][1];
1891 data_upper.pieces[4] = const_delta[1];
1892 data_upper.pieces[4].
max_A = corner_A[1][1];
1893 data_upper.pieces[5] = const_alpha[1];
1894 data_upper.pieces[5].
max_A = GSL_POSINF;
1895 data_upper.pieces[5].altroot =
true;
1913 data_lower.min_A = data_upper.min_A = split_A[0];
1914 data_lower.min_A_bound = data_upper.min_A_bound = split_B;
1915 data_lower.max_A = data_upper.max_A = corner_A[1][1];
1916 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[1][1];
1917 data_lower.pieces[0] = lower_circular;
1918 data_lower.pieces[0].
max_A = split_A[1];
1919 data_lower.pieces[1] = const_alpha[1];
1920 data_lower.pieces[1].
max_A = GSL_POSINF;
1921 data_upper.pieces[0] = const_alpha[1];
1922 data_upper.pieces[0].
max_A = corner_A[1][0];
1923 data_upper.pieces[1] = const_delta[0];
1924 data_upper.pieces[1].
max_A = corner_A[0][0];
1925 data_upper.pieces[2] = const_alpha[0];
1926 data_upper.pieces[2].
max_A = 0;
1927 data_upper.pieces[2].altroot =
true;
1928 data_upper.pieces[3] = const_alpha[0];
1929 data_upper.pieces[3].
max_A = corner_A[0][1];
1930 data_upper.pieces[4] = const_delta[1];
1931 data_upper.pieces[4].
max_A = GSL_POSINF;
1936 if ( corner_A[1][1] < split_A[1] ) {
1952 data_lower.min_A = data_upper.min_A = corner_A[1][0];
1953 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[1][0];
1954 data_lower.max_A = data_upper.max_A = split_A[1];
1955 data_lower.max_A_bound = data_upper.max_A_bound = split_B;
1956 data_lower.pieces[0] = const_alpha[1];
1957 data_lower.pieces[0].
max_A = split_A[0];
1958 data_lower.pieces[0].altroot =
true;
1959 data_lower.pieces[1] = lower_circular;
1960 data_lower.pieces[1].
max_A = GSL_POSINF;
1961 data_upper.pieces[0] = const_delta[0];
1962 data_upper.pieces[0].
max_A = corner_A[0][0];
1963 data_upper.pieces[1] = const_alpha[0];
1964 data_upper.pieces[1].
max_A = 0;
1965 data_upper.pieces[1].altroot =
true;
1966 data_upper.pieces[2] = const_alpha[0];
1967 data_upper.pieces[2].
max_A = corner_A[0][1];
1968 data_upper.pieces[3] = const_delta[1];
1969 data_upper.pieces[3].
max_A = corner_A[1][1];
1970 data_upper.pieces[4] = const_alpha[1];
1971 data_upper.pieces[4].
max_A = GSL_POSINF;
1972 data_upper.pieces[4].altroot =
true;
1990 data_lower.min_A = data_upper.min_A = corner_A[1][0];
1991 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[1][0];
1992 data_lower.max_A = data_upper.max_A = corner_A[1][1];
1993 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[1][1];
1994 data_lower.pieces[0] = const_alpha[1];
1995 data_lower.pieces[0].
max_A = split_A[0];
1996 data_lower.pieces[0].altroot =
true;
1997 data_lower.pieces[1] = lower_circular;
1998 data_lower.pieces[1].
max_A = split_A[1];
1999 data_lower.pieces[2] = const_alpha[1];
2000 data_lower.pieces[2].
max_A = GSL_POSINF;
2001 data_upper.pieces[0] = const_delta[0];
2002 data_upper.pieces[0].
max_A = corner_A[0][0];
2003 data_upper.pieces[1] = const_alpha[0];
2004 data_upper.pieces[1].
max_A = 0;
2005 data_upper.pieces[1].altroot =
true;
2006 data_upper.pieces[2] = const_alpha[0];
2007 data_upper.pieces[2].
max_A = corner_A[0][1];
2008 data_upper.pieces[3] = const_delta[1];
2009 data_upper.pieces[3].
max_A = GSL_POSINF;
2031 const size_t dim UNUSED,
2032 const gsl_matrix *
cache UNUSED,
2033 const gsl_vector *point
2038 const double bound = *( (
const double * )
data );
2042 const double A = gsl_vector_get( point, 0 );
2043 const double rssky[2] = {
A, 0 };
2044 gsl_vector_const_view rssky_view = gsl_vector_const_view_array( rssky, 2 );
2047 const double na = as[0];
2050 const double limit =
RE_SQRT( 1 -
SQR( na ) );
2052 return GSL_MAX( -limit, GSL_MIN( bound, limit ) );
2063 const double target_area = ( (
double * )
params )[0];
2068 return area - target_area;
2079 const double target_area = ( (
double * )
params )[0];
2080 double A0 = ( (
double * )
params )[1];
2081 double A1 = ( (
double * )
params )[2];
2084 const double max_area = A1 *
RE_SQRT( 1 -
SQR( A1 ) ) - A0 *
RE_SQRT( 1 -
SQR( A0 ) ) + asin( A1 ) - asin( A0 );
2098 double area = -fabs( B1 ) * ( A1 - A0 ) + 0.5 * ( A1 *
RE_SQRT( 1 -
SQR( A1 ) ) - A0 *
RE_SQRT( 1 -
SQR( A0 ) ) + asin( A1 ) - asin( A0 ) );
2102 area = max_area - area;
2105 return area - target_area;
2110 LatticeTiling *tiling,
2111 const gsl_matrix *rssky_metric,
2112 const double max_mismatch,
2113 const UINT4 patch_count,
2114 const UINT4 patch_index
2126 XLAL_CHECK( patch_count == 1 || patch_count % 2 == 0,
XLAL_EINVAL,
"'patch_count' must be either one or even" );
2134 double A_bound[2] = {GSL_NAN, GSL_NAN};
2135 double B_bound[2] = {-1, 1};
2138 double A_lower_bbox_pad = -1, A_upper_bbox_pad = -1;
2139 double B_lower_bbox_pad = -1, B_upper_bbox_pad = -1;
2142 if ( patch_count <= 2 ) {
2143 A_bound[0] = -2 + 4 * ( ( double ) patch_index ) / ( ( double ) patch_count );
2144 A_bound[1] = A_bound[0] + 4 / ( ( double ) patch_count );
2148 const UINT4 hemi_patch_count = patch_count / 2;
2151 const UINT4 hemi_patch_index = patch_index < hemi_patch_count ? patch_index : patch_count - patch_index - 1;
2156 const UINT4 min_A_count = ceil( sqrt( hemi_patch_count ) );
2159 const double max_B_bbox = 2 * sqrt( max_mismatch / gsl_matrix_get( rssky_metric, 1, 1 ) );
2162 const double target_B_count = 1.0 / ( 1.0 * max_B_bbox );
2165 const UINT4 A_count = GSL_MIN( min_A_count, ceil( hemi_patch_count / target_B_count ) );
2168 const UINT4 min_B_count = hemi_patch_count / A_count;
2171 INT4 patch_excess = hemi_patch_count - A_count * min_B_count;
2175 UINT4 B_count = min_B_count;
2176 if ( patch_excess > 0 ) {
2192 UINT4 A_index[2] = {0, B_count};
2193 UINT4 B_index = hemi_patch_index;
2194 while ( B_index >= B_count ) {
2201 if ( patch_excess == 0 ) {
2207 A_index[0] = A_index[1];
2208 A_index[1] += B_count;
2213 A_lower_bbox_pad = ( A_index[0] == 0 && patch_index < hemi_patch_count ) ? -1 : 0;
2214 A_upper_bbox_pad = ( A_index[0] == 0 && patch_index >= hemi_patch_count ) ? -1 : 0;
2215 B_lower_bbox_pad = ( B_index == 0 ) ? -1 : 0;
2216 B_upper_bbox_pad = ( B_index + 1 == B_count ) ? -1 : 0;
2219 gsl_root_fsolver *fs = gsl_root_fsolver_alloc( gsl_root_fsolver_brent );
2223 for (
size_t i = 0;
i < 2; ++
i ) {
2224 const UINT4 A_index_i = A_index[
i];
2227 if ( A_index_i == 0 ) {
2229 }
else if ( A_index_i == hemi_patch_count ) {
2234 const double target_area =
LAL_PI * ( ( double ) A_index_i ) / ( ( ( double ) patch_count ) / 2 );
2237 double params[] = { target_area };
2239 double A_lower = -1, A_upper = 1;
2243 int status = 0, iter = 0;
2246 A_lower = gsl_root_fsolver_x_lower( fs );
2247 A_upper = gsl_root_fsolver_x_upper( fs );
2248 status = gsl_root_test_interval( A_lower, A_upper, 1
e-5, 1
e-5 );
2249 }
while (
status == GSL_CONTINUE && ++iter < 1000 );
2250 XLAL_CHECK(
status == GSL_SUCCESS,
XLAL_EMAXITER,
"Could not find bound for A_index[%zu]=%i; best guess [%g, %g]",
i, A_index_i, A_lower, A_upper );
2253 A_bound[
i] = gsl_root_fsolver_root( fs );
2260 for (
size_t i = 0;
i < 2; ++
i ) {
2261 const UINT4 B_index_i = B_index +
i;
2265 double B_max = ( A_count == 1 ) ? 1 :
RE_SQRT( 1 - GSL_MIN(
SQR( A_bound[0] ),
SQR( A_bound[1] ) ) );
2268 if ( B_index_i == 0 ) {
2269 B_bound[
i] = -B_max;
2270 }
else if ( B_index_i == B_count ) {
2275 const double A0 = A_bound[0];
2276 const double A1 = A_bound[1];
2277 const double target_area = ( A1 *
RE_SQRT( 1 -
SQR( A1 ) ) - A0 *
RE_SQRT( 1 -
SQR( A0 ) ) + asin( A1 ) - asin( A0 ) ) * ( (
double ) B_index_i ) / ( (
double ) B_count );
2280 double params[] = { target_area, A0, A1 };
2286 double B_lower = -B_max, B_upper = B_max;
2290 int status = 0, iter = 0;
2293 B_lower = gsl_root_fsolver_x_lower( fs );
2294 B_upper = gsl_root_fsolver_x_upper( fs );
2295 status = gsl_root_test_interval( B_lower, B_upper, 1
e-5, 1
e-5 );
2296 }
while (
status == GSL_CONTINUE && ++iter < 1000 );
2297 XLAL_CHECK(
status == GSL_SUCCESS,
XLAL_EMAXITER,
"Could not find bound for B_index[%zu]=%i; best guess [%g, %g]",
i, B_index_i, B_lower, B_upper );
2300 B_bound[
i] = gsl_root_fsolver_root( fs );
2309 if ( B_count >= 3 && B_index != ( B_count - 1 ) / 2 ) {
2310 const double Ai =
RE_SQRT( 1 - GSL_MIN(
SQR( B_bound[0] ),
SQR( B_bound[1] ) ) );
2311 if ( A_bound[0] < -Ai ) {
2314 if ( A_bound[1] > Ai ) {
2320 if ( patch_index < hemi_patch_count ) {
2321 A_bound[0] = A_bound[0] - 1;
2322 A_bound[1] = A_bound[1] - 1;
2324 A_bound[0] = -A_bound[0] + 1;
2325 A_bound[1] = -A_bound[1] + 1;
2329 gsl_root_fsolver_free( fs );
2352 const size_t dim UNUSED,
2353 const gsl_matrix *
cache,
2354 const gsl_vector *point UNUSED
2359 const double *sky_offsets = ( (
const double * )
data );
2360 double bound = ( (
const double * )
data )[3];
2364 for (
size_t i = 0;
i < 3; ++
i ) {
2365 bound += sky_offsets[
i] * gsl_matrix_get(
cache, 1,
i );
2373 LatticeTiling *tiling,
2374 const SuperskyTransformData *rssky_transf,
2376 const double bound1,
2389 gsl_matrix_const_view sky_offsets = gsl_matrix_const_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
2395 double data_lower[4], data_upper[4];
2396 for (
size_t j = 0;
j < 3; ++
j ) {
2397 data_lower[
j] = data_upper[
j] = gsl_matrix_get( &sky_offsets.matrix,
RSSKY_FKDOT_OFFSET( rssky_transf,
s ),
j );
2399 data_lower[3] = GSL_MIN( bound1, bound2 );
2400 data_upper[3] = GSL_MAX( bound1, bound2 );
2412 XLAL_CHECK( !( tiled_sskyA || tiled_sskyB ) || tiled_fkdot,
XLAL_EINVAL,
"Must search over %zu-order spindown if also searching over sky",
s );
2419 LatticeTiling *tiling,
2420 const SuperskyTransformData *rssky_transf,
2432 const double bbox_pad = padding ? -1 : 0;
2440 const bool first_call,
2441 const LatticeTiling *tiling,
2442 const LatticeTilingIterator *itr,
2443 const gsl_vector *point,
2444 const size_t changed_i,
2451 if ( 2 <= changed_i ) {
2488 INT4 left = 0, right = 0;
2509 LatticeTiling *tiling,
2510 const SuperskyTransformData *rssky_transf,
2530 *min_phys = &
out->min_phys;
2531 *max_phys = &
out->max_phys;
2538 const bool first_call,
2539 const LatticeTiling *tiling,
2540 const LatticeTilingIterator *itr,
2541 const gsl_vector *point,
2542 const size_t changed_i,
2549 if ( 2 <= changed_i ) {
2567 gsl_vector_view rssky2_view = gsl_vector_view_array( rssky2_array, cparam->
rssky2_transf->ndim );
2571 for (
size_t i = 0;
i < 2; ++
i ) {
2579 INT4 left = 0, right = 0;
2600 LatticeTiling *tiling,
2601 const SuperskyTransformData *rssky_transf,
2602 const SuperskyTransformData *rssky2_transf,
2603 const gsl_vector **min_rssky2,
2604 const gsl_vector **max_rssky2
2618 .rssky2_transf = rssky2_transf,
2626 *min_rssky2 = &
out->min_rssky2_view.vector;
2627 *max_rssky2 = &
out->max_rssky2_view.vector;
2634 LatticeTiling *tiling,
2635 const gsl_vector *min_rssky,
2636 const gsl_vector *max_rssky
2649 double A_bound[2] = { gsl_vector_get( min_rssky, 0 ), gsl_vector_get( max_rssky, 0 ) };
2650 double B_bound[2] = { gsl_vector_get( min_rssky, 1 ), gsl_vector_get( max_rssky, 1 ) };
2656 for (
size_t j = 2;
j <
n; ++
j ) {
int XLALFITSArrayOpenWrite(FITSFile UNUSED *file, const CHAR UNUSED *name, const size_t UNUSED ndim, const size_t UNUSED dims[], const CHAR UNUSED *comment)
int XLALFITSTableWriteRow(FITSFile UNUSED *file, const void UNUSED *record)
int XLALFITSTableReadRow(FITSFile UNUSED *file, void UNUSED *record, UINT8 UNUSED *rem_nrows)
int XLALFITSArrayReadGSLMatrix(FITSFile UNUSED *file, const size_t UNUSED idx[], gsl_matrix UNUSED **elems)
int XLALFITSArrayOpenRead2(FITSFile UNUSED *file, const CHAR UNUSED *name, size_t UNUSED *dim0, size_t UNUSED *dim1)
int XLALFITSArrayOpenRead(FITSFile UNUSED *file, const CHAR UNUSED *name, size_t UNUSED *ndim, size_t UNUSED dims[])
int XLALFITSTableOpenWrite(FITSFile UNUSED *file, const CHAR UNUSED *name, const CHAR UNUSED *comment)
int XLALFITSArrayOpenWrite2(FITSFile UNUSED *file, const CHAR UNUSED *name, const size_t UNUSED dim0, const size_t UNUSED dim1, const CHAR UNUSED *comment)
int XLALFITSArrayWriteGSLMatrix(FITSFile UNUSED *file, const size_t UNUSED idx[], const gsl_matrix UNUSED *elems)
int XLALFITSTableOpenRead(FITSFile UNUSED *file, const CHAR UNUSED *name, UINT8 UNUSED *nrows)
int XLALSetLatticeTilingBoundName(LatticeTiling *tiling, const size_t dim, const char *fmt,...)
static int SM_LatticePhysicalRangeCallback(const bool first_call, const LatticeTiling *tiling, const LatticeTilingIterator *itr, const gsl_vector *point, const size_t changed_i, const void *param, void *out)
static void SkyBoundCache(const size_t dim UNUSED, const gsl_vector *point, gsl_vector *cache)
static double PhysicalSkyBound(const void *data, const size_t dim UNUSED, const gsl_matrix *cache UNUSED, const gsl_vector *point)
static double PhysicalSpinBound(const void *data, const size_t dim UNUSED, const gsl_matrix *cache, const gsl_vector *point UNUSED)
#define RSSKY_FKDOT_DIM(RT, S)
const double fiducial_calc_freq
Fiducial frequency at which to numerically calculate metrics, which are then rescaled to user-request...
static int SM_ComputeReducedSuperskyMetric(gsl_matrix **rssky_metric, SuperskyTransformData **rssky_transf, const size_t spindowns, const gsl_matrix *ussky_metric, const DopplerCoordinateSystem *ucoords, const gsl_matrix *orbital_metric, const DopplerCoordinateSystem *ocoords, const LIGOTimeGPS *ref_time, const LIGOTimeGPS *start_time, const LIGOTimeGPS *end_time)
Compute the reduced supersky metric.
#define CHECK_RSSKY_TRANSF(RT)
static int SM_ComputeFittedSuperskyMetric(gsl_matrix *fitted_ssky_metric, SuperskyTransformData *rssky_transf, const gsl_matrix *ussky_metric, const gsl_matrix *orbital_metric, const DopplerCoordinateSystem *ocoords, const LIGOTimeGPS *start_time, const LIGOTimeGPS *end_time)
Find a least-squares linear fit to the orbital X and Y metric elements using the frequency and spindo...
#define CHECK_RSSKY_METRIC_TRANSF(M, RT)
static double ConstantBoundB(const void *data, const size_t dim UNUSED, const gsl_matrix *cache UNUSED, const gsl_vector *point)
static double EqualAreaSkyBoundSolverA(double A1, void *params)
static void SM_ReducedToAligned(double as[3], const gsl_vector *rss, const double hemi)
Convert from 2-dimensional reduced supersky coordinates to 3-dimensional aligned sky coordinates.
#define RSSKY_FKDOT_OFFSET(RT, S)
static double EqualAreaSkyBoundSolverB(double B1, void *params)
static int SM_ScaleSuperskyMetricFiducialFreq(gsl_matrix *rssky_metric, SuperskyTransformData *rssky_transf, const double new_fiducial_freq)
Scale a given supersky metric and its coordinate transform data to a new fiducial frequency.
static int SM_ComputeAlignedSuperskyMetric(gsl_matrix *aligned_ssky_metric, SuperskyTransformData *rssky_transf, const gsl_matrix *decoupled_ssky_metric)
Align the sky–sky block of the decoupled supersky metric with its eigenvalues by means of a rotation.
static int fits_table_init_SuperskyTransformData(FITSFile *file)
Initialise a FITS table for writing/reading a table of SuperskyTransformData entries.
static int SM_LatticeSuperskyRangeCallback(const bool first_call, const LatticeTiling *tiling, const LatticeTilingIterator *itr, const gsl_vector *point, const size_t changed_i, const void *param, void *out)
static int SM_ComputeDecoupledSuperskyMetric(gsl_matrix *decoupled_ssky_metric, SuperskyTransformData *rssky_transf, const gsl_matrix *fitted_ssky_metric)
Decouple the sky–sky and freq+spin–freq+spin blocks of the fitted supersky metric.
static void SM_AlignedToReduced(gsl_vector *rss, const double as[3])
Convert from 3-dimensional aligned sky coordinates to 2-dimensional reduced supersky coordinates.
static gsl_matrix * SM_ComputePhaseMetric(const DopplerCoordinateSystem *coords, const LIGOTimeGPS *ref_time, const LIGOTimeGPS *start_time, const LIGOTimeGPS *end_time, const MultiLALDetector *detectors, const MultiNoiseFloor *detector_weights, const DetectorMotionType detector_motion, const EphemerisData *ephemerides)
Call XLALComputeDopplerPhaseMetric() to compute the phase metric for a given coordinate system.
const double scale
multiplicative scaling factor of the coordinate
#define XLAL_FITS_TABLE_COLUMN_BEGIN(record_type)
#define FFIO_MAX
Maximum possible number of FITS array dimensions, and FITS table columns.
#define XLAL_FITS_TABLE_COLUMN_ADD(file, type, field)
struct tagFITSFile FITSFile
Representation of a FITS file.
#define XLAL_FITS_TABLE_COLUMN_ADD_ARRAY2(file, type, field)
#define XLAL_INIT_DECL(var,...)
void * XLALCalloc(size_t m, size_t n)
int XLALIsTiledLatticeTilingDimension(const LatticeTiling *tiling, const size_t dim)
Return >0 if a lattice tiling dimension is tiled (i.e.
int XLALSetLatticeTilingBound(LatticeTiling *tiling, const size_t dim, const LatticeTilingBound func, const size_t data_len, const void *data_lower, const void *data_upper)
Set a parameter-space bound on a dimension of the lattice tiling.
size_t XLALTotalLatticeTilingDimensions(const LatticeTiling *tiling)
Return the total number of dimensions of the lattice tiling.
int XLALSetLatticeTilingConstantBound(LatticeTiling *tiling, const size_t dim, const double bound1, const double bound2)
Set a constant lattice tiling parameter-space bound, given by the minimum and maximum of the two supp...
REAL8 XLALLatticeTilingStepSize(const LatticeTiling *tiling, const size_t dim)
Return the step size of the lattice tiling in a given dimension, or 0 for non-tiled dimensions.
int XLALSetLatticeTilingBoundCacheFunction(LatticeTiling *tiling, const size_t dim, const LatticeTilingBoundCache func)
Set bound cache function for a lattice tiling parameter-space dimension.
int XLALCurrentLatticeTilingBlock(const LatticeTilingIterator *itr, const size_t dim, INT4 *left, INT4 *right)
Return indexes of the left-most and right-most points in the current block of points in the given dim...
const void * XLALRegisterLatticeTilingCallback(LatticeTiling *tiling, const LatticeTilingCallback func, const size_t param_len, const void *param, const size_t out_len)
Register a callback function which can be used to compute properties of a lattice tiling.
int XLALSetLatticeTilingOrigin(LatticeTiling *tiling, const size_t dim, const double origin)
Set the physical parameter-space origin of the lattice tiling in the given dimension.
int XLALSetLatticeTilingPadding(LatticeTiling *tiling, const size_t dim, const double lower_bbox_pad, const double upper_bbox_pad, const int lower_intp_pad, const int upper_intp_pad, const int find_bound_extrema)
Control the padding of lattice tiling parameter-space bounds in the given dimension.
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 XLALDiagNormalizeMetric(gsl_matrix **p_gpr_ij, gsl_matrix **p_transform, const gsl_matrix *g_ij)
Diagonally-normalize a metric .
double XLALMetricDeterminant(const gsl_matrix *g_ij)
Compute the determinant of a metric .
int XLALTransformMetric(gsl_matrix **p_gpr_ij, const gsl_matrix *transform, const gsl_matrix *g_ij)
Apply a transform to a metric such that , or equivalently .
int XLALSegListInit(LALSegList *seglist)
int XLALSegListClear(LALSegList *seglist)
int XLALSegListIsInitialized(const LALSegList *seglist)
int XLALSegListAppend(LALSegList *seglist, const LALSeg *seg)
int XLALSegSet(LALSeg *seg, const LIGOTimeGPS *start, const LIGOTimeGPS *end, const INT4 id)
void XLALNormalizeSkyPosition(double *restrict longitude, double *restrict latitude)
int XLALConvertSuperskyToPhysicalPoints(gsl_matrix **out_phys, const gsl_matrix *in_rssky, const SuperskyTransformData *rssky_transf)
Convert a set of points from supersky to physical coordinates.
int XLALSetSuperskyPhysicalSkyBounds(LatticeTiling *tiling, gsl_matrix *rssky_metric, SuperskyTransformData *rssky_transf, const double alpha1, const double alpha2, const double delta1, const double delta2)
Set parameter-space bounds on the physical sky position for a lattice tiling using the reduced super...
void XLALDestroySuperskyMetrics(SuperskyMetrics *metrics)
Destroy a SuperskyMetrics struct.
int XLALSetSuperskyEqualAreaSkyBounds(LatticeTiling *tiling, const gsl_matrix *rssky_metric, const double max_mismatch, const UINT4 patch_count, const UINT4 patch_index)
Divide the reduced supersky parameter space into patch_count equal-area patches, and set parameter-sp...
int XLALConvertPhysicalToSuperskyPoints(gsl_matrix **out_rssky, const gsl_matrix *in_phys, const SuperskyTransformData *rssky_transf)
Convert a set of points from physical to supersky coordinates.
int XLALSuperskyMetricsDimensions(const SuperskyMetrics *metrics, size_t *spindowns)
Return dimensions of the supersky metrics.
int XLALEqualizeReducedSuperskyMetricsFreqSpacing(SuperskyMetrics *metrics, const double coh_max_mismatch, const double semi_max_mismatch)
Project and rescale the reduced supersky metrics in the frequency dimension, such that all reduced su...
SuperskyMetrics * XLALCopySuperskyMetrics(const SuperskyMetrics *metrics)
Copy a SuperskyMetrics struct.
SuperskyMetricType
Type of supersky metric to compute.
int XLALScaleSuperskyMetricsFiducialFreq(SuperskyMetrics *metrics, const double new_fiducial_freq)
Scale all supersky metrics and their coordinate transform data to a new fiducial frequency.
int XLALSetPhysicalPointSuperskyRefTime(PulsarDopplerParams *out_phys, const SuperskyTransformData *rssky_transf)
Set the reference time of a physical point to that of the reduced supersky coordinates.
int XLALConvertPhysicalToSuperskyPoint(gsl_vector *out_rssky, const PulsarDopplerParams *in_phys, const SuperskyTransformData *rssky_transf)
Convert a point from physical to supersky coordinates.
int XLALConvertSuperskyToPhysicalPoint(PulsarDopplerParams *out_phys, const gsl_vector *in_rssky, const gsl_vector *ref_rssky, const SuperskyTransformData *rssky_transf)
Convert a point from supersky to physical coordinates.
int XLALFITSWriteSuperskyMetrics(FITSFile *file, const SuperskyMetrics *metrics)
Write a SuperskyMetrics struct to a FITS file.
int XLALSetSuperskyRangeBounds(LatticeTiling *tiling, const gsl_vector *min_rssky, const gsl_vector *max_rssky)
Set parameter-space bounds on an entire lattice tiling given minimum and maximum ranges in reduced su...
int XLALRegisterSuperskyLatticePhysicalRangeCallback(LatticeTiling *tiling, const SuperskyTransformData *rssky_transf, const PulsarDopplerParams **min_phys, const PulsarDopplerParams **max_phys)
Register a lattice tiling callback function which computes the physical range covered by a reduced su...
int XLALConvertSuperskyToSuperskyPoint(gsl_vector *out_rssky, const SuperskyTransformData *out_rssky_transf, const gsl_vector *in_rssky, const gsl_vector *ref_rssky, const SuperskyTransformData *in_rssky_transf)
Convert a point between supersky coordinates.
int XLALSetSuperskyPhysicalSpinBoundPadding(LatticeTiling *tiling, const SuperskyTransformData *rssky_transf, const size_t s, const bool padding)
Set parameter-space bound padding on the physical frequency/spindowns for a lattice tiling using the...
int XLALSetSuperskyPhysicalSpinBound(LatticeTiling *tiling, const SuperskyTransformData *rssky_transf, const size_t s, const double bound1, const double bound2)
Set parameter-space bounds on the physical frequency/spindowns for a lattice tiling using the reduce...
SuperskyMetrics * XLALComputeSuperskyMetrics(const SuperskyMetricType type, const size_t spindowns, const LIGOTimeGPS *ref_time, const LALSegList *segments, const double fiducial_freq, const MultiLALDetector *detectors, const MultiNoiseFloor *detector_weights, const DetectorMotionType detector_motion, const EphemerisData *ephemerides)
Compute the supersky metrics, which are returned in a SuperskyMetrics struct.
int XLALRegisterSuperskyLatticeSuperskyRangeCallback(LatticeTiling *tiling, const SuperskyTransformData *rssky_transf, const SuperskyTransformData *rssky2_transf, const gsl_vector **min_rssky2, const gsl_vector **max_rssky2)
Register a lattice tiling callback function which computes the range covered by a reduced supersky la...
int XLALFITSReadSuperskyMetrics(FITSFile *file, SuperskyMetrics **metrics)
Read a SuperskyMetrics struct from a FITS file.
DetectorMotionType
Bitfield of different types of detector-motion to use in order to compute the Doppler-metric.
int XLALFindDopplerCoordinateInSystem(const DopplerCoordinateSystem *coordSys, const DopplerCoordinateID coordID)
Given a coordinate ID 'coordID', return its dimension within the given coordinate system 'coordSys',...
void XLALDestroyDopplerPhaseMetric(DopplerPhaseMetric *metric)
Free a DopplerPhaseMetric structure.
DopplerPhaseMetric * XLALComputeDopplerPhaseMetric(const DopplerMetricParams *metricParams, const EphemerisData *edat)
Calculate an approximate "phase-metric" with the specified parameters.
@ 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_N3Z_EQU
Z component of unconstrained super-sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_F2DOT
Second spindown [Units: Hz/s^2].
@ DOPPLERCOORD_N3Y_EQU
Y component of unconstrained super-sky position in equatorial coordinates [Units: none].
@ DOPPLERCOORD_F1DOT
First spindown [Units: Hz/s].
@ DOPPLERCOORD_F4DOT
Fourth spindown [Units: Hz/s^4].
@ 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_FREQ
Frequency [Units: Hz].
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_NULL(assertion,...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
p
RUN ANALYSIS SCRIPT ###.
LALDetector detectors[LAL_NUM_DETECTORS]
type describing a Doppler coordinate system: lists the number of dimensions and the symbolic names of...
meta-info specifying a Doppler-metric
Struct to hold the output of XLALComputeDopplerPhaseMetric(), including meta-info on the number of di...
gsl_matrix * g_ij
symmetric matrix holding the phase-metric, averaged over segments
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
array of detectors definitions 'LALDetector'
array of detector-specific 'noise floors' (ie PSD values), assumed constant over the frequency-band o...
PhysicalSkyBoundPiece pieces[6]
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
PulsarSpins fkdot
Intrinsic spins: [Freq, f1dot, f2dot, ...
REAL8 Delta
Sky position: DEC (latitude) in equatorial coords and radians.
LIGOTimeGPS refTime
Reference time of pulsar parameters (in SSB!)
REAL8 Alpha
Sky position: RA (longitude) in equatorial coords and radians.
PulsarDopplerParams min_phys
Minimum physical range.
gsl_vector_view max_rssky2_view
double min_rssky2_array[32]
Minimum range of other reduced supersky coordinates.
double max_rssky2_array[32]
Maximum range of other reduced supersky coordinates.
gsl_vector_view min_rssky2_view
PulsarDopplerParams max_phys
Maximum physical range.
const SuperskyTransformData * rssky_transf
Reduced supersky coordinate transform data.
const SuperskyTransformData * rssky2_transf
Other reduced supersky coordinate transform data.
Computed supersky metrics, returned by XLALComputeSuperskyMetrics().
gsl_matrix * semi_rssky_metric
Semicoherent reduced supersky metric (2-dimensional sky)
gsl_matrix ** coh_rssky_metric
Coherent reduced supersky metric (2-dimensional sky) for each segment.
size_t num_segments
Number of segments.
SuperskyTransformData * semi_rssky_transf
Semicoherent reduced supersky metric coordinate transform data.
SuperskyTransformData ** coh_rssky_transf
Coherent reduced supersky metric coordinate transform data for each segment.