25#include <lal/LatticeTiling.h>
26#include <lal/LALStdlib.h>
27#include <lal/Factorial.h>
28#include <lal/DopplerFullScan.h>
29#include <lal/SuperskyMetrics.h>
30#include <lal/LALInitBarycenter.h>
32#include <lal/GSLHelpers.h>
35#define UNUSED __attribute__ ((unused))
40#define MISM_HIST_BINS 20
43#define ABSDIFF(x, y) (int)((x) > (y) ? ((x) - (y)) : ((y) - (x)))
49 4.531107, 1.870257, 1.430467, 1.202537, 1.057047, 0.953084, 0.875050, 0.813050, 0.762368, 0.719968,
50 0.683877, 0.652659, 0.625394, 0.601300, 0.579724, 0.560515, 0.542944, 0.527142, 0.512487, 0.499022
54 1.570963, 1.571131, 1.571074, 1.571102, 1.570808, 1.570789, 1.570617, 1.570716, 1.570671, 1.570867,
55 1.157132, 0.835785, 0.645424, 0.503305, 0.389690, 0.295014, 0.214022, 0.143584, 0.081427, 0.025878
59 0.608404, 1.112392, 1.440652, 1.705502, 1.934785, 2.139464, 2.296868, 2.071379, 1.748278, 1.443955,
60 1.155064, 0.879719, 0.616210, 0.375368, 0.223752, 0.131196, 0.071216, 0.033130, 0.011178, 0.001489
63#define A1s_mism_hist Z1_mism_hist
66 1.210152, 1.210142, 1.209837, 1.209697, 1.209368, 1.209214, 1.209399, 1.209170, 1.208805, 1.208681,
67 1.208631, 1.208914, 1.208775, 1.209021, 1.208797, 0.816672, 0.505394, 0.315665, 0.170942, 0.052727
71 0.327328, 0.598545, 0.774909, 0.917710, 1.040699, 1.150991, 1.250963, 1.344026, 1.431020, 1.512883,
72 1.590473, 1.664510, 1.595423, 1.391209, 1.194340, 1.004085, 0.729054, 0.371869, 0.098727, 0.011236
76 0.088295, 0.264916, 0.441209, 0.617937, 0.794537, 0.971005, 1.147715, 1.324035, 1.500356, 1.677569,
77 1.806866, 1.816272, 1.757854, 1.653638, 1.513900, 1.268203, 0.833153, 0.417934, 0.100320, 0.004287
81 const LatticeTiling UNUSED *
tiling,
82 const UINT8 UNUSED total_ref,
83 const int UNUSED total_tol,
84 const UINT8 UNUSED total_ckpt_0,
85 const UINT8 UNUSED total_ckpt_1,
86 const UINT8 UNUSED total_ckpt_2,
87 const UINT8 UNUSED total_ckpt_3
91#if !defined(HAVE_LIBCFITSIO)
92 printf(
"Skipping serialisation test (CFITSIO library is not available)\n" );
94 printf(
"Performing serialisation test ..." );
98 const UINT8 total_ckpt[4] = {total_ckpt_0, total_ckpt_1, total_ckpt_2, total_ckpt_3};
117 gsl_vector *GAVEC( point,
n );
123 gsl_vector_const_view points_k_view = gsl_matrix_const_column(
points,
k );
124 gsl_vector_sub( point, &points_k_view.vector );
125 double err = gsl_blas_dasum( point ) /
n;
129 if ( k_ckpt <
XLAL_NUM_ELEM( total_ckpt ) &&
k + 1 >= total_ckpt[k_ckpt] ) {
176 const int bound_on_0,
177 const int bound_on_1,
178 const int bound_on_2,
179 const int bound_on_3,
181 const UINT8 total_ref_0,
182 const UINT8 total_ref_1,
183 const UINT8 total_ref_2,
184 const UINT8 total_ref_3
188 const int total_tol = 1;
191 const int bound_on[4] = {bound_on_0, bound_on_1, bound_on_2, bound_on_3};
192 const UINT8 total_ref[4] = {total_ref_0, total_ref_1, total_ref_2, total_ref_3};
199 for (
size_t i = 0;
i <
n; ++
i ) {
205 const double max_mismatch = 0.3;
208 for (
size_t i = 0;
i <
n; ++
i ) {
209 for (
size_t j = 0;
j <
n; ++
j ) {
210 const double ii =
i + 1, jj =
j + 1;
211 gsl_matrix_set(
metric,
i,
j, jj >= ii ? ii / jj : jj / ii );
217 printf(
" Bounds: %i %i %i %i\n", bound_on_0, bound_on_1, bound_on_2, bound_on_3 );
218 printf(
" Lattice type: %i\n", lattice );
222 for (
size_t i = 0;
i <
n; ++
i ) {
223 gsl_vector *GAVEC( point,
n );
232 for (
size_t i = 0, ti = 0;
i <
n; ++
i ) {
235 XLAL_CHECK( !is_tiled_i == !bound_on[
i],
XLAL_EFAILED,
"XLALIsTiledLatticeTilingDimension(tiling, %zu) = %i, should be %i",
i, is_tiled_i, bound_on[
i] );
248 printf(
" Index trie:\n" );
252 for (
size_t i = 0;
i <
n; ++
i ) {
270 printf(
" Check tiling statistics ..." );
271 for (
size_t j = 0;
j <
n; ++
j ) {
278 printf(
" %s ...",
stats->name );
287 gsl_vector_const_view point_view = gsl_matrix_const_column(
points,
k );
288 const gsl_vector *point = &point_view.vector;
289 for (
size_t j = 0;
j <
n; ++
j ) {
290 const double point_j = gsl_vector_get( point,
j );
293 XLAL_CHECK( point_j <= stats->max_value + value_tol,
XLAL_EFAILED,
"point_j = %.10g > %.10g = stats[%zu]->max_value", point_j,
stats->max_value,
j );
298 printf(
" Testing XLALNearestLatticeTiling{Point|Block}() ..." );
299 gsl_vector *GAVEC( nearest,
n );
303 gsl_vector_const_view point_view = gsl_matrix_const_column(
points,
k );
304 const gsl_vector *point = &point_view.vector;
306 for (
size_t j = 0;
j <
n; ++
j ) {
307 const double nearest_j = gsl_vector_get( nearest,
j );
310 XLAL_CHECK( nearest_j <= stats->max_value + value_tol,
XLAL_EFAILED,
"nearest_j = %.10g > %.10g = stats[%zu]->max_value", nearest_j,
stats->max_value,
j );
312 gsl_vector_sub( nearest, point );
313 double err = gsl_blas_dasum( nearest ) /
n;
319 INT4 nearest_left = 0, nearest_right = 0;
322 XLAL_CHECK( nearest_left <= nearest_right,
XLAL_EFAILED,
"invalid [nearest_left, nearest_right] = [%i, %i]\n", nearest_left, nearest_right );
323 UINT4 nearest_len = nearest_right - nearest_left + 1;
324 XLAL_CHECK( nearest_len <= stats->max_points,
XLAL_EFAILED,
"nearest_len = %i > %i = stats[%zu]->max_points\n", nearest_len,
stats->max_points,
i );
329 INT4 nearest_left = 0, nearest_right = 0;
332 XLAL_CHECK( nearest_left <= nearest_right,
XLAL_EFAILED,
"invalid [nearest_left, nearest_right] = [%i, %i]\n", nearest_left, nearest_right );
333 UINT4 nearest_len = nearest_right - nearest_left + 1;
334 XLAL_CHECK( nearest_len <= stats->max_points,
XLAL_EFAILED,
"nearest_len = %i > %i = stats[%zu]->max_points\n", nearest_len,
stats->max_points,
i + 1 );
346 printf(
" Testing XLALSetLatticeTilingAlternatingIterator() ..." );
378 const LatticeTiling *
tiling,
380 const double max_mismatch,
381 const double injs_per_point,
382 const double mism_hist_error_tol,
383 const double mism_out_of_range_tol,
384 const UINT8 total_ref,
406 double mism_hist_total = 0, mism_hist_out_of_range = 0;
409 printf(
"Injections per point: %g\n", injs_per_point );
411 UINT8 total_injs = llround(
total * injs_per_point );
412 const size_t max_injs_per_batch = 100000;
415 gsl_matrix *GAMAT( max_injections,
n, max_injs_per_batch );
416 gsl_matrix *max_nearest = NULL;
417 gsl_matrix *GAMAT( max_temp,
n, max_injs_per_batch );
423 while ( total_injs > 0 ) {
424 const size_t injs_per_batch = GSL_MIN( max_injs_per_batch, total_injs );
425 total_injs -= injs_per_batch;
429 gsl_matrix_view injections_view = gsl_matrix_submatrix( max_injections, 0, 0,
n, injs_per_batch );
430 gsl_matrix *
const injections = &injections_view.matrix;
431 gsl_matrix_view temp_view = gsl_matrix_submatrix( max_temp, 0, 0,
n, injs_per_batch );
432 gsl_matrix *
const temp = &temp_view.matrix;
439 gsl_matrix_view nearest_view = gsl_matrix_submatrix( max_nearest, 0, 0,
n, injs_per_batch );
440 gsl_matrix *
const nearest = &nearest_view.matrix;
444 gsl_blas_dsymm( CblasLeft, CblasUpper, 1.0,
metric, nearest, 0.0,
temp );
445 for (
size_t j = 0;
j <
temp->size2; ++
j ) {
446 gsl_vector_view temp_j = gsl_matrix_column(
temp,
j );
447 gsl_vector_view nearest_j = gsl_matrix_column( nearest,
j );
449 gsl_blas_ddot( &nearest_j.vector, &temp_j.vector, &
mismatch );
454 if ( mismatch < 0.0 || mismatch > 1.0 ) {
455 ++mism_hist_out_of_range;
466 GFMAT( max_injections, max_nearest, max_temp );
476 printf(
"Mismatch histogram: " );
478 printf(
" %0.3f", mism_hist[
i] );
481 printf(
"Reference histogram:" );
483 printf(
" %0.3f", mism_hist_ref[
i] );
488 double mism_hist_error = 0.0;
490 mism_hist_error += fabs( mism_hist[
i] - mism_hist_ref[
i] );
493 printf(
"Mismatch histogram error: %0.3e (tolerance %0.3e)\n", mism_hist_error, mism_hist_error_tol );
494 if ( mism_hist_error >= mism_hist_error_tol ) {
499 const double mism_out_of_range = mism_hist_out_of_range / mism_hist_total;
500 printf(
"Fraction of points out of histogram range: %0.3e (tolerance %0.3e)\n", mism_out_of_range, mism_out_of_range_tol );
501 if ( mism_out_of_range > mism_out_of_range_tol ) {
508 gsl_matrix *GAMAT( nearest,
n, 10 );
533 const double freqband,
534 const double f1dotband,
535 const double f2dotband,
536 const UINT8 total_ref,
541 const int total_tol = 1;
548 const double fndot[3] = {100, 0, 0};
549 const double fndotband[3] = {freqband, f1dotband, f2dotband};
550 for (
size_t i = 0;
i < 3; ++
i ) {
551 printf(
"Bounds: f%zudot=%0.3g, f%zudotband=%0.3g\n",
i, fndot[
i],
i, fndotband[
i] );
556 const double max_mismatch = 0.3;
557 gsl_matrix *GAMAT(
metric, 3, 3 );
558 for (
size_t i = 0;
i <
metric->size1; ++
i ) {
559 for (
size_t j =
i;
j <
metric->size2; ++
j ) {
560 const double Tspan = 432000;
561 const double metric_i_j_num = 4.0 *
LAL_PI *
LAL_PI * pow(
Tspan,
i +
j + 2 ) * (
i + 1 ) * (
j + 1 );
562 const double metric_i_j_denom =
LAL_FACT[
i + 1] *
LAL_FACT[
j + 1] * (
i + 2 ) * (
j + 2 ) * (
i +
j + 3 );
563 gsl_matrix_set(
metric,
i,
j, metric_i_j_num / metric_i_j_denom );
567 printf(
"Lattice type: %i\n", lattice );
589 const double freqband,
590 const UINT8 total_ref,
595 const int total_tol = 1;
602 printf(
"Bounds: freq=%0.3g, freqband=%0.3g\n",
freq, freqband );
608 const double max_mismatch = 0.3;
609 gsl_matrix *GAMAT(
metric, 3, 3 );
610 for (
size_t i = 0;
i <
metric->size1; ++
i ) {
611 for (
size_t j =
i;
j <
metric->size2; ++
j ) {
612 const double Tspan = 1036800;
613 const double metric_i_j_num = 4.0 *
LAL_PI *
LAL_PI * pow(
Tspan,
i +
j + 2 ) * (
i + 1 ) * (
j + 1 );
614 const double metric_i_j_denom =
LAL_FACT[
i + 1] *
LAL_FACT[
j + 1] * (
i + 2 ) * (
j + 2 ) * (
i +
j + 3 );
615 gsl_matrix_set(
metric,
i,
j, metric_i_j_num / metric_i_j_denom );
619 printf(
"Lattice type: %i\n", lattice );
639 const UINT8 coh_total_ref_0,
640 const UINT8 coh_total_ref_1,
641 const UINT8 coh_total_ref_2,
642 const UINT8 semi_total_ref
646 const UINT8 coh_total_ref[3] = {coh_total_ref_0, coh_total_ref_1, coh_total_ref_2};
648 printf(
"Performing super-sky metric tests ...\n\n" );
651 const double Tspan = 90000;
686 TEST_PKG_DATA_DIR
"sun00-40-DE405.dat.gz" );
694 const double coh_max_mismatch = 1.4, semi_max_mismatch = 4.9;
725 const size_t ifreq = 3;
729 const double tol = 1
e-8;
730 XLAL_CHECK( fabs( coh_dfreq - semi_dfreq ) <
tol * semi_dfreq,
XLAL_EFAILED,
"semi_dfreq=%0.15e, coh_dfreq[%zu]=%0.15e, |coh_dfreq - semi_dfreq| >= %0.5g * semi_dfreq", semi_dfreq,
n, coh_dfreq,
tol );
741 printf(
"Coherent #%zu bound #%zu: name=%6s, points=[%4u,%4u]\n",
n,
i,
stats->name,
stats->min_points,
stats->max_points );
750 printf(
"Semicoherent bound #%zu: name=%6s, points=[%4u,%4u]\n",
i,
stats->name,
stats->min_points,
stats->max_points );
756 printf(
"Coherent #%zu mismatch tests:\n",
n );
760 printf(
"Semicoherent mismatch tests:\n" );
774 printf(
"Finished super-sky metric tests\n\n" );
783 const gsl_matrix *
cache UNUSED,
784 const gsl_vector *point
789 const double *c_m = (
const double * )
data;
790 const double c = c_m[0];
791 const double m = c_m[1];
794 const double x = gsl_vector_get( point, dim - 1 );
812 const double c_m_lower[] = { -y_range, 5.0 };
813 const double c_m_upper[] = { +y_range, 5.0 };
819 const double max_mismatch = 0.3;
821 gsl_matrix *GAMAT(
metric, 2, 2 );
822 for (
size_t i = 0;
i < 2; ++
i ) {
823 for (
size_t j = 0;
j < 2; ++
j ) {
824 const double ii =
i + 1, jj =
j + 1;
825 gsl_matrix_set(
metric,
i,
j, jj >= ii ? ii / jj : jj / ii );
837 gsl_vector *GAVEC( point, 2 );
839 const double x = gsl_vector_get( point, 0 );
840 const double y = gsl_vector_get( point, 1 );
842 const double y_min = 5.0 *
x - y_range;
843 const double y_max = 5.0 *
x + y_range;
844 XLAL_CHECK( y_min <=
y &&
y <= y_max,
XLAL_EFAILED,
"y=%0.5g is not within strict boundaries [%0.5g, %0.5g]",
y, y_min, y_max );
861 setvbuf( stdout, NULL, _IONBF, 0 );
862 setvbuf( stderr, NULL, _IONBF, 0 );
865 XLAL_CHECK_MAIN(
BasicTest( 1, 0, 0, 0, 0,
TILING_LATTICE_CUBIC, 1, 1, 1, 1 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
866 XLAL_CHECK_MAIN(
BasicTest( 1, 1, 1, 1, 1,
TILING_LATTICE_ANSTAR, 93, 0, 0, 0 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
867 XLAL_CHECK_MAIN(
BasicTest( 1, 1, 1, 1, 1,
TILING_LATTICE_CUBIC, 93, 0, 0, 0 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
868 XLAL_CHECK_MAIN(
BasicTest( 2, 0, 0, 0, 0,
TILING_LATTICE_ANSTAR, 1, 1, 1, 1 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
869 XLAL_CHECK_MAIN(
BasicTest( 2, 1, 1, 1, 1,
TILING_LATTICE_ANSTAR, 12, 144, 0, 0 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
870 XLAL_CHECK_MAIN(
BasicTest( 2, 1, 1, 1, 1,
TILING_LATTICE_CUBIC, 13, 190, 0, 0 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
871 XLAL_CHECK_MAIN(
BasicTest( 3, 0, 0, 0, 0,
TILING_LATTICE_CUBIC, 1, 1, 1, 1 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
872 XLAL_CHECK_MAIN(
BasicTest( 3, 1, 1, 1, 1,
TILING_LATTICE_ANSTAR, 8, 46, 332, 0 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
873 XLAL_CHECK_MAIN(
BasicTest( 3, 1, 1, 1, 1,
TILING_LATTICE_CUBIC, 8, 60, 583, 0 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
874 XLAL_CHECK_MAIN(
BasicTest( 4, 0, 0, 0, 0,
TILING_LATTICE_ANSTAR, 1, 1, 1, 1 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
875 XLAL_CHECK_MAIN(
BasicTest( 4, 0, 0, 0, 1,
TILING_LATTICE_ANSTAR, 1, 1, 1, 4 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
876 XLAL_CHECK_MAIN(
BasicTest( 4, 0, 0, 1, 0,
TILING_LATTICE_ANSTAR, 1, 1, 4, 4 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
877 XLAL_CHECK_MAIN(
BasicTest( 4, 0, 0, 1, 1,
TILING_LATTICE_ANSTAR, 1, 1, 4, 20 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
878 XLAL_CHECK_MAIN(
BasicTest( 4, 0, 1, 0, 0,
TILING_LATTICE_ANSTAR, 1, 4, 4, 4 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
879 XLAL_CHECK_MAIN(
BasicTest( 4, 0, 1, 0, 1,
TILING_LATTICE_ANSTAR, 1, 5, 5, 25 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
880 XLAL_CHECK_MAIN(
BasicTest( 4, 0, 1, 1, 0,
TILING_LATTICE_ANSTAR, 1, 5, 24, 24 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
881 XLAL_CHECK_MAIN(
BasicTest( 4, 0, 1, 1, 1,
TILING_LATTICE_ANSTAR, 1, 5, 20, 115 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
882 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 0, 0, 0,
TILING_LATTICE_ANSTAR, 4, 4, 4, 4 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
883 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 0, 0, 1,
TILING_LATTICE_ANSTAR, 5, 5, 5, 23 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
884 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 0, 1, 0,
TILING_LATTICE_ANSTAR, 5, 5, 23, 23 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
885 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 0, 1, 1,
TILING_LATTICE_ANSTAR, 6, 6, 24, 139 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
886 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 1, 0, 0,
TILING_LATTICE_ANSTAR, 5, 25, 25, 25 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
887 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 1, 0, 1,
TILING_LATTICE_ANSTAR, 6, 30, 30, 162 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
888 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 1, 1, 0,
TILING_LATTICE_ANSTAR, 6, 27, 151, 151 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
889 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 1, 1, 1,
TILING_LATTICE_ANSTAR, 6, 30, 145, 897 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
890 XLAL_CHECK_MAIN(
BasicTest( 4, 1, 1, 1, 1,
TILING_LATTICE_CUBIC, 7, 46, 287, 2543 ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
909 for (
double y_range = 0.5; y_range < 2.005; y_range += 0.1 ) {
910 printf(
"Strict boundary tests, y_range=%g\n", y_range );
int XLALSetLatticeTilingF2DotBrakingBound(LatticeTiling *tiling, const size_t freq_dimension, const size_t f1dot_dimension, const size_t f2dot_dimension, const double min_braking, const double max_braking)
Set a second spindown bound derived from braking indices.
int XLALSetLatticeTilingF1DotAgeBrakingBound(LatticeTiling *tiling, const size_t freq_dimension, const size_t f1dot_dimension, const double age, const double min_braking, const double max_braking)
Set a first spindown bound derived from spindown age and braking indices.
FITSFile * XLALFITSFileOpenWrite(const CHAR UNUSED *file_name)
FITSFile * XLALFITSFileOpenRead(const CHAR UNUSED *file_name)
void XLALFITSFileClose(FITSFile UNUSED *file)
void LALCheckMemoryLeaks(void)
static int MismatchSquareTest(const TilingLattice lattice, const double freqband, const double f1dotband, const double f2dotband, const UINT8 total_ref, const double mism_hist_ref[MISM_HIST_BINS])
static int MismatchTest(const LatticeTiling *tiling, const gsl_matrix *metric, const double max_mismatch, const double injs_per_point, const double mism_hist_error_tol, const double mism_out_of_range_tol, const UINT8 total_ref, const int total_tol, const double mism_hist_ref[MISM_HIST_BINS])
const double Z2_mism_hist[MISM_HIST_BINS]
const double Z3_mism_hist[MISM_HIST_BINS]
static double LinearBound(const void *data, const size_t dim, const gsl_matrix *cache UNUSED, const gsl_vector *point)
static int SerialisationTest(const LatticeTiling UNUSED *tiling, const UINT8 UNUSED total_ref, const int UNUSED total_tol, const UINT8 UNUSED total_ckpt_0, const UINT8 UNUSED total_ckpt_1, const UINT8 UNUSED total_ckpt_2, const UINT8 UNUSED total_ckpt_3)
const double A2s_mism_hist[MISM_HIST_BINS]
const double A4s_mism_hist[MISM_HIST_BINS]
const double Z1_mism_hist[MISM_HIST_BINS]
static int SuperskyTests(const UINT8 coh_total_ref_0, const UINT8 coh_total_ref_1, const UINT8 coh_total_ref_2, const UINT8 semi_total_ref)
static int MismatchAgeBrakeTest(const TilingLattice lattice, const double freq, const double freqband, const UINT8 total_ref, const double mism_hist_ref[MISM_HIST_BINS])
static int StrictBoundaryTest(const double y_range)
const double A3s_mism_hist[MISM_HIST_BINS]
static int BasicTest(const size_t n, const int bound_on_0, const int bound_on_1, const int bound_on_2, const int bound_on_3, const TilingLattice lattice, const UINT8 total_ref_0, const UINT8 total_ref_1, const UINT8 total_ref_2, const UINT8 total_ref_3)
const LALDetector lalCachedDetectors[LAL_NUM_DETECTORS]
struct tagFITSFile FITSFile
Representation of a FITS file.
static const UINT8 LAL_FACT[]
EphemerisData * XLALInitBarycenter(const CHAR *earthEphemerisFile, const CHAR *sunEphemerisFile)
XLAL interface to reading ephemeris files 'earth' and 'sun', and return ephemeris-data in old backwar...
void XLALDestroyEphemerisData(EphemerisData *edat)
Destructor for EphemerisData struct, NULL robust.
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 XLALNearestLatticeTilingPoint(const LatticeTilingLocator *loc, const gsl_vector *point, gsl_vector *nearest_point, UINT8Vector *nearest_index)
Locate the nearest point in a lattice tiling to a given point.
UINT8 XLALTotalLatticeTilingPoints(const LatticeTilingIterator *itr)
Return the total number of points covered by the lattice tiling iterator.
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...
int XLALSaveLatticeTilingIterator(const LatticeTilingIterator *itr, FITSFile *file, const char *name)
Save the state of a lattice tiling iterator to a FITS file.
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 XLALGetLatticeTilingBound(const LatticeTiling *tiling, const size_t dim, const gsl_vector *point, const bool padding, double *lower, double *upper)
Get a parameter-space bound on a dimension of the lattice tiling.
int XLALLatticeTilingDimensionByName(const LatticeTiling *tiling, const char *bound_name)
Return the index of the lattice tiling dimension which has the given name.
int XLALSetTilingLatticeAndMetric(LatticeTiling *tiling, const TilingLattice lattice, const gsl_matrix *metric, const double max_mismatch)
Set the tiling lattice, parameter-space metric, and maximum prescribed mismatch.
int XLALNearestLatticeTilingBlock(const LatticeTilingLocator *loc, const gsl_vector *point, const size_t dim, gsl_vector *nearest_point, UINT8 *nearest_index, INT4 *nearest_left, INT4 *nearest_right)
Locate the nearest block in a lattice tiling to a given point.
void XLALDestroyLatticeTilingLocator(LatticeTilingLocator *loc)
Destroy a lattice tiling locator.
UINT8 XLALCurrentLatticeTilingIndex(const LatticeTilingIterator *itr)
Return the index of the current point in the lattice tiling iterator.
size_t XLALTiledLatticeTilingDimensions(const LatticeTiling *tiling)
Return the number of tiled dimensions of the lattice tiling.
size_t XLALLatticeTilingTiledDimension(const LatticeTiling *tiling, const size_t tiled_dim)
Return the dimension of the tiled lattice tiling dimension indexed by 'tiled_dim'.
int XLALRestoreLatticeTilingIterator(LatticeTilingIterator *itr, FITSFile *file, const char *name)
Restore the state of a lattice tiling iterator from a FITS file.
LatticeTilingIterator * XLALCreateLatticeTilingIterator(const LatticeTiling *tiling, const size_t itr_ndim)
Create a new lattice tiling iterator.
void XLALDestroyLatticeTilingIterator(LatticeTilingIterator *itr)
Destroy a lattice tiling iterator.
void XLALDestroyLatticeTiling(LatticeTiling *tiling)
Destroy a lattice tiling.
int XLALNextLatticeTilingPoint(LatticeTilingIterator *itr, gsl_vector *point)
Advance lattice tiling iterator, and optionally return the next point in point.
int XLALSetLatticeTilingAlternatingIterator(LatticeTilingIterator *itr, const bool alternating)
Set whether the lattice tiling iterator should alternate its iteration direction (i....
int XLALNearestLatticeTilingPoints(const LatticeTilingLocator *loc, const gsl_matrix *points, gsl_matrix **nearest_points, UINT8VectorSequence **nearest_indexes)
Locate the nearest points in a lattice tiling to a given set of points.
LatticeTiling * XLALCreateLatticeTiling(const size_t ndim)
Create a new lattice tiling.
const LatticeTilingStats * XLALLatticeTilingStatistics(const LatticeTiling *tiling, const size_t dim)
Return statistics related to the number/value of lattice tiling points in a dimension.
int XLALPrintLatticeTilingIndexTrie(const LatticeTilingLocator *loc, FILE *file)
Print the internal index trie of a lattice tiling locator to the given file pointer.
LatticeTilingLocator * XLALCreateLatticeTilingLocator(const LatticeTiling *tiling)
Create a new lattice tiling locator.
int XLALResetLatticeTilingIterator(LatticeTilingIterator *itr)
Reset an iterator to the beginning of a lattice tiling.
TilingLattice
Type of lattice to generate tiling with.
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.
int XLALNextLatticeTilingPoints(LatticeTilingIterator *itr, gsl_matrix **points)
Advance lattice tiling iterator, and optionally return the next set of points in points.
int XLALRandomLatticeTilingPoints(const LatticeTiling *tiling, const double scale, RandomParams *rng, gsl_matrix *random_points)
Generate random points within the parameter space of the lattice tiling.
@ TILING_LATTICE_ANSTAR
An-star ( ) lattice.
@ TILING_LATTICE_CUBIC
Cubic ( ) lattice.
RandomParams * XLALCreateRandomParams(INT4 seed)
void XLALDestroyRandomParams(RandomParams *params)
int XLALSegListInit(LALSegList *seglist)
int XLALSegListClear(LALSegList *seglist)
int XLALSegListAppend(LALSegList *seglist, const LALSeg *seg)
int XLALSegSet(LALSeg *seg, const LIGOTimeGPS *start, const LIGOTimeGPS *end, const INT4 id)
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 * 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 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...
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...
@ SUPERSKY_METRIC_TYPE
Metric for all-sky searches.
@ DETMOTION_SPIN
Full spin motion.
@ DETMOTION_PTOLEORBIT
Ptolemaic (circular) orbital motion.
void XLALDestroyUINT8Vector(UINT8Vector *vector)
UINT8Vector * XLALCreateUINT8Vector(UINT4 length)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_MAIN(assertion,...)
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
LALDetector detectors[LAL_NUM_DETECTORS]
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
Statistics related to the number/value of lattice tiling points in a dimension.
array of detectors definitions 'LALDetector'
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.