Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org on the morning of Tuesday 11th August 2020, starting at approximately 9am PDT. It is expected to take around 20 minutes and there will be a short period of downtime (less than five minutes) towards the end of the maintenance window. Please direct any comments, questions, or concerns to computing-help@ligo.org.

Commit 72a2f9cb authored by Karl Wette's avatar Karl Wette

Weave: always record whether coherent results have been recomputed

- For easier diagnosis of cache problems
- Use new LALBitset structure to (hopefully) do this efficiently
- FITS output changes:
  - NCOHRES: number of computed coherent results
  - NCOHTPL: number of coherent templates
  - NSEMITPL: number of semicoherent templates (was NSEMIRES)
  - above keywords only output when not checkpointing
  - remove NCOHFBK, resampling timing model doesn't need this
  - remove coh_n1comp and coh_n1recomp fields from misc info table
- Update test scripts

Original lalsuite-weave: 65716bae6941bfb59398ac33bbd274a68b0038f3
parent 3da9477d
......@@ -41,3 +41,6 @@ lalpulsar/test/sun00-19-DE414.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/sun00-19-DE421.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/tdb_2000-2019.dat.gz filter=lfs diff=lfs merge=lfs -text
lalpulsar/test/te405_2000-2019.dat.gz filter=lfs diff=lfs merge=lfs -text
lalapps/src/pulsar/Weave/TestInterpolating.tar.gz filter=lfs diff=lfs merge=lfs -text
lalapps/src/pulsar/Weave/TestNonInterpolating.tar.gz filter=lfs diff=lfs merge=lfs -text
lalapps/src/pulsar/Weave/TestSingleSegment.tar.gz filter=lfs diff=lfs merge=lfs -text
......@@ -163,10 +163,3 @@ EXPORT_VECTORMATH_SS2uU(FindVectorLessEqual, AVX2, SSSE3, NONE, NONE)
EXPORT_VECTORMATH_ANY( NAME ## REAL4, ( UINT4* count, UINT4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len ), (count, out, scalar, in, len), __VA_ARGS__ )
EXPORT_VECTORMATH_sS2uU(FindScalarLessEqual, AVX2, SSSE3, NONE, NONE)
// ---------- define exported vector math functions with 1 REAL8 scalar, 1 REAL8 vector inputs to 1 REAL8 vector output (dD2D) ----------
#define EXPORT_VECTORMATH_dD2D(NAME, ...) \
EXPORT_VECTORMATH_ANY( NAME ## REAL8, (REAL8 *out, REAL8 scalar, const REAL8 *in, const UINT4 len), (out, scalar, in, len), __VA_ARGS__ )
EXPORT_VECTORMATH_dD2D(Scale, NONE, NONE, NONE, NONE)
......@@ -178,9 +178,6 @@ int XLALVectorShiftREAL4 ( REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT
/** Compute \f$\text{out} = \text{scalar} \times \text{in}\f$ over REAL4 vector \c in with \c len elements */
int XLALVectorScaleREAL4 ( REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len);
/** Compute \f$\text{out} = \text{scalar} \times \text{in}\f$ over REAL8 vector \c in with \c len elements */
int XLALVectorScaleREAL8 ( REAL8 *out, REAL8 scalar, const REAL8 *in, const UINT4 len);
/** @} */
/** \name Vector Element Finding Operations */
......
......@@ -50,10 +50,6 @@ static inline REAL4 local_mulf ( REAL4 x, REAL4 y ) {
return x * y;
}
static inline REAL8 local_mul ( REAL8 x, REAL8 y ) {
return x * y;
}
// ========== internal generic functions ==========
// ---------- generic operator with 1 REAL4 vector input to 1 REAL4 vector output (S2S) ----------
......@@ -100,17 +96,6 @@ XLALVectorMath_sS2S_GEN ( REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT4
return XLAL_SUCCESS;
}
// ---------- generic operator with 1 REAL8 scalar and 1 REAL8 vector inputs to 1 REAL8 vector output (dD2D) ----------
static inline int
XLALVectorMath_dD2D_GEN ( REAL8 *out, REAL8 scalar, const REAL8 *in, const UINT4 len, REAL8 (*op)(REAL8, REAL8) )
{
for ( UINT4 i = 0; i < len; i ++ )
{
out[i] = (*op) ( scalar, in[i] );
}
return XLAL_SUCCESS;
}
// ========== internal vector math functions ==========
// ---------- define vector math functions with 1 REAL4 vector input to 1 REAL4 vector output (S2S) ----------
......@@ -143,9 +128,3 @@ DEFINE_VECTORMATH_SS2S(Max, fmaxf)
DEFINE_VECTORMATH_sS2S(Shift, local_addf)
DEFINE_VECTORMATH_sS2S(Scale, local_mulf)
// ---------- define vector math functions with 1 REAL8 scalar and 1 REAL8 vector inputs to 1 REAL8 vector output (dD2D) ----------
#define DEFINE_VECTORMATH_dD2D(NAME, GEN_OP) \
DEFINE_VECTORMATH_ANY( XLALVectorMath_dD2D_GEN, NAME ## REAL8, ( REAL8 *out, REAL8 scalar, const REAL8 *in, const UINT4 len ), ( (out != NULL) && (in != NULL) ), ( out, scalar, in, len, GEN_OP ) )
DEFINE_VECTORMATH_dD2D(Scale, local_mul)
......@@ -91,10 +91,3 @@ DECLARE_VECTORMATH_SS2uU(FindVectorLessEqual, AVX2, SSSE3, NONE, NONE)
DECLARE_VECTORMATH_ANY( NAME ## REAL4, ( UINT4* count, UINT4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len ), __VA_ARGS__ )
DECLARE_VECTORMATH_sS2uU(FindScalarLessEqual, AVX2, SSSE3, NONE, NONE)
/* declare internal prototypes of SIMD-specific vector math functions with 1 REAL8 scalar and 1 REAL8 vector input to 1 REAL8 vector output (dD2D) */
#define DECLARE_VECTORMATH_dD2D(NAME, ...) \
DECLARE_VECTORMATH_ANY( NAME ## REAL8, ( REAL8 *out, REAL8 scalar, const REAL8 *in, const UINT4 len ), __VA_ARGS__ )
DECLARE_VECTORMATH_dD2D(Scale, NONE, NONE, NONE, NONE)
......@@ -36,7 +36,6 @@
// ---------- Macros ----------
#define frand() (rand() / (REAL4)RAND_MAX)
#define Relerr(dx,x) (fabsf(x)>0 ? fabsf((dx)/(x)) : fabsf(dx) )
#define Relerrd(dx,x) (fabs(x)>0 ? fabs((dx)/(x)) : fabs(dx) )
// ----- test and benchmark operators with 1 REAL4 vector input and 1 REAL4 vector output (S2S) ----------
#define TESTBENCH_VECTORMATH_S2S(name,in) \
......@@ -127,28 +126,6 @@
XLALPrintInfo ( "%-32s: %4.0f Mops/sec\n", XLALVector##name##REAL4_name, (REAL8)Ntrials * Nruns / (toc - tic)/1e6 ); \
}
#define TESTBENCH_VECTORMATH_DD2D(name,in1,in2) \
{ \
XLAL_CHECK ( XLALVector##name##REAL8_GEN( xOutRefD, in1, in2, Ntrials ) == XLAL_SUCCESS, XLAL_EFUNC ); \
tic = XLALGetCPUTime(); \
for (UINT4 l=0; l < Nruns; l ++ ) { \
XLAL_CHECK ( XLALVector##name##REAL8( xOutD, in1, in2, Ntrials ) == XLAL_SUCCESS, XLAL_EFUNC ); \
} \
toc = XLALGetCPUTime(); \
maxErr = maxRelerr = 0; \
for ( UINT4 i = 0; i < Ntrials; i ++ ) \
{ \
REAL8 err = fabs ( xOutD[i] - xOutRefD[i] ); \
REAL8 relerr = Relerrd ( err, xOutRefD[i] ); \
maxErr = fmax ( err, maxErr ); \
maxRelerr = fmax ( relerr, maxRelerr ); \
} \
XLALPrintInfo ( "%-32s: %4.0f Mops/sec [maxErr = %7.2g (tol=%7.2g), maxRelerr = %7.2g (tol=%7.2g)]\n", \
XLALVector##name##REAL8_name, (REAL8)Ntrials * Nruns / (toc - tic)/1e6, maxErr, (abstol), maxRelerr, (reltol) ); \
XLAL_CHECK ( (maxErr <= (abstol)), XLAL_ETOL, "%s: absolute error (%g) exceeds tolerance (%g)\n", #name "REAL8", maxErr, abstol ); \
XLAL_CHECK ( (maxRelerr <= (reltol)), XLAL_ETOL, "%s: relative error (%g) exceeds tolerance (%g)\n", #name "REAL8", maxRelerr, reltol ); \
}
// local types
typedef struct
......@@ -209,19 +186,6 @@ main ( int argc, char *argv[] )
XLAL_CHECK ( ( xOutU4 = XLALCreateUINT4Vector ( Ntrials )) != NULL, XLAL_EFUNC );
XLAL_CHECK ( ( xOutRefU4 = XLALCreateUINT4Vector ( Ntrials )) != NULL, XLAL_EFUNC );
REAL8VectorAligned *xInD_a, *xIn2D_a, *xOutD_a, *xOutRefD_a;
XLAL_CHECK ( ( xInD_a = XLALCreateREAL8VectorAligned ( Ntrials, uvar->inAlign )) != NULL, XLAL_EFUNC );
XLAL_CHECK ( ( xIn2D_a = XLALCreateREAL8VectorAligned ( Ntrials, uvar->inAlign )) != NULL, XLAL_EFUNC );
XLAL_CHECK ( ( xOutD_a = XLALCreateREAL8VectorAligned ( Ntrials, uvar->outAlign )) != NULL, XLAL_EFUNC );
XLAL_CHECK ( (xOutRefD_a= XLALCreateREAL8VectorAligned ( Ntrials, uvar->outAlign )) != NULL, XLAL_EFUNC );
// extract aligned REAL8 vectors from these
REAL8 *xInD = xInD_a->data;
REAL8 *xIn2D = xIn2D_a->data;
REAL8 *xOutD = xOutD_a->data;
REAL8 *xOutRefD = xOutRefD_a->data;
REAL8 tic, toc;
REAL4 maxErr = 0, maxRelerr = 0;
REAL4 abstol, reltol;
......@@ -265,8 +229,6 @@ main ( int argc, char *argv[] )
for ( UINT4 i = 0; i < Ntrials; i ++ ) {
xIn[i] = -10000.0f + 20000.0f * frand() + 1e-6;
xIn2[i] = -10000.0f + 20000.0f * frand() + 1e-6;
xInD[i] = -100000.0 + 200000.0 * frand() + 1e-6;
xIn2D[i]= -100000.0 + 200000.0 * frand() + 1e-6;
} // for i < Ntrials
abstol = 2e-7, reltol = 2e-7;
......@@ -278,8 +240,6 @@ main ( int argc, char *argv[] )
TESTBENCH_VECTORMATH_SS2S(Shift,xIn[0],xIn2);
TESTBENCH_VECTORMATH_SS2S(Scale,xIn[0],xIn2);
TESTBENCH_VECTORMATH_DD2D(Scale,xInD[0],xIn2D);
// ==================== FIND ====================
for ( UINT4 i = 0; i < Ntrials; i ++ ) {
xIn[i] = -10000.0f + 20000.0f * frand() + 1e-6;
......@@ -305,11 +265,6 @@ main ( int argc, char *argv[] )
XLALDestroyUINT4Vector ( xOutU4 );
XLALDestroyUINT4Vector ( xOutRefU4 );
XLALDestroyREAL8VectorAligned ( xInD_a );
XLALDestroyREAL8VectorAligned ( xIn2D_a );
XLALDestroyREAL8VectorAligned ( xOutD_a );
XLALDestroyREAL8VectorAligned ( xOutRefD_a );
XLALDestroyUserVars();
LALCheckMemoryLeaks();
......
......@@ -289,6 +289,11 @@ src/pulsar/Tools/lalapps_FstatMetric_v2
src/pulsar/Tools/lalapps_PrintDetectorState
src/pulsar/TwoSpect/lalapps_TwoSpect
src/pulsar/TwoSpect/lalapps_TwoSpectTemplateBank
src/pulsar/Weave/*.testdir
src/pulsar/Weave/lalapps_Weave
src/pulsar/Weave/lalapps_WeaveCompare
src/pulsar/Weave/lalapps_WeaveSetup
src/pulsar/Weave/lalapps_Weave_Callgrind
src/pulsar/Xray/lalapps_Intermittent
src/pulsar/Xray/lalapps_SemiCoherentBinary_v2
src/pulsar/Xray/lalapps_binary2sfts
......
......@@ -42,6 +42,7 @@ AC_CONFIG_FILES([\
src/pulsar/SidebandSearch/Makefile \
src/pulsar/Tools/Makefile \
src/pulsar/TwoSpect/Makefile \
src/pulsar/Weave/Makefile \
src/pulsar/Xray/Makefile \
src/ring/Makefile \
src/stochastic/Makefile \
......@@ -370,6 +371,10 @@ fi
AM_CONDITIONAL([HAVE_BAMBI],[${hbf}])
AM_CONDITIONAL([HAVE_BAMBI_MPI],[${bambimpi}])
# check for valgrind/callgrind headers
AC_CHECK_HEADER([valgrind/callgrind.h],[valgrind_callgrind=true],[valgrind_callgrind=false])
AM_CONDITIONAL([VALGRIND_CALLGRIND],[test ${valgrind_callgrind} = true])
# check for boinc, and modify compiler for lal library checks
LALSUITE_CHECK_BOINC
......
......@@ -167,8 +167,8 @@ typedef struct {
REAL4 NSegmentsInvX[PULSAR_MAX_DETECTORS]; /**< effective inverse number of segments per detector (needed for correct averaging in single-IFO F calculation) */
FstatInputVector* Fstat_in_vec; /**< Original wide-parameter search: vector of Fstat input data structures for XLALComputeFstat(), one per stack */
FstatInputVector* Fstat_in_vec_recalc; /**< Recalculate the toplist: Vector of Fstat input data structures for XLALComputeFstat(), one per stack */
FILE *timingDetailsFP; // file pointer to write detailed coherent-timing info into
PulsarParamsVector *injectionSources; ///< Source parameters to inject: comma-separated list of file-patterns and/or direct config-strings ('{...}')
BOOLEAN collectFstatTiming; ///< flag whether to collect and output F-stat timing info
} UsefulStageVariables;
......@@ -563,7 +563,7 @@ int MAIN( int argc, char *argv[]) {
XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_skyPointIndex, "skyPointIndex", INT4, 0, DEVELOPER, "Only analyze this skypoint in grid" ) == XLAL_SUCCESS, XLAL_EFUNC);
XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_outputTiming, "outputTiming", STRING, 0, DEVELOPER, "Append timing information into this file") == XLAL_SUCCESS, XLAL_EFUNC);
XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_outputTimingDetails, "outputTimingDetails", STRING, 0, DEVELOPER, "Append detailed averaged F-stat timing information to this file") == XLAL_SUCCESS, XLAL_EFUNC);
XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_outputTimingDetails, "outputTimingDetails", STRING, 0, DEVELOPER, "Append detailed F-stat timing information to this file") == XLAL_SUCCESS, XLAL_EFUNC);
XLAL_CHECK_MAIN( XLALRegisterNamedUvar( &uvar_loudestTwoFPerSeg, "loudestTwoFPerSeg", BOOLEAN, 0, DEVELOPER, "Output loudest per-segment Fstat values into file '_loudestTwoFPerSeg'" ) == XLAL_SUCCESS, XLAL_EFUNC );
......@@ -716,7 +716,16 @@ int MAIN( int argc, char *argv[]) {
} /* end of logging */
tic_Start = GETTIME();
usefulParams.collectFstatTiming = ( uvar_outputTimingDetails != NULL );
BOOLEAN printHeader = 0;
if ( uvar_outputTimingDetails != NULL ) {
FILE *tmp;
if ( (tmp = fopen ( uvar_outputTimingDetails, "r" )) == NULL ) {
printHeader = 1;
} else {
fclose (tmp );
}
XLAL_CHECK ( (usefulParams.timingDetailsFP = fopen ( uvar_outputTimingDetails, "wb" )) != NULL, XLAL_ESYS, "Failed to open '%s' for writing\n", uvar_outputTimingDetails );
} // if uvar_outputTimingDetails
/* initializations of coarse and fine grids */
coarsegrid.TwoF=NULL;
......@@ -1563,6 +1572,9 @@ int MAIN( int argc, char *argv[]) {
XLALPrintError ("%s: XLALComputeFstat() failed with errno=%d\n", __func__, xlalErrno );
return xlalErrno;
}
if ( usefulParams.timingDetailsFP != NULL ) {
XLAL_CHECK ( XLALAppendFstatTiming2File ( usefulParams.Fstat_in_vec->data[k], usefulParams.timingDetailsFP, printHeader ) == XLAL_SUCCESS, XLAL_EFUNC );
}
/* if single-only flag is given, add +4 to F-statistic */
if ( uvar_SignalOnly ) {
if (XLALAdd4ToFstatResults(Fstat_res) != XLAL_SUCCESS) {
......@@ -1828,17 +1840,6 @@ int MAIN( int argc, char *argv[]) {
}
LogPrintf( LOG_NORMAL, "Finished main analysis.\n");
// output averaged F-stat timing model (--outputTimingDetails)
if ( uvar_outputTimingDetails != NULL ) {
FILE *fp;
XLAL_CHECK ( (fp = fopen ( uvar_outputTimingDetails, "ab" )) != NULL, XLAL_ESYS, "Failed to open '%s' for writing\n", uvar_outputTimingDetails );
for (size_t l=0; l < nStacks; l++) {
XLAL_CHECK ( XLALAppendFstatTiming2File ( usefulParams.Fstat_in_vec->data[l], fp, (l==0) ) == XLAL_SUCCESS, XLAL_EFUNC );
}
fclose ( fp );
}
/* Also compute F, FX (for line-robust statistics) for all candidates in final toplist */
tic_RecalcToplist = GETTIME();
if ( uvar_recalcToplistStats ) {
......@@ -2087,6 +2088,9 @@ int MAIN( int argc, char *argv[]) {
XLALFree ( VCSInfoString );
if ( usefulParams.timingDetailsFP != NULL ) {
fclose ( usefulParams.timingDetailsFP );
}
XLALFree ( loudestTwoFPerSeg );
LALCheckMemoryLeaks();
......@@ -2331,7 +2335,7 @@ void SetUpSFTs( LALStatus *status, /**< pointer to LALStatus structure */
optionalArgs.Dterms = in->Dterms;
optionalArgs.runningMedianWindow = in->blocksRngMed;
optionalArgs.FstatMethod = in->Fmethod;
optionalArgs.collectTiming = in->collectFstatTiming;
optionalArgs.collectTiming = (in->timingDetailsFP != NULL);
optionalArgs.injectSources = in->injectionSources;
FstatOptionalArgs XLAL_INIT_DECL(optionalArgsRecalc);
......
......@@ -19,6 +19,7 @@ SUBDIRS += \
MakeSFTs \
SidebandSearch \
TwoSpect \
Weave \
Xray \
$(END_OF_LINE)
......
......@@ -202,10 +202,10 @@ initUserVars ( UserInput_t *uvar )
/* now register all our user-variable */
XLAL_CHECK ( XLALRegisterUvarMember( sftBname1, STRING, '1', REQUIRED, "Path and basefilename for SFTs1") == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK ( XLALRegisterUvarMember( sftBname2, STRING, '2', REQUIRED, "Path and basefilename for SFTs2") == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK ( XLALRegisterUvarMember( verbose, BOOLEAN, 'V', OPTIONAL, "Verbose output of differences") == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK ( XLALRegisterUvarMember( relErrorMax, REAL8, 'e', OPTIONAL, "Maximal relative error acceptable to 'pass' comparison") == XLAL_SUCCESS, XLAL_EFUNC );
XLALRegisterUvarMember( sftBname1, STRING, '1', REQUIRED, "Path and basefilename for SFTs1");
XLALRegisterUvarMember( sftBname2, STRING, '2', REQUIRED, "Path and basefilename for SFTs2");
XLALRegisterUvarMember( verbose, BOOLEAN, 'v', OPTIONAL, "Verbose output of differences");
XLALRegisterUvarMember( relErrorMax, REAL8, 'e', OPTIONAL, "Maximal relative error acceptable to 'pass' comparison");
return XLAL_SUCCESS;
......
This diff is collapsed.
//
// Copyright (C) 2016, 2017 Karl Wette
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with with program; see the file COPYING. If not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307 USA
//
#ifndef _CACHE_RESULTS_H
#define _CACHE_RESULTS_H
///
/// \file
/// \ingroup lalapps_pulsar_Weave
///
#include "Weave.h"
#include "ComputeResults.h"
#include <lal/LatticeTiling.h>
#ifdef __cplusplus
extern "C" {
#endif
///
/// \name Functions which cache computed coherent results
///
/// @{
///
/// Cache used to store coherent results
///
typedef struct tagWeaveCache WeaveCache;
///
/// Storage for a series of cache queries
///
typedef struct tagWeaveCacheQueries WeaveCacheQueries;
WeaveCache *XLALWeaveCacheCreate(
const LatticeTiling *coh_tiling,
const BOOLEAN interpolation,
const WeavePhysicalToLattice phys_to_latt,
const WeaveLatticeToPhysical latt_to_phys,
const void *coh_transf_data,
const void *semi_transf_data,
WeaveCohInput *coh_input,
const size_t max_size,
const size_t gc_limit
);
void XLALWeaveCacheDestroy(
WeaveCache *cache
);
WeaveCacheQueries *XLALWeaveCacheQueriesCreate(
const LatticeTiling *semi_tiling,
const WeavePhysicalToLattice phys_to_latt,
const WeaveLatticeToPhysical latt_to_phys,
const void *semi_transf_data,
const UINT4 nqueries,
const UINT4 npartitions
);
void XLALWeaveCacheQueriesDestroy(
WeaveCacheQueries *queries
);
int XLALWeaveCacheQueriesInit(
WeaveCacheQueries *queries,
const LatticeTilingIterator *semi_itr,
const gsl_vector *semi_point
);
int XLALWeaveCacheQuery(
const WeaveCache *cache,
const UINT8 semi_index,
WeaveCacheQueries *queries,
const UINT4 query_index
);
int XLALWeaveCacheQueriesFinal(
WeaveCacheQueries *queries,
const UINT4 partition_index,
PulsarDopplerParams *semi_phys,
const double dfreq,
UINT4 *semi_nfreqs
);
int XLALWeaveCacheRetrieve(
WeaveCache *cache,
WeaveCacheQueries *queries,
const UINT4 query_index,
const WeaveCohResults **coh_res,
UINT8 *coh_index,
UINT4 *coh_offset,
UINT8 *coh_nres,
UINT8 *coh_ntmpl
);
/// @}
#ifdef __cplusplus
}
#endif
#endif // _CACHE_RESULTS_H
// Local Variables:
// c-file-style: "linux"
// c-basic-offset: 2
// End:
This diff is collapsed.
//
// Copyright (C) 2016, 2017 Karl Wette
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with with program; see the file COPYING. If not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307 USA
//
#ifndef _COMPUTE_RESULTS_H
#define _COMPUTE_RESULTS_H
///
/// \file
/// \ingroup lalapps_pulsar_Weave
///
#include "Weave.h"
#include <lal/VectorMath.h>
#include <lal/ComputeFstat.h>
#include "Statistics.h"
#ifdef __cplusplus
extern "C" {
#endif
///
/// \name Functions which compute coherent and semicoherent results
///
/// @{
///
/// Input data required for computing coherent results
///
typedef struct tagWeaveCohInput WeaveCohInput;
///
/// Results of a coherent computation on a single segment
///
typedef struct tagWeaveCohResults WeaveCohResults;
///
/// Final results of a semicoherent computation over many segments
///
typedef struct tagWeaveSemiResults {
/// Bitflag representing search simulation level
WeaveSimulationLevel simulation_level;
/// Struct holding all parameters for which statistics to output and compute, when, and how
const WeaveStatisticsParams *statistics_params;
/// Number of detectors
UINT4 ndetectors;
/// Number of segments
UINT4 nsegments;
/// Frequency spacing for semicoherent results
double dfreq;
/// Number of frequencies
UINT4 nfreqs;
/// Per-segment coherent template index (optional)
UINT8 *coh_index;
/// Per-segment coherent template parameters of the first frequency bin (optional)
PulsarDopplerParams *coh_phys;
/// Per-segment multi-detector F-statistics per frequency (optional)
const REAL4 **coh2F;
/// Per-segment per-detector F-statistics per frequency (optional)
const REAL4 **coh2F_det[PULSAR_MAX_DETECTORS];
/// Number of coherent results processed thus far
UINT4 ncoh_res;
/// Semicoherent template index
UINT8 semi_index;
/// Semicoherent template parameters of the first frequency bin
PulsarDopplerParams semi_phys;
/// Maximized-over-segments multi-detector F-statistics per frequency
REAL4VectorAligned *max2F;
/// Number of max-comparison of multi-detector F-statistics thus far
UINT4 nmax2F;
/// Maximized-over-segments per-detector F-statistics per frequency
REAL4VectorAligned *max2F_det[PULSAR_MAX_DETECTORS];
/// Number of max-comparison to per-detector F-statistics thus far
UINT4 nmax2F_det[PULSAR_MAX_DETECTORS];
/// Summed multi-detector F-statistics per frequency
REAL4VectorAligned *sum2F;
/// Number of additions to multi-detector F-statistics thus far
UINT4 nsum2F;
/// Summed per-detector F-statistics per frequency
REAL4VectorAligned *sum2F_det[PULSAR_MAX_DETECTORS];
/// Number of additions to per-detector F-statistics thus far
UINT4 nsum2F_det[PULSAR_MAX_DETECTORS];
/// Mean multi-detector F-statistics per frequency
REAL4VectorAligned *mean2F;
/// Line-robust log10(B_S/GL) statistic
REAL4VectorAligned *log10BSGL;
/// Transient Line-robust log10(B_S/GLtL) statistic
REAL4VectorAligned *log10BSGLtL;
/// Transient Signal Line-robust log10(B_tS/GLtL) statistic
REAL4VectorAligned *log10BtSGLtL;
} WeaveSemiResults;
WeaveCohInput *XLALWeaveCohInputCreate(
const WeaveSimulationLevel simulation_level,
FstatInput *Fstat_input,
const WeaveStatisticsParams *statistics_params
);
void XLALWeaveCohInputDestroy(
WeaveCohInput *coh_input
);
int XLALWeaveCohResultsCompute(
WeaveCohResults **coh_res,
WeaveCohInput *coh_input,
const PulsarDopplerParams *coh_phys,
const UINT4 coh_nfreqs
);
void XLALWeaveCohResultsDestroy(
WeaveCohResults *coh_res
);
int XLALWeaveSemiResultsInit(
WeaveSemiResults **semi_res,
const WeaveSimulationLevel simulation_level,
const UINT4 ndetectors,
const UINT4 nsegments,
const UINT8 semi_index,
const PulsarDopplerParams *semi_phys,
const double dfreq,
const UINT4 semi_nfreqs,
const WeaveStatisticsParams *statistics_params
);
int XLALWeaveSemiResultsAdd(
WeaveSemiResults *semi_res,
const WeaveCohResults *coh_res,
const UINT8 coh_index,
const UINT4 coh_offset
);
int XLALWeaveSemiResultsComputeMain(
WeaveSemiResults *semi_res
);
void XLALWeaveSemiResultsDestroy(
WeaveSemiResults *semi_res
);
/// @}
#ifdef __cplusplus
}
#endif
#endif // _COMPUTE_RESULTS_H
// Local Variables:
// c-file-style: "linux"
// c-basic-offset: 2
// End:
include $(top_srcdir)/gnuscripts/lalapps.am
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = /bin/bash $(srcdir)/test-compiler.sh
if !CFITSIO
SH_LOG_COMPILER += skip
endif
bin_PROGRAMS = \
lalapps_WeaveSetup \
lalapps_Weave \
lalapps_WeaveCompare \
$(END_OF_LIST)
lalapps_WeaveSetup_SOURCES = \
SetupData.c \
SetupData.h \
Weave.h \
WeaveSetup.c \
$(END_OF_LIST)
lalapps_Weave_SOURCES = \
CacheResults.c \
CacheResults.h \
ComputeResults.c \
ComputeResults.h \
OutputResults.c \
OutputResults.h \
ResultsToplist.c \
ResultsToplist.h \
SetupData.c \
SetupData.h \
Statistics.c \
Statistics.h \
Weave.c \
Weave.h \
$(END_OF_LIST)
lalapps_WeaveCompare_SOURCES = \
OutputResults.c \
OutputResults.h \
ResultsToplist.c \
ResultsToplist.h \
SetupData.c \
SetupData.h \
Statistics.c \
Statistics.h \
Weave.h \
WeaveCompare.c \
$(END_OF_LIST)
if VALGRIND_CALLGRIND
noinst_PROGRAMS = lalapps_Weave_Callgrind
endif
lalapps_Weave_Callgrind_SOURCES = $(lalapps_Weave_SOURCES)
lalapps_Weave_Callgrind_CPPFLAGS = $(AM_CPPFLAGS) -DWEAVE_CALLGRIND
TESTS = \
TestInterpolating.sh \
TestNonInterpolating.sh \
TestSingleSegment.sh \
TestSimulateSearch.sh \
TestCacheMaxSize.sh \
TestCheckpointing.sh \
TestFreqPartition.sh \
$(END_OF_LIST)
EXTRA_DIST = \
$(TESTS) \
test-compiler.sh \
timestamps-1.txt \
timestamps-2.txt \