29#ifdef LALPULSAR_CUDA_ENABLED
31#include <cuda_runtime_api.h>
34#include <lal/UserInputPrint.h>
35#include <lal/ExtrapolatePulsarSpins.h>
37#define XLAL_CHECK_CUDA_CALL(...) do { \
39 XLAL_CHECK ( ( retn = (__VA_ARGS__) ) == cudaSuccess, XLAL_EERR, "%s failed with return code %i", #__VA_ARGS__, retn ); \
112#ifdef LALPULSAR_CUDA_ENABLED
126 const UINT4 segment_index,
135 WeaveStatisticsParams *statistics_params,
152 WeaveCohInput *coh_input =
XLALCalloc( 1,
sizeof( *coh_input ) );
156 coh_input->setup_detectors = setup_detectors;
157 coh_input->simulation_level = simulation_level;
158 coh_input->seg_info_have_sft_info = ( sft_catalog != NULL );
159 coh_input->Fstat_collect_timing = Fstat_opt_args->
collectTiming;
162 coh_input->seg_info.segment_start = segment->
start;
163 coh_input->seg_info.segment_end = segment->
end;
177 XLAL_CHECK_NULL( sft_count == 0 || sft_catalog_seg.length == sft_count,
XLAL_EFAILED,
"Number of SFTs found for segment %u (%u) is inconsistent with expected number of SFTs given by segment list (%u)", segment_index, sft_catalog_seg.length, sft_count );
184 LIGOTimeGPS sft_start = sft_catalog_seg.data[0].header.epoch;
185 LIGOTimeGPS sft_end = sft_catalog_seg.data[sft_catalog_seg.length - 1].header.epoch;
186 const double sft_end_timebase = 1.0 / sft_catalog_seg.data[sft_catalog_seg.length - 1].header.deltaF;
190 double sft_min_cover_freq = 0, sft_max_cover_freq = 0;
196 if ( sft_noise_sqrtSX != NULL ) {
204 if ( Fstat_assume_sqrtSX != NULL ) {
212 Fstat_opt_args->
prevInput = coh_input->Fstat_input;
215 WeaveStatisticType requested_stats = ( recalc_stage ) ? statistics_params->completionloop_statistics[1] : statistics_params->mainloop_statistics;
217#ifdef LALPULSAR_CUDA_ENABLED
223 coh_input->Fstat_what_to_compute |=
FSTATQ_2F;
226 coh_input->Fstat_what_to_compute |=
FSTATQ_2F;
239 coh_input->Fstat_ndetectors = Fstat_detector_info->
length;
241 for (
size_t i = 0;
i < coh_input->Fstat_ndetectors; ++
i ) {
245 coh_input->Fstat_res_idx[
i] = idx;
246 statistics_params->n2F_det[idx] += 1;
248 XLALFree( statistics_detectors_string );
255 for (
size_t j = 0;
j < sft_catalog_seg_view->
length; ++
j ) {
264 coh_input->seg_info.sft_count[
k] = length;
284 WeaveCohInput *coh_input
287 if ( coh_input != NULL ) {
298 const size_t ncoh_input,
299 WeaveCohInput *
const *coh_input
311 for (
size_t i = 0;
i < ncoh_input; ++
i ) {
313 nsfts += coh_input[
i]->seg_info.sft_count[
j];
332 if ( coh_input[0]->Fstat_collect_timing ) {
335 REAL4 tauF_eff = 0, tauF_core = 0, tauF_buffer = 0, NCalls = 0, NBufferMisses = 0;
339 for (
size_t i = 0;
i < ncoh_input; ++
i ) {
348 tauF_eff += timing_generic.tauF_eff;
349 tauF_core += timing_generic.tauF_core;
350 tauF_buffer += timing_generic.tauF_buffer;
351 NCalls += timing_generic.NCalls;
352 NBufferMisses += timing_generic.NBufferMisses;
356 nmodel = timing_model.numVariables;
357 for (
size_t j = 0;
j < nmodel; ++
j ) {
358 model_names[
j] = timing_model.names[
j];
362 for (
size_t j = 0;
j < nmodel; ++
j ) {
368 for (
size_t j = 0;
j < nmodel; ++
j ) {
369 model_values[
j] += timing_model.values[
j];
381 for (
size_t j = 0;
j < nmodel; ++
j ) {
383 snprintf( keyword,
sizeof( keyword ),
"fstat %s", model_names[
j] );
398 const size_t ncoh_input,
399 WeaveCohInput *
const *coh_input
416 if ( coh_input[0]->seg_info_have_sft_info ) {
417 for (
size_t i = 0;
i < coh_input[0]->setup_detectors->length; ++
i ) {
418 snprintf( col_name,
sizeof( col_name ),
"sft_first_%s", coh_input[0]->setup_detectors->data[
i] );
420 snprintf( col_name,
sizeof( col_name ),
"sft_last_%s", coh_input[0]->setup_detectors->data[
i] );
422 snprintf( col_name,
sizeof( col_name ),
"sft_count_%s", coh_input[0]->setup_detectors->data[
i] );
430 for (
size_t i = 0;
i < ncoh_input; ++
i ) {
442 WeaveCohResults **coh_res,
443 WeaveCohInput *coh_input,
445 const UINT4 coh_nfreqs,
446 WeaveSearchTiming *tim
457 if ( *coh_res == NULL ) {
458 *coh_res =
XLALCalloc( 1,
sizeof( **coh_res ) );
463 ( *coh_res )->coh_phys = *coh_phys;
464 ( *coh_res )->nfreqs = coh_nfreqs;
472 if ( coh_input->Fstat_what_to_compute &
FSTATQ_2F ) {
473 if ( ( *coh_res )->coh2F == NULL || ( *coh_res )->coh2F->length < ( *coh_res )->nfreqs ) {
479#ifdef LALPULSAR_CUDA_ENABLED
480 if ( ( *coh_res )->coh2F_CUDA.data == NULL || ( *coh_res )->coh2F_CUDA.length < ( *coh_res )->nfreqs ) {
481 cudaFree( ( *coh_res )->coh2F_CUDA.data );
482 XLAL_CHECK( cudaMalloc( (
void ** ) & ( *coh_res )->coh2F_CUDA.data,
sizeof( ( *coh_res )->coh2F_CUDA.data[0] ) * ( *coh_res )->nfreqs ) == cudaSuccess,
XLAL_ENOMEM );
483 ( *coh_res )->coh2F_CUDA.length = ( *coh_res )->nfreqs;
490 for (
size_t i = 0;
i < coh_input->Fstat_ndetectors; ++
i ) {
491 const size_t idx = coh_input->Fstat_res_idx[
i];
492 if ( ( *coh_res )->coh2F_det[idx] == NULL || ( *coh_res )->coh2F_det[idx]->length < ( *coh_res )->nfreqs ) {
493 ( *coh_res )->coh2F_det[idx] =
XLALResizeREAL4Vector( ( *coh_res )->coh2F_det[idx], ( *coh_res )->nfreqs );
514 Fstat_res->internalalloclen = ( *coh_res )->nfreqs;
515 if ( coh_input->Fstat_what_to_compute &
FSTATQ_2F ) {
516 Fstat_res->
twoF = ( *coh_res )->coh2F->data;
518#ifdef LALPULSAR_CUDA_ENABLED
520 Fstat_res->
twoF_CUDA = ( *coh_res )->coh2F_CUDA.data;
525 for (
size_t i = 0;
i < coh_input->Fstat_ndetectors; ++
i ) {
526 const size_t idx = coh_input->Fstat_res_idx[
i];
527 Fstat_res->
twoFPerDet[
i] = ( *coh_res )->coh2F_det[idx]->data;
538 if ( coh_input->Fstat_what_to_compute &
FSTATQ_2F ) {
541#ifdef LALPULSAR_CUDA_ENABLED
547 for (
size_t i = 0;
i < coh_input->Fstat_ndetectors; ++
i ) {
548 const size_t idx = coh_input->Fstat_res_idx[
i];
566 WeaveCohResults *coh_res
569 if ( coh_res != NULL ) {
571#ifdef LALPULSAR_CUDA_ENABLED
572 if ( coh_res->coh2F_CUDA.data != NULL ) {
573 cudaFree( coh_res->coh2F_CUDA.data );
587 WeaveSemiResults **semi_res,
589 const UINT4 ndetectors,
590 const UINT4 nsegments,
591 const UINT8 semi_index,
594 const UINT4 semi_nfreqs,
595 const WeaveStatisticsParams *statistics_params
623 if ( unsupported != 0 ) {
625 XLALPrintError(
"BUG: unsupported main-loop statistics requested: %s\n", unsupported_names );
631 if ( *semi_res == NULL ) {
632 *semi_res =
XLALCalloc( 1,
sizeof( **semi_res ) );
636 ( *semi_res )->coh_index =
XLALCalloc( nsegments,
sizeof( *( *semi_res )->coh_index ) );
640 ( *semi_res )->coh_phys =
XLALCalloc( nsegments,
sizeof( *( *semi_res )->coh_phys ) );
645 if ( statistics_params->coh_input[0]->Fstat_what_to_compute &
FSTATQ_2F_CUDA ) {
646#ifdef LALPULSAR_CUDA_ENABLED
647 XLAL_CHECK( cudaMallocManaged( (
void ** ) & ( *semi_res )->coh2F_CUDA, nsegments *
sizeof( *( *semi_res )->coh2F_CUDA ), cudaMemAttachGlobal ) == cudaSuccess,
XLAL_ENOMEM );
648 memset( ( *semi_res )->coh2F_CUDA, 0, nsegments *
sizeof( *( *semi_res )->coh2F_CUDA ) );
654 memset( ( *semi_res )->coh2F, 0, nsegments *
sizeof( *( *semi_res )->coh2F ) );
660 for (
size_t i = 0;
i < ndetectors; ++
i ) {
661 ( *semi_res )->coh2F_det[
i] =
XLALCalloc( nsegments,
sizeof( *( *semi_res )->coh2F_det[
i] ) );
669 ( *semi_res )->simulation_level = simulation_level;
670 ( *semi_res )->ndetectors = ndetectors;
671 ( *semi_res )->nsegments = nsegments;
672 ( *semi_res )->dfreq =
dfreq;
673 ( *semi_res )->nfreqs = semi_nfreqs;
674 ( *semi_res )->semi_index = semi_index;
675 ( *semi_res )->semi_phys = *semi_phys;
676 ( *semi_res )->statistics_params = statistics_params;
679 ( *semi_res )->ncoh_res = 0;
683 if ( ( *semi_res )->max2F == NULL || ( *semi_res )->max2F->length < ( *semi_res )->nfreqs ) {
684#ifdef LALPULSAR_CUDA_ENABLED
685 if ( ( *semi_res )->max2F == NULL ) {
688 if ( ( *semi_res )->max2F->data != NULL ) {
689 cudaFree( ( *semi_res )->max2F->data );
691 XLAL_CHECK( cudaMallocManaged( (
void ** ) & ( *semi_res )->max2F->data,
sizeof( ( *semi_res )->max2F->data[0] ) * ( *semi_res )->nfreqs, cudaMemAttachGlobal ) == cudaSuccess,
XLAL_ENOMEM );
692 ( *semi_res )->max2F->length = ( *semi_res )->nfreqs;
701 for (
size_t i = 0;
i < ( *semi_res )->ndetectors; ++
i ) {
702 if ( ( *semi_res )->max2F_det[
i] == NULL || ( *semi_res )->max2F_det[
i]->length < ( *semi_res )->nfreqs ) {
711 if ( ( *semi_res )->sum2F == NULL || ( *semi_res )->sum2F->length < ( *semi_res )->nfreqs ) {
712#ifdef LALPULSAR_CUDA_ENABLED
713 if ( ( *semi_res )->sum2F == NULL ) {
716 if ( ( *semi_res )->sum2F->data != NULL ) {
717 cudaFree( ( *semi_res )->sum2F->data );
719 XLAL_CHECK( cudaMallocManaged( (
void ** ) & ( *semi_res )->sum2F->data,
sizeof( ( *semi_res )->sum2F->data[0] ) * ( *semi_res )->nfreqs, cudaMemAttachGlobal ) == cudaSuccess,
XLAL_ENOMEM );
720 ( *semi_res )->sum2F->length = ( *semi_res )->nfreqs;
729 for (
size_t i = 0;
i < ( *semi_res )->ndetectors; ++
i ) {
730 if ( ( *semi_res )->sum2F_det[
i] == NULL || ( *semi_res )->sum2F_det[
i]->length < ( *semi_res )->nfreqs ) {
739 if ( ( *semi_res )->mean2F == NULL || ( *semi_res )->mean2F->length < ( *semi_res )->nfreqs ) {
747 if ( ( *semi_res )->log10BSGL == NULL || ( *semi_res )->log10BSGL->length < ( *semi_res )->nfreqs ) {
755 if ( ( *semi_res )->log10BSGLtL == NULL || ( *semi_res )->log10BSGLtL->length < ( *semi_res )->nfreqs ) {
763 if ( ( *semi_res )->log10BtSGLtL == NULL || ( *semi_res )->log10BtSGLtL->length < ( *semi_res )->nfreqs ) {
777 WeaveSemiResults *semi_res,
778 const UINT4 nsegments,
779 const WeaveCohResults **coh_res,
780 const UINT8 *coh_index,
781 const UINT4 *coh_offset,
782 WeaveSearchTiming *tim
792 for (
size_t j = 0;
j < nsegments; ++
j ) {
802 semi_res->ncoh_res = nsegments;
804 for (
size_t j = 0;
j < nsegments; ++
j ) {
807 XLAL_CHECK( coh_offset[
j] + semi_res->nfreqs <= coh_res[
j]->nfreqs,
XLAL_EFAILED,
"Coherent offset (%u) + number of semicoherent frequency bins (%u) > number of coherent frequency bins (%u)", coh_offset[
j], semi_res->nfreqs, coh_res[
j]->nfreqs );
810 semi_res->coh_index[
j] = coh_index[
j];
813 semi_res->coh_phys[
j] = coh_res[
j]->coh_phys;
814 semi_res->coh_phys[
j].fkdot[0] += semi_res->dfreq * coh_offset[
j];
825 if ( semi_res->coh2F_CUDA != NULL ) {
826 for (
size_t j = 0;
j < nsegments; ++
j ) {
828 semi_res->coh2F_CUDA[
j] = coh_res[
j]->coh2F_CUDA.data + coh_offset[
j];
831 for (
size_t j = 0;
j < nsegments; ++
j ) {
833 semi_res->coh2F[
j] = coh_res[
j]->coh2F->data + coh_offset[
j];
840 for (
size_t i = 0;
i < semi_res->ndetectors; ++
i ) {
841 for (
size_t j = 0;
j < nsegments; ++
j ) {
842 semi_res->coh2F_det[
i][
j] = ( coh_res[
j]->coh2F_det[
i] != NULL ) ? coh_res[
j]->coh2F_det[
i]->
data + coh_offset[
j] : NULL;
852 if ( semi_res->coh2F_CUDA != NULL ) {
853#ifdef LALPULSAR_CUDA_ENABLED
864 memcpy( semi_res->max2F->data, semi_res->coh2F[0],
sizeof( semi_res->max2F->data[0] ) * semi_res->nfreqs );
865 for (
size_t j = 1;
j < nsegments; ++
j ) {
877 for (
size_t i = 0;
i < semi_res->ndetectors; ++
i ) {
878 memset( semi_res->max2F_det[
i]->data, 0,
sizeof( semi_res->max2F_det[
i]->data[0] ) * semi_res->nfreqs );
879 for (
size_t j = 0;
j < nsegments; ++
j ) {
880 if ( coh_res[
j]->coh2F_det[
i] != NULL ) {
892 if ( semi_res->coh2F_CUDA != NULL ) {
893#ifdef LALPULSAR_CUDA_ENABLED
904 memcpy( semi_res->sum2F->data, semi_res->coh2F[0],
sizeof( semi_res->sum2F->data[0] ) * semi_res->nfreqs );
905 for (
size_t j = 1;
j < nsegments; ++
j ) {
916 for (
size_t i = 0;
i < semi_res->ndetectors; ++
i ) {
918 memset( semi_res->sum2F_det[
i]->data, 0,
sizeof( semi_res->sum2F_det[
i]->data[0] ) * semi_res->nfreqs );
920 for (
size_t j = 0;
j < nsegments; ++
j ) {
921 if ( coh_res[
j]->coh2F_det[
i] != NULL ) {
942 WeaveSemiResults *semi_res,
943 WeaveSearchTiming *tim
960 const REAL4 *sum2F = semi_res->sum2F != NULL ? semi_res->sum2F->data : NULL;
962 for (
size_t i = 0;
i < semi_res->ndetectors; ++
i ) {
963 sum2F_det[
i] = semi_res->sum2F_det[
i] != NULL ? semi_res->sum2F_det[
i]->data : NULL;
965 const REAL4 *max2F = semi_res->max2F != NULL ? semi_res->max2F->data : NULL;
967 for (
size_t i = 0;
i < semi_res->ndetectors; ++
i ) {
968 max2F_det[
i] = semi_res->max2F_det[
i] != NULL ? semi_res->max2F_det[
i]->data : NULL;
1018 WeaveSemiResults *semi_res
1021 if ( semi_res == NULL ) {
1028#ifdef LALPULSAR_CUDA_ENABLED
1029 cudaFree( semi_res->coh2F_CUDA );
1032#ifdef LALPULSAR_CUDA_ENABLED
1033 if ( semi_res->max2F != NULL ) {
1034 if ( semi_res->max2F->data != NULL ) {
1035 cudaFree( semi_res->max2F->data );
1039 if ( semi_res->sum2F != NULL ) {
1040 if ( semi_res->sum2F->data != NULL ) {
1041 cudaFree( semi_res->sum2F->data );
1071 WeaveCohResults *coh_res,
1072 const WeaveCohInput *coh_input
1082 ( *coh2F ) = coh_res->coh2F;
1083 ( *have_coh2F_det ) = 0;
1085 ( *have_coh2F_det ) = 1;
1088 for (
UINT4 i = 0;
i < coh_input->Fstat_ndetectors; ++
i ) {
1089 const size_t idx = coh_input->Fstat_res_idx[
i];
1090 coh2F_det[idx] = coh_res->coh2F_det[idx];
1100 const WeaveSemiResults *semi_res,
1101 const UINT4 freq_idx
1110 if ( semi_res->coh2F_CUDA != NULL ) {
1111#ifdef LALPULSAR_CUDA_ENABLED
1112 for (
size_t j = 0;
j < semi_res->nsegments; ++
j ) {
1113 if ( semi_res->coh2F_CUDA[
j] != NULL ) {
1114 XLAL_CHECK_CUDA_CALL( cudaMemcpy( (
void * )&coh2F[
j], &semi_res->coh2F_CUDA[
j][freq_idx],
sizeof( coh2F[
j] ), cudaMemcpyDeviceToHost ) );
1123 for (
size_t j = 0;
j < semi_res->nsegments; ++
j ) {
1124 if ( semi_res->coh2F[
j] != NULL ) {
1125 coh2F[
j] = semi_res->coh2F[
j][freq_idx];
void XLALWeaveCohResultsDestroy(WeaveCohResults *coh_res)
Destroy coherent results.
int XLALWeaveSemiResultsComputeMain(WeaveSemiResults *semi_res, WeaveSearchTiming *tim)
Compute all remaining toplist-ranking semicoherent statistics (ie 'mainloop-statistics').
void XLALWeaveCohInputDestroy(WeaveCohInput *coh_input)
Destroy coherent input data.
int XLALWeaveCohInputWriteInfo(FITSFile *file, const size_t ncoh_input, WeaveCohInput *const *coh_input)
Write various information from coherent input data to a FITS file.
int XLALWeaveCohInputWriteSegInfo(FITSFile *file, const size_t ncoh_input, WeaveCohInput *const *coh_input)
Write various segment information from coherent input data to a FITS file.
const UINT4 alignment
Aligned arrays use maximum required alignment, i.e. 32 bytes for AVX.
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)
Create and initialise semicoherent results.
void XLALWeaveSemiResultsDestroy(WeaveSemiResults *semi_res)
Destroy final semicoherent results.
#define XLAL_CHECK_CUDA_CALL(...)
int XLALWeaveCohResultsExtract(REAL4Vector **coh2F, REAL4Vector *coh2F_det[PULSAR_MAX_DETECTORS], BOOLEAN *have_coh2F_det, WeaveCohResults *coh_res, const WeaveCohInput *coh_input)
Simple API function to extract pointers to 2F results from WeaveCohResults.
int XLALWeaveCohResultsCompute(WeaveCohResults **coh_res, WeaveCohInput *coh_input, const PulsarDopplerParams *coh_phys, const UINT4 coh_nfreqs, WeaveSearchTiming *tim)
Create and compute coherent results.
WeaveCohInput * XLALWeaveCohInputCreate(const LALStringVector *setup_detectors, const WeaveSimulationLevel simulation_level, const SFTCatalog *sft_catalog, const UINT4 segment_index, const LALSeg *segment, const PulsarDopplerParams *min_phys, const PulsarDopplerParams *max_phys, const double dfreq, const EphemerisData *ephemerides, const LALStringVector *sft_noise_sqrtSX, const LALStringVector *Fstat_assume_sqrtSX, FstatOptionalArgs *Fstat_opt_args, WeaveStatisticsParams *statistics_params, BOOLEAN recalc_stage)
Create coherent input data.
int XLALWeaveSemiCoh2FExtract(REAL4 *coh2F, const WeaveSemiResults *semi_res, const UINT4 freq_idx)
Extract 2F results from WeaveSemiResults; handles results stores in CUDA device memory.
int XLALWeaveSemiResultsComputeSegs(WeaveSemiResults *semi_res, const UINT4 nsegments, const WeaveCohResults **coh_res, const UINT8 *coh_index, const UINT4 *coh_offset, WeaveSearchTiming *tim)
Add a new set of coherent results to the semicoherent results.
Module which computes coherent and semicoherent results.
int XLALVectorsAddREAL4CUDA(REAL4 *sum, const REAL4 **vec, const size_t nvec, const size_t nbin)
Add nvec vectors in vec[], of length nbin, and return the result in sum.
int XLALVectorsMaxREAL4CUDA(REAL4 *max, const REAL4 **vec, const size_t nvec, const size_t nbin)
Find the maximum of nvec vectors in vec[], of length nbin, and return the result in max.
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 XLALFITSTableOpenWrite(FITSFile UNUSED *file, const CHAR UNUSED *name, const CHAR UNUSED *comment)
int XLALFITSHeaderWriteREAL4(FITSFile UNUSED *file, const CHAR UNUSED *key, const REAL4 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSHeaderWriteString(FITSFile UNUSED *file, const CHAR UNUSED *key, const CHAR UNUSED *value, const CHAR UNUSED *comment)
int XLALWeaveSearchTimingStatistic(WeaveSearchTiming *tim, const WeaveStatisticType prev_statistic, const WeaveStatisticType next_statistic)
Change the search statistic currently being timed.
@ WEAVE_SIMULATE
Simulate search (implicitly with full memory allocation)
@ WEAVE_SIMULATE_MIN_MEM
Simulate search with minimal memory allocation.
enum tagWeaveSimulationLevel WeaveSimulationLevel
enum tagWeaveStatisticType WeaveStatisticType
const UserChoices WeaveStatisticChoices
User input choices for all supported statistics.
@ WEAVE_STATISTIC_COH2F
Per segment multi-detector F-statistic.
@ WEAVE_STATISTIC_COH2F_DET
Per segment per-detector F-statistic.
@ WEAVE_STATISTIC_BtSGLtL
(transient-)line robust log10(B_tS/GLtL) statistic
@ WEAVE_STATISTIC_SUM2F_DET
Per detector sum F-statistic.
@ WEAVE_STATISTIC_MAX2F_DET
@ 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.
const MultiLALDetector * XLALGetFstatInputDetectors(const FstatInput *input)
Returns the detector information stored in a FstatInput structure.
const CHAR * XLALGetFstatInputMethodName(const FstatInput *input)
Returns the human-readable name of the -statistic method being used by a FstatInput structure.
int XLALGetFstatInputSFTBand(const FstatInput *input, REAL8 *minFreqFull, REAL8 *maxFreqFull)
Returns the frequency band loaded from input SFTs.
int XLALGetFstatTiming(const FstatInput *input, FstatTimingGeneric *timingGeneric, FstatTimingModel *timingModel)
Return measured values and details about generic F-statistic timing and method-specific timing model,...
void XLALDestroyFstatInput(FstatInput *input)
Free all memory associated with a FstatInput structure.
#define TIMING_MODEL_MAX_VARS
FstatQuantities
Bit-field of -statistic quantities which can be computed by XLALComputeFstat().
FstatInput * XLALCreateFstatInput(const SFTCatalog *SFTcatalog, const REAL8 minCoverFreq, const REAL8 maxCoverFreq, const REAL8 dFreq, const EphemerisData *ephemerides, const FstatOptionalArgs *optionalArgs)
Create a fully-setup FstatInput structure for computing the -statistic using XLALComputeFstat().
int XLALComputeFstat(FstatResults **Fstats, FstatInput *input, const PulsarDopplerParams *doppler, const UINT4 numFreqBins, const FstatQuantities whatToCompute)
Compute the -statistic over a band of frequencies.
@ FSTATQ_2F
Compute multi-detector .
@ FSTATQ_2F_CUDA
Compute multi-detector , store results on CUDA GPU (CUDA implementation of Resamp only).
@ FSTATQ_2F_PER_DET
Compute for each detector.
int XLALParseMultiNoiseFloorMapped(MultiNoiseFloor *multiNoiseFloor, const LALStringVector *multiNoiseFloorDetNames, const LALStringVector *sqrtSX, const LALStringVector *sqrtSXDetNames)
Parse string-vectors (typically input by user) of N detector noise-floors for detectors ,...
#define XLAL_FITS_TABLE_COLUMN_BEGIN(record_type)
#define XLAL_FITS_TABLE_COLUMN_ADD_NAMED(file, type, field, col_name)
#define XLAL_FITS_TABLE_COLUMN_ADD(file, type, field)
struct tagFITSFile FITSFile
Representation of a FITS file.
#define XLAL_INIT_DECL(var,...)
void * XLALMalloc(size_t n)
void * XLALCalloc(size_t m, size_t n)
int XLALStringCaseCompare(const char *s1, const char *s2)
int XLALVectorComputeBSGLtL(REAL4 *outBSGLtL, const REAL4 *twoF, const REAL4 *twoFPerDet[PULSAR_MAX_DETECTORS], const REAL4 *maxTwoFSegPerDet[PULSAR_MAX_DETECTORS], const UINT4 len, const BSGLSetup *setup)
int XLALVectorComputeBSGL(REAL4 *outBSGL, const REAL4 *twoF, const REAL4 *twoFPerDet[PULSAR_MAX_DETECTORS], const UINT4 len, const BSGLSetup *setup)
int XLALVectorComputeBtSGLtL(REAL4 *outBtSGLtL, const REAL4 *maxTwoFSeg, const REAL4 *twoFPerDet[PULSAR_MAX_DETECTORS], const REAL4 *maxTwoFSegPerDet[PULSAR_MAX_DETECTORS], const UINT4 len, const BSGLSetup *setup)
#define PULSAR_MAX_DETECTORS
maximal number of detectors we can handle (for static arrays of detector quantities)
void XLALDestroyMultiSFTCatalogView(MultiSFTCatalogView *multiView)
Destroys a MultiSFTCatalogView, without freeing the original catalog that the 'view' was referring to...
CHAR * XLALGetChannelPrefix(const CHAR *name)
Find the valid CW detector prefix.
MultiSFTCatalogView * XLALGetMultiSFTCatalogView(const SFTCatalog *catalog)
Return a MultiSFTCatalogView generated from an input SFTCatalog.
LALStringVector * XLALListIFOsInCatalog(const SFTCatalog *catalog)
Return a sorted string vector listing the unique IFOs in the given catalog.
int XLALSFTCatalogTimeslice(SFTCatalog *slice, const SFTCatalog *catalog, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS)
Set a SFT catalog 'slice' to a timeslice of a larger SFT catalog 'catalog', with entries restricted t...
void XLALDestroyStringVector(LALStringVector *vect)
char * XLALConcatStringVector(const LALStringVector *strings, const char *sep)
INT4 XLALFindStringInVector(const char *needle, const LALStringVector *haystack)
void XLALDestroyREAL4Vector(REAL4Vector *vector)
REAL4Vector * XLALResizeREAL4Vector(REAL4Vector *vector, UINT4 length)
int XLALVectorScaleREAL4(REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len)
void XLALDestroyREAL4VectorAligned(REAL4VectorAligned *in)
int XLALVectorMaxREAL4(REAL4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
int XLALVectorAddREAL4(REAL4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
REAL4VectorAligned * XLALResizeREAL4VectorAligned(REAL4VectorAligned *in, const UINT4 length, const UINT4 align)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_MAIN(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_NULL(assertion,...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
Struct of optional 'advanced level' and (potentially method-specific) arguments to be passed to the ...
MultiNoiseFloor * injectSqrtSX
Single-sided PSD values for fake Gaussian noise to be added to SFT data.
MultiNoiseFloor * assumeSqrtSX
Single-sided PSD values to be used for computing SFT noise weights instead of from a running median o...
FstatInput * prevInput
An FstatInput structure from a previous call to XLALCreateFstatInput(); may contain common workspace ...
BOOLEAN collectTiming
a flag to turn on/off the collection of F-stat-method-specific timing-data
XLALComputeFstat() computed results structure.
UINT4 numDetectors
Number of detectors over which the were computed.
REAL4 * twoFPerDet[PULSAR_MAX_DETECTORS]
If whatWasComputed & FSTATQ_2F_PER_DET is true, the values computed at numFreqBins frequencies space...
REAL4 * twoF_CUDA
If whatWasComputed & FSTATQ_2F_CUDA is true, the multi-detector values as for twoF,...
UINT4 numFreqBins
Number of frequencies at which the were computed.
REAL4 * twoF
If whatWasComputed & FSTATQ_2F is true, the multi-detector values computed at numFreqBins frequencie...
Generic F-stat timing coefficients (times in seconds) [see https://dcc.ligo.org/LIGO-T1600531-v4 for ...
Struct to carry the -statistic method-specific timing model in terms of a list of variable names and...
array of detectors definitions 'LALDetector'
UINT4 length
number of detectors
LALDetector sites[PULSAR_MAX_DETECTORS]
array of site information
array of detector-specific 'noise floors' (ie PSD values), assumed constant over the frequency-band o...
A multi-SFT-catalogue "view": a multi-IFO vector of SFT-catalogs.
SFTCatalog * data
array of SFT-catalog pointers
UINT4 length
number of detectors
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.
LIGOTimeGPS refTime
Reference time of pulsar parameters (in SSB!)
Contains a "spin-range", ie spins and corresponding bands at a given (SSB) reference GPS-time .
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
SFTDescriptor * data
array of data-entries describing matched SFTs
UINT4 length
number of SFTs in catalog
SFTtype header
SFT-header info.
REAL8 sft_max_freq
Maximum of frequency range loaded from SFTs.
REAL8 sft_min_freq
Minimum of frequency range loaded from SFTs.
LIGOTimeGPS segment_start
Start time of segment.
LIGOTimeGPS segment_end
End time of segment.
Results of a coherent computation on a single segment.
UINT4 nfreqs
Number of frequencies.
REAL4Vector * coh2F_det[PULSAR_MAX_DETECTORS]
Per-detector F-statistics per frequency.
REAL4Vector coh2F_CUDA
Multi-detector F-statistics per frequency, stored in CUDA device memory.
REAL4Vector * coh2F
Multi-detector F-statistics per frequency.
PulsarDopplerParams coh_phys
Coherent template parameters of the first frequency bin.