29#include <lal/UserInputPrint.h>
92 return semi_res->sum2F->data;
96 return item->stage[0].sum2F;
100 item->stage[0].sum2F = value;
111 return semi_res->mean2F->data;
115 return item->stage[0].mean2F;
119 item->stage[0].mean2F = value;
130 return semi_res->log10BSGL->data;
134 return item->stage[0].log10BSGL;
138 item->stage[0].log10BSGL = value;
149 return semi_res->log10BSGLtL->data;
153 return item->stage[0].log10BSGLtL;
157 item->stage[0].log10BSGLtL = value;
168 return semi_res->log10BtSGLtL->data;
172 return item->stage[0].log10BtSGLtL;
176 item->stage[0].log10BtSGLtL = value;
187 WeaveStatisticsParams *statistics_params,
188 const UINT4 toplist_limit,
201 out->ref_time = *ref_time;
202 out->nspins = nspins;
203 out->toplist_limit = toplist_limit;
204 out->statistics_params = statistics_params;
258 memset(
out->mean2F_hgrm_bins->data, 0,
sizeof(
out->mean2F_hgrm_bins->data[0] ) *
out->mean2F_hgrm_bins->length );
269 WeaveOutputResults *out
274 for (
size_t i = 0;
i <
out->ntoplists; ++
i ) {
288 WeaveOutputResults *out,
289 const WeaveSemiResults *semi_res,
290 const UINT4 semi_nfreqs
299 for (
size_t i = 0;
i <
out->ntoplists; ++
i ) {
304 if (
out->mean2F_hgrm_bins != NULL ) {
310 if (
out->mean2F_hgrm_tmp_REAL4 == NULL ||
out->mean2F_hgrm_tmp_REAL4->length < semi_res->mean2F->length ) {
322 for (
size_t j = 0;
j < semi_res->mean2F->length; ++
j ) {
323 INT4 bin =
out->mean2F_hgrm_tmp_INT4->data[
j];
324 const INT4 bin_max =
out->mean2F_hgrm_bins->length;
326 ++
out->mean2F_hgrm_underflow;
327 }
else if ( bin >= bin_max ) {
328 ++
out->mean2F_hgrm_overflow;
330 ++
out->mean2F_hgrm_bins->data[bin];
344 WeaveOutputResults *out
351 for (
size_t i = 0;
i <
out->ntoplists; ++
i ) {
364 const WeaveOutputResults *out
394 WeaveStatisticType extras = (
out->statistics_params->statistics_to_output[0] & ~out->statistics_params->toplist_statistics );
418 for (
size_t i = 0;
i <
out->ntoplists; ++
i ) {
423 if (
out->mean2F_hgrm_bins != NULL ) {
434 if (
out->mean2F_hgrm_underflow > 0 ) {
435 bin.
lower = GSL_NEGINF;
437 bin.
count =
out->mean2F_hgrm_underflow;
440 for (
size_t j = 0;
j <
out->mean2F_hgrm_bins->length; ++
j ) {
441 const UINT4 bin_count =
out->mean2F_hgrm_bins->data[
j];
442 if ( bin_count > 0 ) {
445 bin.
count = bin_count;
449 if (
out->mean2F_hgrm_underflow > 0 ) {
451 bin.
upper = GSL_POSINF;
452 bin.
count =
out->mean2F_hgrm_underflow;
467 WeaveOutputResults **out,
485 WeaveStatisticsParams *statistics_params =
XLALCalloc( 1,
sizeof( *statistics_params ) );
495 char *toplist_stats_names = NULL;
496 int toplist_stats = 0;
502 char *extras_names = NULL;
509 int recalc_stats = 0;
513 char *recalc_names = NULL;
532 if ( *
out == NULL ) {
544 XLAL_CHECK( (
size_t ) nspins == ( *out )->nspins,
XLAL_EIO,
"Inconsistent number of spindowns: %i != %zu", nspins, ( *out )->nspins );
547 if ( statistics_params->detectors != NULL ) {
548 XLAL_CHECK( statistics_params->detectors->length == ( *out )->statistics_params->detectors->length,
XLAL_EIO,
"Inconsistent number of detectors: %u != %u", statistics_params->detectors->length, ( *out )->statistics_params->detectors->length );
549 for (
size_t i = 0;
i < statistics_params->detectors->length; ++
i ) {
550 XLAL_CHECK( strcmp( statistics_params->detectors->data[
i], ( *out )->statistics_params->detectors->data[
i] ) == 0,
XLAL_EIO,
"Inconsistent detectors: %s != %s", statistics_params->detectors->data[
i], ( *out )->statistics_params->detectors->data[
i] );
555 XLAL_CHECK( statistics_params->nsegments == ( *out )->statistics_params->nsegments,
XLAL_EIO,
"Inconsistent output per segment?: %i != %u", statistics_params->nsegments, ( *out )->statistics_params->nsegments );
558 if ( statistics_params->toplist_statistics != ( *out )->statistics_params->toplist_statistics ) {
559 char *toplists1, *toplists2;
564 XLALPrintError(
"Inconsistent set of toplist statistics: %s != %s\n", toplists1, toplists2 );
570 for (
UINT4 istage = 0; istage < 2; ++ istage ) {
571 if ( statistics_params->statistics_to_output[istage] != ( *out )->statistics_params->statistics_to_output[istage] ) {
572 char *output1, *output2;
577 XLALPrintError(
"Inconsistent set of stage-%d output statistics: {%s} != {%s}\n", istage, output1, output2 );
587 XLAL_CHECK( !mean2F_hgrm == !( ( *out )->mean2F_hgrm_bins != NULL ),
XLAL_EIO,
"Inconsistent mean 2F histogram? %i != %i", mean2F_hgrm, ( *out )->mean2F_hgrm_bins != NULL );
592 for (
size_t i = 0;
i < ( *out )->ntoplists; ++
i ) {
597 if ( ( *out )->mean2F_hgrm_bins != NULL ) {
610 while ( nrows > 0 ) {
612 if ( bin.
lower < 0 ) {
613 ( *out )->mean2F_hgrm_underflow += bin.
count;
614 }
else if ( bin.
upper >= bin_upper_max ) {
615 ( *out )->mean2F_hgrm_overflow += bin.
count;
618 ( *out )->mean2F_hgrm_bins->data[
j] += bin.
count;
633 const WeaveSetupData *setup,
634 const BOOLEAN sort_by_semi_phys,
635 const UINT4 round_param_to_dp,
636 const UINT4 round_param_to_sf,
637 const REAL8 unmatched_item_tol,
638 const REAL8 param_tol_mism,
640 const UINT4 toplist_compare_limit,
641 const WeaveOutputResults *out_1,
642 const WeaveOutputResults *out_2
659 if (
XLALGPSCmp( &out_1->ref_time, &out_2->ref_time ) != 0 ) {
666 if ( out_1->nspins != out_2->nspins ) {
668 XLALPrintInfo(
"%s: unequal number of spindowns: %zu != %zu\n",
__func__, out_1->nspins, out_2->nspins );
674 const BOOLEAN have_det_1 = ( out_1->statistics_params->detectors != NULL ), have_det_2 = ( out_2->statistics_params->detectors != NULL );
675 if ( have_det_1 != have_det_2 ) {
677 XLALPrintInfo(
"%s: unequal presence of detector lists: %i != %i\n",
__func__, have_det_1, have_det_2 );
681 if ( out_1->statistics_params->detectors->length != out_2->statistics_params->detectors->length ) {
683 XLALPrintInfo(
"%s: unequal number of detectors: %u != %u\n",
__func__, out_1->statistics_params->detectors->length, out_2->statistics_params->detectors->length );
686 for (
size_t i = 0;
i < out_1->statistics_params->detectors->length; ++
i ) {
687 if ( strcmp( out_1->statistics_params->detectors->data[
i], out_2->statistics_params->detectors->data[
i] ) != 0 ) {
689 XLALPrintInfo(
"%s: unequal detectors: %s != %s\n",
__func__, out_1->statistics_params->detectors->data[
i], out_2->statistics_params->detectors->data[
i] );
697 if ( out_1->statistics_params->nsegments != out_2->statistics_params->nsegments ) {
699 XLALPrintInfo(
"%s: unequal number of segments: %u != %u\n",
__func__, out_1->statistics_params->nsegments, out_2->statistics_params->nsegments );
704 if ( out_1->statistics_params->toplist_statistics != out_2->statistics_params->toplist_statistics ) {
706 char *toplists1, *toplists2;
711 XLALPrintError(
"%s: Inconsistent set of toplist statistics: {%s} != {%s}\n",
__func__, toplists1, toplists2 );
718 for (
UINT4 istage = 0; istage < 2; ++ istage ) {
719 if ( out_1->statistics_params->statistics_to_output[istage] != out_2->statistics_params->statistics_to_output[istage] ) {
721 char *outputs1, *outputs2;
726 XLALPrintError(
"%s: Inconsistent set of stage-%d ouput statistics: {%s} != {%s}\n",
__func__, istage, outputs1, outputs2 );
734 for (
size_t i = 0;
i < out_1->ntoplists; ++
i ) {
736 setup, sort_by_semi_phys,
737 round_param_to_dp, round_param_to_sf, unmatched_item_tol, param_tol_mism, result_tol, toplist_compare_limit,
738 out_1->toplists[
i], out_2->toplists[
i]
#define __func__
log an I/O error, i.e.
int XLALFITSHeaderWriteUINT4(FITSFile UNUSED *file, const CHAR UNUSED *key, const UINT4 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSTableWriteRow(FITSFile UNUSED *file, const void UNUSED *record)
int XLALFITSHeaderWriteStringVector(FITSFile UNUSED *file, const CHAR UNUSED *key, const LALStringVector UNUSED *values, const CHAR UNUSED *comment)
int XLALFITSHeaderWriteGPSTime(FITSFile UNUSED *file, const CHAR UNUSED *key, const LIGOTimeGPS UNUSED *value, const CHAR UNUSED *comment)
int XLALFITSHeaderWriteBOOLEAN(FITSFile UNUSED *file, const CHAR UNUSED *key, const BOOLEAN UNUSED value, const CHAR UNUSED *comment)
int XLALFITSTableReadRow(FITSFile UNUSED *file, void UNUSED *record, UINT8 UNUSED *rem_nrows)
int XLALFITSHeaderQueryKeyExists(FITSFile UNUSED *file, const CHAR UNUSED *key, BOOLEAN UNUSED *exists)
int XLALFITSHeaderReadBOOLEAN(FITSFile UNUSED *file, const CHAR UNUSED *key, BOOLEAN UNUSED *value)
int XLALFITSHeaderReadGPSTime(FITSFile UNUSED *file, const CHAR UNUSED *key, LIGOTimeGPS UNUSED *value)
int XLALFITSTableOpenWrite(FITSFile UNUSED *file, const CHAR UNUSED *name, const CHAR UNUSED *comment)
int XLALFITSHeaderReadStringVector(FITSFile UNUSED *file, const CHAR UNUSED *key, LALStringVector UNUSED **values)
int XLALFITSHeaderReadUINT4(FITSFile UNUSED *file, const CHAR UNUSED *key, UINT4 UNUSED *value)
int XLALFITSTableOpenRead(FITSFile UNUSED *file, const CHAR UNUSED *name, UINT8 UNUSED *nrows)
int XLALFITSHeaderReadString(FITSFile UNUSED *file, const CHAR UNUSED *key, CHAR UNUSED **value)
int XLALFITSHeaderWriteString(FITSFile UNUSED *file, const CHAR UNUSED *key, const CHAR UNUSED *value, const CHAR UNUSED *comment)
int XLALWeaveOutputResultsAdd(WeaveOutputResults *out, const WeaveSemiResults *semi_res, const UINT4 semi_nfreqs)
Add semicoherent results to output.
static const REAL4 * toplist_results_log10BtSGLtL(const WeaveSemiResults *semi_res)
static REAL4 toplist_item_get_log10BSGLtL(const WeaveResultsToplistItem *item)
static void toplist_item_set_mean2F(WeaveResultsToplistItem *item, const REAL4 value)
static void toplist_item_set_sum2F(WeaveResultsToplistItem *item, const REAL4 value)
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.
static void toplist_item_set_log10BtSGLtL(WeaveResultsToplistItem *item, const REAL4 value)
int XLALWeaveOutputResultsWrite(FITSFile *file, const WeaveOutputResults *out)
Write output results to a FITS file.
static const REAL4 * toplist_results_sum2F(const WeaveSemiResults *semi_res)
static const REAL4 * toplist_results_log10BSGLtL(const WeaveSemiResults *semi_res)
static REAL4 toplist_item_get_sum2F(const WeaveResultsToplistItem *item)
static REAL4 toplist_item_get_log10BSGL(const WeaveResultsToplistItem *item)
int XLALWeaveOutputResultsReadAppend(FITSFile *file, WeaveOutputResults **out, UINT4 toplist_limit)
Read results from a FITS file and append to new/existing output results.
static void toplist_item_set_log10BSGL(WeaveResultsToplistItem *item, const REAL4 value)
static const REAL4 * toplist_results_mean2F(const WeaveSemiResults *semi_res)
void XLALWeaveOutputResultsDestroy(WeaveOutputResults *out)
Free output results.
static void toplist_item_set_log10BSGLtL(WeaveResultsToplistItem *item, const REAL4 value)
int XLALWeaveOutputResultsCompletionLoop(WeaveOutputResults *out)
Compute all the missing 'completion-loop' statistics for all toplist entries.
static const REAL4 * toplist_results_log10BSGL(const WeaveSemiResults *semi_res)
static REAL4 toplist_item_get_log10BtSGLtL(const WeaveResultsToplistItem *item)
WeaveOutputResults * XLALWeaveOutputResultsCreate(const LIGOTimeGPS *ref_time, const size_t nspins, WeaveStatisticsParams *statistics_params, const UINT4 toplist_limit, const BOOLEAN mean2F_hgrm)
Create output results.
static REAL4 toplist_item_get_mean2F(const WeaveResultsToplistItem *item)
const REAL4 mean2F_hgrm_bin_width
Histogram bin width of mean multi-F-statistics.
Module which handles the output results.
int XLALWeaveResultsToplistAdd(WeaveResultsToplist *toplist, const WeaveSemiResults *semi_res, const UINT4 semi_nfreqs)
Add semicoherent results to toplist.
void XLALWeaveResultsToplistDestroy(WeaveResultsToplist *toplist)
Free results toplist.
WeaveResultsToplist * XLALWeaveResultsToplistCreate(const size_t nspins, WeaveStatisticsParams *statistics_params, const char *stat_name, const char *stat_desc, const UINT4 toplist_limit, WeaveResultsToplistRankingStats toplist_rank_stats_fcn, WeaveResultsToplistItemGetRankStat toplist_item_get_rank_stat_fcn, WeaveResultsToplistItemSetRankStat toplist_item_set_rank_stat_fcn)
Create results toplist.
int XLALWeaveResultsToplistReadAppend(FITSFile *file, WeaveResultsToplist *toplist)
Read results from a FITS file and append to existing results toplist.
int XLALWeaveResultsToplistCompare(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 WeaveResultsToplist *toplist_1, const WeaveResultsToplist *toplist_2)
Compare two results toplists and return whether they are equal.
int XLALWeaveResultsToplistWrite(FITSFile *file, const WeaveResultsToplist *toplist)
Write results toplist to a FITS file.
int XLALWeaveResultsToplistCompletionLoop(WeaveResultsToplist *toplist)
Compute all missing 'extra' (non-toplist-ranking) statistics for all toplist entries.
Module which handles toplists of results.
enum tagWeaveStatisticType WeaveStatisticType
int XLALWeaveStatisticsParamsSetDependencyMap(WeaveStatisticsParams *statistics_params, const WeaveStatisticType toplist_stats, const WeaveStatisticType extra_output_stats, const WeaveStatisticType recalc_stats)
Fill StatisticsParams logic for given toplist and extra-output stats.
const UserChoices WeaveToplistChoices
User input choices for toplist ranking statistics.
const UserChoices WeaveStatisticChoices
User input choices for all supported statistics.
void XLALWeaveStatisticsParamsDestroy(WeaveStatisticsParams *statistics_params)
Destroy a StatisticsParams struct.
@ WEAVE_STATISTIC_BtSGLtL
(transient-)line robust log10(B_tS/GLtL) statistic
@ WEAVE_STATISTIC_MEAN2F
Multi-detector average (over segments) F-statistic.
@ WEAVE_STATISTIC_BSGLtL
(transient-)line robust log10(B_S/GLtL) statistic
@ WEAVE_STATISTIC_BSGL
Line-robust log10(B_S/GL) statistic.
@ WEAVE_STATISTIC_SUM2F
Multi-detector sum (over segments) F-statistic.
#define WEAVE_STATISTIC_NAME(ws)
Names of all possible statistics.
#define LAL_GPS_PRINT(gps)
#define XLAL_FITS_TABLE_COLUMN_BEGIN(record_type)
#define XLAL_FITS_TABLE_COLUMN_ADD(file, type, field)
struct tagFITSFile FITSFile
Representation of a FITS file.
void * XLALCalloc(size_t m, size_t n)
INT4Vector * XLALResizeINT4Vector(INT4Vector *vector, UINT4 length)
void XLALDestroyREAL4Vector(REAL4Vector *vector)
void XLALDestroyINT4Vector(INT4Vector *vector)
void XLALDestroyUINT8Vector(UINT8Vector *vector)
REAL4Vector * XLALResizeREAL4Vector(REAL4Vector *vector, UINT4 length)
UINT8Vector * XLALCreateUINT8Vector(UINT4 length)
int XLALVectorScaleREAL4(REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len)
int XLALVectorINT4FromREAL4(INT4 *out, const REAL4 *in, const UINT4 len)
int int int XLALPrintInfo(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_NULL(assertion,...)
int XLALGPSCmp(const LIGOTimeGPS *t0, const LIGOTimeGPS *t1)
Struct holding the results of comparing two floating-point vectors (real-valued or complex),...
Histogram bin of mean multi-F-statistics.
Output results from a search.
REAL4Vector * mean2F_hgrm_tmp_REAL4
WeaveResultsToplist * toplists[8]
Output result toplists.
LIGOTimeGPS ref_time
Reference time at which search is conducted.
size_t nspins
Number of spindown parameters to output.
UINT8 mean2F_hgrm_overflow
INT4Vector * mean2F_hgrm_tmp_INT4
size_t ntoplists
Number of output results toplists.
UINT8Vector * mean2F_hgrm_bins
UINT8 mean2F_hgrm_underflow
WeaveStatisticsParams * statistics_params
Struct holding all parameters for which statistics to output and compute, when, and how NOTE: this is...