Commit 322a7bf8 authored by John Whelan's avatar John Whelan
Browse files

PulsarCrossCorr_v2: added function to calculate sigma_alpha ignoring Doppler shift

Original: 6a89d6869fcb7d042cc3ddeb86c8580e2bbc1ef2
parent 6609b4a7
......@@ -194,3 +194,50 @@ int XLALCreateSFTPairIndexList
return XLAL_SUCCESS;
}
/** Construct vector of sigma_alpha values for each SFT pair */
/* This version uses a single frequency rather than the doppler-shifted ones */
/* Allocates memory as well */
int XLALCalculateCrossCorrSigmaUnshifted
(
REAL8Vector **sigma_alpha, /* Output: vector of sigma_alpha values */
SFTPairIndexList *pairIndexList, /* Input: list of SFT pairs */
SFTIndexList *indexList, /* Input: list of SFTs */
MultiPSDVector *psds, /* Input: PSD estimate (Sn*Tsft/2) for each SFT */
REAL8 freq, /* Frequency to extract from PSD */
REAL8 Tsft /**< SFT duration */
)
{
UINT8 j, numPairs, numSFTs, index;
REAL8Vector *psdData;
REAL8FrequencySeries *psd;
SFTIndex sftIndex;
REAL8Vector *ret = NULL;
REAL8 Tsft4;
Tsft4 = SQUARE(SQUARE(Tsft));
numPairs = pairIndexList->length;
numSFTs = indexList->length;
XLAL_CHECK ( ( psdData = XLALCreateREAL8Vector ( numSFTs ) ) != NULL, XLAL_EFUNC, "XLALCreateREAL8Vector ( %d ) failed.", numSFTs );
for (j=0; j < numSFTs; j++) {
sftIndex = indexList->data[j];
psd = &(psds->data[sftIndex.detInd]->data[sftIndex.sftInd]);
index = (UINT8) floor( (freq - psd->f0)/psd->deltaF + 0.5 );
psdData->data[j] = psd->data->data[index];
}
XLAL_CHECK ( ( ret = XLALCreateREAL8Vector ( numPairs ) ) != NULL, XLAL_EFUNC, "XLALCreateREAL8Vector ( %d ) failed.", numPairs );
for (j=0; j < numPairs; j++) {
ret->data[j] = ( psdData->data[pairIndexList->data[j].sftNum[0]]
* psdData->data[pairIndexList->data[j].sftNum[1]]
) / Tsft4 ;
}
(*sigma_alpha) = ret;
XLALDestroyREAL8Vector ( psdData );
return XLAL_SUCCESS;
}
......@@ -120,6 +120,7 @@ int XLALCreateSFTIndexListFromMultiSFTVect
MultiSFTVector *sfts
)
;
int XLALCreateSFTPairIndexList
(
SFTPairIndexList **pairIndexList,
......@@ -130,6 +131,17 @@ int XLALCreateSFTPairIndexList
)
;
int XLALCalculateCrossCorrSigmaUnshifted
(
REAL8Vector **sigma_alpha,
SFTPairIndexList *pairIndexList,
SFTIndexList *indexList,
MultiPSDVector *psds,
REAL8 freq,
REAL8 Tsft
)
;
/*@}*/
#ifdef __cplusplus
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment