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))
91typedef struct tagSM_CallbackParam {
95typedef struct tagSM_CallbackOut {
98 double min_rssky2_array[32];
100 double max_rssky2_array[32];
110 const size_t spindowns,
138 par.coordSys = *coords;
141 par.detMotionType = detector_motion;
149 par.segmentList = segments;
153 if ( detector_weights != NULL ) {
154 par.multiNoiseFloor = *detector_weights;
156 par.multiNoiseFloor.length = 0;
167 par.projectCoord = -1;
177 gsl_matrix *g_ij = NULL;
182 const size_t sky_dim = coords->
dim - ( 1 + spindowns );
184 for (
size_t i = 0;
i < sky_dim; ++
i ) {
185 for (
size_t j = 0;
j < sky_dim; ++
j ) {
186 gsl_matrix_set( g_ij,
i,
j, (
i ==
j ) ? 1.0 : 0.0 );
188 for (
size_t j = sky_dim;
j < coords->
dim; ++
j ) {
189 gsl_matrix_set( g_ij,
i,
j, 0.0 );
190 gsl_matrix_set( g_ij,
j,
i, 0.0 );
209 gsl_matrix *fitted_ssky_metric,
210 SuperskyTransformData *rssky_transf,
211 const gsl_matrix *ussky_metric,
212 const gsl_matrix *orbital_metric,
229 gsl_matrix *GAMAT( tmp, 3 + rssky_transf->SMAX, 3 + rssky_transf->SMAX );
230 gsl_vector *GAVEC( tmpv, 1 + rssky_transf->SMAX );
237 gsl_matrix *orb_metric = NULL, *mid_time_transf = NULL, *diag_norm_transf = NULL;
247 gsl_matrix *GAMAT( fitA, 3 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
249 gsl_matrix_view orb_metric_fspin = gsl_matrix_submatrix( orb_metric, 0, 2, 3 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
250 gsl_matrix_memcpy( fitA, &orb_metric_fspin.matrix );
254 gsl_matrix *GAMAT( fitAt_fitA, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
255 gsl_blas_dgemm( CblasTrans, CblasNoTrans, 1.0, fitA, fitA, 0.0, fitAt_fitA );
258 gsl_matrix *GAMAT( svd_U, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
259 gsl_matrix *GAMAT( svd_V, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
260 gsl_vector *GAVEC( svd_S, 1 + rssky_transf->SMAX );
261 gsl_matrix_memcpy( svd_U, fitAt_fitA );
267 gsl_matrix *GAMAT( fitc, 1 + rssky_transf->SMAX, 2 );
268 for (
size_t j = 0;
j < 2; ++
j ) {
269 gsl_vector_view orb_metric_j = gsl_matrix_column( orb_metric,
j );
270 gsl_vector_view fitc_j = gsl_matrix_column( fitc,
j );
271 gsl_blas_dgemv( CblasTrans, 1.0, fitA, &orb_metric_j.vector, 0.0, tmpv );
288 gsl_matrix *GAMAT( subtract_orb, 3 + rssky_transf->SMAX, 3 + rssky_transf->SMAX );
290 gsl_matrix_set_identity( subtract_orb );
291 gsl_matrix_view subtract_orb_fspin_sky = gsl_matrix_submatrix( subtract_orb, 2, 0, 1 + rssky_transf->SMAX, 2 );
292 gsl_matrix_memcpy( &subtract_orb_fspin_sky.matrix, fitc );
293 gsl_matrix_scale( &subtract_orb_fspin_sky.matrix, -1.0 );
298 gsl_blas_dgemm( CblasNoTrans, CblasNoTrans, 1.0, diag_norm_transf, subtract_orb, 0.0, tmp );
299 gsl_blas_dgemm( CblasNoTrans, CblasNoTrans, 1.0, mid_time_transf, tmp, 0.0, subtract_orb );
315 gsl_matrix *GAMAT( subtract_ussky, 4 + rssky_transf->SMAX, 4 + rssky_transf->SMAX );
317 gsl_matrix_set_identity( subtract_ussky );
318 gsl_matrix_view subtract_ussky_fspin_sky = gsl_matrix_submatrix( subtract_ussky, 3, 0, 1 + rssky_transf->SMAX, 3 );
319 gsl_matrix_view subtract_orb_fspin_sky = gsl_matrix_submatrix( subtract_orb, 2, 0, 1 + rssky_transf->SMAX, 2 );
321 gsl_vector_view subtract_ussky_fspin_sky_col = gsl_matrix_column( &subtract_ussky_fspin_sky.matrix, 0 );
322 gsl_vector_view subtract_orb_fspin_sky_col = gsl_matrix_column( &subtract_orb_fspin_sky.matrix, 0 );
323 gsl_vector_memcpy( &subtract_ussky_fspin_sky_col.vector, &subtract_orb_fspin_sky_col.vector );
326 gsl_vector_view subtract_ussky_fspin_sky_col = gsl_matrix_column( &subtract_ussky_fspin_sky.matrix, 1 );
327 gsl_vector_view subtract_orb_fspin_sky_col = gsl_matrix_column( &subtract_orb_fspin_sky.matrix, 1 );
328 gsl_vector_memcpy( &subtract_ussky_fspin_sky_col.vector, &subtract_orb_fspin_sky_col.vector );
329 gsl_vector_scale( &subtract_ussky_fspin_sky_col.vector,
LAL_COSIEARTH );
332 gsl_vector_view subtract_ussky_fspin_sky_col = gsl_matrix_column( &subtract_ussky_fspin_sky.matrix, 2 );
333 gsl_vector_view subtract_orb_fspin_sky_col = gsl_matrix_column( &subtract_orb_fspin_sky.matrix, 1 );
334 gsl_vector_memcpy( &subtract_ussky_fspin_sky_col.vector, &subtract_orb_fspin_sky_col.vector );
335 gsl_vector_scale( &subtract_ussky_fspin_sky_col.vector,
LAL_SINIEARTH );
344 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
345 gsl_matrix_view subtract_ussky_fspin_sky = gsl_matrix_submatrix( subtract_ussky, 3, 0, 1 + rssky_transf->SMAX, 3 );
346 gsl_matrix_sub( &sky_offsets.matrix, &subtract_ussky_fspin_sky.matrix );
350 GFMAT( diag_norm_transf, fitA, fitAt_fitA, fitc, mid_time_transf, orb_metric, subtract_orb, subtract_ussky, svd_U, svd_V, tmp );
351 GFVEC( svd_S, tmpv );
363 gsl_matrix *decoupled_ssky_metric,
364 SuperskyTransformData *rssky_transf,
365 const gsl_matrix *fitted_ssky_metric
375 gsl_matrix_memcpy( decoupled_ssky_metric, fitted_ssky_metric );
378 gsl_matrix_view sky_sky = gsl_matrix_submatrix( decoupled_ssky_metric, 0, 0, 3, 3 );
379 gsl_matrix_view sky_fspin = gsl_matrix_submatrix( decoupled_ssky_metric, 0, 3, 3, 1 + rssky_transf->SMAX );
380 gsl_matrix_view fspin_sky = gsl_matrix_submatrix( decoupled_ssky_metric, 3, 0, 1 + rssky_transf->SMAX, 3 );
381 gsl_matrix_view fspin_fspin = gsl_matrix_submatrix( decoupled_ssky_metric, 3, 3, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
384 gsl_matrix *fspin_fspin_dnorm = NULL, *fspin_fspin_dnorm_transf = NULL;
388 gsl_matrix *GAMAT( fspin_fspin_dnorm_LU, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
389 gsl_matrix *GAMAT( fspin_fspin_dnorm_inv, 1 + rssky_transf->SMAX, 1 + rssky_transf->SMAX );
390 gsl_permutation *GAPERM( fspin_fspin_dnorm_LU_perm, 1 + rssky_transf->SMAX );
391 int fspin_fspin_dnorm_LU_sign = 0;
392 gsl_matrix_memcpy( fspin_fspin_dnorm_LU, fspin_fspin_dnorm );
393 XLAL_CHECK( gsl_linalg_LU_decomp( fspin_fspin_dnorm_LU, fspin_fspin_dnorm_LU_perm, &fspin_fspin_dnorm_LU_sign ) == 0,
XLAL_EFAILED );
394 XLAL_CHECK( gsl_linalg_LU_invert( fspin_fspin_dnorm_LU, fspin_fspin_dnorm_LU_perm, fspin_fspin_dnorm_inv ) == 0,
XLAL_EFAILED );
399 gsl_matrix *GAMAT( decouple_sky_offsets, 1 + rssky_transf->SMAX, 3 );
400 gsl_blas_dtrmm( CblasLeft, CblasUpper, CblasNoTrans, CblasNonUnit, 1.0, fspin_fspin_dnorm_transf, &fspin_sky.matrix );
401 gsl_blas_dgemm( CblasNoTrans, CblasNoTrans, 1.0, fspin_fspin_dnorm_inv, &fspin_sky.matrix, 0.0, decouple_sky_offsets );
402 gsl_blas_dtrmm( CblasLeft, CblasUpper, CblasNoTrans, CblasNonUnit, 1.0, fspin_fspin_dnorm_transf, decouple_sky_offsets );
405 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
406 gsl_matrix_add( &sky_offsets.matrix, decouple_sky_offsets );
410 gsl_blas_dgemm( CblasNoTrans, CblasNoTrans, -1.0, &sky_fspin.matrix, decouple_sky_offsets, 1.0, &sky_sky.matrix );
413 gsl_matrix_set_zero( &sky_fspin.matrix );
414 gsl_matrix_set_zero( &fspin_sky.matrix );
417 GFPERM( fspin_fspin_dnorm_LU_perm );
418 GFMAT( fspin_fspin_dnorm, fspin_fspin_dnorm_LU, fspin_fspin_dnorm_inv, fspin_fspin_dnorm_transf, decouple_sky_offsets );
430 gsl_matrix *aligned_ssky_metric,
431 SuperskyTransformData *rssky_transf,
432 const gsl_matrix *decoupled_ssky_metric
442 gsl_matrix *GAMAT( tmp, 1 + rssky_transf->SMAX, 3 );
445 gsl_matrix_memcpy( aligned_ssky_metric, decoupled_ssky_metric );
448 gsl_vector *GAVEC( sky_eval, 3 );
449 gsl_matrix *GAMAT( sky_evec, 3, 3 );
450 gsl_eigen_symmv_workspace *GALLOC( wksp, gsl_eigen_symmv_alloc( 3 ) );
451 gsl_matrix_view sky_sky = gsl_matrix_submatrix( aligned_ssky_metric, 0, 0, 3, 3 );
458 gsl_matrix_set_zero( &sky_sky.matrix );
459 gsl_vector_view sky_sky_diag = gsl_matrix_diagonal( &sky_sky.matrix );
460 gsl_vector_memcpy( &sky_sky_diag.vector, sky_eval );
464 for (
size_t j = 0;
j < 3; ++
j ) {
465 gsl_vector_view col = gsl_matrix_column( sky_evec,
j );
466 if ( gsl_vector_get( &col.vector,
j ) < 0.0 ) {
467 gsl_vector_scale( &col.vector, -1.0 );
472 gsl_matrix_view align_sky = gsl_matrix_view_array( &rssky_transf->align_sky[0][0], 3, 3 );
473 gsl_matrix_transpose_memcpy( &align_sky.matrix, sky_evec );
477 gsl_permutation *GAPERM( LU_perm, 3 );
480 if ( gsl_linalg_LU_det( sky_evec, LU_sign ) < 0.0 ) {
481 gsl_vector_view col = gsl_matrix_column( &align_sky.matrix, 2 );
482 gsl_vector_scale( &col.vector, -1.0 );
487 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
488 gsl_matrix_memcpy( tmp, &sky_offsets.matrix );
489 gsl_blas_dgemm( CblasNoTrans, CblasTrans, 1.0, tmp, &align_sky.matrix, 0.0, &sky_offsets.matrix );
492 gsl_eigen_symmv_free( wksp );
493 GFMAT( sky_evec, tmp );
505 gsl_matrix **rssky_metric,
506 SuperskyTransformData **rssky_transf,
507 const size_t spindowns,
508 const gsl_matrix *ussky_metric,
510 const gsl_matrix *orbital_metric,
532 GAMAT( *rssky_metric, orbital_metric->size1, orbital_metric->size1 );
533 *rssky_transf =
XLALCalloc( 1,
sizeof( **rssky_transf ) );
535 gsl_matrix *GAMAT( assky_metric, 1 + orbital_metric->size1, 1 + orbital_metric->size1 );
538 ( *rssky_transf )->ndim = ( *rssky_metric )->size1;
539 ( *rssky_transf )->ref_time = *ref_time;
541 ( *rssky_transf )->nspins = spindowns;
542 ( *rssky_transf )->nsky_offsets = 1 + spindowns;
553 for (
size_t i = ifreq;
i + 1 < assky_metric->size1; ++
i ) {
554 gsl_matrix_swap_rows( assky_metric,
i,
i + 1 );
555 gsl_matrix_swap_columns( assky_metric,
i,
i + 1 );
559 const int isky_offset_freq = ifreq - 3;
560 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &( *rssky_transf )->sky_offsets[0][0], ( *rssky_transf )->nsky_offsets, 3 );
561 for (
size_t i = isky_offset_freq;
i + 1 < sky_offsets.matrix.size1; ++
i ) {
562 gsl_matrix_swap_rows( &sky_offsets.matrix,
i,
i + 1 );
568 for (
size_t i = inc;
i + 1 < assky_metric->size1; ++
i ) {
569 gsl_matrix_swap_rows( assky_metric,
i,
i + 1 );
570 gsl_matrix_swap_columns( assky_metric,
i,
i + 1 );
575 gsl_matrix_view extract_rssky_metric = gsl_matrix_submatrix( assky_metric, 0, 0, ( *rssky_metric )->size1, ( *rssky_metric )->size1 );
576 gsl_matrix_memcpy( *rssky_metric, &extract_rssky_metric.matrix );
579 for (
size_t i = 0;
i < ( *rssky_metric )->size1; ++
i ) {
580 for (
size_t j =
i + 1;
j < ( *rssky_metric )->size1; ++
j ) {
581 const double gij = gsl_matrix_get( *rssky_metric,
i,
j );
582 const double gji = gsl_matrix_get( *rssky_metric,
j,
i );
583 const double g = 0.5 * ( gij + gji );
584 gsl_matrix_set( *rssky_metric,
i,
j, g );
585 gsl_matrix_set( *rssky_metric,
j,
i, g );
590 for (
size_t s = 1;
s <= ( *rssky_metric )->size1; ++
s ) {
591 gsl_matrix_view rssky_metric_s = gsl_matrix_submatrix( *rssky_metric, 0, 0,
s,
s );
593 XLAL_CHECK( det_s > 0,
XLAL_EFAILED,
"Reduced supersky metric is not positive definite (s=%zu, det_s=%0.3e)",
s, det_s );
597 GFMAT( assky_metric );
605 const size_t spindowns,
608 const double fiducial_freq,
643 if ( spindowns >= 1 ) {
647 if ( spindowns >= 2 ) {
651 if ( spindowns >= 3 ) {
655 if ( spindowns >= 4 ) {
672 gsl_matrix *GAMAT_NULL( ussky_metric_avg, 4 + spindowns, 4 + spindowns );
673 gsl_matrix *GAMAT_NULL( orbital_metric_avg, 3 + spindowns, 3 + spindowns );
683 gsl_matrix_add( ussky_metric_avg, ussky_metric_seg );
688 gsl_matrix_add( orbital_metric_avg, orbital_metric_seg );
691 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 );
695 GFMAT( ussky_metric_seg, orbital_metric_seg );
700 gsl_matrix_scale( ussky_metric_avg, 1.0 / metrics->
num_segments );
701 gsl_matrix_scale( orbital_metric_avg, 1.0 / metrics->
num_segments );
706 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 );
713 GFMAT( ussky_metric_avg, orbital_metric_avg );
762 if ( metrics != NULL ) {
813 for ( idx[2] = 0; idx[2] < dims[2]; ++idx[2] ) {
855 *metrics =
XLALCalloc( 1,
sizeof( **metrics ) );
863 ( *metrics )->num_segments = dims[2];
864 ( *metrics )->coh_rssky_metric =
XLALCalloc( ( *metrics )->num_segments,
sizeof( *( *metrics )->coh_rssky_metric ) );
867 for ( idx[2] = 0; idx[2] < dims[2]; ++idx[2] ) {
878 ( *metrics )->coh_rssky_transf =
XLALCalloc( ( *metrics )->num_segments,
sizeof( *( *metrics )->coh_rssky_transf ) );
880 for (
size_t i = 0;
i < ( *metrics )->num_segments; ++
i ) {
881 ( *metrics )->coh_rssky_transf[
i] =
XLALCalloc( 1,
sizeof( *( *metrics )->coh_rssky_transf[
i] ) );
899 ( *metrics )->semi_rssky_transf =
XLALCalloc( 1,
sizeof( *( *metrics )->semi_rssky_transf ) );
923 if ( spindowns != NULL ) {
935 gsl_matrix *rssky_metric,
936 SuperskyTransformData *rssky_transf,
937 const double new_fiducial_freq
946 const double fiducial_scale = new_fiducial_freq / rssky_transf->fiducial_freq;
947 gsl_matrix_view sky_sky = gsl_matrix_submatrix( rssky_metric, 0, 0, 2, 2 );
948 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
949 gsl_matrix_scale( &sky_sky.matrix,
SQR( fiducial_scale ) );
950 gsl_matrix_scale( &sky_offsets.matrix, fiducial_scale );
953 rssky_transf->fiducial_freq = new_fiducial_freq;
961 const double new_fiducial_freq
986 const double coh_max_mismatch,
987 const double semi_max_mismatch
1004 double max_gff_d_mu = gsl_matrix_get( metrics->
semi_rssky_metric, ifreq, ifreq ) / semi_max_mismatch;
1006 const double coh_gff_d_mu = gsl_matrix_get( metrics->
coh_rssky_metric[
n], ifreq, ifreq ) / coh_max_mismatch;
1007 if ( max_gff_d_mu < coh_gff_d_mu ) {
1008 max_gff_d_mu = coh_gff_d_mu;
1017 const double semi_gff_d_mu = gsl_matrix_get( metrics->
semi_rssky_metric, ifreq, ifreq ) / semi_max_mismatch;
1018 const double scale = sqrt( max_gff_d_mu / semi_gff_d_mu );
1021 gsl_vector_view rssky_metric_f_row = gsl_matrix_row( metrics->
semi_rssky_metric, ifreq );
1022 gsl_vector_scale( &rssky_metric_f_row.vector,
scale );
1024 gsl_vector_view rssky_metric_f_col = gsl_matrix_column( metrics->
semi_rssky_metric, ifreq );
1025 gsl_vector_scale( &rssky_metric_f_col.vector,
scale );
1029 const double coh_gff_d_mu = gsl_matrix_get( metrics->
coh_rssky_metric[
n], ifreq, ifreq ) / coh_max_mismatch;
1030 const double scale = sqrt( max_gff_d_mu / coh_gff_d_mu );
1033 gsl_vector_view rssky_metric_f_row = gsl_matrix_row( metrics->
coh_rssky_metric[
n], ifreq );
1034 gsl_vector_scale( &rssky_metric_f_row.vector,
scale );
1036 gsl_vector_view rssky_metric_f_col = gsl_matrix_column( metrics->
coh_rssky_metric[
n], ifreq );
1037 gsl_vector_scale( &rssky_metric_f_col.vector,
scale );
1047 const SuperskyTransformData *rssky_transf
1056 out_phys->
refTime = rssky_transf->ref_time;
1093 const gsl_vector *rss,
1097 const double A = GSL_SIGN( hemi ) * gsl_vector_get( rss, 0 ) - 1;
1098 const double B = gsl_vector_get( rss, 1 );
1099 const double R = sqrt(
SQR(
A ) +
SQR(
B ) );
1100 const double Rmax = GSL_MAX( 1.0, R );
1103 as[2] = GSL_SIGN( hemi ) *
RE_SQRT( 1.0 -
DOT2( as, as ) );
1115 const double r = sqrt(
DOT3( as, as ) );
1116 const double A = GSL_SIGN( as[2] ) * ( ( as[0] /
r ) + 1.0 );
1117 const double B = as[1] /
r;
1118 gsl_vector_set( rss, 0,
A );
1119 gsl_vector_set( rss, 1,
B );
1123 gsl_vector *out_rssky,
1125 const SuperskyTransformData *rssky_transf
1143 double intm[4 + rssky_transf->SMAX];
1144 gsl_vector_view intm_sky2 = gsl_vector_view_array( &intm[0], 2 );
1145 gsl_vector_view intm_sky3 = gsl_vector_view_array( &intm[0], 3 );
1146 gsl_vector_view intm_fspin = gsl_vector_view_array( &intm[3], 1 + rssky_transf->SMAX );
1150 const double cos_Delta = cos( in_phys_ref.
Delta );
1151 intm[0] = cos( in_phys_ref.
Alpha ) * cos_Delta;
1152 intm[1] = sin( in_phys_ref.
Alpha ) * cos_Delta;
1153 intm[2] = sin( in_phys_ref.
Delta );
1157 intm[3 + rssky_transf->SMAX] = in_phys_ref.
fkdot[0];
1158 for (
size_t s = 1;
s <= rssky_transf->SMAX; ++
s ) {
1159 intm[2 +
s] = in_phys_ref.
fkdot[
s];
1165 gsl_vector_view asky_v = gsl_vector_view_array( asky, 3 );
1166 gsl_matrix_const_view align_sky = gsl_matrix_const_view_array( &rssky_transf->align_sky[0][0], 3, 3 );
1167 gsl_blas_dgemv( CblasNoTrans, 1.0, &align_sky.matrix, &intm_sky3.vector, 0.0, &asky_v.vector );
1172 gsl_matrix_const_view sky_offsets = gsl_matrix_const_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
1173 gsl_blas_dgemv( CblasNoTrans, 1.0, &sky_offsets.matrix, &asky_v.vector, 1.0, &intm_fspin.vector );
1180 gsl_vector_view out_sky2 = gsl_vector_subvector( out_rssky, 0, 2 );
1181 gsl_vector_view out_fspin = gsl_vector_subvector( out_rssky, 2, 1 + rssky_transf->SMAX );
1182 gsl_vector_memcpy( &out_sky2.vector, &intm_sky2.vector );
1183 gsl_vector_memcpy( &out_fspin.vector, &intm_fspin.vector );
1192 const gsl_vector *in_rssky,
1193 const gsl_vector *ref_rssky,
1194 const SuperskyTransformData *rssky_transf
1206 out_phys->
refTime = rssky_transf->ref_time;
1209 double intm[4 + rssky_transf->SMAX];
1210 gsl_vector_view intm_sky2 = gsl_vector_view_array( &intm[0], 2 );
1211 gsl_vector_view intm_sky3 = gsl_vector_view_array( &intm[0], 3 );
1212 gsl_vector_view intm_fspin = gsl_vector_view_array( &intm[3], 1 + rssky_transf->SMAX );
1216 gsl_vector_const_view in_sky2 = gsl_vector_const_subvector( in_rssky, 0, 2 );
1217 gsl_vector_const_view in_fspin = gsl_vector_const_subvector( in_rssky, 2, 1 + rssky_transf->SMAX );
1218 gsl_vector_memcpy( &intm_sky2.vector, &in_sky2.vector );
1219 gsl_vector_memcpy( &intm_fspin.vector, &in_fspin.vector );
1223 const double A = gsl_vector_get( ref_rssky != NULL ? ref_rssky : in_rssky, 0 );
1226 gsl_vector_view asky_v = gsl_vector_view_array( asky, 3 );
1231 gsl_matrix_const_view sky_offsets = gsl_matrix_const_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
1232 gsl_blas_dgemv( CblasNoTrans, -1.0, &sky_offsets.matrix, &asky_v.vector, 1.0, &intm_fspin.vector );
1236 gsl_matrix_const_view align_sky = gsl_matrix_const_view_array( &rssky_transf->align_sky[0][0], 3, 3 );
1237 gsl_blas_dgemv( CblasTrans, 1.0, &align_sky.matrix, &asky_v.vector, 0.0, &intm_sky3.vector );
1240 out_phys->
fkdot[0] = intm[3 + rssky_transf->SMAX];
1241 for (
size_t s = 1;
s <= rssky_transf->SMAX; ++
s ) {
1242 out_phys->
fkdot[
s] = intm[2 +
s];
1246 out_phys->
Alpha = atan2( intm[1], intm[0] );
1247 out_phys->
Delta = atan2( intm[2], sqrt(
SQR( intm[0] ) +
SQR( intm[1] ) ) );
1255 gsl_vector *out_rssky,
1256 const SuperskyTransformData *out_rssky_transf,
1257 const gsl_vector *in_rssky,
1258 const gsl_vector *ref_rssky,
1259 const SuperskyTransformData *in_rssky_transf
1281 gsl_matrix **out_rssky,
1282 const gsl_matrix *in_phys,
1283 const SuperskyTransformData *rssky_transf
1294 if ( *out_rssky != NULL ) {
1295 if ( ( *out_rssky )->size1 != in_phys->size1 || ( *out_rssky )->size2 != in_phys->size2 ) {
1296 GFMAT( *out_rssky );
1300 if ( *out_rssky == NULL ) {
1301 GAMAT( *out_rssky, in_phys->size1, in_phys->size2 );
1305 for (
size_t j = 0;
j < in_phys->size2; ++
j ) {
1309 in_phys_j.refTime = rssky_transf->ref_time;
1310 in_phys_j.Alpha = gsl_matrix_get( in_phys, 0,
j );
1311 in_phys_j.Delta = gsl_matrix_get( in_phys, 1,
j );
1312 for (
size_t s = 0;
s <= rssky_transf->SMAX; ++
s ) {
1313 in_phys_j.fkdot[
s] = gsl_matrix_get( in_phys, 2 +
s,
j );
1317 gsl_vector_view out_rssky_j = gsl_matrix_column( *out_rssky,
j );
1327 gsl_matrix **out_phys,
1328 const gsl_matrix *in_rssky,
1329 const SuperskyTransformData *rssky_transf
1340 if ( *out_phys != NULL ) {
1341 if ( ( *out_phys )->size1 != in_rssky->size1 || ( *out_phys )->size2 != in_rssky->size2 ) {
1346 if ( *out_phys == NULL ) {
1347 GAMAT( *out_phys, in_rssky->size1, in_rssky->size2 );
1351 for (
size_t j = 0;
j < in_rssky->size2; ++
j ) {
1354 gsl_vector_const_view in_rssky_j = gsl_matrix_const_column( in_rssky,
j );
1359 gsl_matrix_set( *out_phys, 0,
j, out_phys_j.Alpha );
1360 gsl_matrix_set( *out_phys, 1,
j, out_phys_j.Delta );
1361 for (
size_t s = 0;
s <= rssky_transf->SMAX; ++
s ) {
1362 gsl_matrix_set( *out_phys, 2 +
s,
j, out_phys_j.fkdot[
s] );
1372 const size_t dim UNUSED,
1373 const gsl_vector *point,
1379 const double A = gsl_vector_get( point, 0 );
1384 for (
size_t i = 0;
i < 3; ++
i ) {
1385 gsl_vector_set(
cache,
i, as[
i] );
1411 const size_t dim UNUSED,
1412 const gsl_matrix *
cache UNUSED,
1413 const gsl_vector *point
1422 const double A = gsl_vector_get( point, 0 );
1423 const double rssky[2] = {
A, 0 };
1424 gsl_vector_const_view rssky_view = gsl_vector_const_view_array( rssky, 2 );
1427 const double na = as[0];
1430 const double limit =
RE_SQRT( 1 -
SQR( na ) );
1433 double bound = GSL_NAN;
1434 if ( A <= psbd->min_A ) {
1436 }
else if (
A >= psbd->
max_A ) {
1443 if (
A <=
p.max_A ) {
1445 if (
p.type != 0 ) {
1448 bound =
p.type * limit;
1454 const double c = ( na -
p.na0 ) /
p.r;
1455 double angle = asin( GSL_MAX( -1, GSL_MIN(
c, 1 ) ) );
1460 bound =
p.C * cos( angle ) +
p.S * sin( angle ) +
p.Z;
1471 return GSL_MAX( -limit, GSL_MIN( bound, limit ) );
1477 gsl_matrix *rssky_metric,
1478 SuperskyTransformData *rssky_transf,
1479 const double alpha1,
1480 const double alpha2,
1481 const double delta1,
1493 gsl_matrix_view align_sky = gsl_matrix_view_array( &rssky_transf->align_sky[0][0], 3, 3 );
1494 gsl_matrix_view sky_offsets = gsl_matrix_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
1498 "|alpha1 - alpha2| and |delta1 - delta2| must either be both zero, or both nonzero" );
1499 if ( fabs( alpha1 - alpha2 ) >=
LAL_TWOPI ) {
1501 "If |alpha1 - alpha2| covers the whole sky, then |delta1| == |delta2| == PI/2 is required" );
1504 "If |alpha1 - alpha2| does not cover the whole sky, then |alpha1 - alpha2| <= PI is required" );
1506 "If |alpha1 - alpha2| does not cover the whole sky, then -PI/2 <= delta1 <= PI/2 is required" );
1508 "If |alpha1 - alpha2| does not cover the whole sky, then -PI/2 <= delta2 <= PI/2 is required" );
1516 if ( alpha1 == alpha2 && delta1 == delta2 ) {
1519 double rssky_point[rssky_metric->size1];
1520 gsl_vector_view rssky_point_view = gsl_vector_view_array( rssky_point, rssky_metric->size1 );
1522 phys_point.Alpha = alpha1;
1523 phys_point.Delta = delta1;
1527 for (
size_t dim = 0; dim < 2; ++dim ) {
1540 data_lower.pieces[
i].max_A = data_upper.pieces[
i].max_A = GSL_NEGINF;
1548 if ( fabs( alpha1 - alpha2 ) >=
LAL_TWOPI ) {
1551 data_lower.min_A = data_upper.min_A = -2;
1552 data_lower.min_A_bound = data_upper.min_A_bound = 0;
1553 data_lower.max_A = data_upper.max_A = 2;
1554 data_lower.max_A_bound = data_upper.max_A_bound = 0;
1555 data_lower.pieces[0] = lower_circular;
1556 data_lower.pieces[0].
max_A = GSL_POSINF;
1557 data_upper.pieces[0] = upper_circular;
1558 data_upper.pieces[0].
max_A = GSL_POSINF;
1594 const double alpha = GSL_MIN( alpha1, alpha2 );
1595 const double cos_alpha = cos(
alpha );
1596 const double sin_alpha = sin(
alpha );
1597 const double Q_na_0 = gsl_matrix_get( &align_sky.matrix, 0, 0 );
1598 const double Q_na_1 = gsl_matrix_get( &align_sky.matrix, 0, 1 );
1599 const double Q_nb_0 = gsl_matrix_get( &align_sky.matrix, 1, 0 );
1600 const double Q_nb_1 = gsl_matrix_get( &align_sky.matrix, 1, 1 );
1601 const double na = Q_na_0 * cos_alpha + Q_na_1 * sin_alpha;
1602 const double nb = Q_nb_0 * cos_alpha + Q_nb_1 * sin_alpha;
1603 phi = atan2( -nb, na );
1604 const double na_rot = na * cos( phi ) + nb * sin( phi );
1607 }
else if ( na_rot > 0 ) {
1611 const double cos_phi = cos( phi );
1612 const double sin_phi = sin( phi );
1621 for (
size_t j = 0;
j < 3; ++
j ) {
1622 const double Q_na_j = gsl_matrix_get( &align_sky.matrix, 0,
j );
1623 const double Q_nb_j = gsl_matrix_get( &align_sky.matrix, 1,
j );
1624 const double Q_na_j_rot = Q_na_j * cos_phi - Q_nb_j * sin_phi;
1625 const double Q_nb_j_rot = Q_nb_j * cos_phi + Q_na_j * sin_phi;
1626 gsl_matrix_set( &align_sky.matrix, 0,
j, Q_na_j_rot );
1627 gsl_matrix_set( &align_sky.matrix, 1,
j, Q_nb_j_rot );
1629 for (
size_t i = 0;
i < sky_offsets.matrix.size1; ++
i ) {
1630 const double Delta_0 = gsl_matrix_get( &sky_offsets.matrix,
i, 0 );
1631 const double Delta_1 = gsl_matrix_get( &sky_offsets.matrix,
i, 1 );
1632 const double Delta_0_rot = Delta_0 * cos_phi - Delta_1 * sin_phi;
1633 const double Delta_1_rot = Delta_1 * cos_phi + Delta_0 * sin_phi;
1634 gsl_matrix_set( &sky_offsets.matrix,
i, 0, Delta_0_rot );
1635 gsl_matrix_set( &sky_offsets.matrix,
i, 1, Delta_1_rot );
1648 const double g_na_na = gsl_matrix_get( rssky_metric, 0, 0 );
1649 const double g_nb_nb = gsl_matrix_get( rssky_metric, 1, 1 );
1650 const double g_na_na_rot = g_na_na *
SQR( cos_phi ) + g_nb_nb *
SQR( sin_phi );
1651 const double g_na_nb_rot = ( g_na_na - g_nb_nb ) * cos_phi * sin_phi;
1652 const double g_nb_nb_rot = g_na_na *
SQR( sin_phi ) + g_nb_nb *
SQR( cos_phi );
1653 gsl_matrix_set( rssky_metric, 0, 0, g_na_na_rot );
1654 gsl_matrix_set( rssky_metric, 0, 1, g_na_nb_rot );
1655 gsl_matrix_set( rssky_metric, 1, 0, g_na_nb_rot );
1656 gsl_matrix_set( rssky_metric, 1, 1, g_nb_nb_rot );
1660 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 ) };
1661 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 ) };
1662 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 ) };
1665 const double alphas[2] = { GSL_MIN( alpha1, alpha2 ), GSL_MAX( alpha1, alpha2 ) };
1666 const double deltas[2] = { GSL_MIN( delta1, delta2 ), GSL_MAX( delta1, delta2 ) };
1676 for (
size_t i = 0;
i < 2; ++
i ) {
1678 const_alpha[
i].
type = 0;
1679 const double cos_alpha = cos( alphas[
i] );
1680 const double sin_alpha = sin( alphas[
i] );
1681 const double x = Q_na[2];
1682 const double y = Q_na[0] * cos_alpha + Q_na[1] * sin_alpha;
1683 const_alpha[
i].
na0 = 0;
1684 const_alpha[
i].
r = sqrt(
SQR(
x ) +
SQR(
y ) );
1686 const_alpha[
i].
C = Q_nb[0] * cos_alpha + Q_nb[1] * sin_alpha;
1687 const_alpha[
i].
S = Q_nb[2];
1688 const_alpha[
i].
Z = 0;
1699 for (
size_t j = 0;
j < 2; ++
j ) {
1701 const_delta[
j].
type = 0;
1702 const double cos_delta = cos( deltas[
j] );
1703 const double sin_delta = sin( deltas[
j] );
1704 const double x = Q_na[1] * cos_delta;
1705 const double y = Q_na[0] * cos_delta;
1706 const_delta[
j].
na0 = Q_na[2] * sin_delta;
1707 const_delta[
j].
r = sqrt(
SQR(
x ) +
SQR(
y ) );
1709 const_delta[
j].
C = Q_nb[0] * cos_delta;
1710 const_delta[
j].
S = Q_nb[1] * cos_delta;
1711 const_delta[
j].
Z = Q_nb[2] * sin_delta;
1716 double corner_A[2][2], corner_B[2][2];
1717 for (
size_t i = 0;
i < 2; ++
i ) {
1718 for (
size_t j = 0;
j < 2; ++
j ) {
1719 double rssky_point[rssky_metric->size1];
1720 gsl_vector_view rssky_point_view = gsl_vector_view_array( rssky_point, rssky_metric->size1 );
1722 phys_point.Alpha = alphas[
i];
1723 phys_point.Delta = deltas[
j];
1725 corner_A[
i][
j] = rssky_point[0];
1726 corner_B[
i][
j] = rssky_point[1];
1731 data_lower.min_A = data_upper.min_A = GSL_NEGINF;
1732 data_lower.max_A = data_upper.max_A = GSL_POSINF;
1733 if ( corner_A[1][0] < 0 && corner_A[1][1] <= 0 ) {
1735 if ( corner_A[1][1] < corner_A[1][0] ) {
1751 data_lower.min_A = data_upper.min_A = corner_A[1][1];
1752 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[1][1];
1753 data_lower.max_A = data_upper.max_A = corner_A[0][1];
1754 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[0][1];
1755 data_lower.pieces[0] = const_delta[1];
1756 data_lower.pieces[0].
max_A = GSL_POSINF;
1757 data_upper.pieces[0] = const_alpha[1];
1758 data_upper.pieces[0].
max_A = corner_A[1][0];
1759 data_upper.pieces[1] = const_delta[0];
1760 data_upper.pieces[1].
max_A = corner_A[0][0];
1761 data_upper.pieces[2] = const_alpha[0];
1762 data_upper.pieces[2].
max_A = GSL_POSINF;
1763 data_upper.pieces[2].altroot =
true;
1781 data_lower.min_A = data_upper.min_A = corner_A[1][0];
1782 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[1][0];
1783 data_lower.max_A = data_upper.max_A = corner_A[0][1];
1784 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[0][1];
1785 data_lower.pieces[0] = const_alpha[1];
1786 data_lower.pieces[0].
max_A = corner_A[1][1];
1787 data_lower.pieces[0].altroot =
true;
1788 data_lower.pieces[1] = const_delta[1];
1789 data_lower.pieces[1].
max_A = GSL_POSINF;
1790 data_upper.pieces[0] = const_delta[0];
1791 data_upper.pieces[0].
max_A = corner_A[0][0];
1792 data_upper.pieces[1] = const_alpha[0];
1793 data_upper.pieces[1].
max_A = GSL_POSINF;
1794 data_upper.pieces[1].altroot =
true;
1798 }
else if ( 0 <= corner_A[1][0] && 0 < corner_A[1][1] ) {
1800 if ( corner_A[1][1] < corner_A[1][0] ) {
1816 data_lower.min_A = data_upper.min_A = corner_A[0][0];
1817 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[0][0];
1818 data_lower.max_A = data_upper.max_A = corner_A[1][0];
1819 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[1][0];
1820 data_lower.pieces[0] = const_delta[0];
1821 data_lower.pieces[0].
max_A = GSL_POSINF;
1822 data_upper.pieces[0] = const_alpha[0];
1823 data_upper.pieces[0].
max_A = corner_A[0][1];
1824 data_upper.pieces[1] = const_delta[1];
1825 data_upper.pieces[1].
max_A = corner_A[1][1];
1826 data_upper.pieces[2] = const_alpha[1];
1827 data_upper.pieces[2].
max_A = GSL_POSINF;
1828 data_upper.pieces[2].altroot =
true;
1846 data_lower.min_A = data_upper.min_A = corner_A[0][0];
1847 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[0][0];
1848 data_lower.max_A = data_upper.max_A = corner_A[1][1];
1849 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[1][1];
1850 data_lower.pieces[0] = const_delta[0];
1851 data_lower.pieces[0].
max_A = corner_A[1][0];
1852 data_lower.pieces[1] = const_alpha[1];
1853 data_lower.pieces[1].
max_A = GSL_POSINF;
1854 data_upper.pieces[0] = const_alpha[0];
1855 data_upper.pieces[0].
max_A = corner_A[0][1];
1856 data_upper.pieces[1] = const_delta[1];
1857 data_upper.pieces[1].
max_A = GSL_POSINF;
1868 const double cos_alpha_split = cos( alphas[1] );
1869 const double sin_alpha_split = sin( alphas[1] );
1870 const double delta_split = -1 * atan2( Q_nc[0] * cos_alpha_split + Q_nc[1] * sin_alpha_split, Q_nc[2] );
1871 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 );
1872 const double split_A[2] = { -1 - na_split, 1 + na_split };
1873 const double split_B = -1 *
RE_SQRT( 1 -
SQR( na_split ) );
1875 if ( split_A[0] < corner_A[1][0] ) {
1876 if ( corner_A[1][1] < split_A[1] ) {
1892 data_lower.min_A = data_upper.min_A = split_A[0];
1893 data_lower.min_A_bound = data_upper.min_A_bound = split_B;
1894 data_lower.max_A = data_upper.max_A = split_A[1];
1895 data_lower.max_A_bound = data_upper.max_A_bound = split_B;
1896 data_lower.pieces[0] = lower_circular;
1897 data_lower.pieces[0].
max_A = GSL_POSINF;
1898 data_upper.pieces[0] = const_alpha[1];
1899 data_upper.pieces[0].
max_A = corner_A[1][0];
1900 data_upper.pieces[1] = const_delta[0];
1901 data_upper.pieces[1].
max_A = corner_A[0][0];
1902 data_upper.pieces[2] = const_alpha[0];
1903 data_upper.pieces[2].
max_A = 0;
1904 data_upper.pieces[2].altroot =
true;
1905 data_upper.pieces[3] = const_alpha[0];
1906 data_upper.pieces[3].
max_A = corner_A[0][1];
1907 data_upper.pieces[4] = const_delta[1];
1908 data_upper.pieces[4].
max_A = corner_A[1][1];
1909 data_upper.pieces[5] = const_alpha[1];
1910 data_upper.pieces[5].
max_A = GSL_POSINF;
1911 data_upper.pieces[5].altroot =
true;
1929 data_lower.min_A = data_upper.min_A = split_A[0];
1930 data_lower.min_A_bound = data_upper.min_A_bound = split_B;
1931 data_lower.max_A = data_upper.max_A = corner_A[1][1];
1932 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[1][1];
1933 data_lower.pieces[0] = lower_circular;
1934 data_lower.pieces[0].
max_A = split_A[1];
1935 data_lower.pieces[1] = const_alpha[1];
1936 data_lower.pieces[1].
max_A = GSL_POSINF;
1937 data_upper.pieces[0] = const_alpha[1];
1938 data_upper.pieces[0].
max_A = corner_A[1][0];
1939 data_upper.pieces[1] = const_delta[0];
1940 data_upper.pieces[1].
max_A = corner_A[0][0];
1941 data_upper.pieces[2] = const_alpha[0];
1942 data_upper.pieces[2].
max_A = 0;
1943 data_upper.pieces[2].altroot =
true;
1944 data_upper.pieces[3] = const_alpha[0];
1945 data_upper.pieces[3].
max_A = corner_A[0][1];
1946 data_upper.pieces[4] = const_delta[1];
1947 data_upper.pieces[4].
max_A = GSL_POSINF;
1952 if ( corner_A[1][1] < split_A[1] ) {
1968 data_lower.min_A = data_upper.min_A = corner_A[1][0];
1969 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[1][0];
1970 data_lower.max_A = data_upper.max_A = split_A[1];
1971 data_lower.max_A_bound = data_upper.max_A_bound = split_B;
1972 data_lower.pieces[0] = const_alpha[1];
1973 data_lower.pieces[0].
max_A = split_A[0];
1974 data_lower.pieces[0].altroot =
true;
1975 data_lower.pieces[1] = lower_circular;
1976 data_lower.pieces[1].
max_A = GSL_POSINF;
1977 data_upper.pieces[0] = const_delta[0];
1978 data_upper.pieces[0].
max_A = corner_A[0][0];
1979 data_upper.pieces[1] = const_alpha[0];
1980 data_upper.pieces[1].
max_A = 0;
1981 data_upper.pieces[1].altroot =
true;
1982 data_upper.pieces[2] = const_alpha[0];
1983 data_upper.pieces[2].
max_A = corner_A[0][1];
1984 data_upper.pieces[3] = const_delta[1];
1985 data_upper.pieces[3].
max_A = corner_A[1][1];
1986 data_upper.pieces[4] = const_alpha[1];
1987 data_upper.pieces[4].
max_A = GSL_POSINF;
1988 data_upper.pieces[4].altroot =
true;
2006 data_lower.min_A = data_upper.min_A = corner_A[1][0];
2007 data_lower.min_A_bound = data_upper.min_A_bound = corner_B[1][0];
2008 data_lower.max_A = data_upper.max_A = corner_A[1][1];
2009 data_lower.max_A_bound = data_upper.max_A_bound = corner_B[1][1];
2010 data_lower.pieces[0] = const_alpha[1];
2011 data_lower.pieces[0].
max_A = split_A[0];
2012 data_lower.pieces[0].altroot =
true;
2013 data_lower.pieces[1] = lower_circular;
2014 data_lower.pieces[1].
max_A = split_A[1];
2015 data_lower.pieces[2] = const_alpha[1];
2016 data_lower.pieces[2].
max_A = GSL_POSINF;
2017 data_upper.pieces[0] = const_delta[0];
2018 data_upper.pieces[0].
max_A = corner_A[0][0];
2019 data_upper.pieces[1] = const_alpha[0];
2020 data_upper.pieces[1].
max_A = 0;
2021 data_upper.pieces[1].altroot =
true;
2022 data_upper.pieces[2] = const_alpha[0];
2023 data_upper.pieces[2].
max_A = corner_A[0][1];
2024 data_upper.pieces[3] = const_delta[1];
2025 data_upper.pieces[3].
max_A = GSL_POSINF;
2047 const size_t dim UNUSED,
2048 const gsl_matrix *
cache UNUSED,
2049 const gsl_vector *point
2054 const double bound = *( (
const double * )
data );
2058 const double A = gsl_vector_get( point, 0 );
2059 const double rssky[2] = {
A, 0 };
2060 gsl_vector_const_view rssky_view = gsl_vector_const_view_array( rssky, 2 );
2063 const double na = as[0];
2066 const double limit =
RE_SQRT( 1 -
SQR( na ) );
2068 return GSL_MAX( -limit, GSL_MIN( bound, limit ) );
2079 const double target_area = ( (
double * )
params )[0];
2084 return area - target_area;
2095 const double target_area = ( (
double * )
params )[0];
2096 double A0 = ( (
double * )
params )[1];
2097 double A1 = ( (
double * )
params )[2];
2100 const double max_area = A1 *
RE_SQRT( 1 -
SQR( A1 ) ) - A0 *
RE_SQRT( 1 -
SQR( A0 ) ) + asin( A1 ) - asin( A0 );
2114 double area = -fabs( B1 ) * ( A1 - A0 ) + 0.5 * ( A1 *
RE_SQRT( 1 -
SQR( A1 ) ) - A0 *
RE_SQRT( 1 -
SQR( A0 ) ) + asin( A1 ) - asin( A0 ) );
2118 area = max_area - area;
2121 return area - target_area;
2127 const gsl_matrix *rssky_metric,
2128 const double max_mismatch,
2129 const UINT4 patch_count,
2130 const UINT4 patch_index
2142 XLAL_CHECK( patch_count == 1 || patch_count % 2 == 0,
XLAL_EINVAL,
"'patch_count' must be either one or even" );
2150 double A_bound[2] = {GSL_NAN, GSL_NAN};
2151 double B_bound[2] = {-1, 1};
2154 double A_lower_bbox_pad = -1, A_upper_bbox_pad = -1;
2155 double B_lower_bbox_pad = -1, B_upper_bbox_pad = -1;
2158 if ( patch_count <= 2 ) {
2159 A_bound[0] = -2 + 4 * ( ( double ) patch_index ) / ( ( double ) patch_count );
2160 A_bound[1] = A_bound[0] + 4 / ( ( double ) patch_count );
2164 const UINT4 hemi_patch_count = patch_count / 2;
2167 const UINT4 hemi_patch_index = patch_index < hemi_patch_count ? patch_index : patch_count - patch_index - 1;
2172 const UINT4 min_A_count = ceil( sqrt( hemi_patch_count ) );
2175 const double max_B_bbox = 2 * sqrt( max_mismatch / gsl_matrix_get( rssky_metric, 1, 1 ) );
2178 const double target_B_count = 1.0 / ( 1.0 * max_B_bbox );
2181 const UINT4 A_count = GSL_MIN( min_A_count, ceil( hemi_patch_count / target_B_count ) );
2184 const UINT4 min_B_count = hemi_patch_count / A_count;
2187 INT4 patch_excess = hemi_patch_count - A_count * min_B_count;
2191 UINT4 B_count = min_B_count;
2192 if ( patch_excess > 0 ) {
2208 UINT4 A_index[2] = {0, B_count};
2209 UINT4 B_index = hemi_patch_index;
2210 while ( B_index >= B_count ) {
2217 if ( patch_excess == 0 ) {
2223 A_index[0] = A_index[1];
2224 A_index[1] += B_count;
2229 A_lower_bbox_pad = ( A_index[0] == 0 && patch_index < hemi_patch_count ) ? -1 : 0;
2230 A_upper_bbox_pad = ( A_index[0] == 0 && patch_index >= hemi_patch_count ) ? -1 : 0;
2231 B_lower_bbox_pad = ( B_index == 0 ) ? -1 : 0;
2232 B_upper_bbox_pad = ( B_index + 1 == B_count ) ? -1 : 0;
2235 gsl_root_fsolver *fs = gsl_root_fsolver_alloc( gsl_root_fsolver_brent );
2239 for (
size_t i = 0;
i < 2; ++
i ) {
2240 const UINT4 A_index_i = A_index[
i];
2243 if ( A_index_i == 0 ) {
2245 }
else if ( A_index_i == hemi_patch_count ) {
2250 const double target_area =
LAL_PI * ( ( double ) A_index_i ) / ( ( ( double ) patch_count ) / 2 );
2253 double params[] = { target_area };
2255 double A_lower = -1, A_upper = 1;
2259 int status = 0, iter = 0;
2262 A_lower = gsl_root_fsolver_x_lower( fs );
2263 A_upper = gsl_root_fsolver_x_upper( fs );
2264 status = gsl_root_test_interval( A_lower, A_upper, 1
e-5, 1
e-5 );
2265 }
while (
status == GSL_CONTINUE && ++iter < 1000 );
2266 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 );
2269 A_bound[
i] = gsl_root_fsolver_root( fs );
2276 for (
size_t i = 0;
i < 2; ++
i ) {
2277 const UINT4 B_index_i = B_index +
i;
2281 double B_max = ( A_count == 1 ) ? 1 :
RE_SQRT( 1 - GSL_MIN(
SQR( A_bound[0] ),
SQR( A_bound[1] ) ) );
2284 if ( B_index_i == 0 ) {
2285 B_bound[
i] = -B_max;
2286 }
else if ( B_index_i == B_count ) {
2291 const double A0 = A_bound[0];
2292 const double A1 = A_bound[1];
2293 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 );
2296 double params[] = { target_area, A0, A1 };
2302 double B_lower = -B_max, B_upper = B_max;
2306 int status = 0, iter = 0;
2309 B_lower = gsl_root_fsolver_x_lower( fs );
2310 B_upper = gsl_root_fsolver_x_upper( fs );
2311 status = gsl_root_test_interval( B_lower, B_upper, 1
e-5, 1
e-5 );
2312 }
while (
status == GSL_CONTINUE && ++iter < 1000 );
2313 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 );
2316 B_bound[
i] = gsl_root_fsolver_root( fs );
2325 if ( B_count >= 3 && B_index != ( B_count - 1 ) / 2 ) {
2326 const double Ai =
RE_SQRT( 1 - GSL_MIN(
SQR( B_bound[0] ),
SQR( B_bound[1] ) ) );
2327 if ( A_bound[0] < -Ai ) {
2330 if ( A_bound[1] > Ai ) {
2336 if ( patch_index < hemi_patch_count ) {
2337 A_bound[0] = A_bound[0] - 1;
2338 A_bound[1] = A_bound[1] - 1;
2340 A_bound[0] = -A_bound[0] + 1;
2341 A_bound[1] = -A_bound[1] + 1;
2345 gsl_root_fsolver_free( fs );
2368 const size_t dim UNUSED,
2369 const gsl_matrix *
cache,
2370 const gsl_vector *point UNUSED
2375 const double *sky_offsets = ( (
const double * )
data );
2376 double bound = ( (
const double * )
data )[3];
2380 for (
size_t i = 0;
i < 3; ++
i ) {
2381 bound += sky_offsets[
i] * gsl_matrix_get(
cache, 1,
i );
2390 const SuperskyTransformData *rssky_transf,
2392 const double bound1,
2405 gsl_matrix_const_view sky_offsets = gsl_matrix_const_view_array( &rssky_transf->sky_offsets[0][0], rssky_transf->nsky_offsets, 3 );
2411 double data_lower[4], data_upper[4];
2412 for (
size_t j = 0;
j < 3; ++
j ) {
2413 data_lower[
j] = data_upper[
j] = gsl_matrix_get( &sky_offsets.matrix,
RSSKY_FKDOT_OFFSET( rssky_transf,
s ),
j );
2415 data_lower[3] = GSL_MIN( bound1, bound2 );
2416 data_upper[3] = GSL_MAX( bound1, bound2 );
2428 XLAL_CHECK( !( tiled_sskyA || tiled_sskyB ) || tiled_fkdot,
XLAL_EINVAL,
"Must search over %zu-order spindown if also searching over sky",
s );
2436 const SuperskyTransformData *rssky_transf,
2448 const double bbox_pad = padding ? -1 : 0;
2456 const bool first_call,
2457 const LatticeTiling *
tiling,
2458 const LatticeTilingIterator *itr,
2459 const gsl_vector *point,
2460 const size_t changed_i,
2467 if ( 2 <= changed_i ) {
2504 INT4 left = 0, right = 0;
2526 const SuperskyTransformData *rssky_transf,
2546 *min_phys = &
out->min_phys;
2547 *max_phys = &
out->max_phys;
2554 const bool first_call,
2555 const LatticeTiling *
tiling,
2556 const LatticeTilingIterator *itr,
2557 const gsl_vector *point,
2558 const size_t changed_i,
2565 if ( 2 <= changed_i ) {
2583 gsl_vector_view rssky2_view = gsl_vector_view_array( rssky2_array, cparam->
rssky2_transf->ndim );
2587 for (
size_t i = 0;
i < 2; ++
i ) {
2595 INT4 left = 0, right = 0;
2617 const SuperskyTransformData *rssky_transf,
2618 const SuperskyTransformData *rssky2_transf,
2619 const gsl_vector **min_rssky2,
2620 const gsl_vector **max_rssky2
2634 .rssky2_transf = rssky2_transf,
2642 *min_rssky2 = &
out->min_rssky2_view.vector;
2643 *max_rssky2 = &
out->max_rssky2_view.vector;
2651 const gsl_vector *min_rssky,
2652 const gsl_vector *max_rssky
2665 double A_bound[2] = { gsl_vector_get( min_rssky, 0 ), gsl_vector_get( max_rssky, 0 ) };
2666 double B_bound[2] = { gsl_vector_get( min_rssky, 1 ), gsl_vector_get( max_rssky, 1 ) };
2672 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)
static gsl_matrix * SM_ComputePhaseMetric(const SuperskyMetricType metric_type, const DopplerCoordinateSystem *coords, const size_t spindowns, 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.
#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.
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...
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.
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.
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.
SuperskyMetrics * XLALCopySuperskyMetrics(const SuperskyMetrics *metrics)
Copy 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...
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...
SuperskyMetrics * XLALComputeSuperskyMetrics(const SuperskyMetricType metric_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 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...
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.
@ SUPERSKY_DIRECTED_METRIC_TYPE
Metric for directed searches.
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...
UINT4 dim
number of dimensions covered
meta-info specifying a Doppler-metric
Struct to hold the output of XLALComputeDopplerPhaseMetric(), including meta-info on the number of di...
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, ... ] where fkdot = d^kFreq/dt^k.
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.