Commit 5855d2af authored by John Whelan's avatar John Whelan
Browse files

PulsarCrossCorr_v2: added calculation of average-curly-G amplitude

Original: b53cdb93c9fb0dcf37fe1c13aa2d5372168b71b7
parent df57a9b2
......@@ -101,6 +101,7 @@ int main(int argc, char *argv[]){
REAL8 roughFreq; /* Approximate frequency to use for metric calculations */
REAL8Vector *sigmaUnshifted = NULL;
REAL8Vector *curlyGUnshifted = NULL;
/* initialize and register user variables */
if ( XLALInitUserVars( &uvar ) != XLAL_SUCCESS ) {
......@@ -199,6 +200,11 @@ int main(int argc, char *argv[]){
XLAL_ERROR( XLAL_EFUNC );
}
if ( ( XLALCalculateAveCurlyGAmpUnshifted( &curlyGUnshifted, sftPairs, sftIndices, multiCoeffs) != XLAL_SUCCESS ) ) {
LogPrintf ( LOG_CRITICAL, "%s: XLALCalculateAveCurlyGUnshifted() failed with errno=%d\n", __func__, xlalErrno );
XLAL_ERROR( XLAL_EFUNC );
}
/* /\* get SFT parameters so that we can initialise search frequency resolutions *\/ */
/* /\* calculate deltaF_SFT *\/ */
/* deltaF_SFT = catalog->data[0].header.deltaF; /\* frequency resolution *\/ */
......
......@@ -241,3 +241,42 @@ int XLALCalculateCrossCorrSigmaUnshifted
XLALDestroyREAL8Vector ( psdData );
return XLAL_SUCCESS;
}
/** Construct vector of G_alpha amplitudes for each SFT pair */
/* This is averaged over unknown cosi and psi */
/* Allocates memory as well */
int XLALCalculateAveCurlyGAmpUnshifted
(
REAL8Vector **G_alpha, /* Output: vector of sigma_alpha values */
SFTPairIndexList *pairIndexList, /* Input: list of SFT pairs */
SFTIndexList *indexList, /* Input: list of SFTs */
MultiAMCoeffs *multiCoeffs /* Input: AM coefficients */
)
{
UINT8 j, numPairs;
UINT8 detInd1, detInd2;
UINT8 sftInd1, sftInd2;
UINT8 sftNum1, sftNum2;
REAL8Vector *ret = NULL;
numPairs = pairIndexList->length;
XLAL_CHECK ( ( ret = XLALCreateREAL8Vector ( numPairs ) ) != NULL, XLAL_EFUNC, "XLALCreateREAL8Vector ( %d ) failed.", numPairs );
for (j=0; j < numPairs; j++) {
sftNum1 = pairIndexList->data[j].sftNum[0];
sftNum2 = pairIndexList->data[j].sftNum[1];
detInd1 = indexList->data[sftNum1].detInd;
detInd2 = indexList->data[sftNum2].detInd;
sftInd1 = indexList->data[sftNum1].sftInd;
sftInd2 = indexList->data[sftNum2].sftInd;
ret->data[j] = 0.1 * ( multiCoeffs->data[detInd1]->a->data[sftInd1]
* multiCoeffs->data[detInd2]->a->data[sftInd2]
+ multiCoeffs->data[detInd1]->b->data[sftInd1]
* multiCoeffs->data[detInd2]->b->data[sftInd2] );
}
(*G_alpha) = ret;
return XLAL_SUCCESS;
}
......@@ -138,7 +138,16 @@ int XLALCalculateCrossCorrSigmaUnshifted
SFTIndexList *indexList,
MultiPSDVector *psds,
REAL8 freq,
REAL8 Tsft
REAL8 Tsft
)
;
int XLALCalculateAveCurlyGAmpUnshifted
(
REAL8Vector **G_alpha,
SFTPairIndexList *pairIndexList,
SFTIndexList *indexList,
MultiAMCoeffs *multiCoeffs
)
;
......
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