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;
208 for (
UINT4 k = 0;
k < numDets;
k++ ) {
212 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
221 for (
UINT4 k = 0;
k < numDets;
k++ ) {
223 for (
UINT4 l = 0;
l < numForDet;
l++ ) {
232 ( *indexList ) = ret;
253 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
263 if ( inclAutoCorr ) {
272 if ( fabs( timeDiff ) <= maxLag ) {
285 if ( inclAutoCorr ) {
294 if ( fabs( timeDiff ) <= maxLag ) {
303 ( *pairIndexList ) = ret;
334 fprintf( stdout,
"Number of detectors in SFT list: %u\n", numDets );
335 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
338 if ( ( resampMultiRet =
XLALCalloc( 1,
sizeof( *resampMultiRet ) ) ) == NULL ) {
345 if ( ( MultiListOfLmatchingGivenMultiK =
XLALCalloc( 1,
sizeof( *MultiListOfLmatchingGivenMultiK ) ) ) == NULL ) {
348 MultiListOfLmatchingGivenMultiK->
length = numDets;
350 if ( ( MultiListOfLmatchingGivenMultiK->
data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->
length,
sizeof( *MultiListOfLmatchingGivenMultiK->
data ) ) ) == NULL ) {
351 XLALFree( MultiListOfLmatchingGivenMultiK );
355 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
357 if ( ( MultiListOfLmatchingGivenMultiK->
data[detX].
data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->
data[detX].
length,
sizeof( *MultiListOfLmatchingGivenMultiK->
data[detX].
data ) ) ) == NULL ) {
378 if ( inclAutoCorr ) {
387 if ( fabs( timeDiff ) <= maxLag ) {
395 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
396 MultiListOfLmatchingGivenMultiK->
data[detX].
detInd = detX;
399 for (
UINT4 detY = 0; detY < numDets; detY++ ) {
400 UINT4 LmatchingGivenKMulti = 0;
401 if ( ( ( detY == detX ) && inclSameDetector ) || ( detY > detX ) ) {
402 if ( detY == detX ) {
403 if ( inclAutoCorr ) {
415 if ( fabs( timeDiff ) <= maxLag ) {
416 ++LmatchingGivenKMulti;
437 resampMultiRet->
length = numDets;
438 resampMultiRet->
maxLag = maxLag;
440 resampMultiRet->
Tshort = Tshort;
448 for (
UINT4 detX = 0; detX < resampMultiRet->
length; detX++ ) {
481 if ( inclAutoCorr ) {
490 if ( fabs( timeDiff ) <= maxLag ) {
499 UINT4 allPairCounter = 0;
500 UINT4 kFlatCounter = 0;
501 UINT4 lFlatCounter = 0;
502 for (
UINT4 detX = 0; detX < resampMultiRet->
length; detX++ ) {
506 if ( inclAutoCorr ) {
507 lFlatCounter = kFlatCounter;
509 lFlatCounter = kFlatCounter + 1;
515 UINT4 outLmatchingGivenKMulti = 0;
520 if ( ( ( detY == detX ) && inclSameDetector ) || ( detY > detX ) ) {
521 if ( detY == detX ) {
522 if ( inclAutoCorr ) {
534 if ( fabs( timeDiff ) <= maxLag ) {
541 ++outLmatchingGivenKMulti;
556 ( *pairIndexList ) = ret;
557 ( *resampMultiPairIndexList ) = resampMultiRet;
570 const BOOLEAN inclSameDetector,
582 const UINT4 numShortPerDet = multiTimes->data[0]->length;
584 const REAL8 Tshort = multiTimes->data[0]->deltaT;
586 if ( ( resampMultiRet =
XLALCalloc( 1,
sizeof( *resampMultiRet ) ) ) == NULL ) {
597 if ( ( MultiListOfLmatchingGivenMultiK =
XLALCalloc( 1,
sizeof( *MultiListOfLmatchingGivenMultiK ) ) ) == NULL ) {
600 MultiListOfLmatchingGivenMultiK->length = numDets;
602 if ( ( MultiListOfLmatchingGivenMultiK->data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->length,
sizeof( *MultiListOfLmatchingGivenMultiK->data ) ) ) == NULL ) {
603 XLALFree( MultiListOfLmatchingGivenMultiK );
607 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
608 MultiListOfLmatchingGivenMultiK->data[detX].length = numShortPerDet;
609 if ( ( MultiListOfLmatchingGivenMultiK->data[detX].data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->data[detX].length,
sizeof( *MultiListOfLmatchingGivenMultiK->data[detX].data ) ) ) == NULL ) {
610 XLALFree( MultiListOfLmatchingGivenMultiK->data[detX].data );
615 for (
UINT4 k = 0;
k < MultiListOfLmatchingGivenMultiK->data[detX].length;
k++ ) {
617 MultiListOfLmatchingGivenMultiK->data[detX].data[
k].length = numDets;
618 if ( ( MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data =
XLALCalloc( MultiListOfLmatchingGivenMultiK->data[detX].data[
k].length,
sizeof( *MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data ) ) ) == NULL ) {
619 XLALFree( MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data );
631 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
632 MultiListOfLmatchingGivenMultiK->data[detX].detInd = detX;
633 for (
UINT4 k = 0;
k < MultiListOfLmatchingGivenMultiK->data[detX].length;
k++ ) {
634 MultiListOfLmatchingGivenMultiK->data[detX].data[
k].sftInd =
k;
635 for (
UINT4 detY = 0; detY < numDets; detY++ ) {
636 UINT4 LmatchingGivenKMulti = 0;
637 if ( ( ( detY == detX ) && inclSameDetector ) || ( detY > detX ) ) {
638 if ( detY == detX ) {
639 if ( inclAutoCorr ) {
645 lMinMulti = (
UINT4 )
MYMAX( 0,
k - round( 2 * maxLag / Tshort ) - 2 );
650 lMaxMulti = (
UINT4 )
MYMIN( numShortPerDet, lMinMulti + round( 4 * maxLag / Tshort ) + 4 );
651 for (
UINT4 l = lMinMulti;
l < lMaxMulti;
l++ ) {
654 if ( fabs( timeDiff ) <= maxLag ) {
655 ++LmatchingGivenKMulti;
658 MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data[detY].detInd = detY;
659 MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data[detY].sftCount = LmatchingGivenKMulti;
670 resampMultiRet->length = numDets;
671 resampMultiRet->maxLag = maxLag;
672 resampMultiRet->Tsft =
Tsft;
673 resampMultiRet->Tshort = Tshort;
674 resampMultiRet->inclAutoCorr = inclAutoCorr;
675 resampMultiRet->inclSameDetector = inclSameDetector;
676 if ( ( resampMultiRet->data =
XLALCalloc( resampMultiRet->length,
sizeof( *resampMultiRet->data ) ) ) == NULL ) {
681 for (
UINT4 detX = 0; detX < resampMultiRet->length; detX++ ) {
682 resampMultiRet->data[detX].length = MultiListOfLmatchingGivenMultiK->data[detX].length;
684 resampMultiRet->data[detX].detInd = MultiListOfLmatchingGivenMultiK->data[detX].detInd;
685 if ( ( resampMultiRet->data[detX].data =
XLALCalloc( resampMultiRet->data[detX].length,
sizeof( *resampMultiRet->data[detX].data ) ) ) == NULL ) {
686 XLALFree( resampMultiRet->data[detX].data );
689 for (
UINT4 k = 0;
k < resampMultiRet->data[detX].length;
k++ ) {
690 resampMultiRet->data[detX].data[
k].length = MultiListOfLmatchingGivenMultiK->data[detX].data[
k].length;
692 resampMultiRet->data[detX].data[
k].sftInd = MultiListOfLmatchingGivenMultiK->data[detX].data[
k].sftInd;
693 if ( ( resampMultiRet->data[detX].data[
k].data =
XLALCalloc( resampMultiRet->data[detX].data[
k].length,
sizeof( *resampMultiRet->data[detX].data[
k].data ) ) ) == NULL ) {
694 XLALFree( resampMultiRet->data[detX].data[
k].data );
697 for (
UINT4 detY = 0; detY < resampMultiRet->data[detX].data[
k].length; detY++ ) {
698 resampMultiRet->data[detX].data[
k].data[detY].length = MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data[detY].sftCount;
700 resampMultiRet->data[detX].data[
k].data[detY].detInd = MultiListOfLmatchingGivenMultiK->data[detX].data[
k].data[detY].detInd;
701 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 ) {
702 XLALFree( resampMultiRet->data[detX].data[
k].data[detY].data );
713 if ( ( flatIndexList =
XLALCalloc( 1,
sizeof( *flatIndexList ) ) ) == NULL ) {
716 flatIndexList->length =
numSFTs;
717 if ( ( flatIndexList->data =
XLALCalloc(
numSFTs,
sizeof( *flatIndexList->data ) ) ) == NULL ) {
723 UINT4 allPairCounter = 0;
724 UINT4 kFlatCounter = 0;
725 UINT4 lFlatCounter = 0;
726 for (
UINT4 detX = 0; detX < resampMultiRet->length; detX++ ) {
727 for (
UINT4 k = 0;
k < resampMultiRet->data[detX].length;
k++ ) {
728 kFlatCounter = numShortPerDet * detX +
k;
731 for (
UINT4 detY = 0; detY < resampMultiRet->data[detX].data[
k].length; detY++ ) {
735 UINT4 outLmatchingGivenKMulti = 0;
740 if ( ( ( detY == detX ) && inclSameDetector ) || ( detY > detX ) ) {
741 if ( detY == detX ) {
742 if ( inclAutoCorr ) {
748 lMinMulti = (
UINT4 )
MYMAX( 0,
k - round( 2 * maxLag / Tshort ) - 2 );
752 lMaxMulti = (
UINT4 )
MYMIN( numShortPerDet, lMinMulti + round( 4 * maxLag / Tshort ) + 4 );
753 for (
UINT4 l = lMinMulti;
l < lMaxMulti;
l++ ) {
756 if ( fabs( timeDiff ) <= maxLag ) {
757 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].sftInd =
l;
758 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].detInd = detY;
759 lFlatCounter = numShortPerDet * detY +
l;
760 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].flatInd = lFlatCounter;
762 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].pairInd = allPairCounter;
763 resampMultiRet->data[detX].data[
k].data[detY].data[outLmatchingGivenKMulti].sciFlag = 1.0;
764 ++outLmatchingGivenKMulti;
770 resampMultiRet->data[detX].data[
k].flatInd = kFlatCounter;
771 resampMultiRet->data[detX].data[
k].sciFlag = 1.0;
772 flatIndexList->data[kFlatCounter].detInd = detX;
774 flatIndexList->data[kFlatCounter].sftInd = resampMultiRet->data[detX].data[
k].sftInd;
781 resampMultiRet->allPairCount = allPairCounter;
784 resampMultiRet->sftTotalCount = 1 + kFlatCounter;
785 resampMultiRet->indexList = flatIndexList;
789 if ( ( standardPairIndexList =
XLALCalloc( 1,
sizeof( *standardPairIndexList ) ) ) == NULL ) {
792 standardPairIndexList->length = resampMultiRet->allPairCount;
793 if ( ( standardPairIndexList->data =
XLALCalloc( standardPairIndexList->length,
sizeof( *standardPairIndexList->data ) ) ) == NULL ) {
801 UINT4 standardPairCount = 0;
802 for (
UINT4 detX = 0; detX < resampMultiRet->length; detX++ ) {
803 for (
UINT4 k = 0;
k < resampMultiRet->data[detX].length;
k++ ) {
804 for (
UINT4 detY = 0; detY < resampMultiRet->data[detX].data[
k].length; detY++ ) {
805 for (
UINT4 l = 0;
l < resampMultiRet->data[detX].data[
k].data[detY].length;
l++ ) {
807 sftNum1 = numShortPerDet * detX + resampMultiRet->data[detX].data[
k].sftInd;
808 sftNum2 = numShortPerDet * detY + resampMultiRet->data[detX].data[
k].data[detY].data[
l].sftInd;
809 standardPairIndexList->data[standardPairCount].sftNum[0] = sftNum1;
810 standardPairIndexList->data[standardPairCount].sftNum[1] = sftNum2;
816 resampMultiRet->pairIndexList = standardPairIndexList;
817 resampMultiRet->oldPairCount = standardPairCount;
818 ( *resampMultiPairIndexList ) = resampMultiRet;
831 UINT4 grandTotalCounter = 0;
832 for (
UINT4 detX = 0; detX < resampMultiRet->
length; detX++ ) {
844 fprintf( stdout,
"Sanity check: GRAND TOTAL of passes through loop: %u\n", grandTotalCounter );
845 fprintf( stdout,
"Pairing completed\n" );
847 UINT4 newKFlatCounter = 0;
848 for (
UINT4 detX = 0; detX < resampMultiRet->
length; detX++ ) {
855 printf(
"newKFlatCounter: %u\n", newKFlatCounter );
880 for (
UINT4 j = 0;
j < numPairs;
j++ ) {
887 ret1->
data[
j] = 0.1 * ( multiCoeffs->
data[detInd1]->
a->
data[sftInd1]
888 * multiCoeffs->
data[detInd2]->
a->
data[sftInd2]
889 + multiCoeffs->
data[detInd1]->
b->
data[sftInd1]
890 * multiCoeffs->
data[detInd2]->
b->
data[sftInd2] );
891 ret2->
data[
j] = 0.1 * ( multiCoeffs->
data[detInd1]->
a->
data[sftInd1]
892 * multiCoeffs->
data[detInd2]->
b->
data[sftInd2]
893 - multiCoeffs->
data[detInd1]->
b->
data[sftInd1]
894 * multiCoeffs->
data[detInd2]->
a->
data[sftInd2] );
897 ( *Gamma_ave ) = ret1;
898 ( *Gamma_circ ) = ret2;
923 UINT4 detInd1[numPairs];
924 UINT4 detInd2[numPairs];
925 UINT4 sftInd1[numPairs];
926 UINT4 sftInd2[numPairs];
929 for (
UINT4 detX = 0; detX < resampMultiPairIndexList->
length; detX++ ) {
935 detInd1[pairCount] = resampMultiPairIndexList->
data[detX].
detInd;
937 sftInd1[pairCount] = resampMultiPairIndexList->
data[detX].
data[
k].
sftInd;
944 for (
UINT4 j = 0;
j < numPairs;
j++ ) {
946 * multiCoeffs->
data[detInd2[
j]]->
a->
data[sftInd2[
j]]
947 + multiCoeffs->
data[detInd1[
j]]->
b->
data[sftInd1[
j]]
948 * multiCoeffs->
data[detInd2[
j]]->
b->
data[sftInd2[
j]] );
950 * multiCoeffs->
data[detInd2[
j]]->
b->
data[sftInd2[
j]]
951 - multiCoeffs->
data[detInd1[
j]]->
b->
data[sftInd1[
j]]
952 * multiCoeffs->
data[detInd2[
j]]->
a->
data[sftInd2[
j]] );
955 ( *Gamma_ave ) = ret1;
956 ( *Gamma_circ ) = ret2;
979 REAL4 eleMultiCoeffs1a = 0;
980 REAL4 eleMultiCoeffs2a = 0;
981 REAL4 eleMultiCoeffs1b = 0;
982 REAL4 eleMultiCoeffs2b = 0;
984 REAL4 sciMultiCoeffs1a = 0;
985 REAL4 sciMultiCoeffs2a = 0;
986 REAL4 sciMultiCoeffs1b = 0;
987 REAL4 sciMultiCoeffs2b = 0;
990 REAL4 castSciFlag1[numPairs];
991 REAL4 castSciFlag2[numPairs];
993 UINT4 detInd1[numPairs];
994 UINT4 detInd2[numPairs];
995 UINT4 sftInd1[numPairs];
996 UINT4 sftInd2[numPairs];
999 for (
UINT4 detX = 0; detX < resampMultiPairIndexList->
length; detX++ ) {
1005 detInd1[pairCount] = resampMultiPairIndexList->
data[detX].
detInd;
1007 sftInd1[pairCount] = resampMultiPairIndexList->
data[detX].
data[
k].
sftInd;
1015 castSciFlag1[pairCount] = 1.0;
1016 castSciFlag2[pairCount] = 1.0;
1022 for (
UINT4 j = 0;
j < numPairs;
j++ ) {
1023 eleMultiCoeffs1a = multiCoeffs->
data[detInd1[
j]]->
a->
data[sftInd1[
j]];
1024 eleMultiCoeffs2a = multiCoeffs->
data[detInd2[
j]]->
a->
data[sftInd2[
j]];
1025 eleMultiCoeffs1b = multiCoeffs->
data[detInd1[
j]]->
b->
data[sftInd1[
j]];
1026 eleMultiCoeffs2b = multiCoeffs->
data[detInd2[
j]]->
b->
data[sftInd2[
j]];
1028 sciMultiCoeffs1a = eleMultiCoeffs1a * castSciFlag1[
j];
1029 sciMultiCoeffs2a = eleMultiCoeffs2a * castSciFlag2[
j];
1030 sciMultiCoeffs1b = eleMultiCoeffs1b * castSciFlag1[
j];
1031 sciMultiCoeffs2b = eleMultiCoeffs2b * castSciFlag2[
j];
1032 ret1->
data[
j] = 0.1 * ( sciMultiCoeffs1a
1035 * sciMultiCoeffs2b );
1036 ret2->
data[
j] = 0.1 * ( sciMultiCoeffs1a
1039 * sciMultiCoeffs2a );
1042 ( *Gamma_ave ) = ret1;
1043 ( *Gamma_circ ) = ret2;
1075 if ( curlyGAmp->
length != numPairs ) {
1080 REAL8 curlyGSqr = 0;
1096 && ( detInd2 < inputSFTs->length ),
1099 sftNum1, sftNum2, detInd1, detInd2, inputSFTs->
length );
1105 && ( sftInd2 < inputSFTs->
data[detInd2]->length ),
1108 sftNum1, sftNum2, detInd1, detInd2, sftInd1, sftInd2,
1117 * expSignalPhases->
data[sftNum1]
1118 * conj( expSignalPhases->
data[sftNum2] );
1119 INT4 baseCCSign = 1;
1120 if ( ( ( lowestBins->
data[sftNum1] - lowestBins->
data[sftNum2] ) % 2 ) != 0 ) {
1124 UINT4 lowestBin1 = lowestBins->
data[sftNum1];
1127 "Loop would run off end of array:\n lowestBin1=%d, numBins=%d, len(dataArray1)=%d\n",
1128 lowestBin1,
numBins, lenDataArray1 );
1130 COMPLEX8 data1 = dataArray1[lowestBin1 +
j];
1132 INT4 ccSign = baseCCSign;
1133 UINT4 lowestBin2 = lowestBins->
data[sftNum2];
1136 "Loop would run off end of array:\n lowestBin2=%d, numBins=%d, len(dataArray2)=%d\n",
1137 lowestBin2,
numBins, lenDataArray2 );
1140 REAL8 sincFactor = 1;
1143 nume += ccSign * sincFactor * creal( GalphaCC * conj( data1 ) * data2 );
1148 curlyGSqr +=
SQUARE( GalphaAmp );
1154 if ( curlyGSqr == 0.0 ) {
1159 *ccStat = 4 * multiWeights->
Sinv_Tsft * nume / sqrt( *evSquared );
1193 REAL8 curlyEquivGSqrSum = 0;
1194 for (
UINT4 j = 0;
j < ws->numFreqBinsOut;
j++ ) {
1195 numeEquivAve->data[
j] = 0;
1196 numeEquivCirc->data[
j] = 0;
1197 ccStatVector->data[
j] = 0;
1198 evSquaredVector->data[
j] = 0;
1201 const REAL8 dt_SRC = multiTimeSeries_SRC_b->data[0]->deltaT;
1202 const REAL8 SRCsampPerTcoh = resampMultiPairs->Tshort / dt_SRC;
1205 for (
UINT4 detX = 0; detX < resampMultiPairs->length; detX++ ) {
1206 for (
UINT4 sftK = 0; sftK < resampMultiPairs->data[detX].length; sftK++ ) {
1207 if ( (
XLALComputeFaFb_CrossCorrResamp( ws, ws1KFaX_k, ws1KFbX_k, resampMultiPairs, multiTimeSeries_SRC_a, multiTimeSeries_SRC_b, dopplerpos, binaryTemplateSpacings, SRCsampPerTcoh, detX, sftK, 0,
FALSE ) ) !=
XLAL_SUCCESS ) {
1211 for (
UINT4 detY = 0; detY < resampMultiPairs->data[detX].data[sftK].length; detY++ ) {
1212 if ( (
XLALComputeFaFb_CrossCorrResamp( ws, ws2LFaX_k, ws2LFbX_k, resampMultiPairs, multiTimeSeries_SRC_a, multiTimeSeries_SRC_b, dopplerpos, binaryTemplateSpacings, SRCsampPerTcoh, detX, sftK, detY,
TRUE ) ) !=
XLAL_SUCCESS ) {
1217 for (
UINT8 j = 0;
j < ws->numFreqBinsOut;
j++ ) {
1218 numeEquivAve->data[
j] += creal( 0.1 * ( conj( ws1KFaX_k[
j] ) * ws2LFaX_k[
j] + conj( ws1KFbX_k[
j] ) * ws2LFbX_k[
j] ) );
1231 REAL8 GalphaResampAmp = resampCurlyGAmp->data[
alpha];
1232 curlyEquivGSqrSum +=
SQUARE( GalphaResampAmp );
1250 const REAL8 originalMultiWeightsSinvTsft = multiWeights->Sinv_Tsft * ( resampMultiPairs->Tsft / resampMultiPairs->Tshort );
1251 for (
UINT8 j = 0;
j < ws->numFreqBinsOut;
j++ ) {
1252 evSquaredVector->data[
j] = 8 *
SQUARE( multiWeights->Sinv_Tsft ) * curlyEquivGSqrSum;
1253 ccStatVector->data[
j] = 4 * originalMultiWeightsSinvTsft * numeEquivAve->data[
j] / sqrt( evSquaredVector->data[
j] );
1276 const UINT4 numCoords = coordSys->
dim;
1283 for (
UINT4 coordNum = 0; coordNum < numCoords; coordNum++ ) {
1288 times = multiTimes->
data[detInd];
1298 ( *phaseDerivs ) = ret;
1333 const UINT4 numCoords = coordSys->
dim;
1336 printf(
"numShorts: %u\n", numShorts );
1341 for (
UINT4 coordNum = 0; coordNum < numCoords; coordNum++ ) {
1342 for (
UINT4 detX = 0; detX < resampMultiPairs->
length; detX++ ) {
1353 REAL8 tSSBApprox = startTime8 + Tshort * shortSFTIndOwn;
1359 ( *resampPhaseDerivs ) = retNew;
1387 const UINT4 numCoords = coordSys->
dim;
1396 if ( ( ret_g = gsl_matrix_calloc( numCoords, numCoords ) ) == NULL ) {
1402 if ( ( ret_e = gsl_vector_calloc( numCoords ) ) == NULL ) {
1410 for (
UINT4 pairNum = 0; pairNum < numPairs; pairNum++ ) {
1415 REAL8 circWeight = Gamma_ave->
data[pairNum] * Gamma_circ->
data[pairNum];
1416 for (
UINT4 i = 0;
i < numCoords;
i++ ) {
1418 REAL8 epsi = gsl_vector_get( ret_e,
i );
1419 epsi += circWeight * dDeltaPhi_i->
data[
i];
1420 gsl_vector_set( ret_e,
i, epsi );
1422 REAL8 gij = gsl_matrix_get( ret_g,
i,
j );
1423 gij += aveWeight * dDeltaPhi_i->
data[
i] * dDeltaPhi_i->
data[
j];
1424 gsl_matrix_set( ret_g,
i,
j, gij );
1431 for (
UINT4 i = 0;
i < numCoords;
i++ ) {
1432 REAL8 epsi = gsl_vector_get( ret_e,
i );
1434 gsl_vector_set( ret_e,
i, epsi );
1436 REAL8 gij = gsl_matrix_get( ret_g,
i,
j );
1437 gij /= ( 2.*
denom );
1438 gsl_matrix_set( ret_g,
i,
j, gij );
1440 gsl_matrix_set( ret_g,
j,
i, gij );
1447 ( *sumGammaSq ) =
denom;
1476 const UINT4 numCoords = coordSys->
dim;
1486 gsl_matrix *ret_gNew;
1487 if ( ( ret_gNew = gsl_matrix_calloc( numCoords, numCoords ) ) == NULL ) {
1492 gsl_vector *ret_eNew;
1493 if ( ( ret_eNew = gsl_vector_calloc( numCoords ) ) == NULL ) {
1502 UINT4 pairMetric = 0;
1505 REAL8 aveNewWeight = 0.0;
1506 REAL8 denomNew = 0.0;
1507 REAL8 circNewWeight = 0.0;
1508 for (
UINT4 detX = 0; detX < resampMultiPairs->
length; detX++ ) {
1515 aveNewWeight =
SQUARE( Gamma_ave->
data[pairMetric] );
1516 denomNew += aveNewWeight;
1517 circNewWeight = Gamma_ave->
data[pairMetric] * Gamma_circ->
data[pairMetric];
1518 for (
UINT4 i = 0;
i < numCoords;
i++ ) {
1519 dDeltaPhiNew_i->
data[
i] = phaseDerivs->
data[
i * numShorts + sftInd1] - phaseDerivs->
data[
i * numShorts + sftInd2];
1520 REAL8 epsNewi = gsl_vector_get( ret_eNew,
i );
1521 epsNewi += circNewWeight * dDeltaPhiNew_i->
data[
i];
1522 gsl_vector_set( ret_eNew,
i, epsNewi );
1524 REAL8 gijNew = gsl_matrix_get( ret_gNew,
i,
j );
1525 gijNew += aveNewWeight * dDeltaPhiNew_i->
data[
i] * dDeltaPhiNew_i->
data[
j];
1526 gsl_matrix_set( ret_gNew,
i,
j, gijNew );
1536 for (
UINT4 i = 0;
i < numCoords;
i++ ) {
1537 REAL8 epsNewi = gsl_vector_get( ret_eNew,
i );
1538 epsNewi /= denomNew;
1539 gsl_vector_set( ret_eNew,
i, epsNewi );
1541 REAL8 gijNew = gsl_matrix_get( ret_gNew,
i,
j );
1542 gijNew /= ( 2.*denomNew );
1543 gsl_matrix_set( ret_gNew,
i,
j, gijNew );
1545 gsl_matrix_set( ret_gNew,
j,
i, gijNew );
1550 ( *g_ij ) = ret_gNew;
1551 ( *eps_i ) = ret_eNew;
1552 ( *sumGammaSq ) = denomNew;
1566 REAL8 *weightedMuTAve,
1581 REAL8 TSquaWeightedAve = 0;
1582 REAL8 SinSquaWeightedAve = 0;
1586 REAL8 muTAveSqr = 0;
1587 REAL8 muTSqrAve = 0;
1588 REAL8 sinSquare = 0;
1596 for (
UINT4 j = 0;
j < numalpha;
j++ ) {
1608 muT += sqrG_alpha * TMean;
1609 muTSqr += sqrG_alpha *
SQUARE( TMean );
1610 sinSquare += sqrG_alpha *
SQUARE( sin(
LAL_PI * TDiff / ( DopplerParams.
period ) ) );
1611 tSquare += sqrG_alpha *
SQUARE( TDiff );
1612 denom += sqrG_alpha;
1613 rhosum += 2 * sqrG_alpha;
1616 muTAve = muT /
denom;
1617 muTAveSqr =
SQUARE( muTAve );
1618 muTSqrAve = muTSqr /
denom;
1619 REAL8 sigmaTSqr = muTSqrAve - muTAveSqr;
1620 TSquaWeightedAve = tSquare /
denom;
1621 SinSquaWeightedAve = sinSquare /
denom;
1627 *weightedMuTAve = muTAve;
1655 REAL8 TSquaWeightedAve = 0;
1656 REAL8 SinSquaWeightedAve = 0;
1660 REAL8 muTAveSqr = 0;
1661 REAL8 muTSqrAve = 0;
1662 REAL8 sinSquare = 0;
1668 UINT4 numPairs = resampMultiPairIndexList->allPairCount;
1670 SFTIndexList *indexList = resampMultiPairIndexList->indexList;
1672 for (
UINT4 j = 0;
j < numPairs;
j++ ) {
1684 muT += sqrG_alpha * TMean;
1685 muTSqr += sqrG_alpha *
SQUARE( TMean );
1686 sinSquare += sqrG_alpha *
SQUARE( sin(
LAL_PI * TDiff / ( DopplerParams.
period ) ) );
1687 tSquare += sqrG_alpha *
SQUARE( TDiff );
1688 denom += sqrG_alpha;
1689 rhosum += 2 * sqrG_alpha;
1691 muTAve = muT /
denom;
1692 muTAveSqr =
SQUARE( muTAve );
1693 muTSqrAve = muTSqr /
denom;
1694 REAL8 sigmaTSqr = muTSqrAve - muTAveSqr;
1695 TSquaWeightedAve = tSquare /
denom;
1696 SinSquaWeightedAve = sinSquare /
denom;
1697 *hSens = 4 *
SQUARE( multiWeights->Sinv_Tsft ) * rhosum;
1850 UINT4 numShortPerDet
1861 UINT4 numSFTsNew = numShortPerDet;
1869 ret->
length = numSFTsNew;
1876 for (
i = 0;
i < numShortPerDet;
i ++ ) {
1879 XLALGPSAdd( &( epochHolder ), naiveEpochReal );
1881 ret->
data[
i] = epochHolder;
1886 ( *sciFlag ) = retFlag;
1897 const UINT4 numShortPerDet
1908 UINT4 numSFTsNew = numShortPerDet;
1916 ret->
length = numSFTsNew;
1923 for (
i = 0;
i < numShortPerDet;
i ++ ) {
1926 XLALGPSAdd( &( epochHolder ), naiveEpochReal );
1928 ret->
data[
i] = epochHolder;
1932 ( *sciFlag ) = retFlag;
1946 const UINT4 numShortPerDet
1952 if ( !multiTimes || multiTimes->length == 0 ) {
1956 UINT4 numIFOs = multiTimes->length;
1960 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
1973 if ( ( retFlagVect =
XLALCalloc( 1,
sizeof( *retFlagVect ) ) ) == NULL ) {
1978 if ( ( retFlagVect->
data =
XLALCalloc( numIFOs,
sizeof( *retFlagVect->
data ) ) ) == NULL ) {
1983 retFlagVect->
length = numIFOs;
1987 for ( X = 0; X < numIFOs; X ++ ) {
1996 ( *scienceFlagVect ) = retFlagVect;
2010 UINT4 numShortPerDet
2024 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2037 if ( ( retFlagVect =
XLALCalloc( 1,
sizeof( *retFlagVect ) ) ) == NULL ) {
2042 if ( ( retFlagVect->
data =
XLALCalloc( numIFOs,
sizeof( *retFlagVect->
data ) ) ) == NULL ) {
2047 retFlagVect->
length = numIFOs;
2051 for ( X = 0; X < numIFOs; X ++ ) {
2061 ( *scienceFlagVect ) = retFlagVect;
2082 if (
prefix[0] ==
'Z' ) {
2097 REAL4 sinG, cosG, sinGcosG, sinGsinG, cosGcosG;
2101 sinGsinG = sinG * sinG;
2102 sinGcosG = sinG * cosG;
2103 cosGcosG = cosG * cosG;
2111 - 2 *
detector->response[0][1] * sinGcosG
2112 +
detector->response[1][1] * sinGsinG;
2114 + 2 *
detector->response[0][1] * sinGcosG
2115 +
detector->response[1][1] * cosGcosG;
2118 +
detector->response[0][1] * ( cosGcosG - sinGsinG );
2151 UINT4 numShortPerDet
2161 UINT4 numSteps = numShortPerDet;
2162 printf(
"numSteps in GetDetectorStatesShort: %u\n", numSteps );
2177 if (
detector->frDetector.prefix[0] ==
'Z' ) {
2185 for (
i = 0;
i < numSteps;
i++ ) {
2203 baryinput.
tgps = tgps;
2204 baryinput.
site = ( *detector );
2219 for (
j = 0;
j < 3;
j++ ) {
2257 UINT4 numShortPerDet
2275 if ( ( ret =
LALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2296 if ( !tsX || !detX ) {
2297 XLALPrintError(
"%s: invalid NULL data-vector tsX[%d] = %p, detX[%d] = %p\n",
__func__, X, tsX, X, detX );
2337 const REAL8 tSFTOld,
2338 const UINT4 numShortPerDet,
2340 const UINT4 maxNumStepsOldIfGapless,
2345 UINT4 numStepsXNew = numShortPerDet;
2355 for (
UINT4 alphaFuture = 0; alphaFuture < numStepsXNew; alphaFuture++ ) {
2356 newWeightStamps->
data[alphaFuture] = alphaFuture * tShort;
2369 REAL8 tAlphaOldWithGaps = 0;
2372 for (
UINT4 alphaLoad = 0; alphaLoad < maxNumStepsOldIfGapless; alphaLoad++ ) {
2374 tAlpha = alphaLoad * tSFTOld;
2376 tAlphaOldWithGaps =
XLALGPSDiff( &( multiTimes->data[X]->data[jj] ), &( multiTimes->data[X]->data[0] ) );
2377 for (
UINT4 kk = jj; kk < multiTimes->data[X]->length ; kk++ ) {
2379 tAlphaOldWithGaps =
XLALGPSDiff( &( multiTimes->data[X]->data[kk] ), &( multiTimes->data[X]->data[0] ) );
2380 if ( tAlphaOldWithGaps <= tAlpha ) {
2387 if ( ( tAlpha - tAlphaOldWithGaps ) < tSFTOld ) {
2389 oldTSWeightsX->
data->
data[alphaLoad] = weightsX->
data[jj] + 0.0 * I;
2393 oldTSWeightsX->
data->
data[alphaLoad] = 0.0 + 0.0 * I;
2405 for (
UINT4 alphaReal = 0; alphaReal < numStepsXNew; alphaReal++ ) {
2407 newWeightsXReal->
data[alphaReal] =
MYMAX( 0, creal( newWeightsX->
data[alphaReal] ) );
2409 ret = newWeightsXReal;
2413 ( *resampMultiWeightsX ) = ret;
2423 const REAL8 tSFTOld,
2424 const UINT4 numShortPerDet,
2434 REAL8 ratioSFTs = tShort / tSFTOld;
2449 REAL8 Tobs = numShortPerDet * tShort;
2450 UINT4 maxNumStepsOldIfGapless = lround( Tobs / tSFTOld );
2460 ( *multiWeights ) = ret;
2473 UINT4 numShortPerDet,
2479 if ( !multiAMcoef ) {
2490 REAL8 ratioSFTs = tShort / tSFTOld;
2492 REAL4 Ad = 0, Bd = 0, Cd = 0;
2494 REAL8 Tobs = numShortPerDet * tShort;
2495 UINT4 maxNumStepsOldIfGapless = lround( Tobs / tSFTOld );
2501 UINT4 numStepsXNew = numShortPerDet;
2502 if ( multiWeights ) {
2509 for (
UINT4 alphaFuture = 0; alphaFuture < numStepsXNew; alphaFuture++ ) {
2510 newWeightStamps->
data[alphaFuture] = alphaFuture * tShort;
2524 REAL8 tAlphaOldWithGaps = 0;
2527 for (
UINT4 alphaLoad = 0; alphaLoad < maxNumStepsOldIfGapless; alphaLoad++ ) {
2529 tAlpha = alphaLoad * tSFTOld;
2536 if ( tAlphaOldWithGaps <= tAlpha ) {
2544 if ( ( tAlpha - tAlphaOldWithGaps ) < tSFTOld ) {
2546 oldTSWeightsX->
data->
data[alphaLoad] = weightsX->
data[jj] + 0.0 * I;
2550 oldTSWeightsX->
data->
data[alphaLoad] = 0.0 + 0.0 * I;
2564 for (
UINT4 alphaReal = 0; alphaReal < numStepsXNew; alphaReal++ ) {
2566 newWeightsXReal->
data[alphaReal] =
MYMAX( 0, creal( newWeightsX->
data[alphaReal] ) );
2582 REAL4 AdX = 0, BdX = 0, CdX = 0;
2598 amcoeX->
D = AdX * BdX - CdX * CdX;
2603 if ( amcoeX->
D <= 0 ) {
2604 amcoeX->
D = INFINITY;
2617 multiAMcoef->
Mmunu.
Dd = Ad * Bd - Cd * Cd;
2622 if ( multiAMcoef->
Mmunu.
Dd <= 0 ) {
2623 multiAMcoef->
Mmunu.
Dd = INFINITY;
2627 if ( multiWeights ) {
2643 if ( !DetectorStates ) {
2658 REAL4 sin1delta, cos1delta;
2659 REAL4 sin1alpha, cos1alpha;
2663 REAL4 xi1 = - sin1alpha;
2665 REAL4 eta1 = sin1delta * cos1alpha;
2666 REAL4 eta2 = sin1delta * sin1alpha;
2667 REAL4 eta3 = - cos1delta;
2680 for (
i = 0;
i < numSteps;
i++ ) {
2685 ai =
d->d11 * ( xi1 * xi1 - eta1 * eta1 )
2686 + 2 *
d->d12 * ( xi1 *
xi2 - eta1 * eta2 )
2687 - 2 *
d->d13 * eta1 * eta3
2688 +
d->d22 * (
xi2 *
xi2 - eta2 * eta2 )
2689 - 2 *
d->d23 * eta2 * eta3
2690 -
d->d33 * eta3 * eta3;
2692 bi =
d->d11 * 2 * xi1 * eta1
2693 + 2 *
d->d12 * ( xi1 * eta2 +
xi2 * eta1 )
2694 + 2 *
d->d13 * xi1 * eta3
2695 +
d->d22 * 2 *
xi2 * eta2
2696 + 2 *
d->d23 *
xi2 * eta3;
2718 UINT4 numShortPerDet,
2723 if ( !multiDetStates ) {
2732 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
2775 const REAL8 resampTshort,
2780 UINT4 numShortPerDet = 0;
2782 numShortPerDet = lround( Tobs / resampTshort );
2783 return numShortPerDet;
2803 REAL8 tAlphaOldWithGaps = 0;
2805 for (
UINT4 ii = 0; ii < numSFTsNew; ii++ ) {
2811 tAlphaOldWithGaps =
XLALGPSDiff( &( Times->data[jj] ), &( Times->data[0] ) );
2818 for (
UINT4 kk = jj; kk < Times->length ; kk++ ) {
2819 tAlphaOldWithGaps =
XLALGPSDiff( &( Times->data[kk] ), &( Times->data[0] ) );
2820 if ( tAlphaOldWithGaps <= tAlpha ) {
2828 if ( tAlpha - tAlphaOldWithGaps <
Tsft ) {
2855 REAL8 Tsft = 1.0 / sfts->data[0].deltaF;
2858 REAL8 tAlphaOldWithGaps = 0;
2860 for (
UINT4 ii = 0; ii < numSFTsNew; ii++ ) {
2866 tAlphaOldWithGaps =
XLALGPSDiff( &( sfts->data[jj].epoch ), &( sfts->data[0] ).epoch );
2873 for (
UINT4 kk = jj; kk < sfts->length ; kk++ ) {
2874 tAlphaOldWithGaps =
XLALGPSDiff( &( sfts->data[kk].epoch ), &( sfts->data[0] ).epoch );
2875 if ( tAlphaOldWithGaps <= tAlpha ) {
2883 if ( tAlpha - tAlphaOldWithGaps <
Tsft ) {
2908 REAL4 castSciFlag1 = 0;
2909 REAL4 castSciFlag2 = 0;
2914 for (
UINT4 detX = 0; detX < resampMultiPairs->
length; detX++ ) {
2915 detInd1 = resampMultiPairs->
data[detX].
detInd;
2984 FstatInput *resampFstatInput,
2985 const UINT4 numFreqBins,
2987 const BOOLEAN treatWarningsAsErrors
2994 COMPLEX8 *restrict ws1KFaX_k = ( *ws1KFaX_kOut );
2995 COMPLEX8 *restrict ws1KFbX_k = ( *ws1KFbX_kOut );
2996 COMPLEX8 *restrict ws2LFaX_k = ( *ws2LFaX_kOut );
2997 COMPLEX8 *restrict ws2LFbX_k = ( *ws2LFbX_kOut );
3002 ( *multiTimeSeries_SRC_aOut ) = multiTimeSeries_SRC_a;
3003 ( *multiTimeSeries_SRC_bOut ) = multiTimeSeries_SRC_b;
3042 const REAL8 dFreqMetric = binaryTemplateSpacings.
fkdot[0];
3044 const REAL8 TspanFFT = 1.0 / dFreqMetric;
3045 const UINT4 decimateFFT = (
UINT4 )ceil( tCoh / TspanFFT );
3046 if ( 1 <= ( dFreqMetric * dt_SRC ) ) {
3047 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" );
3048 if ( treatWarningsAsErrors ) {
3049 XLALPrintError(
"Error! (treating warnings as errors) metric spacing less than one FFT sample.\n" );
3053 if ( decimateFFT > 1 ) {
3054 printf(
"Warning! Frequency spacing larger than 1/Tcoh, decimation being applied of %" LAL_UINT4_FORMAT "\n", decimateFFT );
3055 if ( treatWarningsAsErrors ==
TRUE ) {
3056 XLALPrintError(
"Error! (treating warnings as errors) FFT samples limited by tCoh (not metric), unexpected unless high mismatchF.\n" );
3060 const REAL8 TspanFFT1 = decimateFFT * TspanFFT;
3062 const UINT4 numSamplesFFT0 = (
UINT4 ) ceil( TspanFFT1 / dt_SRC );
3063 const UINT4 numSamplesFFT = (
UINT4 ) pow( 2, ceil( log2( numSamplesFFT0 ) ) );
3066 const int fft_plan_flags = FFTW_MEASURE;
3068 const double fft_plan_timeout = FFTW_NO_TIMELIMIT ;
3078 ws->decimateFFT = decimateFFT;
3079 ws->numSamplesFFT = numSamplesFFT;
3080 ws->numFreqBinsOut = numFreqBins;
3084 fftw_set_timelimit( fft_plan_timeout );
3085 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" );
3093 ( *ws1KFaX_kOut ) = ws1KFaX_k;
3094 ( *ws1KFbX_kOut ) = ws1KFbX_k;
3095 ( *ws2LFaX_kOut ) = ws2LFaX_k;
3096 ( *ws2LFbX_kOut ) = ws2LFbX_k;
3112 if ( ! sftIndices ) {
3116 if ( sftIndices->
data ) {
3139 if ( sftPairs->
data ) {
3151 if ( !sftResampList ) {
3155 if ( sftResampList->
data ) {
3166 if ( !sftResampMultiList ) {
3170 for (
UINT4 detY = 0; detY < sftResampMultiList->
length; detY++ ) {
3174 if ( sftResampMultiList->
data ) {
3184 if ( !sftResampPairMultiList ) {
3192 if ( sftResampPairMultiList->
data ) {
3203 if ( ! sftMultiPairsResamp ) {
3208 for (
UINT4 detX = 0; detX < sftMultiPairsResamp->
length; detX++ ) {
3215 if ( sftMultiPairsResamp->
data ) {
3230 if ( ! localMultiListOfLmatchingGivenMultiK ) {
3234 UINT4 numDets = localMultiListOfLmatchingGivenMultiK->
length;
3236 for (
UINT4 detX = 0; detX < numDets; detX++ ) {
3237 for (
UINT4 k = 0;
k < localMultiListOfLmatchingGivenMultiK->
data[detX].
length;
k++ ) {
3238 if ( localMultiListOfLmatchingGivenMultiK->
data[detX].
data[
k].
data ) {
3242 if ( localMultiListOfLmatchingGivenMultiK->
data[detX].
data ) {
3247 if ( localMultiListOfLmatchingGivenMultiK->
data ) {
3248 XLALFree( localMultiListOfLmatchingGivenMultiK->
data );
3251 XLALFree( localMultiListOfLmatchingGivenMultiK );
3265 fftwf_destroy_plan( ws->
fftplan );
3290 const REAL8 freqShift,
3291 const UINT4 indexStartResamp,
3292 const UINT4 indexEndResamp,
3293 const UINT4 numSamplesIn,
3294 const UINT4 insertPoint
3309 if ( insertPoint > numSamplesIn ) {
3310 XLALPrintError(
"ERROR! Would insert off end of matrix, numSamplesIn < insertPoint: %i, %i\n", numSamplesIn, insertPoint );
3320 if ( ( indexEndResamp - indexStartResamp ) > numSamplesIn ) {
3321 XLALPrintError(
"indexStartResamp, indexEndResamp: %u %u\n", indexStartResamp, indexEndResamp );
3322 XLALPrintError(
"ERROR! numSamplesIn only: %u\n", numSamplesIn );
3323 XLALPrintError(
"diff in indices, and num samples: %i %u\n", ( indexEndResamp - indexStartResamp ), numSamplesIn );
3329 REAL4 cosphase, sinphase;
3331 for (
UINT4 j = 0;
j < ( indexEndResamp - indexStartResamp );
j ++ ) {
3333 taup_j = (
j + indexStartResamp ) *
dt + Dtau0;
3336 cycles = - freqShift * taup_j;
3347 em2piphase =
crectf( cosphase, sinphase );
3351 xOut[
j + insertPoint] = em2piphase * xIn->data->data[(
j + indexStartResamp )];
3371 const REAL8 SRCsampPerTcoh,
3381 const REAL8 FreqOut0 = dopplerpos->fkdot[0];
3382 const REAL8 fHet = multiTimeSeries_SRC_a->data[0]->f0;
3383 const REAL8 dt_SRC = multiTimeSeries_SRC_b->data[0]->deltaT;
3384 const REAL8 dFreqMetric = binaryTemplateSpacings->fkdot[0];
3475 const REAL4 RedecimateFFT = dFreqMetric * dt_SRC * ( ws->numSamplesFFT );
3476 const REAL8 dFreqFFT = dFreqMetric / RedecimateFFT;
3477 const REAL8 freqShiftInFFT = remainder( FreqOut0 - fHet, dFreqFFT );
3478 const REAL8 fMinFFT = fHet + freqShiftInFFT - dFreqFFT * ( ws->numSamplesFFT / 2 );
3479 XLAL_CHECK( FreqOut0 >= fMinFFT,
XLAL_EDOM,
"Lowest output frequency outside the available frequency band: [FreqOut0 = %.16g] < [fMinFFT = %.16g]\n", FreqOut0, fMinFFT );
3481 const UINT4 offset_bins = (
UINT4 ) lround( ( FreqOut0 - fMinFFT ) / dFreqFFT );
3482 const UINT4 maxOutputBin = offset_bins + (
UINT4 )floor( ( ws->numFreqBinsOut - 1 ) * RedecimateFFT );
3483 XLAL_CHECK( maxOutputBin < ws->numSamplesFFT,
XLAL_EDOM,
"Highest output frequency bin outside available band: [maxOutputBin = %d] >= [ws->numSamplesFFT = %d]\n", maxOutputBin, ws->numSamplesFFT );
3486 UINT4 startFirstInd = 0;
3489 UINT4 sftIndFirst = 0;
3502 if ( isL ==
TRUE ) {
3503 detInd = resampMultiPairsDetXsftK->
data[detY].
detInd;
3505 detInd = resampMultiPairsDetX->detInd;
3513 if ( isL ==
TRUE ) {
3515 if ( resampMultiPairsDetXsftK->data[detY].length > 0 ) {
3516 sftIndFirst = resampMultiPairsDetXsftK->
data[detY].data[0].sftInd;
3517 startFirstInd = (
UINT4 )round( sftIndFirst * SRCsampPerTcoh );
3520 sftIndFirst = resampMultiPairsDetXsftK->sftInd;
3521 startFirstInd = (
UINT4 )round( sftIndFirst * SRCsampPerTcoh );
3523 if ( startFirstInd > resampDataArrayA->data->length ) {
3524 startFirstInd = resampDataArrayA->data->length;
3527 memset( ws->TS_FFT, 0, ws->numSamplesFFT *
sizeof( ws->TS_FFT[0] ) );
3528 UINT4 sftLength = 0;
3529 if ( isL ==
TRUE ) {
3530 sftLength = resampMultiPairsDetXsftK->data[detY].length;
3535 for (
UINT4 sft = 0; sft < sftLength; sft++ ) {
3538 if ( isL ==
TRUE ) {
3539 sftInd = resampMultiPairsDetXsftK->data[detY].data[sft].sftInd;
3541 sftInd = resampMultiPairsDetXsftK->sftInd;
3543 startInd = (
UINT4 )round( sftInd * SRCsampPerTcoh );
3544 endInd = (
UINT4 )round( ( sftInd + 1 ) * SRCsampPerTcoh );
3545 if ( startInd > resampDataArrayA->data->length ) {
3546 startInd = resampDataArrayA->data->length;
3548 if ( endInd > resampDataArrayA->data->length ) {
3549 endInd = resampDataArrayA->data->length;
3551 if ( startInd > endInd ) {
3554 UINT4 headOfSliceIndex = startInd - startFirstInd;
3558 fftwf_execute( ws->fftplan );
3559 for (
UINT4 k = 0;
k < ws->numFreqBinsOut;
k++ ) {
3560 ws->FaX_k[
k] = ws->FabX_Raw [ offset_bins + (
UINT4 )floor(
k * RedecimateFFT ) ];
3565 memset( ws->TS_FFT, 0, ws->numSamplesFFT *
sizeof( ws->TS_FFT[0] ) );
3566 for (
UINT4 sft = 0; sft < sftLength; sft++ ) {
3568 if ( isL ==
TRUE ) {
3569 sftInd = resampMultiPairsDetXsftK->data[detY].data[sft].sftInd;
3571 sftInd = resampMultiPairsDetXsftK->sftInd;
3573 startInd = (
UINT4 )round( sftInd * SRCsampPerTcoh );
3574 endInd = (
UINT4 )round( ( sftInd + 1 ) * SRCsampPerTcoh );
3575 if ( startInd > resampDataArrayB->data->length ) {
3576 startInd = resampDataArrayB->data->length;
3578 if ( endInd > resampDataArrayB->data->length ) {
3579 endInd = resampDataArrayB->data->length;
3581 if ( startInd > endInd ) {
3584 UINT4 headOfSliceIndex = startInd - startFirstInd;
3588 fftwf_execute( ws->fftplan );
3589 for (
UINT4 k = 0;
k < ws->numFreqBinsOut;
k++ ) {
3590 ws->FbX_k[
k] = ws->FabX_Raw [ offset_bins + (
UINT4 )floor(
k * RedecimateFFT ) ];
3594 const REAL8 dtauX =
GPSDIFF( resampDataArrayB->epoch, dopplerpos->refTime );
3595 const REAL8 timeFromResampStartToSFTFirst = startFirstInd * dt_SRC;
3601 REAL4 sinphase, cosphase;
3603 for (
UINT4 k = 0;
k < ws->numFreqBinsOut;
k++ ) {
3604 f_kOut = FreqOut0 +
k * dFreqMetric;
3605 f_kIn = ( offset_bins + (
UINT4 )floor(
k * RedecimateFFT ) ) * dFreqFFT;
3606 cyclesOut = - f_kOut * dtauX;
3607 cyclesIn = -f_kIn * timeFromResampStartToSFTFirst;
3608 cycles = cyclesOut + cyclesIn;
3610 normX_k = dt_SRC *
crectf( cosphase, sinphase );
3611 wsFaX_k[
k] = normX_k * ws->FaX_k[
k];
3612 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)
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...
void XLALDestroyMultiAMCoeffs(MultiAMCoeffs *multiAMcoef)
Destroy a MultiAMCoeffs structure.
AMCoeffs * XLALCreateAMCoeffs(UINT4 numSteps)
Create an AMCeoffs vector for given number of timesteps.
void * XLALCalloc(size_t m, 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 */
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)
int XLALCalculateCrossCorrGammasResampShort(REAL8Vector **Gamma_ave, REAL8Vector **Gamma_circ, MultiResampSFTPairMultiIndexList *resampMultiPairIndexList, MultiAMCoeffs *multiCoeffs)
test function for RESAMPLING with tShort
LIGOTimeGPSVector * XLALModifyTimestampsFromSFTsShort(REAL8TimeSeries **sciFlag, const LIGOTimeGPSVector *restrict Times, const REAL8 tShort, const UINT4 numShortPerDet)
Modify timestamps from one detector 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....
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 XLALTestResampPairIndexList(MultiResampSFTPairMultiIndexList *resampMultiPairIndexList)
Check that the contents of a resampling multi-pair index list are sensible by inspection.
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.
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)
REAL8TimeSeries * XLALCrossCorrGapFinderResamp(LIGOTimeGPSVector *restrict timestamps, const LIGOTimeGPSVector *restrict Times)
Find gaps in the data given the SFTs.
void XLALDestroyResampSFTMultiIndexList(ResampSFTMultiIndexList *sftResampMultiList)
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.
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...
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
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
REAL8TimeSeries * XLALCrossCorrGapFinderResampAlt(LIGOTimeGPSVector *restrict timestamps, const SFTVector *restrict sfts)
(test function) find gaps in the data given the SFTs
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
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
COMPLEX8TimeSeries * XLALCreateCOMPLEX8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyCOMPLEX8TimeSeries(COMPLEX8TimeSeries *series)
const LALUnit lalDimensionlessUnit
REAL8 XLALComputePhaseDerivative(REAL8 t, const PulsarDopplerParams *dopplerPoint, DopplerCoordinateID coordID, const EphemerisData *edat, const LALDetector *site, BOOLEAN includeRoemer)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
COMPLEX8Vector * XLALCreateCOMPLEX8Vector(UINT4 length)
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.
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, ...
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.