27#include <lal/UserInput.h>
28#include <lal/SFTfileIO.h>
29#include <lal/LogPrintf.h>
30#include <lal/DopplerScan.h>
31#include <lal/DetectorStates.h>
32#include <lal/ExtrapolatePulsarSpins.h>
33#include <lal/LALInitBarycenter.h>
34#include <lal/NormalizeSFTRngMed.h>
35#include <lal/LALString.h>
36#include <lal/PulsarCrossCorr_v2.h>
37#include <lal/LALPulsarVCSInfo.h>
40#include <lal/LatticeTiling.h>
41#include <lal/TascPorbTiling.h>
61typedef struct tagUserInput_t {
74 REAL8 orbitAsiniSecBand;
78 REAL8 orbitTimeAscBand;
93 CHAR *linesToCleanFilenames;
94 CHAR *pairListInputFilename;
95 CHAR *pairListOutputFilename;
96 CHAR *resampPairListOutputFilename;
97 CHAR *sftListOutputFilename;
98 CHAR *tShortListOutputFilename;
99 CHAR *sftListInputFilename;
100 CHAR *gammaAveOutputFilename;
101 CHAR *resampGammaAveOutputFilename;
102 CHAR *gammaCircOutputFilename;
103 CHAR *resampGammaCircOutputFilename;
104 CHAR *toplistFilename;
113 REAL8 allowedMismatchFromSFTLength;
120 REAL8 unresolvedPorbMismatch;
121 BOOLEAN reallocatePorbMismatch;
126 REAL8 orbitPSecCenter;
127 REAL8 orbitPSecSigma;
128 REAL8 orbitTimeAscCenter;
129 REAL8 orbitTimeAscSigma;
130 REAL8 orbitTPEllipseRadius;
132 CHAR *LatticeOutputFilename;
137typedef struct tagConfigVariables {
156#define MAXFILENAMELENGTH 512
157#define MAXLINELENGTH 1024
159#define SQR(x) ((x)*(x))
161#define MYMAX(x,y) ( (x) > (y) ? (x) : (y) )
162#define MYMIN(x,y) ( (x) < (y) ? (x) : (y) )
163#define USE_ALIGNED_MEMORY_ROUTINES
169int GetNextCrossCorrTemplate(
BOOLEAN *binaryParamsFlag,
BOOLEAN *firstPoint,
PulsarDopplerParams *dopplerpos,
PulsarDopplerParams *binaryTemplateSpacings,
PulsarDopplerParams *minBinaryTemplate,
PulsarDopplerParams *maxBinaryTemplate,
UINT8 *fCount,
UINT8 *aCount,
UINT8 *tCount,
UINT8 *pCount,
UINT8 fSpacingNum,
UINT8 aSpacingNum,
UINT8 tSpacingNum,
UINT8 pSpacingNum,
ConfigVariables *config );
172int demodLoopCrossCorr(
MultiSSBtimes *multiBinaryTimes,
MultiSSBtimes *multiSSBTimes,
PulsarDopplerParams dopplerpos,
BOOLEAN dopplerShiftFlag,
PulsarDopplerParams binaryTemplateSpacings,
PulsarDopplerParams minBinaryTemplate,
PulsarDopplerParams maxBinaryTemplate,
UINT8 fCount,
UINT8 aCount,
UINT8 tCount,
UINT8 pCount,
UINT8 fSpacingNum,
UINT8 aSpacingNum,
UINT8 tSpacingNum,
UINT8 pSpacingNum,
REAL8Vector *shiftedFreqs,
UINT4Vector *lowestBins,
COMPLEX8Vector *expSignalPhases,
REAL8VectorSequence *sincList,
UserInput_t uvar,
SFTIndexList *sftIndices,
MultiSFTVector *inputSFTs,
MultiUINT4Vector *badBins,
REAL8 Tsft,
MultiNoiseWeights *multiWeights,
REAL8 ccStat,
REAL8 evSquared,
REAL8 estSens,
REAL8Vector *GammaAve,
SFTPairIndexList *sftPairs,
CrossCorrBinaryOutputEntry thisCandidate,
toplist_t *ccToplist,
int DEMODndim,
int DEMODdimf,
int DEMODdima,
int DEMODdimT,
int DEMODdimP, gsl_matrix *metric_ij,
int *DEMODnumpoints,
int *DEMODnumorb,
ConfigVariables *config );
174int resampForLoopCrossCorr(
PulsarDopplerParams dopplerpos,
BOOLEAN dopplerShiftGlag,
PulsarDopplerParams binaryTemplateSpacings,
PulsarDopplerParams minBinaryTemplate,
PulsarDopplerParams maxBinaryTemplate,
UINT8 fCount,
UINT8 aCount,
UINT8 tCount,
UINT8 pCount,
UINT8 fSpacingNum,
UINT8 aSpacingNum,
UINT8 tSpacingNum,
UINT8 pSpacingNum,
UserInput_t uvar,
MultiNoiseWeights *multiWeights,
UINT4 *numSamplesFFT,
REAL8Vector *ccStatVector,
REAL8Vector *evSquaredVector,
REAL8Vector *numeEquivAve,
REAL8Vector *numeEquivCirc,
REAL8 estSens,
REAL8Vector *resampGammaAve,
MultiResampSFTPairMultiIndexList *resampMultiPairs,
CrossCorrBinaryOutputEntry thisCandidate,
toplist_t *ccToplist,
REAL8 tShort,
ConfigVariables *config );
175int testShortFunctionsBlock(
UserInput_t uvar,
MultiSFTVector *inputSFTs,
REAL8 Tsft,
REAL8 resampTshort,
SFTIndexList **sftIndices,
SFTPairIndexList **sftPairs,
REAL8Vector **GammaAve,
REAL8Vector **GammaCirc,
MultiResampSFTPairMultiIndexList **resampMultiPairs,
MultiLALDetector *multiDetectors,
MultiDetectorStateSeries **multiStates,
MultiDetectorStateSeries **resampMultiStates,
MultiNoiseWeights **multiWeights,
MultiLIGOTimeGPSVector **multiTimes,
MultiLIGOTimeGPSVector **resampMultiTimes,
MultiSSBtimes **multiSSBTimes,
REAL8VectorSequence **phaseDerivs, gsl_matrix **g_ij, gsl_vector **eps_i,
REAL8 estSens,
SkyPosition *skypos,
PulsarDopplerParams *dopplerpos,
PulsarDopplerParams *thisBinaryTemplate,
ConfigVariables config,
const DopplerCoordinateSystem coordSys );
180int main(
int argc,
char *argv[] )
226 LIGOTimeGPS computingStartGPSTime, computingEndGPSTime;
255 REAL8 resampTshort = uvar.maxLag;
257 resampTshort = uvar.tShort;
258 printf(
"Using tShort: %f\n", resampTshort );
261 printf(
"Warning! Please note that tShort is designed to be used with resampling flag, --resamp TRUE\n" );
262 printf(
"Proceeding without resampling...\n" );
263 if ( uvar.treatWarningsAsErrors ) {
264 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
268 if ( ( uvar.resamp ==
TRUE ) && ( uvar.testResampNoTShort ==
TRUE ) ) {
272 printf(
"Caution: test mode with no tShort detected with resampling. Please note,...\n results may be inconsistent when data contains gaps,...\n for which tShort is recommended.\n" );
274 if ( ( uvar.resamp ==
FALSE ) && ( uvar.testResampNoTShort ==
TRUE ) ) {
275 printf(
"Warning! testResampNoTShort should only be used with --resamp TRUE\n" );
276 printf(
"Proceeding, but unexpected behavior may follow...\n" );
277 if ( uvar.treatWarningsAsErrors ) {
278 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
282 if ( !( ( uvar.resamp ==
TRUE ) && ( uvar.testResampNoTShort ==
FALSE ) ) && ( uvar.testShortFunctions ==
TRUE ) ) {
283 printf(
"Warning! testShortFunctions should only be used with --resamp TRUE\n" );
284 printf(
"Proceeding, but unexpected behavior may follow...\n" );
285 if ( uvar.treatWarningsAsErrors ) {
286 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
290 if ( ( uvar.resamp ==
FALSE ) && ( uvar.alignTShorts ==
TRUE ) ) {
291 printf(
"Warning! alignTShorts should only be used with --resamp TRUE\n" );
292 printf(
"Proceeding without resampling...\n" );
293 if ( uvar.treatWarningsAsErrors ) {
294 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
298 if ( ( uvar.resamp ==
FALSE ) && ( uvar.accurateResampMetric ==
TRUE ) ) {
299 printf(
"Warning! accurateResampMetric should only be used with --resamp TRUE\n" );
300 printf(
"Proceeding without resampling...\n" );
301 if ( uvar.treatWarningsAsErrors ) {
302 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
306 UINT4 numShortPerDet = 0;
313 LogPrintf(
LOG_CRITICAL,
"spacingF and mismatchF are both set, use spacingF %.9g by default\n\n", uvar.spacingF );
316 LogPrintf(
LOG_CRITICAL,
"spacingA and mismatchA are both set, use spacingA %.9g by default\n\n", uvar.spacingA );
319 LogPrintf(
LOG_CRITICAL,
"spacingT and mismatchT are both set, use spacingT %.9g by default\n\n", uvar.spacingT );
322 LogPrintf(
LOG_CRITICAL,
"spacingP and mismatchP are both set, use spacingP %.9g by default\n\n", uvar.spacingP );
325 if ( uvar.useLattice ==
FALSE ) {
327 LogPrintf(
LOG_CRITICAL,
"neither spacingF nor mismatchF was set, using mismatchF %.9g by default\n\n", uvar.mismatchF );
328 if ( uvar.treatWarningsAsErrors ) {
329 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
334 LogPrintf(
LOG_CRITICAL,
"neither spacingA nor mismatchA was set, using mismatchA %.9g by default\n\n", uvar.mismatchA );
335 if ( uvar.treatWarningsAsErrors ) {
336 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
341 LogPrintf(
LOG_CRITICAL,
"neither spacingT nor mismatchT was set, using mismatchT %.9g by default\n\n", uvar.mismatchT );
342 if ( uvar.treatWarningsAsErrors ) {
343 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
348 LogPrintf(
LOG_CRITICAL,
"neither spacingP nor mismatchP was set, using mismatchP %.9g by default\n\n", uvar.mismatchP );
349 if ( uvar.treatWarningsAsErrors ) {
350 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
356 if ( uvar.resamp ==
TRUE && uvar.useLattice ==
TRUE ) {
357 printf(
"Error! LatticeTiling placement not yet implemented with resampling\n" );
361 if ( uvar.useLattice ==
TRUE
362 && uvar.mismatchMax < uvar.unresolvedPorbMismatch ) {
363 printf(
"Error! Unresolved P threshold (%g) exceeds max mismatch (%g)",
364 uvar.unresolvedPorbMismatch, uvar.mismatchMax );
435 fMin = uvar.fStart * ( 1 - vMax ) - 0.5 * uvar.rngMedBlock *
deltaF;
436 fMax = ( uvar.fStart + uvar.fBand ) * ( 1 + vMax ) + 0.5 * uvar.rngMedBlock *
deltaF;
466 MFDparams.fMin = sft->
f0;
468 MFDparams.multiIFO = multiDetectors;
469 MFDparams.multiTimestamps = multiTimes;
471 MFDparams.multiNoiseFloor.
length = multiDetectors.
length;
511 skyPos.longitude = uvar.alphaRad;
512 skyPos.latitude = uvar.deltaRad;
515 if ( ( uvar.resamp ==
TRUE ) && ( uvar.testResampNoTShort ==
FALSE ) ) {
521 if ( ( resampMultiWeights =
XLALModifyMultiWeights( multiWeights, resampTshort,
Tsft, numShortPerDet, multiTimes ) ) == NULL ) {
537 if ( ( uvar.resamp ==
FALSE ) || ( uvar.accurateResampMetric ==
TRUE ) ) {
556#define PCC_SFTPAIR_HEADER "# The length of SFT-pair list is %u #\n"
557#define PCC_SFTPAIR_BODY "%u %u\n"
558#define PCC_SFT_HEADER "# The length of SFT list is %u #\n"
559#define PCC_SFT_BODY "%s %d %d\n"
563 if ( uvar.resamp ==
TRUE ) {
564 LogPrintf(
LOG_CRITICAL,
"Error! Reading pair list from input file not supported with resampling.\n" );
567 if ( ( sftPairs =
XLALCalloc( 1,
sizeof( sftPairs ) ) ) == NULL ) {
570 if ( (
fp = fopen( uvar.pairListInputFilename,
"r" ) ) == NULL ) {
584 for (
j = 0;
j < sftPairs->
length;
j++ ) {
592 if ( uvar.resamp ==
TRUE ) {
593 if ( uvar.testResampNoTShort ==
FALSE ) {
599 if ( uvar.accurateResampMetric ==
TRUE ) {
608 tShortIndices = resampMultiPairs->
indexList;
624 if ( (
fp = fopen( uvar.pairListOutputFilename,
"w" ) ) == NULL ) {
628 if ( sftPairs == NULL ) {
629 LogPrintf(
LOG_CRITICAL,
"No pair list available to write (are you using --resamp without --accurateResampMetric?)" );
630 if ( uvar.treatWarningsAsErrors ) {
631 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
636 for (
j = 0;
j < sftPairs->
length;
j++ ) {
642 if ( (
fp = fopen( uvar.resampPairListOutputFilename,
"w" ) ) == NULL ) {
646 if ( tShortPairs == NULL ) {
648 if ( uvar.treatWarningsAsErrors ) {
649 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
654 for (
j = 0;
j < tShortPairs->
length;
j++ ) {
661 if ( (
fp = fopen( uvar.sftListOutputFilename,
"w" ) ) == NULL ) {
672 if ( (
fp = fopen( uvar.sftListInputFilename,
"r" ) ) == NULL ) {
686 INT4 checkGPS[numofsft], checkGPSns[numofsft];
688 for (
j = 0;
j < numofsft;
j++ ) {
709 if ( (
fp = fopen( uvar.tShortListOutputFilename,
"w" ) ) == NULL ) {
714 for (
j = 0;
j < tShortIndices->
length;
j++ ) {
724#define PCC_LINEFILE_HEADER "%% %2s lines cleaning file for %s\n"\
726"%% File contains %d (non-comment) lines\n"\
728"%% Column 1 - frequency spacing (Hz) of comb (or frequency of single line)\n"\
729"%% Column 2 - comb type (0 - singlet, 1 - comb with fixed width, 2 - comb with scaling width)\n"\
730"%% Column 3 - frequency offset of 1st visible harmonic (Hz)\n"\
731"%% Column 4 - index of first visible harmonic\n"\
732"%% Column 5 - index of last visible harmonic\n"\
733"%% Column 6 - width of left band (Hz)\n"\
734"%% Column 7 - width of right band (Hz)\n"\
736"%% For fixed-width combs, veto the band:\n"\
737"%% [offset+index*spacing-leftwidth, offset+index*spacing+rightwidth]\n"\
738"%% For scaling-width combs, veto the band:\n"\
739"%% [offset+index*spacing-index*leftwidth, offset+index*spacing+index*rightwidth]\n"\
741#define PCC_LINEFILE_BODY "%lf %d %lf %d %d %lf %lf"
744 if ( ( badBins =
XLALCalloc( 1,
sizeof( badBins ) ) ) == NULL ) {
748 badBins->
length = numDets;
769 for ( ; detInd < numDets ; detInd++ ) {
774 if ( detInd >= numDets ) {
798 while ( fgets( thisline,
sizeof thisline,
fp ) ) {
799 if ( thisline[0] ==
'%' ) {
805 UINT4 firstindex, lastindex;
806 REAL8 leftwidth, rightwidth;
807 UINT4 numRead = sscanf( thisline,
PCC_LINEFILE_BODY, &spacing, &combtype, &offset, &firstindex, &lastindex, &leftwidth, &rightwidth );
808 if ( numRead != 7 ) {
813 switch ( combtype ) {
815 if ( firstindex != lastindex ) {
819 binCount =
XLALFindBadBins( badBins->
data[detInd], binCount, offset + firstindex * spacing - leftwidth, offset + lastindex * spacing + rightwidth,
f0,
deltaF, numSFTFreqs );
820 if ( binCount < 0 ) {
827 if ( firstindex > lastindex ) {
831 for (
UINT4 index0 = firstindex ; index0 <= lastindex; index0++ ) {
832 binCount =
XLALFindBadBins( badBins->
data[detInd], binCount, offset + index0 * spacing - leftwidth, offset + index0 * spacing + rightwidth,
f0,
deltaF, numSFTFreqs );
833 if ( binCount < 0 ) {
841 if ( firstindex > lastindex ) {
845 for (
UINT4 index0 = firstindex ; index0 <= lastindex; index0++ ) {
846 binCount =
XLALFindBadBins( badBins->
data[detInd], binCount, offset + index0 * spacing - index0 * leftwidth, offset + index0 * spacing + index0 * rightwidth,
f0,
deltaF, numSFTFreqs );
847 if ( binCount < 0 ) {
861 if ( linesRead != numLines ) {
865 if ( binCount == 0 ) {
867 badBins->
data[detInd] = NULL;
886 if ( ( uvar.resamp ==
FALSE ) || ( uvar.accurateResampMetric ==
TRUE ) ) {
891 if ( uvar.resamp ==
TRUE ) {
902 }
else if ( uvar.testResampNoTShort ==
TRUE ) {
919#define PCC_GAMMA_HEADER "# The normalization Sinv_Tsft is %g #\n"
920#define PCC_GAMMA_BODY "%.10g\n"
922 if ( (
fp = fopen( uvar.gammaAveOutputFilename,
"w" ) ) == NULL ) {
927 for (
j = 0;
j < sftPairs->
length;
j++ ) {
933 if ( (
fp = fopen( uvar.resampGammaAveOutputFilename,
"w" ) ) == NULL ) {
938 for (
j = 0;
j < tShortPairs->
length;
j++ ) {
944 if ( (
fp = fopen( uvar.gammaCircOutputFilename,
"w" ) ) == NULL ) {
949 for (
j = 0;
j < sftPairs->
length;
j++ ) {
955 if ( (
fp = fopen( uvar.resampGammaCircOutputFilename,
"w" ) ) == NULL ) {
960 for (
j = 0;
j < tShortPairs->
length;
j++ ) {
973 minBinaryTemplate.
argp = 0.0;
974 minBinaryTemplate.
asini = uvar.orbitAsiniSec;
975 minBinaryTemplate.
ecc = 0.0;
977 minBinaryTemplate.
fkdot[0] = uvar.fStart;
979 XLALGPSSetREAL8( &maxBinaryTemplate.
tp, uvar.orbitTimeAsc + uvar.orbitTimeAscBand );
980 maxBinaryTemplate.
argp = 0.0;
981 maxBinaryTemplate.
asini = uvar.orbitAsiniSec + uvar.orbitAsiniSecBand;
982 maxBinaryTemplate.
ecc = 0.0;
984 maxBinaryTemplate.
fkdot[0] = uvar.fStart + uvar.fBand;
986 XLALGPSSetREAL8( &thisBinaryTemplate.
tp, uvar.orbitTimeAsc + 0.5 * uvar.orbitTimeAscBand );
987 thisBinaryTemplate.
argp = 0.0;
988 thisBinaryTemplate.
asini = 0.5 * ( minBinaryTemplate.
asini + maxBinaryTemplate.
asini );
989 thisBinaryTemplate.
ecc = 0.0;
990 thisBinaryTemplate.
period = 0.5 * ( minBinaryTemplate.
period + maxBinaryTemplate.
period );
991 thisBinaryTemplate.
fkdot[0] = 0.5 * ( minBinaryTemplate.
fkdot[0] + maxBinaryTemplate.
fkdot[0] );
993 REAL8 old_diagff = 0;
994 REAL8 old_diagaa = 0;
995 REAL8 old_diagTT = 0;
996 REAL8 old_diagpp = 0;
1000 REAL8 weightedMuTAve = 0;
1003 if ( ( uvar.resamp ==
TRUE ) && ( uvar.testResampNoTShort ==
FALSE ) ) {
1004 if ( uvar.accurateResampMetric ==
TRUE ) {
1005 if ( (
XLALCalculateLMXBCrossCorrDiagMetric( &estSens, &old_diagff, &old_diagaa, &old_diagTT, &old_diagpp, &weightedMuTAve, thisBinaryTemplate, GammaAve, sftPairs, sftIndices, inputSFTs, multiWeights ) !=
XLAL_SUCCESS ) ) {
1016 if ( (
XLALCalculateLMXBCrossCorrDiagMetric( &estSens, &old_diagff, &old_diagaa, &old_diagTT, &old_diagpp, &weightedMuTAve, thisBinaryTemplate, GammaAve, sftPairs, sftIndices, inputSFTs, multiWeights ) !=
XLAL_SUCCESS ) ) {
1024 dopplerpos.Alpha = uvar.alphaRad;
1025 dopplerpos.Delta = uvar.deltaRad;
1026 dopplerpos.fkdot[0] = minBinaryTemplate.
fkdot[0];
1029 dopplerpos.fkdot[
k] = 0.0;
1031 dopplerpos.asini = minBinaryTemplate.
asini;
1032 dopplerpos.period = minBinaryTemplate.
period;
1033 dopplerpos.tp = minBinaryTemplate.
tp;
1034 dopplerpos.ecc = minBinaryTemplate.
ecc;
1035 dopplerpos.argp = minBinaryTemplate.
argp;
1039 if ( ( uvar.resamp ==
FALSE ) || ( uvar.accurateResampMetric ==
TRUE ) ) {
1051 if ( uvar.resamp ==
FALSE ) {
1087 if ( ( uvar.resamp ==
FALSE ) || ( uvar.accurateResampMetric ==
TRUE ) ) {
1100 gsl_matrix *g_ij = NULL;
1101 gsl_vector *eps_i = NULL;
1102 REAL8 sumGammaSq = 0;
1103 if ( ( uvar.resamp ==
FALSE ) || ( uvar.accurateResampMetric ==
TRUE ) ) {
1116 if ( ( uvar.resamp ==
TRUE ) && ( uvar.testResampNoTShort ==
FALSE ) && ( uvar.testShortFunctions ==
TRUE ) ) {
1117 testShortFunctionsBlock( uvar, inputSFTs,
Tsft, resampTshort, &sftIndices, &sftPairs, &GammaAve, &GammaCirc, &resampMultiPairs, &multiDetectors, &multiStates, &resampMultiStates, &multiWeights, &multiTimes, &resampMultiTimes, &multiSSBTimes, &phaseDerivs, &g_ij, &eps_i, estSens, &skyPos, &dopplerpos, &thisBinaryTemplate, config, coordSys );
1142 if ( uvar.useShearedPorb ==
TRUE ) {
1143 REAL8 gTT = gsl_matrix_get( g_ij, dimT, dimT );
1144 REAL8 gTP = gsl_matrix_get( g_ij, dimT, dimP );
1145 REAL8 gPP = gsl_matrix_get( g_ij, dimP, dimP );
1151 gsl_matrix_set( g_ij, dimT, dimT, gtildeTT );
1152 gsl_matrix_set( g_ij, dimT, dimP, gtildeTP );
1153 gsl_matrix_set( g_ij, dimP, dimT, gtildeTP );
1156 REAL8 diagff = gsl_matrix_get( g_ij, dimf, dimf );
1157 REAL8 diagaa = gsl_matrix_get( g_ij, dima, dima );
1158 REAL8 diagTT = gsl_matrix_get( g_ij, dimT, dimT );
1159 REAL8 diagpp = gsl_matrix_get( g_ij, dimP, dimP );
1162 dimName->
data[0] =
'T';
1163 dimName->
data[1] =
'p';
1164 dimName->
data[2] =
'a';
1165 dimName->
data[3] =
'f';
1169 binaryTemplateSpacings.
fkdot[0] = uvar.spacingF;
1171 binaryTemplateSpacings.
fkdot[0] = sqrt( uvar.mismatchF / diagff );
1175 binaryTemplateSpacings.
asini = uvar.spacingA;
1177 binaryTemplateSpacings.
asini = sqrt( uvar.mismatchA / diagaa );
1186 binaryTemplateSpacings.
period = uvar.spacingP;
1188 binaryTemplateSpacings.
period = sqrt( uvar.mismatchP / diagpp );
1193 UINT8 fCount = 0, aCount = 0, tCount = 0, pCount = 0;
1194 const UINT8 fSpacingNum = floor( uvar.fBand / binaryTemplateSpacings.
fkdot[0] );
1195 const UINT8 aSpacingNum = floor( uvar.orbitAsiniSecBand / binaryTemplateSpacings.
asini );
1196 const UINT8 tSpacingNum = floor( uvar.orbitTimeAscBand /
XLALGPSGetREAL8( &binaryTemplateSpacings.
tp ) );
1210 minBinaryTemplate.
fkdot[0] = uvar.fStart + 0.5 * ( uvar.fBand - fSpacingNum * binaryTemplateSpacings.
fkdot[0] );
1211 minBinaryTemplate.
asini = uvar.orbitAsiniSec + 0.5 * ( uvar.orbitAsiniSecBand - aSpacingNum * binaryTemplateSpacings.
asini );
1215 dopplerpos.fkdot[0] = minBinaryTemplate.
fkdot[0];
1216 dopplerpos.asini = minBinaryTemplate.
asini;
1217 dopplerpos.tp = minBinaryTemplate.
tp;
1218 dopplerpos.period = minBinaryTemplate.
period;
1220 dopplerpos.period +=
1230 UINT4 numSamplesFFT = 0;
1231 if ( uvar.resamp ==
TRUE ) {
1235 if ( (
resampForLoopCrossCorr( dopplerpos, dopplerShiftFlag, binaryTemplateSpacings, minBinaryTemplate, maxBinaryTemplate, fCount, aCount, tCount, pCount, fSpacingNum, aSpacingNum, tSpacingNum, pSpacingNum, uvar, resampMultiWeights, &numSamplesFFT, ccStatVector, numeEquivAve, numeEquivCirc, evSquaredVector, estSens, resampGammaAve, resampMultiPairs, thisCandidate, ccToplist, resampTshort, &config ) !=
XLAL_SUCCESS ) ) {
1247 if ( (
demodLoopCrossCorr( multiBinaryTimes, multiSSBTimes, dopplerpos, dopplerShiftFlag, binaryTemplateSpacings, minBinaryTemplate, maxBinaryTemplate, fCount, aCount, tCount, pCount, fSpacingNum, aSpacingNum, tSpacingNum, pSpacingNum, shiftedFreqs, lowestBins, expSignalPhases, sincList, uvar, sftIndices, inputSFTs, badBins,
Tsft, multiWeights, ccStat, evSquared, estSens, GammaAve, sftPairs, thisCandidate, ccToplist, ndim, dimf, dima, dimT, dimP, g_ij, &numpoints, &numorb, &config ) !=
XLAL_SUCCESS ) ) {
1278 REAL8 h0Sens = sqrt( ( 10 / sqrt( estSens ) ) );
1285 if ( (
fp = fopen( uvar.logFilename,
"w" ) ) == NULL ) {
1291 fprintf(
fp,
"[CalculatedValues]\n\n" );
1292 if ( config.
norb != 0 ) {
1300 g_lm = gsl_matrix_get( g_ij,
l,
m );
1308 g_lm = gsl_matrix_get( g_ij,
l,
m );
1314 eps_n = gsl_vector_get( eps_i,
n );
1318 fprintf(
fp,
"old_diagff = %.9g\n", old_diagff );
1319 fprintf(
fp,
"old_diagaa = %.9g\n", old_diagaa );
1320 fprintf(
fp,
"old_diagTT = %.9g\n", old_diagTT );
1321 fprintf(
fp,
"old_diagpp = %.9g\n", old_diagpp );
1322 if ( uvar.useShearedPorb ==
TRUE ) {
1330 if ( uvar.useLattice ==
TRUE ) {
1331 fprintf(
fp,
"TemplatenumTotal = %d\n", numpoints );
1332 fprintf(
fp,
"TemplatenumOrb = %d\n", numorb );
1334 fprintf(
fp,
"FSpacing = %.9g\n", binaryTemplateSpacings.
fkdot[0] );
1335 fprintf(
fp,
"ASpacing = %.9g\n", binaryTemplateSpacings.
asini );
1342 fprintf(
fp,
"TemplatenumTotal = %" LAL_UINT8_FORMAT "\n", ( fSpacingNum + 1 ) * ( aSpacingNum + 1 ) * ( tSpacingNum + 1 ) * ( pSpacingNum + 1 ) );
1344 if ( numSamplesFFT > 0 ) {
1347 fprintf(
fp,
"Sens = %.9g\n", estSens );
1348 fprintf(
fp,
"h0_min_SNR10 = %.9g\n", h0Sens );
1349 fprintf(
fp,
"weightedMutAve = %.9f\n", weightedMuTAve );
1354 if ( tShortIndices ) {
1360 if ( tShortPairs ) {
1364 fprintf(
fp,
"Tshort = %.6g\n", resampTshort );
1398 gsl_matrix_free( g_ij );
1399 gsl_vector_free( eps_i );
1416 uvar->inclAutoCorr =
FALSE;
1417 uvar->fStart = 100.0;
1421 uvar->alphaRad = 0.0;
1422 uvar->deltaRad = 0.0;
1423 uvar->refTime = 0.0;
1424 uvar->rngMedBlock = 50;
1426 uvar->resamp =
FALSE;
1430 uvar->orbitAsiniSec = 0.0;
1431 uvar->orbitAsiniSecBand = 0.0;
1432 uvar->orbitPSec = 0.0;
1433 uvar->orbitPSecBand = 0.0;
1434 uvar->orbitTimeAsc = 0;
1435 uvar->orbitTimeAscBand = 0;
1438 uvar->orbitTPEllipseRadius = 3.3;
1443 uvar->mismatchF = 0.1;
1444 uvar->mismatchA = 0.1;
1445 uvar->mismatchT = 0.1;
1446 uvar->mismatchP = 0.1;
1474 uvar->allowedMismatchFromSFTLength = 0.10;
1477 uvar->inclSameDetector =
TRUE;
1478 uvar->treatWarningsAsErrors =
TRUE;
1479 uvar->testShortFunctions =
FALSE;
1480 uvar->testResampNoTShort =
FALSE;
1483 uvar->useLattice =
FALSE;
1487 uvar->useShearedPorb =
FALSE;
1488 uvar->unresolvedPorbMismatch = 0.0;
1489 uvar->reallocatePorbMismatch =
FALSE;
1493 XLALRegisterUvarMember( endTime,
INT4, 0, REQUIRED,
"Desired end time of analysis in GPS seconds (SFT timestamps must be < this)" );
1503 XLALRegisterUvarMember( orbitAsiniSec,
REAL8, 0, OPTIONAL,
"Start of search band for projected semimajor axis (seconds) [0 means not a binary]" );
1512 " - '<SFT file>;<SFT file>;...', where <SFT file> may contain wildcards\n - 'list:<file containing list of SFT files>'" );
1528 XLALRegisterUvarMember( sftListOutputFilename,
STRING, 0, OPTIONAL,
"Name of file to which to write list of SFTs (for sanity checks)" );
1529 XLALRegisterUvarMember( tShortListOutputFilename,
STRING, 0, OPTIONAL,
"Name of file to which to write list of Tshorts (for sanity checks)" );
1530 XLALRegisterUvarMember( sftListInputFilename,
STRING, 0, OPTIONAL,
"Name of file to which to read in list of SFTs (for sanity checks)" );
1531 XLALRegisterUvarMember( gammaAveOutputFilename,
STRING, 0, OPTIONAL,
"Name of file to which to write aa+bb weights (for e.g., false alarm estimation)" );
1532 XLALRegisterUvarMember( resampGammaAveOutputFilename,
STRING, 0, OPTIONAL,
"Name of file to which to write aa+bb weights for Tshort pairs (for e.g., false alarm estimation)" );
1533 XLALRegisterUvarMember( gammaCircOutputFilename,
STRING, 0, OPTIONAL,
"Name of file to which to write ab-ba weights (for e.g., systematic error)" );
1534 XLALRegisterUvarMember( resampGammaCircOutputFilename,
STRING, 0, OPTIONAL,
"Name of file to which to write ab-ba weights for Tshort pairs (for e.g., systematic error)" );
1540 XLALRegisterUvarMember( testResampNoTShort,
BOOLEAN, 0, OPTIONAL,
"Use resampling without tShort (for e.g., comparison in gapless Gaussian data)" );
1544 XLALRegisterUvarMember( allowedMismatchFromSFTLength,
REAL8, 0, OPTIONAL,
"override default value in XLALFstatCheckSFTLengthMismatch() (only relevant for resamp)" );
1545 XLALRegisterUvarMember( inclSameDetector,
BOOLEAN, 0, OPTIONAL,
"Cross-correlate a detector with itself at a different time (if inclAutoCorr, then also same time)" );
1546 XLALRegisterUvarMember( treatWarningsAsErrors,
BOOLEAN, 0, OPTIONAL,
"Abort program if any warnings arise (for e.g., zero-maxLag radiometer mode)" );
1550 XLALRegisterUvarMember( unresolvedPorbMismatch,
REAL8, 0, OPTIONAL,
"If maximum mismatch in period direction is less than this, only one point compensate in overall mismatch" );
1551 XLALRegisterUvarMember( reallocatePorbMismatch,
BOOLEAN, 0, OPTIONAL,
"Compensate for unresolved period with actual mismatch in that direction. (Otherwise use mismatch threshold, which is more conservative.)" );
1556 XLALRegisterUvarMember( orbitTimeAscCenter,
REAL8, 0, OPTIONAL,
"Center of prior ellipse for orbital time-of-ascension in GPS seconds" );
1586 config->
refTime = uvar->refTime;
1588 config->
refTime = uvar->startTime + 0.5 * ( (
REAL8 )( uvar->endTime - uvar->startTime ) );
1614 CHAR *tmpstring = NULL;
1622 for (
UINT4 i = 0 ;
i < numfiles ;
i++ ) {
1623 CHAR *pcc_tmpfile = NULL;
1633 printf(
"Error! Need to set all or none of --orbitPSecCenter --orbitPSecSigma --orbitTimeAscCenter --orbitTimeAscSigma\n" );
1637 if ( uvar->useShearedPorb ) {
1638 if ( ( uvar->orbitPSec != 0.0 ) ) {
1642 printf(
"Warning! --orbitPSec not expected with elliptical boundaries; ignored\n" );
1643 if ( uvar->treatWarningsAsErrors ) {
1644 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
1651 if ( ( uvar->orbitPSecBand != 0.0 ) ) {
1652 printf(
"Warning! --orbitPSecBand not expected with elliptical boundaries\n; ignored\n" );
1653 if ( uvar->treatWarningsAsErrors ) {
1654 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
1661 if ( ( uvar->orbitPSec != 0.0 ) ) {
1662 printf(
"Warning! --orbitPSec not expected with elliptical boundaries; ignored\n" );
1663 if ( uvar->treatWarningsAsErrors ) {
1664 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
1668 if ( ( uvar->orbitPSecBand != 0.0 ) ) {
1669 printf(
"Warning! --orbitPSecBand not expected with elliptical boundaries\n; ignored\n" );
1670 if ( uvar->treatWarningsAsErrors ) {
1671 printf(
"Error! (--treatWarningsAsErrors flag is true).\n" );
1675 if ( uvar->useLattice ==
FALSE ) {
1676 printf(
"Error! Elliptical boundary only works with LatticeTiling\n" );
1682 printf(
"Error! Elliptical boundary not yet implemented with resampling\n" );
1687 config->
norb = (
int ) round( ( uvar->orbitTimeAsc
1688 + 0.5 * uvar->orbitTimeAscBand
1689 - uvar->orbitTimeAscCenter )
1690 / uvar->orbitPSecCenter );
1694 +
SQR( ( uvar->orbitTimeAscSigma / uvar->orbitPSecSigma ) ) ) );
1696 if ( uvar->useShearedPorb ==
TRUE ) {
1697 printf(
"Error! Sheared period requires values for --orbitPSecCenter --orbitPSecSigma --orbitTimeAscCenter --orbitTimeAscSigma\n" );
1705 config->
orbitPSecMin = uvar->orbitPSecCenter - uvar->orbitTPEllipseRadius * uvar->orbitPSecSigma;
1706 config->
orbitPSecMax = uvar->orbitPSecCenter + uvar->orbitTPEllipseRadius * uvar->orbitPSecSigma;
1709 config->
orbitPSecMax = uvar->orbitPSec + uvar->orbitPSecBand;
1731int GetNextCrossCorrTemplate(
BOOLEAN *binaryParamsFlag,
BOOLEAN *firstPoint,
PulsarDopplerParams *dopplerpos,
PulsarDopplerParams *binaryTemplateSpacings,
PulsarDopplerParams *minBinaryTemplate,
PulsarDopplerParams *maxBinaryTemplate,
UINT8 *fCount,
UINT8 *aCount,
UINT8 *tCount,
UINT8 *pCount,
UINT8 fSpacingNum,
UINT8 aSpacingNum,
UINT8 tSpacingNum,
UINT8 pSpacingNum,
ConfigVariables *config )
1735 if ( binaryTemplateSpacings == NULL ) {
1739 if ( minBinaryTemplate == NULL ) {
1743 if ( maxBinaryTemplate == NULL ) {
1749 if ( *fCount < fSpacingNum ) {
1750 dopplerpos->
fkdot[0] = minBinaryTemplate->
fkdot[0] + ( *fCount + 1 ) * binaryTemplateSpacings->
fkdot[0];
1751 *binaryParamsFlag =
FALSE;
1755 if ( *aCount < aSpacingNum ) {
1756 dopplerpos->
asini = minBinaryTemplate->
asini + ( *aCount + 1 ) * binaryTemplateSpacings->
asini;
1757 dopplerpos->
fkdot[0] = minBinaryTemplate->
fkdot[0];
1759 *binaryParamsFlag =
TRUE;
1763 if ( *pCount < pSpacingNum ) {
1764 dopplerpos->
period = minBinaryTemplate->
period + ( *pCount + 1 ) * binaryTemplateSpacings->
period;
1771 dopplerpos->
fkdot[0] = minBinaryTemplate->
fkdot[0];
1773 dopplerpos->
asini = minBinaryTemplate->
asini;
1775 *binaryParamsFlag =
TRUE;
1781 if ( *tCount < tSpacingNum ) {
1784 dopplerpos->
fkdot[0] = minBinaryTemplate->
fkdot[0];
1786 dopplerpos->
asini = minBinaryTemplate->
asini;
1795 *binaryParamsFlag =
TRUE;
1801 if ( *firstPoint ==
TRUE ) {
1802 dopplerpos->
fkdot[0] = minBinaryTemplate->
fkdot[0];
1803 dopplerpos->
asini = minBinaryTemplate->
asini;
1805 dopplerpos->
tp = minBinaryTemplate->
tp;
1812 *firstPoint =
FALSE;
1813 *binaryParamsFlag =
TRUE;
1917 if ( binaryTemplateSpacings == NULL ) {
1921 if ( minBinaryTemplate == NULL ) {
1925 if ( maxBinaryTemplate == NULL ) {
1932 *binaryParamsFlag =
FALSE;
1933 dopplerpos->
fkdot[0] = minBinaryTemplate->
fkdot[0] + ( *fCount ) * binaryTemplateSpacings->
fkdot[0];
1934 if ( *fCount == 0 ) {
1935 *binaryParamsFlag =
TRUE;
1936 dopplerpos->
asini = minBinaryTemplate->
asini + ( *aCount ) * binaryTemplateSpacings->
asini;
1937 if ( *aCount == 0 ) {
1938 dopplerpos->
period = minBinaryTemplate->
period + ( *pCount ) * binaryTemplateSpacings->
period;
1939 if ( *pCount == 0 ) {
1968 CHAR *inputstr = NULL;
1979 if ( inputstr == NULL ) {
2008 INT4 newBinCount = binCount;
2011 if ( firstBadBin < 0 ) {
2016 if ( lastBadBin >= (
INT4 ) length ) {
2017 lastBadBin = (
INT4 )( length - 1 );
2022 for (
INT4 badBin = firstBadBin ; badBin <= lastBadBin ; badBin++ ) {
2024 if ( newBinCount > (
INT4 ) length ) {
2028 UINT4 checkIfBinAppeared = 0;
2029 for (
INT4 checkExistBadBin = 0; checkExistBadBin < binCount; checkExistBadBin++ ) {
2034 if ( badBinData->
data[checkExistBadBin] == (
UINT4 ) badBin ) {
2035 checkIfBinAppeared++;
2038 if ( checkIfBinAppeared == 0 ) {
2039 badBinData->
data[newBinCount] = badBin;
2049int demodLoopCrossCorr(
MultiSSBtimes *multiBinaryTimes,
MultiSSBtimes *multiSSBTimes,
PulsarDopplerParams dopplerpos,
BOOLEAN dopplerShiftFlag,
PulsarDopplerParams binaryTemplateSpacings,
PulsarDopplerParams minBinaryTemplate,
PulsarDopplerParams maxBinaryTemplate,
UINT8 fCount,
UINT8 aCount,
UINT8 tCount,
UINT8 pCount,
UINT8 fSpacingNum,
UINT8 aSpacingNum,
UINT8 tSpacingNum,
UINT8 pSpacingNum,
REAL8Vector *shiftedFreqs,
UINT4Vector *lowestBins,
COMPLEX8Vector *expSignalPhases,
REAL8VectorSequence *sincList,
UserInput_t uvar,
SFTIndexList *sftIndices,
MultiSFTVector *inputSFTs,
MultiUINT4Vector *badBins,
REAL8 Tsft,
MultiNoiseWeights *multiWeights,
REAL8 ccStat,
REAL8 evSquared,
REAL8 estSens,
REAL8Vector *GammaAve,
SFTPairIndexList *sftPairs,
CrossCorrBinaryOutputEntry thisCandidate,
toplist_t *ccToplist,
int DEMODndim,
int DEMODdimf,
int DEMODdima,
int DEMODdimT,
int DEMODdimP, gsl_matrix *metric_ij,
int *DEMODnumpoints,
int *DEMODnumorb,
ConfigVariables *config )
2052 if ( uvar.useLattice ==
TRUE ) {
2053 FILE *LatticeFile = NULL;
2054 if ( uvar.LatticeOutputFilename != NULL ) {
2055 if ( ( LatticeFile = fopen( uvar.LatticeOutputFilename,
"w" ) ) == NULL ) {
2064 REAL8 mismatchMax = uvar.mismatchMax;
2065 if ( uvar.unresolvedPorbMismatch > 0.0 ) {
2066 gsl_matrix *ginv_ij = gsl_matrix_alloc( DEMODndim, DEMODndim );
2073 deltaP = uvar.orbitTPEllipseRadius * uvar.orbitPSecSigma;
2075 if ( uvar.useShearedPorb ) {
2076 deltaP *= 1. / sqrt( 1. +
SQR( config->
norb * uvar.orbitPSecSigma / uvar.orbitTimeAscSigma ) );
2080 deltaP = 0.5 * uvar.orbitPSecBand;
2083 config->
mismatchMaxP =
SQR( deltaP ) / gsl_matrix_get( ginv_ij, DEMODdimP, DEMODdimP );
2084 if ( config->
mismatchMaxP < uvar.unresolvedPorbMismatch ) {
2085 if ( uvar.reallocatePorbMismatch ) {
2088 mismatchMax -= uvar.unresolvedPorbMismatch;
2091 if ( uvar.useShearedPorb ) {
2103 gsl_matrix_free( ginv_ij );
2107 if ( mismatchMax == uvar.mismatchMax ) {
2117 int lattice = uvar.latticeType;
2122 gsl_vector *curr_point = gsl_vector_alloc( DEMODndim );
2123 gsl_vector *prev_point = gsl_vector_alloc( DEMODndim );
2125 if ( uvar.useShearedPorb ) {
2126 curr_point->data[DEMODdimP] -=
2130 curr_point->data[DEMODdimT] = uvar.orbitTimeAsc + ( uvar.orbitTimeAscBand / 2.0 );
2131 curr_point->data[DEMODdima] = uvar.orbitAsiniSec + ( uvar.orbitAsiniSecBand / 2.0 );
2132 curr_point->data[DEMODdimf] = uvar.fStart + ( uvar.fBand / 2.0 );
2133 if ( LatticeFile != NULL ) {
2134 if ( uvar.useShearedPorb ) {
2135 fprintf( LatticeFile,
"# TASC\tPTILDE\tASINI\tFREQ\n" );
2137 fprintf( LatticeFile,
"# TASC\tPORB\tASINI\tFREQ\n" );
2139 fprintf( LatticeFile,
"%f\t%f\t%f\t%f\n", curr_point->data[DEMODdimT], curr_point->data[DEMODdimP], curr_point->data[DEMODdima], curr_point->data[DEMODdimf] );
2142 dopplerpos.
fkdot[0] = curr_point->data[DEMODdimf];
2143 dopplerpos.
asini = curr_point->data[DEMODdima];
2144 dopplerpos.
period = curr_point->data[DEMODdimP];
2146 *DEMODnumpoints += 1;
2147 if ( uvar.useShearedPorb ) {
2153 if ( LatticeFile != NULL ) {
2154 fprintf( LatticeFile,
"%f\t%f\t%f\t%f\n", curr_point->data[DEMODdimT], curr_point->data[DEMODdimP], curr_point->data[DEMODdima], curr_point->data[DEMODdimf] );
2157 if ( *DEMODnumpoints == 1 ) {
2158 dopplerShiftFlag =
TRUE;
2164 }
else if ( ( prev_point->data[DEMODdima] == curr_point->data[DEMODdima] )
2165 && ( prev_point->data[DEMODdimP] == curr_point->data[DEMODdimP] )
2166 && ( prev_point->data[DEMODdimT] == curr_point->data[DEMODdimT] ) ) {
2167 dopplerShiftFlag =
FALSE;
2169 dopplerShiftFlag =
TRUE;
2188 if ( dopplerShiftFlag ==
TRUE ) {
2196 if ( (
XLALGetDopplerShiftedFrequencyInfo( shiftedFreqs, lowestBins, expSignalPhases, sincList, uvar.numBins, &dopplerpos, sftIndices, inputSFTs, multiBinaryTimes, badBins,
Tsft ) !=
XLAL_SUCCESS ) ) {
2201 if ( (
XLALCalculatePulsarCrossCorrStatistic( &ccStat, &evSquared, GammaAve, expSignalPhases, lowestBins, sincList, sftPairs, sftIndices, inputSFTs, multiWeights, uvar.numBins ) !=
XLAL_SUCCESS ) ) {
2207 thisCandidate.
freq = dopplerpos.
fkdot[0];
2209 thisCandidate.
argp = dopplerpos.
argp;
2211 thisCandidate.
ecc = dopplerpos.
ecc;
2213 thisCandidate.
rho = ccStat;
2215 thisCandidate.
estSens = estSens;
2223 gsl_vector_free( curr_point );
2224 gsl_vector_free( prev_point );
2227 if ( LatticeFile != NULL ) {
2228 fclose( LatticeFile );
2240 while (
GetNextCrossCorrTemplate( &dopplerShiftFlag, &firstPoint, &dopplerpos, &binaryTemplateSpacings, &minBinaryTemplate, &maxBinaryTemplate, &fCount, &aCount, &tCount, &pCount, fSpacingNum, aSpacingNum, tSpacingNum, pSpacingNum, config ) == 0 ) {
2245 if ( dopplerShiftFlag ==
TRUE ) {
2252 if ( (
XLALGetDopplerShiftedFrequencyInfo( shiftedFreqs, lowestBins, expSignalPhases, sincList, uvar.numBins, &dopplerpos, sftIndices, inputSFTs, multiBinaryTimes, badBins,
Tsft ) !=
XLAL_SUCCESS ) ) {
2257 if ( (
XLALCalculatePulsarCrossCorrStatistic( &ccStat, &evSquared, GammaAve, expSignalPhases, lowestBins, sincList, sftPairs, sftIndices, inputSFTs, multiWeights, uvar.numBins ) !=
XLAL_SUCCESS ) ) {
2263 thisCandidate.
freq = dopplerpos.
fkdot[0];
2265 thisCandidate.
argp = dopplerpos.
argp;
2267 thisCandidate.
ecc = dopplerpos.
ecc;
2269 thisCandidate.
rho = ccStat;
2271 thisCandidate.
estSens = estSens;
2343int resampForLoopCrossCorr(
PulsarDopplerParams dopplerpos,
BOOLEAN dopplerShiftFlag,
PulsarDopplerParams binaryTemplateSpacings,
PulsarDopplerParams minBinaryTemplate,
PulsarDopplerParams maxBinaryTemplate,
UINT8 fCount,
UINT8 aCount,
UINT8 tCount,
UINT8 pCount,
UINT8 fSpacingNum,
UINT8 aSpacingNum,
UINT8 tSpacingNum,
UINT8 pSpacingNum,
UserInput_t uvar,
MultiNoiseWeights *multiWeights,
UINT4 *numSamplesFFT,
REAL8Vector *ccStatVector,
REAL8Vector *evSquaredVector,
REAL8Vector *numeEquivAve,
REAL8Vector *numeEquivCirc,
REAL8 estSens,
REAL8Vector *resampGammaAve,
MultiResampSFTPairMultiIndexList *resampMultiPairs,
CrossCorrBinaryOutputEntry thisCandidate,
toplist_t *ccToplist,
REAL8 tShort,
ConfigVariables *config )
2352 optionalArgs.
Dterms = uvar.Dterms;
2360 if ( uvar.injectionSources != NULL ) {
2379 REAL8 Tobs = (
REAL8 )( uvar.endTime - uvar.startTime );
2380 REAL8 dFreq = 1.0 / Tobs;
2381 REAL8 fCoverMin, fCoverMax;
2382 const REAL8 binaryMaxAsini =
MYMAX( uvar.orbitAsiniSec, uvar.orbitAsiniSec + uvar.orbitAsiniSecBand );
2383 const REAL8 binaryMinPorb =
MYMIN( uvar.orbitPSec, uvar.orbitPSec + uvar.orbitPSecBand );
2385 const REAL8 binaryMaxEcc = 0.0;
2389 extraPerFreq += maxOmega * binaryMaxAsini / ( 1.0 - binaryMaxEcc );
2390 fCoverMin = ( uvar.fStart ) * ( 1.0 - extraPerFreq );
2391 fCoverMax = ( uvar.fStart + uvar.fBand ) * ( 1.0 + extraPerFreq );
2421 FstatInput *resampFstatInput = NULL;
2430 UINT8 fCountResamp = fSpacingNum + 1;
2435 const UINT4 numFreqBins = fCountResamp;
2439 if ( *( Fstats ) == NULL ) {
2442 ( *Fstats )->dFreq = 1.0 / Tobs;
2443 ( *Fstats )->numFreqBins = numFreqBins;
2445 ( *Fstats )->whatWasComputed = whatToCompute;
2455 REAL8 Tcoh = 2 * resampMultiPairs->
maxLag + tShort;
2456 if ( (
XLALCreateCrossCorrWorkspace( &ws, &ws1KFaX_k, &ws1KFbX_k, &ws2LFaX_k, &ws2LFbX_k, &multiTimeSeries_SRC_a, &multiTimeSeries_SRC_b, binaryTemplateSpacings, resampFstatInput, numFreqBins, Tcoh, uvar.treatWarningsAsErrors ) !=
XLAL_SUCCESS ) ) {
2464 for ( tCount = 0; tCount <= tSpacingNum; tCount++ ) {
2465 for ( pCount = 0; pCount <= pSpacingNum; pCount++ ) {
2466 for ( aCount = 0; aCount <= aSpacingNum; aCount++ ) {
2470 if ( (
GetNextCrossCorrTemplateForResamp( &dopplerShiftFlag, &dopplerpos, &binaryTemplateSpacings, &minBinaryTemplate, &maxBinaryTemplate, &fCount, &aCount, &tCount, &pCount, config ) ) != 0 ) {
2482 if ( (
XLALCalculatePulsarCrossCorrStatisticResamp( ccStatVector, evSquaredVector, numeEquivAve, numeEquivCirc, resampGammaAve, resampMultiPairs, multiWeights, &binaryTemplateSpacings, &dopplerpos, multiTimeSeries_SRC_a, multiTimeSeries_SRC_b, ws, ws1KFaX_k, ws1KFbX_k, ws2LFaX_k, ws2LFbX_k ) !=
XLAL_SUCCESS ) ) {
2486 for ( fCount = 0; fCount <= fSpacingNum; fCount++ ) {
2489 thisCandidate.
freq = dopplerpos.
fkdot[0] + fCount * binaryTemplateSpacings.
fkdot[0];
2491 thisCandidate.
argp = dopplerpos.
argp;
2493 thisCandidate.
ecc = dopplerpos.
ecc;
2495 thisCandidate.
rho = ccStatVector->
data[fCount];
2497 thisCandidate.
estSens = estSens;
2505 fftw_free( ws1KFaX_k );
2506 fftw_free( ws1KFbX_k );
2507 fftw_free( ws2LFaX_k );
2508 fftw_free( ws2LFbX_k );
2517int testShortFunctionsBlock(
UserInput_t uvar,
MultiSFTVector *inputSFTs,
REAL8 Tsft,
REAL8 resampTshort,
SFTIndexList **sftIndices,
SFTPairIndexList **sftPairs,
REAL8Vector **GammaAve,
REAL8Vector **GammaCirc,
MultiResampSFTPairMultiIndexList **resampMultiPairs,
MultiLALDetector *multiDetectors,
MultiDetectorStateSeries **multiStates,
MultiDetectorStateSeries **resampMultiStates,
MultiNoiseWeights **multiWeights,
MultiLIGOTimeGPSVector **multiTimes,
MultiLIGOTimeGPSVector **resampMultiTimes,
MultiSSBtimes **multiSSBTimes,
REAL8VectorSequence **phaseDerivs, gsl_matrix **g_ij, gsl_vector **eps_i,
REAL8 estSens,
SkyPosition *skyPos,
PulsarDopplerParams *dopplerpos,
PulsarDopplerParams *thisBinaryTemplate,
ConfigVariables config,
const DopplerCoordinateSystem coordSys )
2534 printf(
"starting short functions block at time: %f\n",
XLALGetTimeOfDay() );
2537 UINT4 numShortPerDet = 0;
2549 REAL8 fMin = uvar.fStart * ( 1 - vMax ) - 0.5 * uvar.rngMedBlock *
deltaF;
2550 REAL8 fMax = ( uvar.fStart + uvar.fBand ) * ( 1 + vMax ) + 0.5 * uvar.rngMedBlock *
deltaF;
2558 inputSFTs = inputSFTsAlt;
2572 ( *multiWeights ) = multiWeightsNew;
2579 ( *multiTimes ) = multiTimesNew;
2589 ( *multiDetectors ) = ( multiDetectorsNew );
2599 if ( ( *( resampMultiStates ) =
XLALGetMultiDetectorStatesShort( *( resampMultiTimes ), &( multiDetectorsNew ), config.
edat, 0.5 * resampTshort, resampTshort, numShortPerDet ) ) == NULL ) {
2604 *( multiStates ) = *( resampMultiStates );
2611 ( *sftIndices ) = sftIndicesNew;
2617 if ( ( resampMultiCoeffs =
XLALComputeMultiAMCoeffsShort( *( resampMultiStates ), *( multiWeights ), *( skyPos ), resampTshort,
Tsft, numShortPerDet, *( multiTimes ) ) ) == NULL ) {
2640 ( *sftPairs ) = sftPairsNew;
2642 fprintf( stdout,
"Number of detectors in SFT list: %u\n", ( *resampMultiTimes )->length );
2651 ( *resampMultiPairs ) = resampMultiPairsNew;
2654 ( *sftIndices ) = ( *resampMultiPairs )->indexList ;
2655 ( *sftPairs ) = ( *resampMultiPairs )->pairIndexList ;
2672 *( GammaAve ) = intermediateGammaAve;
2673 *( GammaCirc ) = intermediateGammaCirc;
2674 resampGammaAve = intermediateGammaAve;
2675 resampGammaCirc = intermediateGammaCirc;
2683 *( multiSSBTimes ) = shortMultiSSBTimes;
2685 REAL8 old_diagff = 0;
2686 REAL8 old_diagaa = 0;
2687 REAL8 old_diagTT = 0;
2688 REAL8 old_diagpp = 0;
2691 thisBinaryTemplateNew = ( *thisBinaryTemplate );
2709 ( *phaseDerivs ) = phaseDerivsNew;
2710 ( *thisBinaryTemplate ) = thisBinaryTemplateNew;
2712 REAL8 sumGammaSq = 0;
2713 gsl_matrix *g_ijNew = NULL;
2714 gsl_vector *eps_iNew = NULL;
2720 gsl_matrix_free( *g_ij );
2721 gsl_vector_free( *eps_i );
2723 ( *g_ij ) = g_ijNew;
2724 ( *eps_i ) = eps_iNew;
2726 *( GammaAve ) = resampGammaAve;
2727 *( GammaCirc ) = resampGammaCirc;
2734 printf(
"ending short functions block at time: %f\n",
XLALGetTimeOfDay() );
2735 fprintf( stdout,
"Using resampling for CrossCorr\n" );
2736 fprintf( stdout,
"Resampling? %s \n", uvar.resamp ?
"true" :
"false" );
void sort_crossCorrBinary_toplist(toplist_t *l)
#define __func__
log an I/O error, i.e.
void free_crossCorr_toplist(toplist_t **l)
frees the space occupied by the toplist
int final_write_crossCorrBinary_toplist_to_file(toplist_t *l, const char *filename, UINT4 *checksum)
int create_crossCorrBinary_toplist(toplist_t **tl, UINT8 length)
int insert_into_crossCorrBinary_toplist(toplist_t *tl, CrossCorrBinaryOutputEntry elem)
void LALCheckMemoryLeaks(void)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
int XLALSetLatticeTilingPorbEllipticalBound(LatticeTiling *tiling, const size_t tasc_dimension, const size_t porb_dimension, const double P0, const double sigP, const double T0, const double sigT, const int norb, const double nsigma, const BOOLEAN useShearedPeriod)
Set an orbital period as a function of time of ascension.
REAL8VectorSequence * XLALCreateREAL8VectorSequence(UINT4 length, UINT4 veclen)
void XLALDestroyREAL8VectorSequence(REAL8VectorSequence *vecseq)
void XLALDestroyUINT4VectorSequence(UINT4VectorSequence *vecseq)
PulsarParamsVector * XLALPulsarParamsFromUserInput(const LALStringVector *UserInput, const LIGOTimeGPS *refTimeDef)
Function to determine the PulsarParamsVector input from a user-input defining CW sources.
void XLALDestroyPulsarParamsVector(PulsarParamsVector *ppvect)
Destructor for PulsarParamsVector type.
int XLALCWMakeFakeMultiData(MultiSFTVector **multiSFTs, MultiREAL8TimeSeries **multiTseries, const PulsarParamsVector *injectionSources, const CWMFDataParams *dataParams, const EphemerisData *edat)
Generate fake 'CW' data, returned either as SFTVector or REAL4Timeseries or both, for given CW-signal...
const FstatOptionalArgs FstatOptionalArgsDefaults
Global initializer for setting FstatOptionalArgs to default values.
int XLALExtractResampledTimeseries(MultiCOMPLEX8TimeSeries **multiTimeSeries_SRC_a, MultiCOMPLEX8TimeSeries **multiTimeSeries_SRC_b, FstatInput *input)
Extracts the resampled timeseries from a given FstatInput structure (must have been initialized previ...
void XLALDestroyFstatInput(FstatInput *input)
Free all memory associated with a FstatInput structure.
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.
void XLALDestroyFstatResults(FstatResults *Fstats)
Free all memory associated with a FstatResults structure.
@ FMETHOD_RESAMP_BEST
Resamp: best guess of the fastest available implementation
@ FSTATQ_NONE
Do not compute -statistic, still compute buffered quantities.
LIGOTimeGPS * XLALGPSTimeNow(LIGOTimeGPS *gpstime)
void XLALDestroyMultiDetectorStateSeries(MultiDetectorStateSeries *mdetStates)
Helper function to get rid of a multi-IFO DetectorStateSeries Note, this is "NULL-robust" in the sens...
int XLALMultiLALDetectorFromMultiSFTs(MultiLALDetector *multiIFO, const MultiSFTVector *multiSFTs)
Extract multi detector-info from a given multi SFTCatalog view.
MultiDetectorStateSeries * XLALGetMultiDetectorStates(const MultiLIGOTimeGPSVector *multiTS, const MultiLALDetector *multiIFO, const EphemerisData *edat, REAL8 tOffset)
Get the detector-time series for the given MultiLIGOTimeGPSVector.
void XLALDestroyMultiREAL8TimeSeries(MultiREAL8TimeSeries *multiTS)
Destroy a MultiREAL8TimeSeries, NULL-robust.
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.
void XLALDestroyMultiAMCoeffs(MultiAMCoeffs *multiAMcoef)
Destroy a MultiAMCoeffs structure.
MultiAMCoeffs * XLALComputeMultiAMCoeffs(const MultiDetectorStateSeries *multiDetStates, const MultiNoiseWeights *multiWeights, SkyPosition skypos)
Multi-IFO version of XLALComputeAMCoeffs().
#define XLAL_INIT_DECL(var,...)
void * XLALCalloc(size_t m, size_t n)
void * XLALRealloc(void *p, size_t n)
char char * XLALStringDuplicate(const char *s)
char * XLALStringToken(char **s, const char *delim, int empty)
char * XLALVCSInfoString(const LALVCSInfoList vcs_list, const int verbose, const char *prefix)
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 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.
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.
LatticeTiling * XLALCreateLatticeTiling(const size_t ndim)
Create a new lattice tiling.
const UserChoices TilingLatticeChoices
Static array of all :tagTilingLattice choices, for use by the UserInput module parsing routines.
@ TILING_LATTICE_ANSTAR
An-star ( ) lattice.
REAL8 XLALGetTimeOfDay(void)
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
MultiPSDVector * XLALNormalizeMultiSFTVect(MultiSFTVector *multsft, UINT4 blockSize, const MultiNoiseFloor *assumeSqrtSX)
Function for normalizing a multi vector of SFTs in a multi IFO search and returns the running-median ...
void XLALDestroyMultiPSDVector(MultiPSDVector *multvect)
Destroy a multi PSD-vector.
MultiNoiseWeights * XLALComputeMultiNoiseWeights(const MultiPSDVector *rngmed, UINT4 blocksRngMed, UINT4 excludePercentile)
Computes weight factors arising from MultiSFTs with different noise floors.
void XLALDestroyMultiNoiseWeights(MultiNoiseWeights *weights)
Destroy a MultiNoiseWeights object.
void XLALDestroySFTPairIndexList(SFTPairIndexList *sftPairs)
Destroy a SFTPairIndexList structure.
void XLALDestroyResampCrossCorrWorkspace(void *workspace)
int XLALCreateCrossCorrWorkspace(ResampCrossCorrWorkspace **wsOut, COMPLEX8 **ws1KFaX_kOut, COMPLEX8 **ws1KFbX_kOut, COMPLEX8 **ws2LFaX_kOut, COMPLEX8 **ws2LFbX_kOut, MultiCOMPLEX8TimeSeries **multiTimeSeries_SRC_aOut, MultiCOMPLEX8TimeSeries **multiTimeSeries_SRC_bOut, const PulsarDopplerParams binaryTemplateSpacings, FstatInput *resampFstatInput, const UINT4 numFreqBins, const REAL8 tCoh, const BOOLEAN treatWarningsAsErrors)
** (possible future function) does not work – would adjust timestamps of an SFT vector */
MultiLIGOTimeGPSVector * XLALGenerateMultiTshortTimestamps(const MultiLIGOTimeGPSVector *restrict multiTimes, const REAL8 tShort, const UINT4 numShortPerDet, const BOOLEAN alignTShorts)
Given a multi-SFT vector, return a MultiLIGOTimeGPSVector holding the modified SFT timestamps (produc...
int XLALCalculateCrossCorrPhaseDerivatives(REAL8VectorSequence **phaseDerivs, const PulsarDopplerParams *dopplerPoint, const EphemerisData *edat, SFTIndexList *indexList, MultiSSBtimes *multiTimes, const DopplerCoordinateSystem *coordSys)
calculate signal phase derivatives wrt Doppler coords, for each SFT
int XLALCreateSFTPairIndexList(SFTPairIndexList **pairIndexList, SFTIndexList *indexList, MultiSFTVector *sfts, REAL8 maxLag, BOOLEAN inclAutoCorr)
Construct list of SFT pairs for inclusion in statistic.
int XLALCalculateLMXBCrossCorrDiagMetric(REAL8 *hSens, REAL8 *g_ff, REAL8 *g_aa, REAL8 *g_TT, REAL8 *g_pp, REAL8 *weightedMuTAve, PulsarDopplerParams DopplerParams, REAL8Vector *G_alpha, SFTPairIndexList *pairIndexList, SFTIndexList *indexList, MultiSFTVector *sfts, MultiNoiseWeights *multiWeights)
int XLALCalculateCrossCorrGammasResampShort(REAL8Vector **Gamma_ave, REAL8Vector **Gamma_circ, MultiResampSFTPairMultiIndexList *resampMultiPairIndexList, MultiAMCoeffs *multiCoeffs)
test function for RESAMPLING with tShort
MultiNoiseWeights * XLALModifyMultiWeights(const MultiNoiseWeights *restrict multiWeights, const REAL8 tShort, const REAL8 tSFTOld, const UINT4 numShortPerDet, const MultiLIGOTimeGPSVector *restrict multiTimes)
Modify multiple detectors' amplitude weight coefficients for tShort.
int XLALCalculateCrossCorrGammas(REAL8Vector **Gamma_ave, REAL8Vector **Gamma_circ, SFTPairIndexList *pairIndexList, SFTIndexList *indexList, MultiAMCoeffs *multiCoeffs)
Construct vector of G_alpha amplitudes for each SFT pair.
int XLALCalculatePulsarCrossCorrStatisticResamp(REAL8Vector *restrict ccStatVector, REAL8Vector *restrict evSquaredVector, REAL8Vector *restrict numeEquivAve, REAL8Vector *restrict numeEquivCirc, const REAL8Vector *restrict resampCurlyGAmp, const MultiResampSFTPairMultiIndexList *restrict resampMultiPairs, const MultiNoiseWeights *restrict multiWeights, const PulsarDopplerParams *restrict binaryTemplateSpacings, const PulsarDopplerParams *restrict dopplerpos, const MultiCOMPLEX8TimeSeries *restrict multiTimeSeries_SRC_a, const MultiCOMPLEX8TimeSeries *restrict multiTimeSeries_SRC_b, ResampCrossCorrWorkspace *restrict ws, COMPLEX8 *restrict ws1KFaX_k, COMPLEX8 *restrict ws1KFbX_k, COMPLEX8 *restrict ws2LFaX_k, COMPLEX8 *restrict ws2LFbX_k)
Calculate multi-bin cross-correlation statistic using resampling.
int XLALCreateSFTPairIndexListAccurateResamp(SFTPairIndexList **pairIndexList, UINT4VectorSequence **sftPairForTshortPair, SFTIndexList *indexList, MultiResampSFTPairMultiIndexList *resampPairs, const MultiLIGOTimeGPSVector *restrict multiTimes, const MultiLIGOTimeGPSVector *restrict resampMultiTimes)
Construct list of SFT pairs corresponding to a list of tShort pairs.
int XLALCreateSFTPairIndexListResamp(MultiResampSFTPairMultiIndexList **resampMultiPairIndexList, SFTPairIndexList **pairIndexList, SFTIndexList *indexList, MultiSFTVector *sfts, REAL8 maxLag, BOOLEAN inclAutoCorr, BOOLEAN inclSameDetector, REAL8 Tsft, REAL8 Tshort)
Resampling-modified: construct list of SFT pairs for inclusion in statistic.
MultiAMCoeffs * XLALComputeMultiAMCoeffsShort(const MultiDetectorStateSeries *multiDetStates, const MultiNoiseWeights *multiWeights, SkyPosition skypos, REAL8 tShort, REAL8 tSFTOld, UINT4 numShortPerDet, MultiLIGOTimeGPSVector *multiTimes)
(test function) used for computing multi amplitude modulation weights
int XLALCalculateCrossCorrPhaseMetricShort(gsl_matrix **g_ij, gsl_vector **eps_i, REAL8 *sumGammaSq, const REAL8VectorSequence *phaseDerivs, const MultiResampSFTPairMultiIndexList *resampMultiPairs, const REAL8Vector *Gamma_ave, const REAL8Vector *Gamma_circ, const DopplerCoordinateSystem *coordSys)
(test function) Redesigning to use Tshort instead
int XLALCalculatePulsarCrossCorrStatistic(REAL8 *ccStat, REAL8 *evSquared, REAL8Vector *curlyGAmp, COMPLEX8Vector *expSignalPhases, UINT4Vector *lowestBins, REAL8VectorSequence *sincList, SFTPairIndexList *sftPairs, SFTIndexList *sftIndices, MultiSFTVector *inputSFTs, MultiNoiseWeights *multiWeights, UINT4 numBins)
Calculate multi-bin cross-correlation statistic.
void XLALDestroySFTIndexList(SFTIndexList *sftIndices)
Destroy a SFTIndexList structure.
void XLALDestroyMultiResampSFTPairMultiIndexList(MultiResampSFTPairMultiIndexList *sftMultiPairsResamp)
int XLALCombineCrossCorrGammas(REAL8Vector **resampGamma, REAL8Vector *Gamma, UINT4VectorSequence *sftPairForTshortPair, REAL8 Tsft, REAL8 Tshort)
Combine G_alpha amplitudes for SFT pairs into amplitudes for Tshort pairs.
int XLALCreateSFTIndexListFromMultiSFTVect(SFTIndexList **indexList, MultiSFTVector *sfts)
Construct flat SFTIndexList out of a MultiSFTVector.
int XLALGetDopplerShiftedFrequencyInfo(REAL8Vector *shiftedFreqs, UINT4Vector *lowestBins, COMPLEX8Vector *expSignalPhases, REAL8VectorSequence *sincList, UINT4 numBins, PulsarDopplerParams *dopp, SFTIndexList *sftIndices, MultiSFTVector *inputSFTs, MultiSSBtimes *multiTimes, MultiUINT4Vector *badBins, REAL8 Tsft)
Calculate the Doppler-shifted frequency associated with each SFT in a list.
int XLALCalculateCrossCorrGammasResamp(REAL8Vector **Gamma_ave, REAL8Vector **Gamma_circ, MultiResampSFTPairMultiIndexList *resampMultiPairIndexList, MultiAMCoeffs *multiCoeffs)
test function for RESAMPLING
int XLALCalculateCrossCorrPhaseMetric(gsl_matrix **g_ij, gsl_vector **eps_i, REAL8 *sumGammaSq, const REAL8VectorSequence *phaseDerivs, const SFTPairIndexList *pairIndexList, const REAL8Vector *Gamma_ave, const REAL8Vector *Gamma_circ, const DopplerCoordinateSystem *coordSys)
calculate phase metric for CW cross-correlation search, as well as vector used for parameter offsets
MultiLIGOTimeGPSVector * XLALExtractMultiTimestampsFromSFTsShort(MultiREAL8TimeSeries **scienceFlagVect, const MultiSFTVector *multiSFTs, REAL8 tShort, UINT4 numShortPerDet)
Given a multi-SFT vector, return a MultiLIGOTimeGPSVector holding the SFT timestamps (test function u...
int XLALCalculateLMXBCrossCorrDiagMetricShort(REAL8 *hSens, REAL8 *g_ff, REAL8 *g_aa, REAL8 *g_TT, REAL8 *g_pp, const PulsarDopplerParams DopplerParams, const REAL8Vector *restrict G_alpha, const MultiResampSFTPairMultiIndexList *restrict resampMultiPairIndexList, const MultiLIGOTimeGPSVector *restrict timestamps, const MultiNoiseWeights *restrict multiWeights)
MODIFIED for Tshort: calculate metric diagonal components, also include the estimation of sensitivity...
UINT4 XLALCrossCorrNumShortPerDetector(const REAL8 resampTshort, const INT4 startTime, const INT4 endTime)
Compute the number of tShort segments per detector.
int XLALCreateSFTPairIndexListShortResamp(MultiResampSFTPairMultiIndexList **resampMultiPairIndexList, const REAL8 maxLag, const BOOLEAN inclAutoCorr, const BOOLEAN inclSameDetector, const REAL8 Tsft, const MultiLIGOTimeGPSVector *restrict multiTimes)
With Tshort, and Resampling-modified: construct list of SFT pairs for inclusion in statistic.
MultiDetectorStateSeries * XLALGetMultiDetectorStatesShort(const MultiLIGOTimeGPSVector *multiTS, const MultiLALDetector *multiIFO, const EphemerisData *edat, REAL8 tOffset, REAL8 tShort, UINT4 numShortPerDet)
(test function) get multi detector states for tShort
int XLALCalculateCrossCorrPhaseDerivativesShort(REAL8VectorSequence **resampPhaseDerivs, const PulsarDopplerParams *dopplerPoint, const EphemerisData *edat, SFTIndexList *indexList, MultiResampSFTPairMultiIndexList *resampMultiPairs, MultiSSBtimes *multiTimes, const DopplerCoordinateSystem *coordSys)
(test function) MODIFIED for Tshort
#define PULSAR_MAX_SPINS
maximal number of spin-parameters (Freq + spindowns) we can handle
void XLALDestroySFTCatalog(SFTCatalog *catalog)
Free an 'SFT-catalogue'.
MultiSFTVector * XLALLoadMultiSFTs(const SFTCatalog *inputCatalog, REAL8 fMin, REAL8 fMax)
Function to load a catalog of SFTs from possibly different detectors.
void XLALDestroyMultiSFTVector(MultiSFTVector *multvect)
Destroy a multi SFT-vector.
SFTCatalog * XLALSFTdataFind(const CHAR *file_pattern, const SFTConstraints *constraints)
Find the list of SFTs matching the file_pattern and satisfying the given constraints,...
MultiLIGOTimeGPSVector * XLALExtractMultiTimestampsFromSFTs(const MultiSFTVector *multiSFTs)
Given a multi-SFT vector, return a MultiLIGOTimeGPSVector holding the SFT timestamps.
int XLALMultiSFTVectorAdd(MultiSFTVector *a, const MultiSFTVector *b)
Adds SFT-data from MultiSFTvector 'b' to elements of MultiSFTVector 'a'.
void XLALDestroyMultiTimestamps(MultiLIGOTimeGPSVector *multiTS)
Destroy a MultiLIGOTimeGPSVector timestamps vector.
MultiSSBtimes * XLALGetMultiSSBtimes(const MultiDetectorStateSeries *multiDetStates, SkyPosition skypos, LIGOTimeGPS refTime, SSBprecision precision)
Multi-IFO version of XLALGetSSBtimes().
void XLALDestroyMultiSSBtimes(MultiSSBtimes *multiSSB)
Destroy a MultiSSBtimes structure.
int XLALAddMultiBinaryTimes(MultiSSBtimes **multiSSBOut, const MultiSSBtimes *multiSSBIn, const PulsarDopplerParams *Doppler)
Multi-IFO version of XLALAddBinaryTimes().
MultiSSBtimes * XLALDuplicateMultiSSBtimes(const MultiSSBtimes *multiSSB)
Duplicate (ie allocate + copy) an input MultiSSBtimes structure.
@ SSBPREC_RELATIVISTICOPT
optimized relativistic, numerically equivalent to SSBPREC_RELATIVISTIC, but faster
COORDINATESYSTEM_EQUATORIAL
void XLALDestroyStringVector(LALStringVector *vect)
LALStringVector * XLALAppendString2Vector(LALStringVector *vect, const CHAR *string)
@ DOPPLERCOORD_TASC
Time of ascension (neutron star crosses line of nodes moving away from observer) for binary orbit (EL...
@ DOPPLERCOORD_ASINI
Projected semimajor axis of binary orbit in small-eccentricy limit (ELL1 model) [Units: light seconds...
@ DOPPLERCOORD_PORB
Period of binary orbit (ELL1 model) [Units: s].
@ DOPPLERCOORD_FREQ
Frequency [Units: Hz].
void XLALDestroyUINT4Vector(UINT4Vector *vector)
COMPLEX8Vector * XLALCreateCOMPLEX8Vector(UINT4 length)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
UINT4Vector * XLALCreateUINT4Vector(UINT4 length)
void XLALDestroyCHARVector(CHARVector *vector)
CHARVector * XLALCreateCHARVector(UINT4 length)
void XLALDestroyCOMPLEX8Vector(COMPLEX8Vector *vector)
void XLALDestroyCHARVectorSequence(CHARVectorSequence *vecseq)
CHARVectorSequence * XLALCreateCHARVectorSequence(UINT4 length, UINT4 veclen)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_MAIN(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
LIGOTimeGPS * XLALGPSSet(LIGOTimeGPS *epoch, INT4 gpssec, INT8 gpsnan)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
#define PCC_LINEFILE_HEADER
int testShortFunctionsBlock(UserInput_t uvar, MultiSFTVector *inputSFTs, REAL8 Tsft, REAL8 resampTshort, SFTIndexList **sftIndices, SFTPairIndexList **sftPairs, REAL8Vector **GammaAve, REAL8Vector **GammaCirc, MultiResampSFTPairMultiIndexList **resampMultiPairs, MultiLALDetector *multiDetectors, MultiDetectorStateSeries **multiStates, MultiDetectorStateSeries **resampMultiStates, MultiNoiseWeights **multiWeights, MultiLIGOTimeGPSVector **multiTimes, MultiLIGOTimeGPSVector **resampMultiTimes, MultiSSBtimes **multiSSBTimes, REAL8VectorSequence **phaseDerivs, gsl_matrix **g_ij, gsl_vector **eps_i, REAL8 estSens, SkyPosition *skypos, PulsarDopplerParams *dopplerpos, PulsarDopplerParams *thisBinaryTemplate, ConfigVariables config, const DopplerCoordinateSystem coordSys)
int main(int argc, char *argv[])
int demodLoopCrossCorr(MultiSSBtimes *multiBinaryTimes, MultiSSBtimes *multiSSBTimes, PulsarDopplerParams dopplerpos, BOOLEAN dopplerShiftFlag, PulsarDopplerParams binaryTemplateSpacings, PulsarDopplerParams minBinaryTemplate, PulsarDopplerParams maxBinaryTemplate, UINT8 fCount, UINT8 aCount, UINT8 tCount, UINT8 pCount, UINT8 fSpacingNum, UINT8 aSpacingNum, UINT8 tSpacingNum, UINT8 pSpacingNum, REAL8Vector *shiftedFreqs, UINT4Vector *lowestBins, COMPLEX8Vector *expSignalPhases, REAL8VectorSequence *sincList, UserInput_t uvar, SFTIndexList *sftIndices, MultiSFTVector *inputSFTs, MultiUINT4Vector *badBins, REAL8 Tsft, MultiNoiseWeights *multiWeights, REAL8 ccStat, REAL8 evSquared, REAL8 estSens, REAL8Vector *GammaAve, SFTPairIndexList *sftPairs, CrossCorrBinaryOutputEntry thisCandidate, toplist_t *ccToplist, int DEMODndim, int DEMODdimf, int DEMODdima, int DEMODdimT, int DEMODdimP, gsl_matrix *metric_ij, int *DEMODnumpoints, int *DEMODnumorb, ConfigVariables *config)
Function to isolate the loop for demod.
#define PCC_LINEFILE_BODY
UINT4 pcc_count_csv(CHAR *csvline)
Counts the number of comma separated values in a string.
int GetNextCrossCorrTemplateForResamp(BOOLEAN *binaryParamsFlag, PulsarDopplerParams *dopplerpos, PulsarDopplerParams *binaryTemplateSpacings, PulsarDopplerParams *minBinaryTemplate, PulsarDopplerParams *maxBinaryTemplate, UINT8 *fCount, UINT8 *aCount, UINT8 *tCount, UINT8 *pCount, ConfigVariables *config)
int resampForLoopCrossCorr(PulsarDopplerParams dopplerpos, BOOLEAN dopplerShiftGlag, PulsarDopplerParams binaryTemplateSpacings, PulsarDopplerParams minBinaryTemplate, PulsarDopplerParams maxBinaryTemplate, UINT8 fCount, UINT8 aCount, UINT8 tCount, UINT8 pCount, UINT8 fSpacingNum, UINT8 aSpacingNum, UINT8 tSpacingNum, UINT8 pSpacingNum, UserInput_t uvar, MultiNoiseWeights *multiWeights, UINT4 *numSamplesFFT, REAL8Vector *ccStatVector, REAL8Vector *evSquaredVector, REAL8Vector *numeEquivAve, REAL8Vector *numeEquivCirc, REAL8 estSens, REAL8Vector *resampGammaAve, MultiResampSFTPairMultiIndexList *resampMultiPairs, CrossCorrBinaryOutputEntry thisCandidate, toplist_t *ccToplist, REAL8 tShort, ConfigVariables *config)
For-loop function for resampling.
INT4 XLALFindBadBins(UINT4Vector *badBinData, INT4 binCount, REAL8 flo, REAL8 fhi, REAL8 f0, REAL8 deltaF, UINT4 length)
Convert a range of contaminated frequencies into a set of bins to zero out.
int XLALDestroyConfigVars(ConfigVariables *config)
#define MAXFILENAMELENGTH
int XLALInitializeConfigVars(ConfigVariables *config, const UserInput_t *uvar)
int XLALInitUserVars(UserInput_t *uvar)
Register all our "user-variables" that can be specified from cmd-line and/or config-file.
int GetNextCrossCorrTemplate(BOOLEAN *binaryParamsFlag, BOOLEAN *firstPoint, PulsarDopplerParams *dopplerpos, PulsarDopplerParams *binaryTemplateSpacings, PulsarDopplerParams *minBinaryTemplate, PulsarDopplerParams *maxBinaryTemplate, UINT8 *fCount, UINT8 *aCount, UINT8 *tCount, UINT8 *pCount, UINT8 fSpacingNum, UINT8 aSpacingNum, UINT8 tSpacingNum, UINT8 pSpacingNum, ConfigVariables *config)
FIXME: spacings and min, max values of binary parameters are not used yet.
#define PCC_SFTPAIR_HEADER
COMPLEX8FrequencySeries * data
Pointer to the data array.
Struct controlling all the aspects of the fake data (time-series + SFTs) to be produced by XLALCWMake...
Configuration settings required for and defining a coherent pulsar search.
REAL8 mismatchMaxP
maximum mismatch in porb
REAL8 refTime
reference time for pulsar phase definition
REAL8 dPorbdTascShear
slope of centerline of prior ellipse
SFTCatalog * catalog
catalog of SFTs
BOOLEAN useTPEllipse
whether to use elliptical boundary for Tasc-Porb search space
int norb
number of orbits to shift prior elliptical boundary for Tasc-Porb search space
REAL8 mismatchMaxThreeD
mismatch used for 3d lattice
REAL8 unshearedgTT
metric element gTT in unsheared coordinates
REAL8 unshearedgTP
metric element gTP in unsheared coordinates
REAL8 orbitPSecMax
maximum binary orbital period in seconds
REAL8 orbitPSecMin
minimum binary orbital period in seconds
REAL8 orbitTimeAscCenterShifted
shifted center of prior ellipse for binary time of ascension (GPS seconds)
EphemerisData * edat
ephemeris data
LALStringVector * lineFiles
list of line files
Type to hold the fields that will be kept in a "toplist" – for a directed binary search.
REAL8 argp
argument of periapse
REAL8 estSens
average template E[rho]/h0^2)^2
REAL8 evSquared
E[rho]/h0^2)^2.
REAL8 tp
time of periapse passage
REAL8 rho
Crosscorr statistic.
REAL8 asini
projected semi-major axis
type describing a Doppler coordinate system: lists the number of dimensions and the symbolic names of...
UINT4 dim
number of dimensions covered
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.
PulsarParamsVector * injectSources
Vector of parameters of CW signals to simulate and inject.
UINT4 runningMedianWindow
If SFT noise weights are calculated from the SFTs, the running median window length to use.
BOOLEAN resampFFTPowerOf2
Resamp: round up FFT lengths to next power of 2; see FstatMethodType.
REAL8 allowedMismatchFromSFTLength
Optional override for XLALFstatCheckSFTLengthMismatch().
UINT4 Dterms
Number of Dirichlet kernel terms, used by some Demod methods; see FstatMethodType.
FstatMethodType FstatMethod
Method to use for computing the -statistic.
XLALComputeFstat() computed results structure.
LIGOTimeGPS * data
array of timestamps
Multi-IFO container for antenna-pattern coefficients and atenna-pattern matrix .
Multi-IFO container for COMPLEX8 resampled timeseries.
Multi-IFO time-series of DetectorStates.
array of detectors definitions 'LALDetector'
UINT4 length
number of detectors
A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
UINT4 length
number of timestamps vectors or ifos
LIGOTimeGPSVector ** data
timestamps vector for each ifo
array of detector-specific 'noise floors' (ie PSD values), assumed constant over the frequency-band o...
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
REAL8 Sinv_Tsft
normalization factor used: (using single-sided PSD!)
A collection of PSD vectors – one for each IFO in a multi-IFO search.
A collection of (multi-IFO) REAL8 time-series.
Resampling Multi List of all paired SFTs L_Y_K_X, top level (multiple pairs, multiple detectors)
REAL8 maxLag
Maximum allowed lag time.
SFTPairIndexList * pairIndexList
Make a classic pair index list.
SFTIndexList * indexList
Make an overall flat index list.
A collection of SFT vectors – one for each IFO in a multi-IFO search.
UINT4 length
number of ifos
SFTVector ** data
sftvector for each ifo
Multi-IFO container for SSB timings.
A collection of UINT4Vectors – one for each IFO
UINT4Vector ** data
unit4vector for each ifo
UINT4 length
number of ifos
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
REAL8 period
Binary: orbital period (sec)
LIGOTimeGPS tp
Binary: time of observed periapsis passage (in SSB)
PulsarSpins fkdot
Intrinsic spins: [Freq, f1dot, f2dot, ... ] where fkdot = d^kFreq/dt^k.
REAL8 ecc
Binary: orbital eccentricity.
REAL8 asini
Binary: projected, normalized orbital semi-major axis (s).
REAL8 argp
Binary: argument of periapsis (radians)
Straightforward vector type of N PulsarParams structs.
UINT4 numSamplesFFT
allocated number of zero-padded SRC-frame time samples (related to dFreq)
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
SFTDescriptor * data
array of data-entries describing matched SFTs
'Constraints' for SFT-matching: which detector, within which time-stretch and which timestamps exactl...
CHAR * detector
2-char channel-prefix describing the detector (eg 'H1', 'H2', 'L1', 'G1' etc)
LIGOTimeGPSVector * timestamps
list of timestamps
LIGOTimeGPS * maxStartTime
only include SFTs whose epoch is < maxStartTime
LIGOTimeGPS * minStartTime
only include SFTs whose epoch is >= minStartTime
SFTtype header
SFT-header info.
UINT4 sftInd
index of SFT in list for this detector
UINT4 detInd
index of detector in list
UINT4 length
number of SFTs
SFTIndex * data
array of SFT indices
UINT4 sftNum[2]
ordinal numbers of first and second SFTs
List of SFT pair indices.
UINT4 length
number of SFT Pairs
SFTPairIndex * data
array of SFT Pair indices