23#include <lal/PulsarCrossCorr_v2.h>
25#define SQUARE(x) ((x)*(x))
26#define QUAD(x) ((x)*(x)*(x)*(x))
27#define GPSDIFF(x,y) (1.0*((x).gpsSeconds - (y).gpsSeconds) + ((x).gpsNanoSeconds - (y).gpsNanoSeconds)*1e-9)
28#define MYMAX(x,y) ( (x) > (y) ? (x) : (y) )
29#define MYMIN(x,y) ( (x) < (y) ? (x) : (y) )
30#define USE_ALIGNED_MEMORY_ROUTINES
42 const REAL8 freqShift,
43 const UINT4 indexStartResamp,
44 const UINT4 indexEndResamp,
45 const UINT4 numSamplesIn,
46 const UINT4 insertPoint
59 const REAL8 SRCsampPerTcoh,
99 if ( multiTimes->
length != numDets
100 || ( badBins && badBins->
length != numDets )
102 XLALPrintError(
"Lengths of detector-indexed lists don't match!" );
107 XLALPrintError(
"Must specify a positive number of bins to use!" );
120 sftNum, detInd, inputSFTs->
length );
124 times = multiTimes->
data[detInd];
128 "Lengths of multilists don't match!" );
134 sftNum, detInd, sftInd, numSFTsDet );
138 REAL8 phiByTwoPi = fmod( fhat * timeDiff, 1.0 );
139 REAL8 factor = timeDiff;
142 fhat += dopp->
fkdot[
k] * factor;
143 factor *= timeDiff / (
k + 1 );
144 phiByTwoPi += dopp->
fkdot[
k] * factor;
146 REAL4 sinPhi, cosPhi;
151 expSignalPhases->
data[sftNum] = cosPhi + I * sinPhi;
152 shiftedFreqs->
data[sftNum] = fhat * times->
Tdot->
data[sftInd];
155#define SINC_SAFETY 1e-5
158 if ( badBins && badBins->
data[detInd] ) {
163 if ( lowestBins->
data[sftNum] +
l
170 if ( !badBins || !( badBins->
data[detInd] )
173 REAL4 sinPiX, cosPiX;
209 for (
UINT4 k = 0;
k < numDets;
k++ ) {
213 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
222 for (
UINT4 k = 0;
k < numDets;
k++ ) {
224 for (
UINT4 l = 0;
l < numForDet;
l++ ) {
233 ( *indexList ) = ret;
255 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
265 if ( inclAutoCorr ) {
274 if ( fabs( timeDiff ) <= maxLag ) {
287 if ( inclAutoCorr ) {
296 if ( fabs( timeDiff ) <= maxLag ) {
305 ( *pairIndexList ) = ret;
333 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
341 for (
UINT4 reK = 0; reK < numTshorts; reK++ ) {
344 LIGOTimeGPS reTimeK = resampMultiTimes->data[ifoK]->data[reIndK];
349 LIGOTimeGPS timeK = multiTimes->data[ifoK]->data[indK];
351 if ( SFTMidOff >= 0 && SFTMidOff < Tshort ) {
357 kInShort, TsftsPerTshort );
358 SFTIndsForTshort->
data[reK * TsftsPerTshort + kInShort] = K;
364 for (
UINT4 k = kInShort;
k < TsftsPerTshort;
k++ ) {
371 UINT4 maxAlphaInReAlpha =
SQUARE( TsftsPerTshort );
372 UINT4 maxNumSFTPairs = numTshortPairs * maxAlphaInReAlpha;
374 ret->
length = maxNumSFTPairs;
388 for (
UINT4 reAlpha = 0; reAlpha < numTshortPairs; reAlpha++ ) {
389 UINT4 alphaInReAlpha = 0;
393 for (
UINT4 kInShort = 0; kInShort < TsftsPerTshort; kInShort++ ) {
394 UINT4 K = SFTIndsForTshort->
data[reK * TsftsPerTshort + kInShort];
398 for (
UINT4 lInShort = 0; lInShort < TsftsPerTshort; lInShort++ ) {
399 UINT4 L = SFTIndsForTshort->
data[reL * TsftsPerTshort + lInShort];
405 alpha, maxNumSFTPairs );
408 ret2->
data[reAlpha * maxAlphaInReAlpha + alphaInReAlpha] =
alpha;
413 for ( ; alphaInReAlpha < maxAlphaInReAlpha; alphaInReAlpha++ ) {
426 ( *pairIndexList ) = ret;
427 ( *sftPairForTshortPair ) = ret2;
459 fprintf( stdout,
"Number of detectors in SFT list: %u\n", numDets );
460 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
463 if ( ( resampMultiRet =
XLALCalloc( 1,
sizeof( *resampMultiRet ) ) ) == NULL ) {
470 if ( ( MultiListOfLmatchingGivenMultiK =
XLALCalloc( 1,
sizeof( *MultiListOfLmatchingGivenMultiK ) ) ) == NULL ) {
473 MultiListOfLmatchingGivenMultiK->
length = numDets;
475 if ( ( MultiListOfLmatchingGivenMultiK->
data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->
length,
sizeof( *MultiListOfLmatchingGivenMultiK->
data ) ) ) == NULL ) {
476 XLALFree( MultiListOfLmatchingGivenMultiK );
480 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
482 if ( ( MultiListOfLmatchingGivenMultiK->
data[detX].
data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->
data[detX].
length,
sizeof( *MultiListOfLmatchingGivenMultiK->
data[detX].
data ) ) ) == NULL ) {
503 if ( inclAutoCorr ) {
512 if ( fabs( timeDiff ) <= maxLag ) {
520 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
521 MultiListOfLmatchingGivenMultiK->
data[detX].
detInd = detX;
524 for (
UINT4 detY = 0; detY < numDets; detY++ ) {
525 UINT4 LmatchingGivenKMulti = 0;
526 if ( ( ( detY == detX ) && inclSameDetector ) || ( detY > detX ) ) {
527 if ( detY == detX ) {
528 if ( inclAutoCorr ) {
540 if ( fabs( timeDiff ) <= maxLag ) {
541 ++LmatchingGivenKMulti;
562 resampMultiRet->
length = numDets;
563 resampMultiRet->
maxLag = maxLag;
565 resampMultiRet->
Tshort = Tshort;
573 for (
UINT4 detX = 0; detX < resampMultiRet->
length; detX++ ) {
606 if ( inclAutoCorr ) {
615 if ( fabs( timeDiff ) <= maxLag ) {
624 UINT4 allPairCounter = 0;
625 UINT4 kFlatCounter = 0;
626 UINT4 lFlatCounter = 0;
627 for (
UINT4 detX = 0; detX < resampMultiRet->
length; detX++ ) {
631 if ( inclAutoCorr ) {
632 lFlatCounter = kFlatCounter;
634 lFlatCounter = kFlatCounter + 1;
640 UINT4 outLmatchingGivenKMulti = 0;
645 if ( ( ( detY == detX ) && inclSameDetector ) || ( detY > detX ) ) {
646 if ( detY == detX ) {
647 if ( inclAutoCorr ) {
659 if ( fabs( timeDiff ) <= maxLag ) {
666 ++outLmatchingGivenKMulti;
681 ( *pairIndexList ) = ret;
682 ( *resampMultiPairIndexList ) = resampMultiRet;
695 const BOOLEAN inclSameDetector,
707 const UINT4 numShortPerDet = multiTimes->data[0]->length;
709 const REAL8 Tshort = multiTimes->data[0]->deltaT;
711 if ( ( resampMultiRet =
XLALCalloc( 1,
sizeof( *resampMultiRet ) ) ) == NULL ) {
722 if ( ( MultiListOfLmatchingGivenMultiK =
XLALCalloc( 1,
sizeof( *MultiListOfLmatchingGivenMultiK ) ) ) == NULL ) {
725 MultiListOfLmatchingGivenMultiK->length = numDets;
727 if ( ( MultiListOfLmatchingGivenMultiK->data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->length,
sizeof( *MultiListOfLmatchingGivenMultiK->data ) ) ) == NULL ) {
728 XLALFree( MultiListOfLmatchingGivenMultiK );
732 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
733 MultiListOfLmatchingGivenMultiK->data[detX].length = numShortPerDet;
734 if ( ( MultiListOfLmatchingGivenMultiK->data[detX].data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->data[detX].length,
sizeof( *MultiListOfLmatchingGivenMultiK->data[detX].data ) ) ) == NULL ) {
735 XLALFree( MultiListOfLmatchingGivenMultiK->data[detX].data );
740 for (
UINT4 k = 0;
k < MultiListOfLmatchingGivenMultiK->data[detX].length;
k++ ) {
742 MultiListOfLmatchingGivenMultiK->data[detX].data[
k].length = numDets;
743 if ( ( MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->data[detX].data[
k].length,
sizeof( *MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data ) ) ) == NULL ) {
744 XLALFree( MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data );
756 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
757 MultiListOfLmatchingGivenMultiK->data[detX].detInd = detX;
758 for (
UINT4 k = 0;
k < MultiListOfLmatchingGivenMultiK->data[detX].length;
k++ ) {
759 MultiListOfLmatchingGivenMultiK->data[detX].data[
k].sftInd =
k;
760 for (
UINT4 detY = 0; detY < numDets; detY++ ) {
761 UINT4 LmatchingGivenKMulti = 0;
762 if ( ( ( detY == detX ) && inclSameDetector ) || ( detY > detX ) ) {
763 if ( detY == detX ) {
764 if ( inclAutoCorr ) {
770 lMinMulti = (
UINT4 )
MYMAX( 0,
k - round( 2 * maxLag / Tshort ) - 2 );
775 lMaxMulti = (
UINT4 )
MYMIN( numShortPerDet, lMinMulti + round( 4 * maxLag / Tshort ) + 4 );
776 for (
UINT4 l = lMinMulti;
l < lMaxMulti;
l++ ) {
779 if ( fabs( timeDiff ) <= maxLag ) {
780 ++LmatchingGivenKMulti;
783 MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data[detY].detInd = detY;
784 MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data[detY].sftCount = LmatchingGivenKMulti;
795 resampMultiRet->length = numDets;
796 resampMultiRet->maxLag = maxLag;
797 resampMultiRet->Tsft =
Tsft;
798 resampMultiRet->Tshort = Tshort;
799 resampMultiRet->inclAutoCorr = inclAutoCorr;
800 resampMultiRet->inclSameDetector = inclSameDetector;
801 if ( ( resampMultiRet->data =
XLALCalloc( resampMultiRet->length,
sizeof( *resampMultiRet->data ) ) ) == NULL ) {
806 for (
UINT4 detX = 0; detX < resampMultiRet->length; detX++ ) {
807 resampMultiRet->data[detX].length = MultiListOfLmatchingGivenMultiK->data[detX].length;
809 resampMultiRet->data[detX].detInd = MultiListOfLmatchingGivenMultiK->data[detX].detInd;
810 if ( ( resampMultiRet->data[detX].data =
XLALCalloc( resampMultiRet->data[detX].length,
sizeof( *resampMultiRet->data[detX].data ) ) ) == NULL ) {
811 XLALFree( resampMultiRet->data[detX].data );
814 for (
UINT4 k = 0;
k < resampMultiRet->data[detX].length;
k++ ) {
815 resampMultiRet->data[detX].data[
k].length = MultiListOfLmatchingGivenMultiK->data[detX].data[
k].length;
817 resampMultiRet->data[detX].data[
k].sftInd = MultiListOfLmatchingGivenMultiK->data[detX].data[
k].sftInd;
818 if ( ( resampMultiRet->data[detX].data[
k].data =
XLALCalloc( resampMultiRet->data[detX].data[
k].length,
sizeof( *resampMultiRet->data[detX].data[
k].data ) ) ) == NULL ) {
819 XLALFree( resampMultiRet->data[detX].data[
k].data );
822 for (
UINT4 detY = 0; detY < resampMultiRet->data[detX].data[
k].length; detY++ ) {
823 resampMultiRet->data[detX].data[
k].data[detY].length = MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data[detY].sftCount;
825 resampMultiRet->data[detX].data[
k].data[detY].detInd = MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data[detY].detInd;
826 if ( ( resampMultiRet->data[detX].data[
k].data[detY].data =
XLALCalloc( resampMultiRet->data[detX].data[
k].data[detY].length,
sizeof( *resampMultiRet->data[detX].data[
k].data[detY].data ) ) ) == NULL ) {
827 XLALFree( resampMultiRet->data[detX].data[
k].data[detY].data );
838 if ( ( flatIndexList =
XLALCalloc( 1,
sizeof( *flatIndexList ) ) ) == NULL ) {
841 flatIndexList->length =
numSFTs;
842 if ( ( flatIndexList->data =
XLALCalloc(
numSFTs,
sizeof( *flatIndexList->data ) ) ) == NULL ) {
848 UINT4 allPairCounter = 0;
849 UINT4 kFlatCounter = 0;
850 UINT4 lFlatCounter = 0;
851 for (
UINT4 detX = 0; detX < resampMultiRet->length; detX++ ) {
852 for (
UINT4 k = 0;
k < resampMultiRet->data[detX].length;
k++ ) {
853 kFlatCounter = numShortPerDet * detX +
k;
856 for (
UINT4 detY = 0; detY < resampMultiRet->data[detX].data[
k].length; detY++ ) {
860 UINT4 outLmatchingGivenKMulti = 0;
865 if ( ( ( detY == detX ) && inclSameDetector ) || ( detY > detX ) ) {
866 if ( detY == detX ) {
867 if ( inclAutoCorr ) {
873 lMinMulti = (
UINT4 )
MYMAX( 0,
k - round( 2 * maxLag / Tshort ) - 2 );
877 lMaxMulti = (
UINT4 )
MYMIN( numShortPerDet, lMinMulti + round( 4 * maxLag / Tshort ) + 4 );
878 for (
UINT4 l = lMinMulti;
l < lMaxMulti;
l++ ) {
881 if ( fabs( timeDiff ) <= maxLag ) {
882 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].sftInd =
l;
883 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].detInd = detY;
884 lFlatCounter = numShortPerDet * detY +
l;
885 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].flatInd = lFlatCounter;
887 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].pairInd = allPairCounter;
888 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].sciFlag = 1.0;
889 ++outLmatchingGivenKMulti;
895 resampMultiRet->data[detX].data[
k].flatInd = kFlatCounter;
896 resampMultiRet->data[detX].data[
k].sciFlag = 1.0;
897 flatIndexList->data[kFlatCounter].detInd = detX;
899 flatIndexList->data[kFlatCounter].sftInd = resampMultiRet->data[detX].data[
k].sftInd;
906 resampMultiRet->allPairCount = allPairCounter;
909 resampMultiRet->sftTotalCount = 1 + kFlatCounter;
910 resampMultiRet->indexList = flatIndexList;
914 if ( ( standardPairIndexList =
XLALCalloc( 1,
sizeof( *standardPairIndexList ) ) ) == NULL ) {
917 standardPairIndexList->length = resampMultiRet->allPairCount;
918 if ( ( standardPairIndexList->data =
XLALCalloc( standardPairIndexList->length,
sizeof( *standardPairIndexList->data ) ) ) == NULL ) {
926 UINT4 standardPairCount = 0;
927 for (
UINT4 detX = 0; detX < resampMultiRet->length; detX++ ) {
928 for (
UINT4 k = 0;
k < resampMultiRet->data[detX].length;
k++ ) {
929 for (
UINT4 detY = 0; detY < resampMultiRet->data[detX].data[
k].length; detY++ ) {
930 for (
UINT4 l = 0;
l < resampMultiRet->data[detX].data[
k].data[detY].length;
l++ ) {
932 sftNum1 = numShortPerDet * detX + resampMultiRet->data[detX].data[
k].sftInd;
933 sftNum2 = numShortPerDet * detY + resampMultiRet->data[detX].data[
k].data[detY].data[
l].sftInd;
934 standardPairIndexList->data[standardPairCount].sftNum[0] = sftNum1;
935 standardPairIndexList->data[standardPairCount].sftNum[1] = sftNum2;
941 resampMultiRet->pairIndexList = standardPairIndexList;
942 resampMultiRet->oldPairCount = standardPairCount;
943 ( *resampMultiPairIndexList ) = resampMultiRet;
957 UINT4 grandTotalCounter = 0;
958 for (
UINT4 detX = 0; detX < resampMultiRet->
length; detX++ ) {
970 fprintf( stdout,
"Sanity check: GRAND TOTAL of passes through loop: %u\n", grandTotalCounter );
971 fprintf( stdout,
"Pairing completed\n" );
973 UINT4 newKFlatCounter = 0;
974 for (
UINT4 detX = 0; detX < resampMultiRet->
length; detX++ ) {
981 printf(
"newKFlatCounter: %u\n", newKFlatCounter );
1006 for (
UINT4 j = 0;
j < numPairs;
j++ ) {
1013 ret1->
data[
j] = 0.1 * ( multiCoeffs->
data[detInd1]->
a->
data[sftInd1]
1014 * multiCoeffs->
data[detInd2]->
a->
data[sftInd2]
1015 + multiCoeffs->
data[detInd1]->
b->
data[sftInd1]
1016 * multiCoeffs->
data[detInd2]->
b->
data[sftInd2] );
1017 ret2->
data[
j] = 0.1 * ( multiCoeffs->
data[detInd1]->
a->
data[sftInd1]
1018 * multiCoeffs->
data[detInd2]->
b->
data[sftInd2]
1019 - multiCoeffs->
data[detInd1]->
b->
data[sftInd1]
1020 * multiCoeffs->
data[detInd2]->
a->
data[sftInd2] );
1023 ( *Gamma_ave ) = ret1;
1024 ( *Gamma_circ ) = ret2;
1051 UINT4 detInd1[numPairs];
1052 UINT4 detInd2[numPairs];
1053 UINT4 sftInd1[numPairs];
1054 UINT4 sftInd2[numPairs];
1056 UINT4 pairCount = 0;
1057 for (
UINT4 detX = 0; detX < resampMultiPairIndexList->
length; detX++ ) {
1063 detInd1[pairCount] = resampMultiPairIndexList->
data[detX].
detInd;
1065 sftInd1[pairCount] = resampMultiPairIndexList->
data[detX].
data[
k].
sftInd;
1072 for (
UINT4 j = 0;
j < numPairs;
j++ ) {
1074 * multiCoeffs->
data[detInd2[
j]]->
a->
data[sftInd2[
j]]
1075 + multiCoeffs->
data[detInd1[
j]]->
b->
data[sftInd1[
j]]
1076 * multiCoeffs->
data[detInd2[
j]]->
b->
data[sftInd2[
j]] );
1078 * multiCoeffs->
data[detInd2[
j]]->
b->
data[sftInd2[
j]]
1079 - multiCoeffs->
data[detInd1[
j]]->
b->
data[sftInd1[
j]]
1080 * multiCoeffs->
data[detInd2[
j]]->
a->
data[sftInd2[
j]] );
1083 ( *Gamma_ave ) = ret1;
1084 ( *Gamma_circ ) = ret2;
1108 REAL4 eleMultiCoeffs1a = 0;
1109 REAL4 eleMultiCoeffs2a = 0;
1110 REAL4 eleMultiCoeffs1b = 0;
1111 REAL4 eleMultiCoeffs2b = 0;
1113 REAL4 sciMultiCoeffs1a = 0;
1114 REAL4 sciMultiCoeffs2a = 0;
1115 REAL4 sciMultiCoeffs1b = 0;
1116 REAL4 sciMultiCoeffs2b = 0;
1119 REAL4 castSciFlag1[numPairs];
1120 REAL4 castSciFlag2[numPairs];
1122 UINT4 detInd1[numPairs];
1123 UINT4 detInd2[numPairs];
1124 UINT4 sftInd1[numPairs];
1125 UINT4 sftInd2[numPairs];
1127 UINT4 pairCount = 0;
1128 for (
UINT4 detX = 0; detX < resampMultiPairIndexList->
length; detX++ ) {
1134 detInd1[pairCount] = resampMultiPairIndexList->
data[detX].
detInd;
1136 sftInd1[pairCount] = resampMultiPairIndexList->
data[detX].
data[
k].
sftInd;
1144 castSciFlag1[pairCount] = 1.0;
1145 castSciFlag2[pairCount] = 1.0;
1151 for (
UINT4 j = 0;
j < numPairs;
j++ ) {
1152 eleMultiCoeffs1a = multiCoeffs->
data[detInd1[
j]]->
a->
data[sftInd1[
j]];
1153 eleMultiCoeffs2a = multiCoeffs->
data[detInd2[
j]]->
a->
data[sftInd2[
j]];
1154 eleMultiCoeffs1b = multiCoeffs->
data[detInd1[
j]]->
b->
data[sftInd1[
j]];
1155 eleMultiCoeffs2b = multiCoeffs->
data[detInd2[
j]]->
b->
data[sftInd2[
j]];
1157 sciMultiCoeffs1a = eleMultiCoeffs1a * castSciFlag1[
j];
1158 sciMultiCoeffs2a = eleMultiCoeffs2a * castSciFlag2[
j];
1159 sciMultiCoeffs1b = eleMultiCoeffs1b * castSciFlag1[
j];
1160 sciMultiCoeffs2b = eleMultiCoeffs2b * castSciFlag2[
j];
1161 ret1->
data[
j] = 0.1 * ( sciMultiCoeffs1a
1164 * sciMultiCoeffs2b );
1165 ret2->
data[
j] = 0.1 * ( sciMultiCoeffs1a
1168 * sciMultiCoeffs2a );
1171 ( *Gamma_ave ) = ret1;
1172 ( *Gamma_circ ) = ret2;
1189 UINT4 numTshortPairs = sftPairForTshortPair->
length;
1196 Gamma->
length, numTshortPairs, maxAlphaInReAlpha );
1201 for (
UINT4 reAlpha = 0; reAlpha < numTshortPairs; reAlpha++ ) {
1202 REAL8 thisGammaSq = 0.;
1203 for (
UINT4 alphaInReAlpha = 0; alphaInReAlpha < maxAlphaInReAlpha; alphaInReAlpha++ ) {
1204 UINT4 alpha = sftPairForTshortPair->
data[reAlpha * maxAlphaInReAlpha + alphaInReAlpha];
1210 thisGammaSq *=
SQUARE( normFactor );
1211 ret->
data[reAlpha] = sqrt( thisGammaSq );
1214 ( *resampGamma ) = ret;
1246 if ( curlyGAmp->
length != numPairs ) {
1251 REAL8 curlyGSqr = 0;
1267 && ( detInd2 < inputSFTs->length ),
1270 sftNum1, sftNum2, detInd1, detInd2, inputSFTs->
length );
1276 && ( sftInd2 < inputSFTs->
data[detInd2]->length ),
1279 sftNum1, sftNum2, detInd1, detInd2, sftInd1, sftInd2,
1288 * expSignalPhases->
data[sftNum1]
1289 * conj( expSignalPhases->
data[sftNum2] );
1290 INT4 baseCCSign = 1;
1291 if ( ( ( lowestBins->
data[sftNum1] - lowestBins->
data[sftNum2] ) % 2 ) != 0 ) {
1295 UINT4 lowestBin1 = lowestBins->
data[sftNum1];
1298 "Loop would run off end of array:\n lowestBin1=%d, numBins=%d, len(dataArray1)=%d\n",
1299 lowestBin1,
numBins, lenDataArray1 );
1301 COMPLEX8 data1 = dataArray1[lowestBin1 +
j];
1303 INT4 ccSign = baseCCSign;
1304 UINT4 lowestBin2 = lowestBins->
data[sftNum2];
1307 "Loop would run off end of array:\n lowestBin2=%d, numBins=%d, len(dataArray2)=%d\n",
1308 lowestBin2,
numBins, lenDataArray2 );
1311 REAL8 sincFactor = 1;
1314 nume += ccSign * sincFactor * creal( GalphaCC * conj( data1 ) * data2 );
1319 curlyGSqr +=
SQUARE( GalphaAmp );
1325 if ( curlyGSqr == 0.0 ) {
1330 *ccStat = 4 * multiWeights->
Sinv_Tsft * nume / sqrt( *evSquared );
1365 REAL8 curlyEquivGSqrSum = 0;
1366 for (
UINT4 j = 0;
j < ws->numFreqBinsOut;
j++ ) {
1367 numeEquivAve->data[
j] = 0;
1368 numeEquivCirc->data[
j] = 0;
1369 ccStatVector->data[
j] = 0;
1370 evSquaredVector->data[
j] = 0;
1373 const REAL8 dt_SRC = multiTimeSeries_SRC_b->data[0]->deltaT;
1374 const REAL8 SRCsampPerTcoh = resampMultiPairs->Tshort / dt_SRC;
1377 for (
UINT4 detX = 0; detX < resampMultiPairs->length; detX++ ) {
1378 for (
UINT4 sftK = 0; sftK < resampMultiPairs->data[detX].length; sftK++ ) {
1379 if ( (
XLALComputeFaFb_CrossCorrResamp( ws, ws1KFaX_k, ws1KFbX_k, resampMultiPairs, multiTimeSeries_SRC_a, multiTimeSeries_SRC_b, dopplerpos, binaryTemplateSpacings, SRCsampPerTcoh, detX, sftK, 0,
FALSE ) ) !=
XLAL_SUCCESS ) {
1383 for (
UINT4 detY = 0; detY < resampMultiPairs->data[detX].data[sftK].length; detY++ ) {
1384 if ( (
XLALComputeFaFb_CrossCorrResamp( ws, ws2LFaX_k, ws2LFbX_k, resampMultiPairs, multiTimeSeries_SRC_a, multiTimeSeries_SRC_b, dopplerpos, binaryTemplateSpacings, SRCsampPerTcoh, detX, sftK, detY,
TRUE ) ) !=
XLAL_SUCCESS ) {
1389 for (
UINT8 j = 0;
j < ws->numFreqBinsOut;
j++ ) {
1390 numeEquivAve->data[
j] += creal( 0.1 * ( conj( ws1KFaX_k[
j] ) * ws2LFaX_k[
j] + conj( ws1KFbX_k[
j] ) * ws2LFbX_k[
j] ) );
1403 REAL8 GalphaResampAmp = resampCurlyGAmp->data[
alpha];
1404 curlyEquivGSqrSum +=
SQUARE( GalphaResampAmp );
1422 const REAL8 originalMultiWeightsSinvTsft = multiWeights->Sinv_Tsft * ( resampMultiPairs->Tsft / resampMultiPairs->Tshort );
1423 for (
UINT8 j = 0;
j < ws->numFreqBinsOut;
j++ ) {
1424 evSquaredVector->data[
j] = 8 *
SQUARE( multiWeights->Sinv_Tsft ) * curlyEquivGSqrSum;
1425 ccStatVector->data[
j] = 4 * originalMultiWeightsSinvTsft * numeEquivAve->data[
j] / sqrt( evSquaredVector->data[
j] );
1449 const UINT4 numCoords = coordSys->
dim;
1456 for (
UINT4 coordNum = 0; coordNum < numCoords; coordNum++ ) {
1461 times = multiTimes->
data[detInd];
1471 ( *phaseDerivs ) = ret;
1507 const UINT4 numCoords = coordSys->
dim;
1510 printf(
"numShorts: %u\n", numShorts );
1515 for (
UINT4 coordNum = 0; coordNum < numCoords; coordNum++ ) {
1516 for (
UINT4 detX = 0; detX < resampMultiPairs->
length; detX++ ) {
1527 REAL8 tSSBApprox = startTime8 + Tshort * shortSFTIndOwn;
1533 ( *resampPhaseDerivs ) = retNew;
1562 const UINT4 numCoords = coordSys->
dim;
1571 if ( ( ret_g = gsl_matrix_calloc( numCoords, numCoords ) ) == NULL ) {
1577 if ( ( ret_e = gsl_vector_calloc( numCoords ) ) == NULL ) {
1585 for (
UINT4 pairNum = 0; pairNum < numPairs; pairNum++ ) {
1590 REAL8 circWeight = Gamma_ave->
data[pairNum] * Gamma_circ->
data[pairNum];
1591 for (
UINT4 i = 0;
i < numCoords;
i++ ) {
1593 REAL8 epsi = gsl_vector_get( ret_e,
i );
1594 epsi += circWeight * dDeltaPhi_i->
data[
i];
1595 gsl_vector_set( ret_e,
i, epsi );
1597 REAL8 gij = gsl_matrix_get( ret_g,
i,
j );
1598 gij += aveWeight * dDeltaPhi_i->
data[
i] * dDeltaPhi_i->
data[
j];
1599 gsl_matrix_set( ret_g,
i,
j, gij );
1606 for (
UINT4 i = 0;
i < numCoords;
i++ ) {
1607 REAL8 epsi = gsl_vector_get( ret_e,
i );
1609 gsl_vector_set( ret_e,
i, epsi );
1611 REAL8 gij = gsl_matrix_get( ret_g,
i,
j );
1612 gij /= ( 2.*
denom );
1613 gsl_matrix_set( ret_g,
i,
j, gij );
1615 gsl_matrix_set( ret_g,
j,
i, gij );
1622 ( *sumGammaSq ) =
denom;
1652 const UINT4 numCoords = coordSys->
dim;
1662 gsl_matrix *ret_gNew;
1663 if ( ( ret_gNew = gsl_matrix_calloc( numCoords, numCoords ) ) == NULL ) {
1668 gsl_vector *ret_eNew;
1669 if ( ( ret_eNew = gsl_vector_calloc( numCoords ) ) == NULL ) {
1678 UINT4 pairMetric = 0;
1681 REAL8 aveNewWeight = 0.0;
1682 REAL8 denomNew = 0.0;
1683 REAL8 circNewWeight = 0.0;
1684 for (
UINT4 detX = 0; detX < resampMultiPairs->
length; detX++ ) {
1691 aveNewWeight =
SQUARE( Gamma_ave->
data[pairMetric] );
1692 denomNew += aveNewWeight;
1693 circNewWeight = Gamma_ave->
data[pairMetric] * Gamma_circ->
data[pairMetric];
1694 for (
UINT4 i = 0;
i < numCoords;
i++ ) {
1695 dDeltaPhiNew_i->
data[
i] = phaseDerivs->
data[
i * numShorts + sftInd1] - phaseDerivs->
data[
i * numShorts + sftInd2];
1696 REAL8 epsNewi = gsl_vector_get( ret_eNew,
i );
1697 epsNewi += circNewWeight * dDeltaPhiNew_i->
data[
i];
1698 gsl_vector_set( ret_eNew,
i, epsNewi );
1700 REAL8 gijNew = gsl_matrix_get( ret_gNew,
i,
j );
1701 gijNew += aveNewWeight * dDeltaPhiNew_i->
data[
i] * dDeltaPhiNew_i->
data[
j];
1702 gsl_matrix_set( ret_gNew,
i,
j, gijNew );
1712 for (
UINT4 i = 0;
i < numCoords;
i++ ) {
1713 REAL8 epsNewi = gsl_vector_get( ret_eNew,
i );
1714 epsNewi /= denomNew;
1715 gsl_vector_set( ret_eNew,
i, epsNewi );
1717 REAL8 gijNew = gsl_matrix_get( ret_gNew,
i,
j );
1718 gijNew /= ( 2.*denomNew );
1719 gsl_matrix_set( ret_gNew,
i,
j, gijNew );
1721 gsl_matrix_set( ret_gNew,
j,
i, gijNew );
1726 ( *g_ij ) = ret_gNew;
1727 ( *eps_i ) = ret_eNew;
1728 ( *sumGammaSq ) = denomNew;
1742 REAL8 *weightedMuTAve,
1757 REAL8 TSquaWeightedAve = 0;
1758 REAL8 SinSquaWeightedAve = 0;
1762 REAL8 muTAveSqr = 0;
1763 REAL8 muTSqrAve = 0;
1764 REAL8 sinSquare = 0;
1772 for (
UINT4 j = 0;
j < numalpha;
j++ ) {
1784 muT += sqrG_alpha * TMean;
1785 muTSqr += sqrG_alpha *
SQUARE( TMean );
1786 sinSquare += sqrG_alpha *
SQUARE( sin(
LAL_PI * TDiff / ( DopplerParams.
period ) ) );
1787 tSquare += sqrG_alpha *
SQUARE( TDiff );
1788 denom += sqrG_alpha;
1789 rhosum += 2 * sqrG_alpha;
1792 muTAve = muT /
denom;
1793 muTAveSqr =
SQUARE( muTAve );
1794 muTSqrAve = muTSqr /
denom;
1795 REAL8 sigmaTSqr = muTSqrAve - muTAveSqr;
1796 TSquaWeightedAve = tSquare /
denom;
1797 SinSquaWeightedAve = sinSquare /
denom;
1803 *weightedMuTAve = muTAve;
1832 REAL8 TSquaWeightedAve = 0;
1833 REAL8 SinSquaWeightedAve = 0;
1837 REAL8 muTAveSqr = 0;
1838 REAL8 muTSqrAve = 0;
1839 REAL8 sinSquare = 0;
1845 UINT4 numPairs = resampMultiPairIndexList->allPairCount;
1847 SFTIndexList *indexList = resampMultiPairIndexList->indexList;
1849 for (
UINT4 j = 0;
j < numPairs;
j++ ) {
1861 muT += sqrG_alpha * TMean;
1862 muTSqr += sqrG_alpha *
SQUARE( TMean );
1863 sinSquare += sqrG_alpha *
SQUARE( sin(
LAL_PI * TDiff / ( DopplerParams.
period ) ) );
1864 tSquare += sqrG_alpha *
SQUARE( TDiff );
1865 denom += sqrG_alpha;
1866 rhosum += 2 * sqrG_alpha;
1868 muTAve = muT /
denom;
1869 muTAveSqr =
SQUARE( muTAve );
1870 muTSqrAve = muTSqr /
denom;
1871 REAL8 sigmaTSqr = muTSqrAve - muTAveSqr;
1872 TSquaWeightedAve = tSquare /
denom;
1873 SinSquaWeightedAve = sinSquare /
denom;
1874 *hSens = 4 *
SQUARE( multiWeights->Sinv_Tsft ) * rhosum;
2028 UINT4 numShortPerDet
2039 UINT4 numSFTsNew = numShortPerDet;
2047 ret->
length = numSFTsNew;
2054 for (
i = 0;
i < numShortPerDet;
i ++ ) {
2057 XLALGPSAdd( &( epochHolder ), naiveEpochReal );
2059 ret->
data[
i] = epochHolder;
2064 ( *sciFlag ) = retFlag;
2072 const UINT4 numShortPerDet,
2077 UINT4 numSFTsNew = numShortPerDet;
2085 ret->
length = numSFTsNew;
2091 for (
i = 0;
i < numShortPerDet;
i ++ ) {
2096 ret->
data[
i] = epochHolder;
2109 const UINT4 numShortPerDet
2120 UINT4 numSFTsNew = numShortPerDet;
2128 ret->
length = numSFTsNew;
2135 for (
i = 0;
i < numShortPerDet;
i ++ ) {
2138 XLALGPSAdd( &( epochHolder ), naiveEpochReal );
2140 ret->
data[
i] = epochHolder;
2144 ( *sciFlag ) = retFlag;
2157 const UINT4 numShortPerDet,
2163 if ( !multiTimes || multiTimes->length == 0 ) {
2167 UINT4 numIFOs = multiTimes->length;
2171 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2186 if ( alignTShorts ==
TRUE ) {
2188 epoch = multiTimes->data[0]->data[0];
2189 for ( X = 1; X < numIFOs; X ++ ) {
2191 epoch = multiTimes->data[X]->data[0];
2195 for ( X = 0; X < numIFOs; X ++ ) {
2196 if ( alignTShorts ==
FALSE ) {
2197 epoch = multiTimes->data[X]->data[0];
2222 const UINT4 numShortPerDet
2228 if ( !multiTimes || multiTimes->length == 0 ) {
2232 UINT4 numIFOs = multiTimes->length;
2236 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2249 if ( ( retFlagVect =
XLALCalloc( 1,
sizeof( *retFlagVect ) ) ) == NULL ) {
2254 if ( ( retFlagVect->
data =
XLALCalloc( numIFOs,
sizeof( *retFlagVect->
data ) ) ) == NULL ) {
2259 retFlagVect->
length = numIFOs;
2263 for ( X = 0; X < numIFOs; X ++ ) {
2272 ( *scienceFlagVect ) = retFlagVect;
2286 UINT4 numShortPerDet
2300 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2313 if ( ( retFlagVect =
XLALCalloc( 1,
sizeof( *retFlagVect ) ) ) == NULL ) {
2318 if ( ( retFlagVect->
data =
XLALCalloc( numIFOs,
sizeof( *retFlagVect->
data ) ) ) == NULL ) {
2323 retFlagVect->
length = numIFOs;
2327 for ( X = 0; X < numIFOs; X ++ ) {
2337 ( *scienceFlagVect ) = retFlagVect;
2359 if (
prefix[0] ==
'Z' ) {
2374 REAL4 sinG, cosG, sinGcosG, sinGsinG, cosGcosG;
2378 sinGsinG = sinG * sinG;
2379 sinGcosG = sinG * cosG;
2380 cosGcosG = cosG * cosG;
2388 - 2 *
detector->response[0][1] * sinGcosG
2389 +
detector->response[1][1] * sinGsinG;
2391 + 2 *
detector->response[0][1] * sinGcosG
2392 +
detector->response[1][1] * cosGcosG;
2395 +
detector->response[0][1] * ( cosGcosG - sinGsinG );
2429 UINT4 numShortPerDet
2439 UINT4 numSteps = numShortPerDet;
2440 printf(
"numSteps in GetDetectorStatesShort: %u\n", numSteps );
2455 if (
detector->frDetector.prefix[0] ==
'Z' ) {
2463 for (
i = 0;
i < numSteps;
i++ ) {
2481 baryinput.
tgps = tgps;
2482 baryinput.
site = ( *detector );
2497 for (
j = 0;
j < 3;
j++ ) {
2536 UINT4 numShortPerDet
2554 if ( ( ret =
LALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2575 if ( !tsX || !detX ) {
2576 XLALPrintError(
"%s: invalid NULL data-vector tsX[%d] = %p, detX[%d] = %p\n",
__func__, X, tsX, X, detX );
2616 const REAL8 tSFTOld,
2617 const UINT4 numShortPerDet,
2619 const UINT4 maxNumStepsOldIfGapless,
2624 UINT4 numStepsXNew = numShortPerDet;
2634 for (
UINT4 alphaFuture = 0; alphaFuture < numStepsXNew; alphaFuture++ ) {
2635 newWeightStamps->
data[alphaFuture] = alphaFuture * tShort;
2648 REAL8 tAlphaOldWithGaps = 0;
2651 for (
UINT4 alphaLoad = 0; alphaLoad < maxNumStepsOldIfGapless; alphaLoad++ ) {
2653 tAlpha = alphaLoad * tSFTOld;
2655 tAlphaOldWithGaps =
XLALGPSDiff( &( multiTimes->data[X]->data[jj] ), &( multiTimes->data[X]->data[0] ) );
2656 for (
UINT4 kk = jj; kk < multiTimes->data[X]->length ; kk++ ) {
2658 tAlphaOldWithGaps =
XLALGPSDiff( &( multiTimes->data[X]->data[kk] ), &( multiTimes->data[X]->data[0] ) );
2659 if ( tAlphaOldWithGaps <= tAlpha ) {
2666 if ( ( tAlpha - tAlphaOldWithGaps ) < tSFTOld ) {
2668 oldTSWeightsX->
data->
data[alphaLoad] = weightsX->
data[jj] + 0.0 * I;
2672 oldTSWeightsX->
data->
data[alphaLoad] = 0.0 + 0.0 * I;
2684 for (
UINT4 alphaReal = 0; alphaReal < numStepsXNew; alphaReal++ ) {
2686 newWeightsXReal->
data[alphaReal] =
MYMAX( 0, creal( newWeightsX->
data[alphaReal] ) );
2688 ret = newWeightsXReal;
2692 ( *resampMultiWeightsX ) = ret;
2702 const REAL8 tSFTOld,
2703 const UINT4 numShortPerDet,
2712 REAL8 ratioSFTs = tShort / tSFTOld;
2719 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2734 ret->
Sinv_Tsft = multiWeights->Sinv_Tsft * ratioSFTs;
2736 REAL8 Tobs = numShortPerDet * tShort;
2737 UINT4 maxNumStepsOldIfGapless = lround( Tobs / tSFTOld );
2757 const REAL8 tSFTOld,
2758 const UINT4 numShortPerDet,
2768 REAL8 ratioSFTs = tShort / tSFTOld;
2783 REAL8 Tobs = numShortPerDet * tShort;
2784 UINT4 maxNumStepsOldIfGapless = lround( Tobs / tSFTOld );
2794 ( *multiWeights ) = ret;
2806 UINT4 numShortPerDet,
2812 if ( !multiAMcoef ) {
2823 REAL8 ratioSFTs = tShort / tSFTOld;
2825 REAL4 Ad = 0, Bd = 0, Cd = 0;
2827 REAL8 Tobs = numShortPerDet * tShort;
2828 UINT4 maxNumStepsOldIfGapless = lround( Tobs / tSFTOld );
2834 UINT4 numStepsXNew = numShortPerDet;
2835 if ( multiWeights ) {
2842 for (
UINT4 alphaFuture = 0; alphaFuture < numStepsXNew; alphaFuture++ ) {
2843 newWeightStamps->
data[alphaFuture] = alphaFuture * tShort;
2857 REAL8 tAlphaOldWithGaps = 0;
2860 for (
UINT4 alphaLoad = 0; alphaLoad < maxNumStepsOldIfGapless; alphaLoad++ ) {
2862 tAlpha = alphaLoad * tSFTOld;
2869 if ( tAlphaOldWithGaps <= tAlpha ) {
2877 if ( ( tAlpha - tAlphaOldWithGaps ) < tSFTOld ) {
2879 oldTSWeightsX->
data->
data[alphaLoad] = weightsX->
data[jj] + 0.0 * I;
2883 oldTSWeightsX->
data->
data[alphaLoad] = 0.0 + 0.0 * I;
2897 for (
UINT4 alphaReal = 0; alphaReal < numStepsXNew; alphaReal++ ) {
2899 newWeightsXReal->
data[alphaReal] =
MYMAX( 0, creal( newWeightsX->
data[alphaReal] ) );
2915 REAL4 AdX = 0, BdX = 0, CdX = 0;
2931 amcoeX->
D = AdX * BdX - CdX * CdX;
2936 if ( amcoeX->
D <= 0 ) {
2937 amcoeX->
D = INFINITY;
2950 multiAMcoef->
Mmunu.
Dd = Ad * Bd - Cd * Cd;
2955 if ( multiAMcoef->
Mmunu.
Dd <= 0 ) {
2956 multiAMcoef->
Mmunu.
Dd = INFINITY;
2960 if ( multiWeights ) {
2977 if ( !DetectorStates ) {
2992 REAL4 sin1delta, cos1delta;
2993 REAL4 sin1alpha, cos1alpha;
2997 REAL4 xi1 = - sin1alpha;
2999 REAL4 eta1 = sin1delta * cos1alpha;
3000 REAL4 eta2 = sin1delta * sin1alpha;
3001 REAL4 eta3 = - cos1delta;
3014 for (
i = 0;
i < numSteps;
i++ ) {
3019 ai =
d->d11 * ( xi1 * xi1 - eta1 * eta1 )
3020 + 2 *
d->d12 * ( xi1 *
xi2 - eta1 * eta2 )
3021 - 2 *
d->d13 * eta1 * eta3
3022 +
d->d22 * (
xi2 *
xi2 - eta2 * eta2 )
3023 - 2 *
d->d23 * eta2 * eta3
3024 -
d->d33 * eta3 * eta3;
3026 bi =
d->d11 * 2 * xi1 * eta1
3027 + 2 *
d->d12 * ( xi1 * eta2 +
xi2 * eta1 )
3028 + 2 *
d->d13 * xi1 * eta3
3029 +
d->d22 * 2 *
xi2 * eta2
3030 + 2 *
d->d23 *
xi2 * eta3;
3052 UINT4 numShortPerDet,
3057 if ( !multiDetStates ) {
3066 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
3109 const REAL8 resampTshort,
3114 UINT4 numShortPerDet = 0;
3116 numShortPerDet = lround( Tobs / resampTshort );
3117 return numShortPerDet;
3138 REAL8 tAlphaOldWithGaps = 0;
3140 for (
UINT4 ii = 0; ii < numSFTsNew; ii++ ) {
3146 tAlphaOldWithGaps =
XLALGPSDiff( &( Times->data[jj] ), &( Times->data[0] ) );
3153 for (
UINT4 kk = jj; kk < Times->length ; kk++ ) {
3154 tAlphaOldWithGaps =
XLALGPSDiff( &( Times->data[kk] ), &( Times->data[0] ) );
3155 if ( tAlphaOldWithGaps <= tAlpha ) {
3163 if ( tAlpha - tAlphaOldWithGaps <
Tsft ) {
3191 REAL8 Tsft = 1.0 / sfts->data[0].deltaF;
3194 REAL8 tAlphaOldWithGaps = 0;
3196 for (
UINT4 ii = 0; ii < numSFTsNew; ii++ ) {
3202 tAlphaOldWithGaps =
XLALGPSDiff( &( sfts->data[jj].epoch ), &( sfts->data[0] ).epoch );
3209 for (
UINT4 kk = jj; kk < sfts->length ; kk++ ) {
3210 tAlphaOldWithGaps =
XLALGPSDiff( &( sfts->data[kk].epoch ), &( sfts->data[0] ).epoch );
3211 if ( tAlphaOldWithGaps <= tAlpha ) {
3219 if ( tAlpha - tAlphaOldWithGaps <
Tsft ) {
3244 REAL4 castSciFlag1 = 0;
3245 REAL4 castSciFlag2 = 0;
3250 for (
UINT4 detX = 0; detX < resampMultiPairs->
length; detX++ ) {
3251 detInd1 = resampMultiPairs->
data[detX].
detInd;
3320 FstatInput *resampFstatInput,
3321 const UINT4 numFreqBins,
3323 const BOOLEAN treatWarningsAsErrors
3330 COMPLEX8 *restrict ws1KFaX_k = ( *ws1KFaX_kOut );
3331 COMPLEX8 *restrict ws1KFbX_k = ( *ws1KFbX_kOut );
3332 COMPLEX8 *restrict ws2LFaX_k = ( *ws2LFaX_kOut );
3333 COMPLEX8 *restrict ws2LFbX_k = ( *ws2LFbX_kOut );
3338 ( *multiTimeSeries_SRC_aOut ) = multiTimeSeries_SRC_a;
3339 ( *multiTimeSeries_SRC_bOut ) = multiTimeSeries_SRC_b;
3378 const REAL8 dFreqMetric = binaryTemplateSpacings.
fkdot[0];
3380 const REAL8 TspanFFT = 1.0 / dFreqMetric;
3381 const UINT4 decimateFFT = (
UINT4 )ceil( tCoh / TspanFFT );
3382 if ( 1 <= ( dFreqMetric * dt_SRC ) ) {
3383 printf(
"Warning! Metric spacing less than one FFT sample,...\n ...is maxLag < tShort? \n ...proceeding in radiometer mode...\n ...intended for non-production comparison tests only!\n" );
3384 if ( treatWarningsAsErrors ) {
3385 XLALPrintError(
"Error! (treating warnings as errors) metric spacing less than one FFT sample.\n" );
3389 if ( decimateFFT > 1 ) {
3390 printf(
"Warning! Frequency spacing larger than 1/Tcoh, decimation being applied of %" LAL_UINT4_FORMAT "\n", decimateFFT );
3391 if ( treatWarningsAsErrors ==
TRUE ) {
3392 XLALPrintError(
"Error! (treating warnings as errors) FFT samples limited by tCoh (not metric), unexpected unless high mismatchF.\n" );
3396 const REAL8 TspanFFT1 = decimateFFT * TspanFFT;
3398 const UINT4 numSamplesFFT0 = (
UINT4 ) ceil( TspanFFT1 / dt_SRC );
3399 const UINT4 numSamplesFFT = (
UINT4 ) pow( 2, ceil( log2( numSamplesFFT0 ) ) );
3402 const int fft_plan_flags = FFTW_MEASURE;
3404 const double fft_plan_timeout = FFTW_NO_TIMELIMIT ;
3414 ws->decimateFFT = decimateFFT;
3415 ws->numSamplesFFT = numSamplesFFT;
3416 ws->numFreqBinsOut = numFreqBins;
3420 fftw_set_timelimit( fft_plan_timeout );
3421 XLAL_CHECK( ( ws->fftplan = fftwf_plan_dft_1d( numSamplesFFT, ws->TS_FFT, ws->FabX_Raw, FFTW_FORWARD, fft_plan_flags ) ) != NULL,
XLAL_EFAILED,
"fftwf_plan_dft_1d() failed\n" );
3429 ( *ws1KFaX_kOut ) = ws1KFaX_k;
3430 ( *ws1KFbX_kOut ) = ws1KFbX_k;
3431 ( *ws2LFaX_kOut ) = ws2LFaX_k;
3432 ( *ws2LFbX_kOut ) = ws2LFbX_k;
3448 if ( ! sftIndices ) {
3452 if ( sftIndices->
data ) {
3475 if ( sftPairs->
data ) {
3487 if ( !sftResampList ) {
3491 if ( sftResampList->
data ) {
3502 if ( !sftResampMultiList ) {
3506 for (
UINT4 detY = 0; detY < sftResampMultiList->
length; detY++ ) {
3510 if ( sftResampMultiList->
data ) {
3520 if ( !sftResampPairMultiList ) {
3528 if ( sftResampPairMultiList->
data ) {
3539 if ( ! sftMultiPairsResamp ) {
3544 for (
UINT4 detX = 0; detX < sftMultiPairsResamp->
length; detX++ ) {
3551 if ( sftMultiPairsResamp->
data ) {
3566 if ( ! localMultiListOfLmatchingGivenMultiK ) {
3570 UINT4 numDets = localMultiListOfLmatchingGivenMultiK->
length;
3572 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
3573 for (
UINT4 k = 0;
k < localMultiListOfLmatchingGivenMultiK->
data[detX].
length;
k++ ) {
3574 if ( localMultiListOfLmatchingGivenMultiK->
data[detX].
data[
k].
data ) {
3578 if ( localMultiListOfLmatchingGivenMultiK->
data[detX].
data ) {
3583 if ( localMultiListOfLmatchingGivenMultiK->
data ) {
3584 XLALFree( localMultiListOfLmatchingGivenMultiK->
data );
3587 XLALFree( localMultiListOfLmatchingGivenMultiK );
3601 fftwf_destroy_plan( ws->
fftplan );
3607 fftw_free( ws->
FaX_k );
3608 fftw_free( ws->
FbX_k );
3626 const REAL8 freqShift,
3627 const UINT4 indexStartResamp,
3628 const UINT4 indexEndResamp,
3629 const UINT4 numSamplesIn,
3630 const UINT4 insertPoint
3645 if ( insertPoint > numSamplesIn ) {
3646 XLALPrintError(
"ERROR! Would insert off end of matrix, numSamplesIn < insertPoint: %i, %i\n", numSamplesIn, insertPoint );
3656 if ( ( indexEndResamp - indexStartResamp ) > numSamplesIn ) {
3657 XLALPrintError(
"indexStartResamp, indexEndResamp: %u %u\n", indexStartResamp, indexEndResamp );
3658 XLALPrintError(
"ERROR! numSamplesIn only: %u\n", numSamplesIn );
3659 XLALPrintError(
"diff in indices, and num samples: %i %u\n", ( indexEndResamp - indexStartResamp ), numSamplesIn );
3665 REAL4 cosphase, sinphase;
3667 for (
UINT4 j = 0;
j < ( indexEndResamp - indexStartResamp );
j ++ ) {
3669 taup_j = (
j + indexStartResamp ) *
dt + Dtau0;
3672 cycles = - freqShift * taup_j;
3683 em2piphase =
crectf( cosphase, sinphase );
3687 xOut[
j + insertPoint] = em2piphase * xIn->data->data[(
j + indexStartResamp )];
3707 const REAL8 SRCsampPerTcoh,
3717 const REAL8 FreqOut0 = dopplerpos->fkdot[0];
3718 const REAL8 fHet = multiTimeSeries_SRC_a->data[0]->f0;
3719 const REAL8 dt_SRC = multiTimeSeries_SRC_b->data[0]->deltaT;
3720 const REAL8 dFreqMetric = binaryTemplateSpacings->fkdot[0];
3811 const REAL4 RedecimateFFT = dFreqMetric * dt_SRC * ( ws->numSamplesFFT );
3812 const REAL8 dFreqFFT = dFreqMetric / RedecimateFFT;
3813 const REAL8 freqShiftInFFT = remainder( FreqOut0 - fHet, dFreqFFT );
3814 const REAL8 fMinFFT = fHet + freqShiftInFFT - dFreqFFT * ( ws->numSamplesFFT / 2 );
3815 XLAL_CHECK( FreqOut0 >= fMinFFT,
XLAL_EDOM,
"Lowest output frequency outside the available frequency band: [FreqOut0 = %.16g] < [fMinFFT = %.16g]\n", FreqOut0, fMinFFT );
3817 const UINT4 offset_bins = (
UINT4 ) lround( ( FreqOut0 - fMinFFT ) / dFreqFFT );
3818 const UINT4 maxOutputBin = offset_bins + (
UINT4 )floor( ( ws->numFreqBinsOut - 1 ) * RedecimateFFT );
3819 XLAL_CHECK( maxOutputBin < ws->numSamplesFFT,
XLAL_EDOM,
"Highest output frequency bin outside available band: [maxOutputBin = %d] >= [ws->numSamplesFFT = %d]\n", maxOutputBin, ws->numSamplesFFT );
3822 UINT4 startFirstInd = 0;
3825 UINT4 sftIndFirst = 0;
3838 if ( isL ==
TRUE ) {
3839 detInd = resampMultiPairsDetXsftK->
data[detY].
detInd;
3841 detInd = resampMultiPairsDetX->detInd;
3849 if ( isL ==
TRUE ) {
3851 if ( resampMultiPairsDetXsftK->data[detY].length > 0 ) {
3852 sftIndFirst = resampMultiPairsDetXsftK->
data[detY].data[0].sftInd;
3853 startFirstInd = (
UINT4 )round( sftIndFirst * SRCsampPerTcoh );
3856 sftIndFirst = resampMultiPairsDetXsftK->sftInd;
3857 startFirstInd = (
UINT4 )round( sftIndFirst * SRCsampPerTcoh );
3859 if ( startFirstInd > resampDataArrayA->data->length ) {
3860 startFirstInd = resampDataArrayA->data->length;
3863 memset( ws->TS_FFT, 0, ws->numSamplesFFT *
sizeof( ws->TS_FFT[0] ) );
3864 UINT4 sftLength = 0;
3865 if ( isL ==
TRUE ) {
3866 sftLength = resampMultiPairsDetXsftK->data[detY].length;
3871 for (
UINT4 sft = 0; sft < sftLength; sft++ ) {
3874 if ( isL ==
TRUE ) {
3875 sftInd = resampMultiPairsDetXsftK->data[detY].data[sft].sftInd;
3877 sftInd = resampMultiPairsDetXsftK->sftInd;
3879 startInd = (
UINT4 )round( sftInd * SRCsampPerTcoh );
3880 endInd = (
UINT4 )round( ( sftInd + 1 ) * SRCsampPerTcoh );
3881 if ( startInd > resampDataArrayA->data->length ) {
3882 startInd = resampDataArrayA->data->length;
3884 if ( endInd > resampDataArrayA->data->length ) {
3885 endInd = resampDataArrayA->data->length;
3887 if ( startInd > endInd ) {
3890 UINT4 headOfSliceIndex = startInd - startFirstInd;
3894 fftwf_execute( ws->fftplan );
3895 for (
UINT4 k = 0;
k < ws->numFreqBinsOut;
k++ ) {
3896 ws->FaX_k[
k] = ws->FabX_Raw [ offset_bins + (
UINT4 )floor(
k * RedecimateFFT ) ];
3901 memset( ws->TS_FFT, 0, ws->numSamplesFFT *
sizeof( ws->TS_FFT[0] ) );
3902 for (
UINT4 sft = 0; sft < sftLength; sft++ ) {
3904 if ( isL ==
TRUE ) {
3905 sftInd = resampMultiPairsDetXsftK->data[detY].data[sft].sftInd;
3907 sftInd = resampMultiPairsDetXsftK->sftInd;
3909 startInd = (
UINT4 )round( sftInd * SRCsampPerTcoh );
3910 endInd = (
UINT4 )round( ( sftInd + 1 ) * SRCsampPerTcoh );
3911 if ( startInd > resampDataArrayB->data->length ) {
3912 startInd = resampDataArrayB->data->length;
3914 if ( endInd > resampDataArrayB->data->length ) {
3915 endInd = resampDataArrayB->data->length;
3917 if ( startInd > endInd ) {
3920 UINT4 headOfSliceIndex = startInd - startFirstInd;
3924 fftwf_execute( ws->fftplan );
3925 for (
UINT4 k = 0;
k < ws->numFreqBinsOut;
k++ ) {
3926 ws->FbX_k[
k] = ws->FabX_Raw [ offset_bins + (
UINT4 )floor(
k * RedecimateFFT ) ];
3930 const REAL8 dtauX =
GPSDIFF( resampDataArrayB->epoch, dopplerpos->refTime );
3931 const REAL8 timeFromResampStartToSFTFirst = startFirstInd * dt_SRC;
3937 REAL4 sinphase, cosphase;
3939 for (
UINT4 k = 0;
k < ws->numFreqBinsOut;
k++ ) {
3940 f_kOut = FreqOut0 +
k * dFreqMetric;
3941 f_kIn = ( offset_bins + (
UINT4 )floor(
k * RedecimateFFT ) ) * dFreqFFT;
3942 cyclesOut = - f_kOut * dtauX;
3943 cyclesIn = -f_kIn * timeFromResampStartToSFTFirst;
3944 cycles = cyclesOut + cyclesIn;
3946 normX_k = dt_SRC *
crectf( cosphase, sinphase );
3947 wsFaX_k[
k] = normX_k * ws->FaX_k[
k];
3948 wsFbX_k[
k] = normX_k * ws->FbX_k[
k];
#define __func__
log an I/O error, i.e.
#define LAL_FFTW_WISDOM_UNLOCK
#define LAL_FFTW_WISDOM_LOCK
static double double delta
const WeaveSearchTimingDenominator denom
LIGOTimeGPSVector * timestamps
REAL8VectorSequence * XLALCreateREAL8VectorSequence(UINT4 length, UINT4 veclen)
UINT4VectorSequence * XLALCreateUINT4VectorSequence(UINT4 length, UINT4 veclen)
void XLALDestroyUINT4VectorSequence(UINT4VectorSequence *vecseq)
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...
DetectorStateSeries * XLALCreateDetectorStateSeries(UINT4 length)
Create a DetectorStateSeries with length entries.
void XLALDestroyDetectorStateSeries(DetectorStateSeries *detStates)
Get rid of a DetectorStateSeries.
int XLALBarycenterEarth(EarthState *earth, const LIGOTimeGPS *tGPS, const EphemerisData *edat)
Computes the position and orientation of the Earth, at some arrival time , specified LIGOTimeGPS inp...
int XLALBarycenter(EmissionTime *emit, const BarycenterInput *baryinput, const EarthState *earth)
Transforms from detector arrival time in GPS (as specified in the LIGOTimeGPS structure) to pulse em...
AMCoeffs * XLALCreateAMCoeffs(UINT4 numSteps)
Create an AMCeoffs vector for given number of timesteps.
void XLALDestroyMultiAMCoeffs(MultiAMCoeffs *multiAMcoef)
Destroy a MultiAMCoeffs structure.
void * XLALCalloc(size_t m, size_t n)
void * XLALRealloc(void *p, size_t n)
int XLALSincInterpolateCOMPLEX8TimeSeries(COMPLEX8Vector *y_out, const REAL8Vector *t_out, const COMPLEX8TimeSeries *ts_in, UINT4 Dterms)
Interpolate a given regularly-spaced COMPLEX8 timeseries 'ts_in = x_in(j * dt)' onto new samples 'y_o...
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
void XLALDestroyMultiNoiseWeights(MultiNoiseWeights *weights)
Destroy a MultiNoiseWeights object.
int XLALEquipCrossCorrPairsWithScienceFlags(MultiResampSFTPairMultiIndexList *resampMultiPairs, MultiREAL8TimeSeries *scienceFlagVect)
Demarcate pairs with flags about whether data exists in zero-padded timeseries.
void XLALDestroyResampSFTIndexList(ResampSFTIndexList *sftResampList)
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 XLALModifyMultiAMCoeffsWeights(MultiNoiseWeights **multiWeights, const REAL8 tShort, const REAL8 tSFTOld, const UINT4 numShortPerDet, const MultiLIGOTimeGPSVector *restrict multiTimes)
Modify multiple detectors' amplitude weight coefficients for tShort.
int XLALCreateSFTPairIndexList(SFTPairIndexList **pairIndexList, SFTIndexList *indexList, MultiSFTVector *sfts, REAL8 maxLag, BOOLEAN inclAutoCorr)
Construct list of SFT pairs for inclusion in statistic.
AMCoeffs * XLALComputeAMCoeffsShort(const DetectorStateSeries *DetectorStates, SkyPosition skypos)
(test function) used for computing amplitude modulation weights
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)
REAL8TimeSeries * XLALCrossCorrGapFinderResampAlt(LIGOTimeGPSVector *restrict timestamps, const SFTVector *restrict sfts)
(test function) find gaps in the data given the SFTs
int XLALCalculateCrossCorrGammasResampShort(REAL8Vector **Gamma_ave, REAL8Vector **Gamma_circ, MultiResampSFTPairMultiIndexList *resampMultiPairIndexList, MultiAMCoeffs *multiCoeffs)
test function for RESAMPLING with tShort
int XLALFillDetectorTensorShort(DetectorState *detState, const LALDetector *detector)
(test function) fill detector state with tShort, importing various slightly-modified LALPulsar functi...
int XLALWeightMultiAMCoeffsShort(MultiAMCoeffs *multiAMcoef, const MultiNoiseWeights *multiWeights, REAL8 tShort, REAL8 tSFTOld, UINT4 numShortPerDet, MultiLIGOTimeGPSVector *multiTimes)
(test function) used for weighting multi amplitude modulation coefficients
LIGOTimeGPSVector * XLALExtractTimestampsFromSFTsShort(REAL8TimeSeries **sciFlag, const SFTVector *sfts, REAL8 tShort, UINT4 numShortPerDet)
** (possible future function) Wrapper for Bessel Orbital Space stepper in the manner of V....
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 XLALTestResampPairIndexList(MultiResampSFTPairMultiIndexList *resampMultiPairIndexList)
Check that the contents of a resampling multi-pair index list are sensible by inspection.
MultiLIGOTimeGPSVector * XLALModifyMultiTimestampsFromSFTs(MultiREAL8TimeSeries **scienceFlagVect, const MultiLIGOTimeGPSVector *restrict multiTimes, const REAL8 tShort, const UINT4 numShortPerDet)
Given a multi-SFT vector, return a MultiLIGOTimeGPSVector holding the modified SFT timestamps (produc...
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.
LIGOTimeGPSVector * XLALGenerateTshortTimestamps(const REAL8 tShort, const UINT4 numShortPerDet, const LIGOTimeGPS epoch)
Generate timestamps for one detector with tShort.
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.
int XLALModifyAMCoeffsWeights(REAL8Vector **resampMultiWeightsX, const MultiNoiseWeights *restrict multiWeights, const REAL8 tShort, const REAL8 tSFTOld, const UINT4 numShortPerDet, const MultiLIGOTimeGPSVector *restrict multiTimes, const UINT4 maxNumStepsOldIfGapless, const UINT4 X)
Modify amplitude weight coefficients for tShort.
void XLALDestroySFTIndexList(SFTIndexList *sftIndices)
Destroy a SFTIndexList structure.
static int XLALApplyCrossCorrFreqShiftResamp(COMPLEX8 *restrict xOut, const COMPLEX8TimeSeries *restrict xIn, const PulsarDopplerParams *restrict doppler, const REAL8 freqShift, const UINT4 indexStartResamp, const UINT4 indexEndResamp, const UINT4 numSamplesIn, const UINT4 insertPoint)
Imported and modified from ComputeFstat_Resamp.c.
void XLALDestroyMultiResampSFTPairMultiIndexList(MultiResampSFTPairMultiIndexList *sftMultiPairsResamp)
void XLALDestroyResampSFTMultiIndexList(ResampSFTMultiIndexList *sftResampMultiList)
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
void XLALDestroyMultiMatchList(MultiResampSFTMultiCountList *localMultiListOfLmatchingGivenMultiK)
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...
static int XLALComputeFaFb_CrossCorrResamp(ResampCrossCorrWorkspace *restrict ws2L, COMPLEX8 *restrict wsFaX_k, COMPLEX8 *restrict wsFbX_k, const MultiResampSFTPairMultiIndexList *restrict resampMultiPairs, const MultiCOMPLEX8TimeSeries *restrict multiTimeSeries_SRC_a, const MultiCOMPLEX8TimeSeries *restrict multiTimeSeries_SRC_b, const PulsarDopplerParams *restrict dopplerpos, const PulsarDopplerParams *restrict binaryTemplateSpacings, const REAL8 SRCsampPerTcoh, const UINT4 detX, const UINT4 sftK, const UINT4 detY, const BOOLEAN isL)
Compute the equivalent of Fa and Fb for CrossCorr's rho statistic.
REAL8TimeSeries * XLALCrossCorrGapFinderResamp(LIGOTimeGPSVector *restrict timestamps, const LIGOTimeGPSVector *restrict Times)
Find gaps in the data given the SFTs.
UINT4 XLALCrossCorrNumShortPerDetector(const REAL8 resampTshort, const INT4 startTime, const INT4 endTime)
Compute the number of tShort segments per detector.
DetectorStateSeries * XLALGetDetectorStatesShort(const LIGOTimeGPSVector *timestamps, const LALDetector *detector, const EphemerisData *edat, REAL8 tOffset, REAL8 tShort, UINT4 numShortPerDet)
(test function) get detector states for tShort
LIGOTimeGPSVector * XLALModifyTimestampsFromSFTsShort(REAL8TimeSeries **sciFlag, const LIGOTimeGPSVector *restrict Times, const REAL8 tShort, const UINT4 numShortPerDet)
Modify timestamps from one detector with tShort.
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.
void XLALDestroyResampSFTPairMultiIndexList(ResampSFTPairMultiIndexList *sftResampPairMultiList)
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
LIGOTimeGPSVector * XLALCreateTimestampVector(UINT4 len)
Allocate a LIGOTimeGPSVector.
void XLALDestroyMultiTimestamps(MultiLIGOTimeGPSVector *multiTS)
Destroy a MultiLIGOTimeGPSVector timestamps vector.
int XLALSinCosLUT(REAL4 *sinx, REAL4 *cosx, REAL8 x)
Calculate sin(x) and cos(x) to roughly 1e-7 precision using a lookup-table and Taylor-expansion.
int XLALSinCos2PiLUT(REAL4 *sin2pix, REAL4 *cos2pix, REAL8 x)
Calculate sin(2*pi*x) and cos(2*pi*x) to roughly 1e-7 precision using a lookup-table and Taylor-expan...
COORDINATESYSTEM_ECLIPTIC
COORDINATESYSTEM_EQUATORIAL
COMPLEX8TimeSeries * XLALCreateCOMPLEX8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyCOMPLEX8TimeSeries(COMPLEX8TimeSeries *series)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalDimensionlessUnit
REAL8 XLALComputePhaseDerivative(REAL8 t, const PulsarDopplerParams *dopplerPoint, DopplerCoordinateID coordID, const EphemerisData *edat, const LALDetector *site, BOOLEAN includeRoemer)
COMPLEX8Vector * XLALCreateCOMPLEX8Vector(UINT4 length)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
void XLALDestroyCOMPLEX8Vector(COMPLEX8Vector *vector)
#define XLAL_ERROR_NULL(...)
#define XLAL_CHECK(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_NULL(assertion,...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
This structure contains the per-SFT (weighted) antenna-pattern functions , with the SFT-index,...
REAL4 B
summed antenna-pattern matrix coefficient:
REAL4Vector * b
(weighted) per-SFT antenna-pattern function
REAL4 A
summed antenna-pattern matrix coefficient:
REAL4 C
summed antenna-pattern matrix coefficient:
REAL4Vector * a
(weighted) per-SFT antenna-pattern function
REAL8 Sinv_Tsft
normalization-factor (using single-sided PSD!)
REAL4 Dd
determinant factor , such that
A vector of COMPLEX8FrequencySeries.
COMPLEX8FrequencySeries * data
Pointer to the data array.
UINT4 length
Number of elements in array.
State-info about position, velocity and LMST of a detector together with corresponding EarthState.
EarthState earthState
EarthState information.
REAL8 rDetector[3]
Cartesian coords of detector position in ICRS J2000.
LIGOTimeGPS tGPS
GPS timestamps corresponding to this entry.
SymmTensor3 detT
Detector-tensor components in SSB-fixed, Cartesian coordinates.
REAL8 LMST
local mean sidereal time at the detector-location in radians
Timeseries of DetectorState's, representing the detector-info at different timestamps.
REAL8 deltaT
timespan centered on each timestamp (e.g.
CoordinateSystem system
The coordinate system used for detector's position/velocity and detector-tensor.
DetectorState * data
array of DetectorState entries
UINT4 length
total number of entries
LALDetector detector
detector-info corresponding to this timeseries
type describing a Doppler coordinate system: lists the number of dimensions and the symbolic names of...
DopplerCoordinateID coordIDs[DOPPLERMETRIC_MAX_DIM]
coordinate 'names'
UINT4 dim
number of dimensions covered
Basic output structure of LALBarycenterEarth.c.
REAL8 gmstRad
Greenwich Mean Sidereal Time (GMST) in radians, at tgps.
Basic output structure produced by LALBarycenter.c.
REAL8 rDetector[3]
Cartesian coords (0=x,1=y,2=z) of detector position at $t_a$ (GPS), in ICRS J2000 coords.
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
A vector of 'timestamps' of type LIGOTimeGPS.
REAL8 deltaT
'length' of each timestamp (e.g.
LIGOTimeGPS * data
array of timestamps
UINT4 length
number of timestamps
Multi-IFO container for antenna-pattern coefficients and atenna-pattern matrix .
UINT4 length
number of IFOs
AMCoeffs ** data
noise-weighted AM-coeffs , and
AntennaPatternMatrix Mmunu
antenna-pattern matrix
Multi-IFO container for COMPLEX8 resampled timeseries.
COMPLEX8TimeSeries ** data
array of COMPLEX8TimeSeries (pointers)
Multi-IFO time-series of DetectorStates.
UINT4 length
number of detectors
DetectorStateSeries ** data
vector of pointers to DetectorStateSeries
array of detectors definitions 'LALDetector'
UINT4 length
number of detectors
LALDetector sites[PULSAR_MAX_DETECTORS]
array of site information
A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
UINT4 length
number of timestamps vectors or ifos
LIGOTimeGPSVector ** data
timestamps vector for each ifo
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
REAL8 Sinv_Tsft
normalization factor used: (using single-sided PSD!)
UINT4 length
number of detectors
REAL8Vector ** data
weights-vector for each detector
A collection of (multi-IFO) REAL8 time-series.
REAL8TimeSeries ** data
Pointer to the data array.
UINT4 length
Number of elements in array.
OUTER List of SFT indices.
ResampSFTMultiCountListDet * data
list per-detectors X
UINT4 length
number of detectors X
Resampling Multi List of all paired SFTs L_Y_K_X, top level (multiple pairs, multiple detectors)
UINT4 oldPairCount
count of sft pairs, old-style
REAL8 Tshort
Duration of resamp Tshort.
REAL8 maxLag
Maximum allowed lag time.
SFTPairIndexList * pairIndexList
Make a classic pair index list.
UINT4 sftTotalCount
count of all sfts
BOOLEAN inclSameDetector
Do we include same detectors?
ResampSFTPairMultiIndexList * data
list per-detector X
UINT4 length
number of detectors X
REAL8 Tsft
Duration of one SFT.
SFTIndexList * indexList
Make an overall flat index list.
UINT4 allPairCount
count of all pairs
BOOLEAN inclAutoCorr
Do we include auto-correlation?
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.
SSBtimes ** data
array of SSBtimes (pointers)
UINT4 length
number of IFOs
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)
PulsarSpins fkdot
Intrinsic spins: [Freq, f1dot, f2dot, ... ] where fkdot = d^kFreq/dt^k.
LIGOTimeGPS refTime
Reference time of pulsar parameters (in SSB!)
REAL8 asini
Binary: projected, normalized orbital semi-major axis (s).
COMPLEX8 * FabX_Raw
raw full-band FFT result Fa,Fb
COMPLEX8 * Fa_k
properly normalized F_a(f_k) over output bins
COMPLEX8Vector * TStmp2_SRC
can hold a single-detector SRC-frame spindown-corrected timeseries [without zero-padding]
COMPLEX8 * FaX_k
properly normalized F_a^X(f_k) over output bins
REAL8Vector * SRCtimes_DET
holds uniformly-spaced SRC-frame timesteps translated into detector frame [for interpolation]
fftwf_plan fftplan
buffer FFT plan for given numSamplesOut length
COMPLEX8 * TS_FFT
zero-padded, spindown-corr SRC-frame TS
COMPLEX8 * Fb_k
properly normalized F_b(f_k) over output bins
COMPLEX8 * FbX_k
properly normalized F_b^X(f_k) over output bins
COMPLEX8Vector * TStmp1_SRC
can hold a single-detector SRC-frame spindown-corrected timeseries [without zero-padding]
REAL4 sciFlag
science-or-not value: 1 is science mode, 0 is in a gap
UINT4 detInd
index of detector in list
UINT4 pairInd
index of SFT among overall pairs
UINT4 sftInd
index of SFT in list for this detector L
UINT4 flatInd
index in the flat SFT list
Resampling: List of SFT indices L for a given detector Y_K_X: indexing method is nominally original v...
UINT4 length
number of SFTs
ResampSFTIndex * data
array of SFT indices
UINT4 detInd
original vector index of detector Y
UINT4 length
number of SFTs K_X
UINT4 detInd
original vector index of detector X
ResampSFTMultiCountList * data
array of SFT L_Y indices for given SFT K_X at detector X
UINT4 sftInd
original vector index of sft K
UINT4 length
number of detectors Y
SFTCount * data
arrays of count of SFTs L_Y, at given detector Y, that match each given SFT K_X
Resampling: Multi List of indices of SFT L_Y, for a given sft K_X
ResampSFTIndexList * data
array, per detector, of lists of SFT indices
UINT4 sftInd
original vector index of sft K
UINT4 length
number of detectors Y
UINT4 flatInd
index in the flat SFT list
REAL4 sciFlag
science-or-not value: 1 is science mode, 0 is in a gap
Resampling Multi List of SFT pair indices (L_Y_K), for a given detector X.
UINT4 length
number of K SFTs at detector X
ResampSFTMultiIndexList * data
array of SFT L_Y indices for given SFT K_X at detector X
UINT4 detInd
original vector index of detector X
UINT4 sftCount
number of matching SFTs
UINT4 detInd
original vector index of detector Y
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
Simple container for two REAL8-vectors, namely the SSB-timings DeltaT_alpha and Tdot_alpha,...
REAL8Vector * Tdot
dT/dt : time-derivative of SSB-time wrt local time for SFT-alpha
REAL8Vector * DeltaT
Time-difference of SFT-alpha - tau0 in SSB-frame.
LIGOTimeGPS refTime
reference-time 'tau0'
A symmetric 3x3 tensor (such as detector-tensors), storing only the upper triangle.