35 #include <gsl/gsl_permutation.h>
37 #include <lal/PulsarCrossCorr.h>
38 #include <lal/DopplerScan.h>
39 #include <lal/ExtrapolatePulsarSpins.h>
40 #include <lal/LALString.h>
41 #include <lal/LALPulsarVCSInfo.h>
92 #define BLOCKSRNGMED 51
93 #define MAXFILENAMELENGTH 512
95 #define DIROUT "./output/"
96 #define FILEOUT "CrossCorr_out.dat"
97 #define DEBUGOUT "estimator.dat"
98 #define BASENAMEOUT "radio"
100 #define SKYFILE "./skypatchfile"
101 #define SKYREGION "allsky"
106 #define SQUARE(x) ((x)*(x))
107 #define CUBE(x) ((x)*(x)*(x))
109 #define N_SPINDOWN_DERIVS 6
114 int main(
int argc,
char *argv[] )
129 REAL8 deltaF_SFT, timeBase;
139 static REAL8Vector *aplussq1, *aplussq2, *acrossq1, *acrossq2;
157 REAL8 *skyAlpha = NULL, *skyDelta = NULL,
158 *skySizeAlpha = NULL, *skySizeDelta = NULL;
159 INT8 nSkyPatches, skyCounter = 0;
163 INT8 nfreqLoops = 1, freqCounter = 0;
165 REAL8 f_current = 0.0;
166 INT8 ualphacounter = 0.0;
169 INT8 nfdotLoops = 1, fdotCounter = 0;
170 INT8 nfddotLoops = 1, fddotCounter = 0;
171 REAL8 fdot_current = 0.0, delta_fdot = 0.0;
172 REAL8 fddot_current = 0.0, delta_fddot = 0.0;
175 INT8 nq1Loops = 1, nq2Loops = 1, nnLoops = 1;
176 INT8 q1Counter = 0, q2Counter = 0, nCounter = 0;
177 REAL8 q1_current = 0.0, q2_current = 0.0, n_current = 0.0;
178 REAL8 delta_q1 = 0.0, delta_q2 = 0.0, delta_n = 0.0;
181 INT8 paramCounter = 0;
186 REAL8 tmpstat, freq1, fbin1, phase1, freq2, fbin2, phase2;
188 REAL8 tmpstat2, tmpstat3, tmpstat4;
194 FILE *fpdebug = NULL;
195 FILE *fpCrossCorr = NULL;
196 CHAR *fnameDebug = NULL;
197 CHAR *fnameCrossCorrCand = NULL;
202 FILE *skytest = NULL;
209 INT4 sftcounter = 0, slidingcounter = 1, listLength = 0;
229 fprintf( stderr,
"start frequency must be positive\n" );
234 fprintf( stderr,
"search frequency band must be positive\n" );
239 fprintf( stderr,
"search frequency resolution must be > 0\n" );
244 fprintf( stderr,
"fdot and fddot are not used if useQCoeffs is set\n" );
249 fprintf( stderr,
"useQCoeffs must be set in order to search over q1, q2 or braking index\n" );
254 fprintf( stderr,
"frequency derivative band must be positive\n" );
259 fprintf( stderr,
"frequency derivative resolution must be > 0\n" );
264 fprintf( stderr,
"frequency double derivative band must be positive\n" );
269 fprintf( stderr,
"reference frequency must be positive\n" );
274 fprintf( stderr,
"frequency double derivative resolution must be > 0\n" );
279 fprintf( stderr,
"if uvar_averagePsi = TRUE, psi will not be used\n" );
284 fprintf( stderr,
"if uvar_averageIota = TRUE, cosi will not be used\n" );
289 fprintf( stderr,
"autoCorrelate option is not currently usable\n" );
301 if ( fnameDebug == NULL ) {
302 fprintf( stderr,
"error allocating memory [pulsar_crosscorr.c %d]\n", __LINE__ );
308 if ( !( fpdebug = fopen( fnameDebug,
"wb" ) ) ) {
309 fprintf( stderr,
"Unable to open debugging output file '%s' for writing.\n", fnameDebug );
318 if ( fnameCrossCorrCand == NULL ) {
319 fprintf( stderr,
"error allocating memory [pulsar_crosscorr.c %d]\n", __LINE__ );
326 if ( !( fpCrossCorr = fopen( fnameCrossCorrCand,
"wb" ) ) ) {
327 fprintf( stderr,
"Unable to open output-file '%s' for writing.\n", fnameCrossCorrCand );
333 fprintf( fpCrossCorr,
"##Alpha\tDelta\tFrequency\tQ1\tQ2\tBraking Index\tNormalised Power\n" );
335 fprintf( fpCrossCorr,
"##Alpha\tDelta\tFrequency\t Fdot \t Fddot \t Normalised Power\n" );
367 if ( ( catalog == NULL ) || ( catalog->
length == 0 ) ) {
368 fprintf( stderr,
"Unable to match any SFTs with pattern '%s'\n",
376 fprintf( stderr,
"Time taken to load sft catalog: %f s\n", difftime(
t2,
t1 ) );
382 timeBase = 1.0 / deltaF_SFT;
387 tObs =
XLALGPSDiff( &lastTimeStamp, &firstTimeStamp ) + timeBase;
456 if ( ( skytest = fopen(
uvar_skyfile,
"r" ) ) == NULL ) {
457 fprintf( stderr,
"skyfile doesn't exist\n" );
465 skyAlpha = skyInfo.
alpha;
466 skyDelta = skyInfo.
delta;
476 amplitudes.
Aplussq = 7.0 / 15.0;
495 nParams = nSkyPatches * nfreqLoops * nq1Loops * nq2Loops * nnLoops;
497 nParams = nSkyPatches * nfreqLoops * nfdotLoops * nfddotLoops;
504 variance->
length = nParams;
509 aplussq1->
length = nParams;
513 aplussq2->
length = nParams;
517 acrossq1->
length = nParams;
521 acrossq2->
length = nParams;
525 galphasq->
length = nParams;
529 galphare->
length = nParams;
533 galphaim->
length = nParams;
550 REAL8 startTime_freqLo, startTime_freqHi, endTime_freqLo, endTime_freqHi, freqLo, freqHi;
569 spinRange_refTime.
refTime = refTime;
585 for (
k = 1;
k < fdotsMin->
length;
k++ ) {
586 spinRange_refTime.
fkdot[
k] = fdotsMin->
data[
k - 1];
601 startTime_freqLo = spinRange_startTime.
fkdot[0];
602 startTime_freqHi = startTime_freqLo + spinRange_startTime.
fkdotBand[0];
603 endTime_freqLo = spinRange_endTime.
fkdot[0];
604 endTime_freqHi = endTime_freqLo + spinRange_endTime.
fkdotBand[0];
607 freqLo = startTime_freqLo < endTime_freqLo ? startTime_freqLo : endTime_freqLo;
608 freqHi = startTime_freqHi > endTime_freqHi ? startTime_freqHi : endTime_freqHi;
613 doppWings = freqHi *
VTOT ;
629 for ( sftcounter = 0; sftcounter < (
INT4 )catalog->
length - 1; sftcounter++ ) {
650 if ( sftcounter > 0 ) {
666 while ( ( slidingcounter < (
INT4 )catalog->
length ) &&
677 tmpSFT = &( sftTail->sft );
678 tmpPSD = &( psdTail->psd );
694 listLength = slidingcounter - sftcounter;
695 if ( listLength > 1 ) {
697 while ( paramCounter < nParams ) {
702 q1_current =
uvar_q1 + ( delta_q1 * q1Counter );
703 q2_current =
uvar_q2 + ( delta_q2 * q2Counter );
707 if ( skyCounter == nSkyPatches ) {
711 if ( nCounter == nnLoops ) {
715 if ( q2Counter == nq2Loops ) {
719 if ( q1Counter == nq1Loops ) {
727 fdot_current =
uvar_fdot + ( delta_fdot * fdotCounter );
728 fddot_current =
uvar_fddot + ( delta_fddot * fddotCounter );
731 if ( skyCounter == nSkyPatches ) {
735 if ( fddotCounter == nfddotLoops ) {
739 if ( fdotCounter == nfdotLoops ) {
747 fdot_current, fddot_current ), &
status );
750 thisPoint.
Alpha = skyAlpha[skyCounter];
751 thisPoint.
Delta = skyDelta[skyCounter];
769 phaseList = phaseHead;
772 sft1 = &( sftList->
sft );
773 psd1 = &( psdList->
psd );
774 freq1 = freqList->
val;
775 bin1 = (
UINT4 )ceil( ( ( freq1 - psd1->
f0 ) / ( deltaF_SFT ) ) - 0.5 );
776 fbin1 = psd1->
f0 + (
REAL8 )bin1 * deltaF_SFT;
777 phase1 = phaseList->
val;
778 beamfns1 = &( beamList->
beamfn );
788 sft2 = &( sftList->
sft );
789 psd2 = &( psdList->
psd );
790 freq2 = freqList->
val;
791 bin2 = (
UINT4 )ceil( ( ( freq2 - psd2->
f0 ) / ( deltaF_SFT ) ) - 0.5 );
792 fbin2 = psd2->
f0 + (
REAL8 )bin2 * deltaF_SFT;
793 phase2 = phaseList->
val;
794 beamfns2 = &( beamList->
beamfn );
810 sft2 = &( sftList->
sft );
811 psd2 = &( psdList->
psd );
812 freq2 = freqList->
val;
813 bin2 = (
UINT4 )ceil( ( ( freq2 - psd2->
f0 ) / ( deltaF_SFT ) ) - 0.5 );
814 fbin2 = psd2->
f0 + (
REAL8 )bin2 * deltaF_SFT;
815 phase2 = phaseList->
val;
816 beamfns2 = &( beamList->
beamfn );
819 sameDet = strcmp( sft1->
name, sft2->name );
822 if ( sameDet != 0 ) {
827 if ( detChoice ==
ALL ) {
832 if ( sameDet == (
INT4 )detChoice ) {
842 sft1, sft2, psd1, psd2, bin1, bin2 ),
846 bin1, bin2, psd1, psd2 ),
852 phase1, phase2, fbin1, fbin2, deltaF_SFT, *beamfns1, *beamfns2,
853 sigmasq->
data[ualphacounter] ),
858 phase1, phase2, fbin1, fbin2, deltaF_SFT, *beamfns1, *beamfns2,
859 sigmasq->
data[ualphacounter], psi, &gplus->
data[ualphacounter], &gcross->data[ualphacounter] ),
868 if ( ualphacounter > 0 ) {
876 rho->
data[counter] += tmpstat;
882 variance->
data[counter] += tmpstat;
894 aplussq1->
data[counter] += tmpstat;
895 aplussq2->
data[counter] += tmpstat2;
896 acrossq1->
data[counter] += tmpstat3;
897 acrossq2->
data[counter] += tmpstat4;
899 for (
i = 0;
i < (
INT4 )ualpha->length;
i++ ) {
901 galphasq->
data[counter] +=
SQUARE( sigmasq->
data[
i] * creal( ualpha->data[
i] ) ) +
SQUARE( sigmasq->
data[
i] * cimag( ualpha->data[
i] ) );
903 galphare->
data[counter] += ( sigmasq->
data[
i] * creal( ualpha->data[
i] ) );
904 galphaim->
data[counter] += -( sigmasq->
data[
i] * cimag( ualpha->data[
i] ) );
913 for (
i = 0;
i < (
INT4 )ualpha->length;
i++ ) {
915 galphasq->
data[counter] += (
SQUARE( sigmasq->
data[
i] * creal( ualpha->data[
i] ) ) +
SQUARE( sigmasq->
data[
i] * cimag( ualpha->data[
i] ) ) );
916 galphare->
data[counter] += ( sigmasq->
data[
i] * creal( ualpha->data[
i] ) );
917 galphaim->
data[counter] += -( sigmasq->
data[
i] * cimag( ualpha->data[
i] ) );
939 fprintf( stderr,
"finish loop over all sfts\n" );
944 fprintf( stderr,
"Time taken for main loop: %f\n", difftime(
t2,
t1 ) );
952 for ( freqCounter = 0; freqCounter < nfreqLoops; freqCounter++ ) {
959 for ( q1Counter = 0; q1Counter < nq1Loops; q1Counter++ ) {
961 q1_current =
uvar_q1 + ( delta_q1 * q1Counter );
964 for ( q2Counter = 0; q2Counter < nq2Loops; q2Counter++ ) {
966 q2_current =
uvar_q2 + ( delta_q2 * q2Counter );
969 for ( nCounter = 0; nCounter < nnLoops; nCounter++ ) {
973 for ( skyCounter = 0; skyCounter < nSkyPatches; skyCounter++ ) {
975 thisPoint.
Alpha = skyAlpha[skyCounter];
976 thisPoint.
Delta = skyDelta[skyCounter];
980 rho->
data[counter] = rho->
data[counter] / sqrt( variance->
data[counter] );
981 fprintf( fpCrossCorr,
"%1.5f\t %1.5f\t %1.5f\t %e\t %e\t %e\t %1.10g\n", thisPoint.
Alpha,
982 thisPoint.
Delta, f_current,
983 q1_current, q2_current, n_current, rho->
data[counter] );
986 fprintf( fpdebug,
"%1.5f %e %e %g %g %g\n", f_current, sqrt( fabs( aplussq2->
data[counter] / aplussq1->
data[counter] ) ), sqrt( fabs( acrossq2->
data[counter] / acrossq1->
data[counter] ) ), galphasq->
data[counter], galphare->
data[counter], galphaim->
data[counter] );
990 fprintf( fpdebug,
"%1.5f %g %g %g\n", f_current, galphasq->
data[counter], galphare->
data[counter], galphaim->
data[counter] );
1003 for ( fdotCounter = 0; fdotCounter < nfdotLoops; fdotCounter++ ) {
1005 fdot_current =
uvar_fdot + ( delta_fdot * fdotCounter );
1008 for ( fddotCounter = 0; fddotCounter < nfddotLoops; fddotCounter++ ) {
1009 for ( skyCounter = 0; skyCounter < nSkyPatches; skyCounter++ ) {
1011 thisPoint.
Alpha = skyAlpha[skyCounter];
1012 thisPoint.
Delta = skyDelta[skyCounter];
1014 rho->
data[counter] = rho->
data[counter] / sqrt( variance->
data[counter] );
1015 fprintf( fpCrossCorr,
"%1.5f\t %1.5f\t %1.5f\t %e\t %e\t %1.10f\n", thisPoint.
Alpha,
1016 thisPoint.
Delta, f_current,
1017 fdot_current, fddot_current, rho->
data[counter] );
1027 fprintf( stderr,
"Time taken to write to output file: %f\n", difftime(
t2,
t1 ) );
1033 fclose( fpCrossCorr );
1048 LALFree( fnameCrossCorrCand );
1070 if ( beamHead != beamTail ) {
1077 if ( sftHead != sftTail ) {
1078 tmpSFT = &( sftTail->sft );
1081 tmpSFT = &( sftHead->
sft );
1085 if ( psdHead != psdTail ) {
1093 if ( phaseHead != phaseTail ) {
1100 if ( freqHead != freqTail ) {
1114 return status.statusCode;
1134 UINT4 nSkyPatches, skyCounter;
1146 scanInit.dAlpha = dAlpha;
1147 scanInit.dDelta = dDelta;
1150 scanInit.skyRegionString = (
CHAR * )
LALCalloc( 1, strlen( skyRegion ) + 1 );
1151 strcpy( scanInit.skyRegionString, skyRegion );
1157 nSkyPatches =
out->numSkyPatches = thisScan.numSkyGridPoints;
1169 out->alpha[skyCounter] = dopplerpos.
Alpha;
1170 out->delta[skyCounter] = dopplerpos.
Delta;
1171 out->alphaSize[skyCounter] = dAlpha;
1172 out->deltaSize[skyCounter] = dDelta;
1174 if ( ( dopplerpos.
Delta > 0 ) && ( dopplerpos.
Delta < atan( 4 *
LAL_PI / dAlpha / dDelta ) ) ) {
1175 out->alphaSize[skyCounter] = dAlpha * cos( dopplerpos.
Delta - 0.5 * dDelta ) / cos( dopplerpos.
Delta );
1178 if ( ( dopplerpos.
Delta < 0 ) && ( dopplerpos.
Delta > -atan( 4 *
LAL_PI / dAlpha / dDelta ) ) ) {
1179 out->alphaSize[skyCounter] = dAlpha * cos( dopplerpos.
Delta + 0.5 * dDelta ) / cos( dopplerpos.
Delta );
1189 if ( scanInit.skyRegionString ) {
1190 LALFree( scanInit.skyRegionString );
1199 REAL8 temp1, temp2, temp3, temp4;
1203 if ( ( fpsky = fopen( skyFileName,
"r" ) ) == NULL ) {
1209 r =
fscanf( fpsky,
"%lf%lf%lf%lf\n", &temp1, &temp2, &temp3, &temp4 );
1214 }
while (
r != EOF );
1217 out->numSkyPatches = nSkyPatches;
1223 for ( skyCounter = 0; skyCounter < nSkyPatches; skyCounter++ ) {
1224 r =
fscanf( fpsky,
"%lf%lf%lf%lf\n",
out->alpha + skyCounter,
out->delta + skyCounter,
1225 out->alphaSize + skyCounter,
out->deltaSize + skyCounter );
1247 REAL8 fddot_current )
1263 thisPoint->
fkdot[0] = f_current;
1276 thisPoint->
fkdot[0] = f_current;
1277 thisPoint->
fkdot[1] = fdot_current;
1278 thisPoint->
fkdot[2] = fddot_current;
1321 phasetmp = phaseHead;
1364 freqtmp->
val = freq1;
1365 phasetmp->
val = phase1;
1468 if ( !( *sftHead ) ) {
1496 if ( !( *psdHead ) ) {
1552 if ( !( *beamHead ) ) {
1553 *beamHead = beamList;
1557 *beamTail = beamList;
1578 tmpSFT = &( sftList->
sft );
1599 tmpPSD = &( psdList->
psd );
1621 tmpVal = &( List->
val );
1640 beamList = *beamHead;
1642 beamfns = &( beamList->
beamfn );
1670 fdots->
data[0] = -( q1 * pow(
f0, 5 ) ) - ( q2 * pow(
f0,
n ) );
1672 fdots->
data[1] = -( 5.0 * q1 * pow(
f0, 4 ) * fdots->
data[0] )
1673 - (
n * q2 * pow(
f0,
n - 1 ) * fdots->
data[0] );
1676 - q2 * ( (
n - 1 ) *
n * pow(
f0,
n - 2 ) *
SQUARE( fdots->
data[0] ) +
n * pow(
f0,
n - 1 ) * fdots->
data[1] );
1679 + 5.0 * pow(
f0, 4 ) * fdots->
data[2] )
1680 - q2 * ( (
n - 2 ) * (
n - 1 ) *
n * pow(
f0,
n - 3 ) *
CUBE( fdots->
data[0] )
1681 + 3 *
n * (
n - 1 ) * pow(
f0,
n - 2 ) * fdots->
data[0] * fdots->
data[1] +
n * pow(
f0,
n - 1 ) * fdots->
data[2] );
1686 - q2 * ( (
n - 3 ) * (
n - 2 ) * (
n - 1 ) *
n * pow(
f0,
n - 4 ) * pow( fdots->
data[0], 4 )
1687 + 6.0 * (
n - 2 ) * (
n - 1 ) *
n * pow(
f0,
n - 3 ) *
SQUARE( fdots->
data[0] ) * fdots->
data[1]
1689 + 4.0 * (
n - 1 ) *
n * pow(
f0,
n - 2 ) * fdots->
data[0] * fdots->
data[2] +
n * pow(
f0,
n - 1 ) * fdots->
data[3] );
1691 fdots->
data[5] = -q1 * ( 120.0 * pow( fdots->
data[0], 5 ) + 1200.0 *
f0 *
CUBE( fdots->
data[0] ) * fdots->
data[1]
1694 + 5.0 * pow(
f0, 4 ) * fdots->
data[4] )
1695 - q2 * ( (
n - 4 ) * (
n - 3 ) * (
n - 2 ) * (
n - 1 ) *
n * pow(
f0,
n - 5 ) * pow( fdots->
data[0], 5 )
1696 + 10.0 * (
n - 3 ) * (
n - 2 ) * (
n - 1 ) *
n * pow(
f0,
n - 4 ) *
CUBE( fdots->
data[0] ) * fdots->
data[1]
1697 + 15.0 * (
n - 2 ) * (
n - 1 ) *
n * pow(
f0,
n - 3 ) * fdots->
data[0] *
SQUARE( fdots->
data[1] )
1698 + 10.0 * (
n - 2 ) * (
n - 1 ) *
n * pow(
f0,
n - 3 ) *
SQUARE( fdots->
data[1] ) * fdots->
data[2]
1699 + 10.0 * (
n - 1 ) *
n * pow(
f0,
n - 2 ) * fdots->
data[1] * fdots->
data[2]
1700 + 5.0 * (
n - 1 ) *
n * pow(
f0,
n - 2 ) * fdots->
data[0] * fdots->
data[3]
1701 +
n * pow(
f0,
n - 1 ) * fdots->
data[4] );
1794 " - '<SFT file>;<SFT file>;...', where <SFT file> may contain wildcards\n - 'list:<file containing list of SFT files>'" ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
void InitDopplerSkyScan(LALStatus *status, DopplerSkyScanState *skyScan, const DopplerSkyScanInit *init)
void FreeDopplerSkyScan(LALStatus *status, DopplerSkyScanState *skyScan)
int XLALNextDopplerSkyPos(PulsarDopplerParams *pos, DopplerSkyScanState *skyScan)
NextDopplerSkyPos(): step through sky-grid return 0 = OK, -1 = ERROR.
@ STATE_FINISHED
all templates have been read
@ GRID_ISOTROPIC
approximately isotropic sky-grid
void REPORTSTATUS(LALStatus *status)
lal_errhandler_t lal_errhandler
int LAL_ERR_EXIT(LALStatus *stat, const char *func, const char *file, const int line, volatile const char *id)
#define LAL_CALL(function, statusptr)
void LALCheckMemoryLeaks(void)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
#define ABORT(statusptr, code, mesg)
#define XLAL_CHECK_LAL(sp, assertion,...)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
void XLALDestroyDetectorStateSeries(DetectorStateSeries *detStates)
Get rid of a DetectorStateSeries.
DetectorStateSeries * XLALGetDetectorStates(const LIGOTimeGPSVector *timestamps, const LALDetector *detector, const EphemerisData *edat, REAL8 tOffset)
Get the 'detector state' (ie detector-tensor, position, velocity, etc) for the given vector of timest...
void XLALDestroyREAL8FrequencySeries(REAL8FrequencySeries *series)
void XLALDestroyEphemerisData(EphemerisData *edat)
Destructor for EphemerisData struct, NULL robust.
EphemerisData * XLALInitBarycenter(const CHAR *earthEphemerisFile, const CHAR *sunEphemerisFile)
XLAL interface to reading ephemeris files 'earth' and 'sun', and return ephemeris-data in old backwar...
AMCoeffs * XLALComputeAMCoeffs(const DetectorStateSeries *DetectorStates, SkyPosition skypos)
Compute the 'amplitude coefficients' , as defined in for a series of timestamps.
void XLALDestroyAMCoeffs(AMCoeffs *amcoef)
Destroy a AMCoeffs structure.
#define XLAL_INIT_DECL(var,...)
char char * XLALStringDuplicate(const char *s)
#define VTOT
Total detector velocity/c TO BE CHANGED DEPENDING ON DETECTOR.
int XLALNormalizeSFT(REAL8FrequencySeries *rngmed, SFTtype *sft, UINT4 blockSize, const REAL8 assumeSqrtS)
Normalize an sft based on RngMed estimated PSD, and returns running-median.
void LALCalculateEstimators(LALStatus *status, REAL8 *aplussq1, REAL8 *aplussq2, REAL8 *acrossq1, REAL8 *acrossq2, COMPLEX16Vector *yalpha, COMPLEX16Vector *gplus, COMPLEX16Vector *gcross, REAL8Vector *sigmaAlphasq)
void LALCalculateAveUalpha(LALStatus *status, COMPLEX16 *out, REAL8 phiI, REAL8 phiJ, REAL8 freqI, REAL8 freqJ, REAL8 deltaF, CrossCorrBeamFn beamfnsI, CrossCorrBeamFn beamfnsJ, REAL8 sigmasq)
Calculate pair weights (U_alpha) for an average over Psi and cos(iota)
void LALCalculateSigmaAlphaSq(LALStatus *status, REAL8 *out, UINT4 bin1, UINT4 bin2, REAL8FrequencySeries *psd1, REAL8FrequencySeries *psd2)
void LALGetSignalFrequencyInSFT(LALStatus *status, REAL8 *out, LIGOTimeGPS *epoch, PulsarDopplerParams *dopp, REAL8Vector *vel_c)
Calculate the frequency of the SFT at a given epoch.
void LALCorrelateSingleSFTPair(LALStatus *status, COMPLEX16 *out, COMPLEX8FrequencySeries *sft1, COMPLEX8FrequencySeries *sft2, REAL8FrequencySeries *psd1, REAL8FrequencySeries *psd2, UINT4 bin1, UINT4 bin2)
Correlate a single pair of SFT at a parameter space point.
void LALCalculateUalpha(LALStatus *status, COMPLEX16 *out, CrossCorrAmps amplitudes, REAL8 phiI, REAL8 phiJ, REAL8 freqI, REAL8 freqJ, REAL8 deltaF, CrossCorrBeamFn beamfnsI, CrossCorrBeamFn beamfnsJ, REAL8 sigmasq, REAL8 *psi, COMPLEX16 *gplus, COMPLEX16 *gcross)
Calculate pair weights (U_alpha) for the general case.
void LALGetSignalPhaseInSFT(LALStatus *status, REAL8 *out, LIGOTimeGPS *epoch, PulsarDopplerParams *dopp, REAL8Vector *r_c)
Get signal phase at a given epoch.
void LALCalculateCrossCorrPower(LALStatus *status, REAL8 *out, COMPLEX16Vector *yalpha, COMPLEX16Vector *ualpha)
void LALNormaliseCrossCorrPower(LALStatus *status, REAL8 *out, COMPLEX16Vector *ualpha, REAL8Vector *sigmaAlphasq)
#define PULSAR_MAX_SPINS
maximal number of spin-parameters (Freq + spindowns) we can handle
const LALDetector * XLALGetSiteInfo(const CHAR *name)
Find the site geometry-information 'LALDetector' for given a detector name (or prefix).
void XLALDestroySFTVector(SFTVector *vect)
XLAL interface to destroy an SFTVector.
void XLALDestroySFTCatalog(SFTCatalog *catalog)
Free an 'SFT-catalogue'.
LIGOTimeGPSVector * XLALCreateTimestampVector(UINT4 len)
Allocate a LIGOTimeGPSVector.
int XLALCopySFT(SFTtype *dest, const SFTtype *src)
Copy an entire SFT-type into another.
SFTVector * XLALLoadSFTs(const SFTCatalog *catalog, REAL8 fMin, REAL8 fMax)
Load the given frequency-band [fMin, fMax) (half-open) from the SFT-files listed in the SFT-'catalogu...
SFTCatalog * XLALSFTdataFind(const CHAR *file_pattern, const SFTConstraints *constraints)
Find the list of SFTs matching the file_pattern and satisfying the given constraints,...
void XLALDestroySFT(SFTtype *sft)
Destructor for one SFT.
void XLALDestroyTimestampVector(LIGOTimeGPSVector *vect)
De-allocate a LIGOTimeGPSVector.
REAL8Sequence * XLALCreateREAL8Sequence(size_t length)
COORDINATESYSTEM_EQUATORIAL
COMPLEX16Vector * XLALResizeCOMPLEX16Vector(COMPLEX16Vector *vector, UINT4 length)
REAL8Vector * XLALResizeREAL8Vector(REAL8Vector *vector, UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
void XLALDestroyCOMPLEX16Vector(COMPLEX16Vector *vector)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_MAIN(assertion,...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
LIGOTimeGPS * XLALGPSSet(LIGOTimeGPS *epoch, INT4 gpssec, INT8 gpsnan)
#define N_SPINDOWN_DERIVS
REAL8 uvar_fdotResolution
int main(int argc, char *argv[])
void initUserVars(LALStatus *status)
void DeleteSFTHead(LALStatus *status, SFTListElement **sftHead)
void AddBeamFntoList(LALStatus *status, CrossCorrBeamFnListElement **beamHead, CrossCorrBeamFnListElement **beamTail)
void CopySFTFromCatalog(LALStatus *status, SFTCatalog *catalog, SFTVector **sft, REAL8 fMin, REAL8 fMax, INT4 sftindex)
void AddPSDtoList(LALStatus *status, PSDListElement **psdHead, PSDListElement **psdTail, INT4 length)
REAL8 uvar_brakingindexResolution
void DeletePSDHead(LALStatus *status, PSDListElement **psdHead)
REAL8 uvar_brakingindexBand
void CalculateFdots(LALStatus *status, REAL8Vector *fdots, REAL8 f0, REAL8 q1, REAL8 q2, REAL8 n)
void AddSFTtoList(LALStatus *status, SFTListElement **sftHead, SFTListElement **sftTail, SFTtype *sft)
REAL8 uvar_fddotResolution
void InitDoppParams(LALStatus *status, REAL8Vector *fdots, PulsarDopplerParams *thisPoint, LIGOTimeGPS refTime, REAL8 f_current, REAL8 q1_current, REAL8 q2_current, REAL8 n_current, REAL8 fdot_current, REAL8 fddot_current)
void DeleteREAL8Head(LALStatus *status, REAL8ListElement **head)
CHAR * uvar_ephemEarth
Earth ephemeris file to use.
BOOLEAN uvar_autoCorrelate
void DeleteBeamFnHead(LALStatus *status, CrossCorrBeamFnListElement **beamHead)
void GetBeamInfo(LALStatus *status, CrossCorrBeamFnListElement *beamHead, SFTListElement *sftHead, REAL8ListElement *freqHead, REAL8ListElement *phaseHead, SkyPosition skypos, EphemerisData *edat, PulsarDopplerParams *thisPoint)
void AddREAL8toList(LALStatus *status, REAL8ListElement **head, REAL8ListElement **tail)
#define MAXFILENAMELENGTH
CHAR * uvar_ephemSun
Sun ephemeris file to use.
void SetUpRadiometerSkyPatches(LALStatus *status, SkyPatchesInfo *out, CHAR *skyFileName, CHAR *skyRegion, REAL8 dAlpha, REAL8 dDelta)
Set up location of skypatch centers and sizes If user specified skyRegion then use DopplerScan functi...
Header for CW cross-correlation search.
#define PULSAR_CROSSCORR_ENULL
#define PULSAR_CROSSCORR_MSGEBAD
#define PULSAR_CROSSCORR_EBAD
#define PULSAR_CROSSCORR_MSGEMEM
#define PULSAR_CROSSCORR_EMEM
#define PULSAR_CROSSCORR_MSGENULL
#define PULSAR_CROSSCORR_MSGEVAL
#define PULSAR_CROSSCORR_EFILE
#define PULSAR_CROSSCORR_EVAL
#define PULSAR_CROSSCORR_MSGEFILE
This structure contains the per-SFT (weighted) antenna-pattern functions , with the SFT-index,...
REAL4Vector * b
(weighted) per-SFT antenna-pattern function
REAL4Vector * a
(weighted) per-SFT antenna-pattern function
A vector of COMPLEX8FrequencySeries.
COMPLEX8FrequencySeries * data
Pointer to the data array.
struct tagCrossCorrBeamFnListElement * nextBeamfn
REAL8 rDetector[3]
Cartesian coords of detector position in ICRS J2000.
Timeseries of DetectorState's, representing the detector-info at different timestamps.
DetectorState * data
array of DetectorState entries
LALDetector detector
detector-info corresponding to this timeseries
initialization-structure passed to InitDopplerSkyScan()
this structure reflects the current state of a DopplerSkyScan
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
A vector of 'timestamps' of type LIGOTimeGPS.
struct tagPSDListElement * nextPSD
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
PulsarSpins fkdot
Intrinsic spins: [Freq, f1dot, f2dot, ...
REAL8 Delta
Sky position: DEC (latitude) in equatorial coords and radians.
LIGOTimeGPS refTime
Reference time of pulsar parameters (in SSB!)
REAL8 Alpha
Sky position: RA (longitude) in equatorial coords and radians.
Contains a "spin-range", ie spins and corresponding bands at a given (SSB) reference GPS-time .
PulsarSpins fkdot
Vector of spin-values .
LIGOTimeGPS refTime
SSB reference GPS-time at which spin-range is defined.
PulsarSpins fkdotBand
Vector of spin-bands , MUST be same length as fkdot.
struct tagREAL8ListElement * nextVal
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
SFTDescriptor * data
array of data-entries describing matched SFTs
UINT4 length
number of SFTs in catalog
'Constraints' for SFT-matching: which detector, within which time-stretch and which timestamps exactl...
CHAR * detector
2-char channel-prefix describing the detector (eg 'H1', 'H2', 'L1', 'G1' etc)
LIGOTimeGPSVector * timestamps
list of timestamps
LIGOTimeGPS * maxStartTime
only include SFTs whose epoch is < maxStartTime
LIGOTimeGPS * minStartTime
only include SFTs whose epoch is >= minStartTime
A 'descriptor' of an SFT: basically containing the header-info plus an opaque description of where ex...
SFTtype header
SFT-header info.
UINT4 version
SFT-specification version.
struct tagSFTLocator * locator
internal description of where to find this SFT [opaque!]
UINT4 numBins
number of frequency-bins in this SFT
UINT8 crc64
crc64 checksum
CHAR * comment
comment-entry in SFT-header
struct tagSFTListElement * nextSFT
struct holding info about skypoints