29#include <lal/LogPrintf.h>
30#include <lal/UserInput.h>
32int main(
int argc,
char *argv[] )
43 CHAR *setup_file, *result_file_1, *result_file_2;
44 REAL8 unmatched_item_tol, param_tol_mism, result_tol_L1, result_tol_L2, result_tol_angle, result_tol_at_max;
45 UINT4 round_param_to_dp, round_param_to_sf, toplist_limit;
47 .unmatched_item_tol = 0,
48 .param_tol_mism = 1
e-3,
49 .result_tol_L1 = 5.5e-2,
50 .result_tol_L2 = 4.5e-2,
51 .result_tol_angle = 0.04,
52 .result_tol_at_max = 5
e-2,
61 setup_file,
STRING,
'S', REQUIRED,
62 "Setup file generated by lalpulsar_WeaveSetup; the segment list, parameter-space metrics, and other required data. "
65 result_file_1,
STRING,
'1', REQUIRED,
66 "First result file produced by lalpulsar_Weave for comparison. "
69 result_file_2,
STRING,
'2', REQUIRED,
70 "Second result file produced by lalpulsar_Weave for comparison. "
77 sort_by_semi_phys,
BOOLEAN,
'p', OPTIONAL,
78 "Sort toplist items by semicoherent physical coordinates, instead of serial number. "
81 round_param_to_dp,
UINT4,
'f', OPTIONAL,
82 "Round parameter-space points to the given number of decimal places (must be >0, or zero to disable). "
85 round_param_to_sf,
UINT4,
'e', OPTIONAL,
86 "Round parameter-space points to the given number of significant figures (must be >0, or zero to disable). "
93 unmatched_item_tol,
REAL8,
'u', OPTIONAL,
94 "When comparing toplists, allow this fraction of items to be umatched to an item in the other toplist (must in in range [0, 1]). "
97 param_tol_mism,
REAL8,
'm', OPTIONAL,
98 "Allowed tolerance on mismatch between parameter-space points (must be >0, or zero to disable comparison). "
101 result_tol_L1,
REAL8,
'r', OPTIONAL,
102 "Allowed tolerance on relative error between mismatch between result vectors using L1 (sum of absolutes) norm. "
103 "Must be within range [0,2]. "
106 result_tol_L2,
REAL8,
's', OPTIONAL,
107 "Allowed tolerance on relative error between mismatch between result vectors using L2 (root of sum of squares) norm. "
108 "Must be within range [0,2]. "
111 result_tol_angle,
REAL8,
'a', OPTIONAL,
112 "Allowed tolerance on angle between result vectors, in radians. "
113 "Must be within range [0,PI]. "
116 result_tol_at_max,
REAL8,
'x', OPTIONAL,
117 "Allowed tolerance on relative errors at maximum component of each result vector. "
118 "Must be within range [0,2]. "
121 toplist_limit,
UINT4,
'n', OPTIONAL,
122 "Maximum number of candidates to compare in an output toplist; if 0, all candidates are compared. "
143 0 <= uvar->unmatched_item_tol && uvar->unmatched_item_tol <= 1,
144 UVAR_STR( unmatched_item_tol )
" must be within range [0,1]" );
146 0 <= uvar->param_tol_mism,
147 UVAR_STR( param_tol_mism )
" must be >=0" );
149 0 <= uvar->result_tol_L1 && uvar->result_tol_L1 <= 2,
150 UVAR_STR( result_tol_L1 )
" must be within range [0,2]" );
152 0 <= uvar->result_tol_L2 && uvar->result_tol_L2 <= 2,
153 UVAR_STR( result_tol_L2 )
" must be within range [0,2]" );
155 0 <= uvar->result_tol_angle && uvar->result_tol_angle <=
LAL_PI,
156 UVAR_STR( result_tol_angle )
" must be within range [0,PI]" );
158 0 <= uvar->result_tol_at_max && uvar->result_tol_at_max <= 2,
159 UVAR_STR( result_tol_at_max )
" must be within range [0,2]" );
189 WeaveOutputResults *out_1 = NULL, *out_2 = NULL;
193 LogPrintf(
LOG_NORMAL,
"Opening result file '%s' for reading ...\n", uvar->result_file_1 );
207 LogPrintf(
LOG_NORMAL,
"Opening result file '%s' for reading ...\n", uvar->result_file_2 );
224 .relErr_L2 = uvar->result_tol_L2,
225 .angleV = uvar->result_tol_angle,
226 .relErr_atMaxAbsx = uvar->result_tol_at_max,
227 .relErr_atMaxAbsy = uvar->result_tol_at_max,
232 LogPrintf(
LOG_NORMAL,
"Comparing result files '%s' and '%s ...\n", uvar->result_file_1, uvar->result_file_2 );
234 &setup, uvar->sort_by_semi_phys,
235 uvar->round_param_to_dp, uvar->round_param_to_sf, uvar->unmatched_item_tol, uvar->param_tol_mism, &result_tol, uvar->toplist_limit,
258 return equal ? 0 : 1;
FITSFile * XLALFITSFileOpenRead(const CHAR UNUSED *file_name)
void XLALFITSFileClose(FITSFile UNUSED *file)
void LALCheckMemoryLeaks(void)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
int XLALWeaveOutputResultsCompare(BOOLEAN *equal, const WeaveSetupData *setup, const BOOLEAN sort_by_semi_phys, const UINT4 round_param_to_dp, const UINT4 round_param_to_sf, const REAL8 unmatched_item_tol, const REAL8 param_tol_mism, const VectorComparison *result_tol, const UINT4 toplist_compare_limit, const WeaveOutputResults *out_1, const WeaveOutputResults *out_2)
Compare two output results and return whether they are equal.
int XLALWeaveOutputResultsReadAppend(FITSFile *file, WeaveOutputResults **out, UINT4 toplist_limit)
Read results from a FITS file and append to new/existing output results.
void XLALWeaveOutputResultsDestroy(WeaveOutputResults *out)
Free output results.
Module which handles the output results.
void XLALWeaveSetupDataClear(WeaveSetupData *setup)
Free contents of setup data.
int XLALWeaveSetupDataRead(FITSFile *file, WeaveSetupData *setup)
Read setup data from a FITS file.
Module which handles the setup data.
int main(int argc, char *argv[])
struct tagFITSFile FITSFile
Representation of a FITS file.
#define XLAL_INIT_DECL(var,...)
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
#define XLAL_CHECK_FAIL(assertion,...)
Struct holding the results of comparing two floating-point vectors (real-valued or complex),...
REAL4 relErr_L1
relative error between vectors using L1 norm