Commit 5cd72ed3 authored by Karl Wette's avatar Karl Wette Committed by Reinhard Prix

Move binary orbit parameters into PulsarDopplerParams

- one parameter structure for both isolated/binary CW signals
- no longer need to allocate free memory for *orbit field
- new convention: asini >  0 --> binary pulsar
                  asini  = 0 --> isolated pulsar
- PulsarSignalParams, which uses deprecated PulsarSourceParams,
  gets its own inline copy of BinaryOrbitParams fields, to
  ease backward compatibility with GeneratePulsarSignal()
- otherwise, all codes converted to using binary parameters
  from PulsarDopplerParams
- removes restriction on binary support from XLALComputeFstat()
- adapted XML (de)serialisation functions and test
- add checks on value of 'asini' to a few functions as appropriate
- passes 'make distcheck'
- refs #1161
Original: 6786cc25ba504c2616ffb6c55a7607b6c27269d1
parent 79db2057
......@@ -386,7 +386,6 @@ int main(int argc,char *argv[])
time_t clock0;
PulsarDopplerParams dopplerpos = empty_PulsarDopplerParams; /* current search-parameters */
FstatCandidate loudestFCand = empty_FstatCandidate, thisFCand = empty_FstatCandidate;
BinaryOrbitParams *orbitalParams = NULL;
FILE *fpLogPrintf = NULL;
gsl_vector_int *Fstat_histogram = NULL;
......@@ -501,27 +500,30 @@ int main(int argc,char *argv[])
}
/* setup binary parameters */
orbitalParams = NULL;
REAL8 orbit_asini = 0 /* isolated pulsar */;
REAL8 orbit_period = 0;
REAL8 orbit_ecc = 0;
LIGOTimeGPS orbit_tp = LIGOTIMEGPSZERO;
REAL8 orbit_argp = 0;
if ( LALUserVarWasSet(&uvar.orbitasini) && (uvar.orbitasini > 0) )
{
orbitalParams = (BinaryOrbitParams *)LALCalloc(1,sizeof(BinaryOrbitParams));
orbitalParams->tp.gpsSeconds = uvar.orbitTpSSBsec;
orbitalParams->tp.gpsNanoSeconds = uvar.orbitTpSSBnan;
orbitalParams->argp = uvar.orbitArgp;
orbitalParams->asini = uvar.orbitasini;
orbitalParams->ecc = uvar.orbitEcc;
orbitalParams->period = uvar.orbitPeriod;
orbit_tp.gpsSeconds = uvar.orbitTpSSBsec;
orbit_tp.gpsNanoSeconds = uvar.orbitTpSSBnan;
orbit_argp = uvar.orbitArgp;
orbit_asini = uvar.orbitasini;
orbit_ecc = uvar.orbitEcc;
orbit_period = uvar.orbitPeriod;
if (LALUserVarWasSet(&uvar.orbitTpSSBMJD))
{
/* convert MJD peripase to GPS using Matt Pitkins code found at lal/packages/pulsar/src/BinaryPulsarTimeing.c */
REAL8 GPSfloat;
GPSfloat = XLALTTMJDtoGPS(uvar.orbitTpSSBMJD);
XLALGPSSetREAL8(&(orbitalParams->tp),GPSfloat);
XLALGPSSetREAL8(&(orbit_tp),GPSfloat);
}
else
{
orbitalParams->tp.gpsSeconds = uvar.orbitTpSSBsec;
orbitalParams->tp.gpsNanoSeconds = uvar.orbitTpSSBnan;
orbit_tp.gpsSeconds = uvar.orbitTpSSBsec;
orbit_tp.gpsNanoSeconds = uvar.orbitTpSSBnan;
}
}
......@@ -562,7 +564,12 @@ int main(int argc,char *argv[])
/* skip search if user supplied --countTemplates */
while ( !uvar.countTemplates && (XLALNextDopplerPos( &dopplerpos, GV.scanState ) == 0) )
{
dopplerpos.orbit = orbitalParams; /* temporary solution until binary-gridding exists */
/* temporary solution until binary-gridding exists */
dopplerpos.asini = orbit_asini;
dopplerpos.period = orbit_period;
dopplerpos.ecc = orbit_ecc;
dopplerpos.tp = orbit_tp;
dopplerpos.argp = orbit_argp;
tic0 = tic = GETTIME();
......@@ -633,12 +640,12 @@ int main(int argc,char *argv[])
LogPrintf (LOG_CRITICAL, "[Alpha,Delta] = [%.16g,%.16g],\nfkdot=[%.16g,%.16g,%.16g,%16.g]\n",
thisFCand.doppler.Alpha, thisFCand.doppler.Delta,
thisFCand.doppler.fkdot[0], thisFCand.doppler.fkdot[1], thisFCand.doppler.fkdot[2], thisFCand.doppler.fkdot[3] );
if (thisFCand.doppler.orbit != NULL)
if (thisFCand.doppler.asini > 0)
{
LogPrintf (LOG_CRITICAL, "tp = {%d s, %d ns}, argp = %f, asini = %f, ecc = %f, period = %f\n",
thisFCand.doppler.orbit->tp.gpsSeconds, thisFCand.doppler.orbit->tp.gpsNanoSeconds,
thisFCand.doppler.orbit->argp, thisFCand.doppler.orbit->asini,
thisFCand.doppler.orbit->ecc, thisFCand.doppler.orbit->period);
thisFCand.doppler.tp.gpsSeconds, thisFCand.doppler.tp.gpsNanoSeconds,
thisFCand.doppler.argp, thisFCand.doppler.asini,
thisFCand.doppler.ecc, thisFCand.doppler.period);
}
return -1;
}
......@@ -1001,9 +1008,6 @@ int main(int argc,char *argv[])
XLALDestroyFstatResults ( Fstat_res );
/* free memory allocated for binary parameters */
if (orbitalParams) LALFree(orbitalParams);
LAL_CALL ( Freemem(&status, &GV), &status);
if (Fstat_histogram)
......@@ -1060,7 +1064,7 @@ initUserVars (LALStatus *status, UserInput_t *uvar)
uvar->df3dot = 0.0;
/* define default orbital semi-major axis */
uvar->orbitasini = 0.0;
uvar->orbitasini = 0 /* isolated pulsar */;
uvar->TwoFthreshold = 0.0;
uvar->NumCandidatesToKeep = 0;
......@@ -1428,7 +1432,6 @@ InitFStat ( LALStatus *status, ConfigVariables *cfg, const UserInput_t *uvar )
cfg->stepSizes.fkdot[1] = uvar->df1dot;
cfg->stepSizes.fkdot[2] = uvar->df2dot;
cfg->stepSizes.fkdot[3] = uvar->df3dot;
cfg->stepSizes.orbit = NULL;
REAL8 tmpFreqBandRef = cfg->searchRegion.fkdotBand[0];
......@@ -2189,14 +2192,14 @@ write_PulsarCandidate_to_fp ( FILE *fp, const PulsarCandidate *pulsarParams, co
fprintf (fp, "\n");
/* Binary parameters */
if (pulsarParams->Doppler.orbit)
if (pulsarParams->Doppler.asini > 0)
{
fprintf (fp, "orbitPeriod = % .16g;\n", pulsarParams->Doppler.orbit->period );
fprintf (fp, "orbitasini = % .16g;\n", pulsarParams->Doppler.orbit->asini );
fprintf (fp, "orbitTpSSBsec = % .8d;\n", pulsarParams->Doppler.orbit->tp.gpsSeconds );
fprintf (fp, "orbitTpSSBnan = % .8d;\n", pulsarParams->Doppler.orbit->tp.gpsNanoSeconds );
fprintf (fp, "orbitArgp = % .16g;\n", pulsarParams->Doppler.orbit->argp );
fprintf (fp, "orbitEcc = % .16g;\n", pulsarParams->Doppler.orbit->ecc );
fprintf (fp, "orbitPeriod = % .16g;\n", pulsarParams->Doppler.period );
fprintf (fp, "orbitasini = % .16g;\n", pulsarParams->Doppler.asini );
fprintf (fp, "orbitTpSSBsec = % .8d;\n", pulsarParams->Doppler.tp.gpsSeconds );
fprintf (fp, "orbitTpSSBnan = % .8d;\n", pulsarParams->Doppler.tp.gpsNanoSeconds );
fprintf (fp, "orbitArgp = % .16g;\n", pulsarParams->Doppler.argp );
fprintf (fp, "orbitEcc = % .16g;\n", pulsarParams->Doppler.ecc );
}
/* Amplitude Modulation Coefficients */
......
......@@ -1175,7 +1175,6 @@ InitFStat ( LALStatus *status, ConfigVariables *cfg )
cfg->stepSizes.fkdot[1] = uvar_df1dot;
cfg->stepSizes.fkdot[2] = uvar_df2dot;
cfg->stepSizes.fkdot[3] = uvar_df3dot;
cfg->stepSizes.orbit = NULL;
/* ----- set up toplist if requested ----- */
if ( uvar_NumCandidatesToKeep > 0 )
......@@ -2742,7 +2741,7 @@ void ComputeFStat_resamp(LALStatus *status, const PulsarDopplerParams *doppler,
} /* could not reuse previously buffered quantites */
/* new orbital parameter corrections if not already buffered */
if ( doppler->orbit )
if ( doppler->asini > 0 )
{
/* if already buffered */
if ( Buffer && Buffer->multiBinary )
......@@ -2752,7 +2751,7 @@ void ComputeFStat_resamp(LALStatus *status, const PulsarDopplerParams *doppler,
else
{
/* compute binary time corrections to the SSB time delays and SSB time derivitive */
if ( (XLALAddMultiBinaryTimes ( &multiBinary, multiSSB, doppler->orbit )) != XLAL_SUCCESS )
if ( (XLALAddMultiBinaryTimes ( &multiBinary, multiSSB, doppler )) != XLAL_SUCCESS )
{
XLALPrintError("XLALAddMultiBinaryTimes() failed with xlalErrno = %d\n\n", xlalErrno );
ABORTXLAL( status );
......
......@@ -912,7 +912,7 @@ int MAIN( int argc, char *argv[]) {
thisPoint.refTime = tMidGPS; /* midpoint of data spanned */
/* binary orbit and higher spindowns not considered */
thisPoint.orbit = NULL;
thisPoint.asini = 0 /* isolated pulsar */;
INIT_MEM ( thisPoint.fkdot );
/*---------- set up stuff for semi-coherent part ---------*/
......
......@@ -265,7 +265,11 @@ main(int argc, char *argv[])
params.pulsar.f0 = GV.pulsar.Doppler.fkdot[0];
params.pulsar.spindown = GV.spindown;
params.orbit = GV.pulsar.Doppler.orbit;
params.orbit.tp = GV.pulsar.Doppler.tp;
params.orbit.argp = GV.pulsar.Doppler.argp;
params.orbit.asini = GV.pulsar.Doppler.asini;
params.orbit.ecc = GV.pulsar.Doppler.ecc;
params.orbit.period = GV.pulsar.Doppler.period;
/* detector params */
params.transfer = GV.transfer; /* detector transfer function (NULL if not used) */
......@@ -586,7 +590,6 @@ main(int argc, char *argv[])
int
XLALInitMakefakedata ( ConfigVars_t *cfg, UserVariables_t *uvar )
{
int len;
XLAL_CHECK ( cfg != NULL, XLAL_EINVAL, "Invalid NULL input 'cfg'\n" );
XLAL_CHECK ( uvar != NULL, XLAL_EINVAL, "Invalid NULL input 'uvar'\n");
......@@ -1119,7 +1122,6 @@ XLALInitMakefakedata ( ConfigVars_t *cfg, UserVariables_t *uvar )
BOOLEAN set5 = XLALUserVarWasSet(&uvar->orbitTpSSBsec);
BOOLEAN set6 = XLALUserVarWasSet(&uvar->orbitTpSSBnan);
BOOLEAN set7 = XLALUserVarWasSet(&uvar->orbitTpSSBMJD);
BinaryOrbitParams *orbit = NULL;
if (set1 || set2 || set3 || set4 || set5 || set6 || set7)
{
......@@ -1129,20 +1131,18 @@ XLALInitMakefakedata ( ConfigVars_t *cfg, UserVariables_t *uvar )
if ( (uvar->orbitEcc < 0) || (uvar->orbitEcc > 1) ) {
XLAL_ERROR ( XLAL_EINVAL, "\nEccentricity = %g has to lie within [0, 1]\n\n", uvar->orbitEcc );
}
orbit = XLALCalloc ( 1, len = sizeof(BinaryOrbitParams) );
XLAL_CHECK ( orbit != NULL, XLAL_ENOMEM, "XLALCalloc (1, %d) failed.\n", len );
if ( set7 && (!set5 && !set6) )
{
/* convert MJD peripase to GPS using Matt Pitkins code found at lal/packages/pulsar/src/BinaryPulsarTimeing.c */
REAL8 GPSfloat;
GPSfloat = XLALTTMJDtoGPS(uvar->orbitTpSSBMJD);
XLALGPSSetREAL8(&(orbit->tp),GPSfloat);
XLALGPSSetREAL8(&(cfg->pulsar.Doppler.tp),GPSfloat);
}
else if ( set5 && !set7 )
{
orbit->tp.gpsSeconds = uvar->orbitTpSSBsec;
orbit->tp.gpsNanoSeconds = uvar->orbitTpSSBnan;
cfg->pulsar.Doppler.tp.gpsSeconds = uvar->orbitTpSSBsec;
cfg->pulsar.Doppler.tp.gpsNanoSeconds = uvar->orbitTpSSBnan;
}
else if ((set7 && set5) || (set7 && set6))
{
......@@ -1150,15 +1150,14 @@ XLALInitMakefakedata ( ConfigVars_t *cfg, UserVariables_t *uvar )
}
/* fill in orbital parameter structure */
orbit->period = uvar->orbitPeriod;
orbit->asini = uvar->orbitasini;
orbit->argp = uvar->orbitArgp;
orbit->ecc = uvar->orbitEcc;
cfg->pulsar.Doppler.period = uvar->orbitPeriod;
cfg->pulsar.Doppler.asini = uvar->orbitasini;
cfg->pulsar.Doppler.argp = uvar->orbitArgp;
cfg->pulsar.Doppler.ecc = uvar->orbitEcc;
cfg->pulsar.Doppler.orbit = orbit; /* struct copy */
} /* if one or more orbital parameters were set */
else
cfg->pulsar.Doppler.orbit = NULL;
cfg->pulsar.Doppler.asini = 0 /* isolated pulsar */;
} /* END: binary orbital params */
......@@ -1425,8 +1424,6 @@ XLALFreeMem ( ConfigVars_t *cfg )
/* free spindown-vector (REAL8) */
XLALDestroyREAL8Vector ( cfg->spindown );
XLALFree ( cfg->pulsar.Doppler.orbit );
/* free noise-SFTs */
XLALDestroySFTVector( cfg->noiseSFTs );
......
......@@ -336,7 +336,7 @@ int main(int argc, char *argv[])
oneSignal->data[0].Amp.cosi = 2.0*gsl_rng_uniform(inputParams->rng) - 1.0;
oneSignal->data[0].Amp.psi = LAL_TWOPI*gsl_rng_uniform(inputParams->rng);
oneSignal->data[0].Amp.phi0 = LAL_TWOPI*gsl_rng_uniform(inputParams->rng);
oneSignal->data[0].Doppler.orbit->argp = LAL_TWOPI*gsl_rng_uniform(inputParams->rng);
oneSignal->data[0].Doppler.argp = LAL_TWOPI*gsl_rng_uniform(inputParams->rng);
MultiSFTVector *oneSignalSFTs = NULL;
XLAL_CHECK( XLALCWMakeFakeMultiData(&oneSignalSFTs, NULL, oneSignal, &DataParams, edat) == XLAL_SUCCESS, XLAL_EFUNC );
......
......@@ -89,7 +89,7 @@ UserInput_t empty_UserInput;
int XLALInitUserVars ( UserInput_t *uvar );
int XLALInitializeConfigVars (ConfigVariables *config, const UserInput_t *uvar);
int XLALDestroyConfigVars (ConfigVariables *config);
int GetNextCrossCorrTemplate(BOOLEAN *binaryParamsFlag, PulsarDopplerParams *dopplerpos, REAL8 dFreq, BinaryOrbitParams *binaryTemplateSpacings, BinaryOrbitParams *minBinaryTemplate, BinaryOrbitParams *maxBinaryTemplate, REAL8 h0, REAL8 freq_hi);
int GetNextCrossCorrTemplate(BOOLEAN *binaryParamsFlag, PulsarDopplerParams *dopplerpos, REAL8 dFreq, PulsarDopplerParams *binaryTemplateSpacings, PulsarDopplerParams *minBinaryTemplate, PulsarDopplerParams *maxBinaryTemplate, REAL8 h0, REAL8 freq_hi);
int main(int argc, char *argv[]){
......@@ -113,8 +113,8 @@ int main(int argc, char *argv[]){
REAL8Vector *signalPhases = NULL;
PulsarDopplerParams dopplerpos = empty_PulsarDopplerParams;
BinaryOrbitParams thisBinaryTemplate, binaryTemplateSpacings;
BinaryOrbitParams minBinaryTemplate, maxBinaryTemplate;
PulsarDopplerParams thisBinaryTemplate, binaryTemplateSpacings;
PulsarDopplerParams minBinaryTemplate, maxBinaryTemplate;
SkyPosition skyPos = empty_SkyPosition;
MultiSSBtimes *multiSSBTimes = NULL;
MultiSSBtimes *multiBinaryTimes = NULL;
......@@ -296,10 +296,10 @@ int main(int argc, char *argv[]){
XLAL_ERROR( XLAL_EFUNC );
}
/*initialize binary parameters structure*/
minBinaryTemplate=empty_BinaryOrbitParams;
maxBinaryTemplate=empty_BinaryOrbitParams;
thisBinaryTemplate=empty_BinaryOrbitParams;
binaryTemplateSpacings=empty_BinaryOrbitParams;
minBinaryTemplate=empty_PulsarDopplerParams;
maxBinaryTemplate=empty_PulsarDopplerParams;
thisBinaryTemplate=empty_PulsarDopplerParams;
binaryTemplateSpacings=empty_PulsarDopplerParams;
/*fill in minbinaryOrbitParams*/
XLALGPSSetREAL8( &minBinaryTemplate.tp, uvar.orbitTimeAsc);
minBinaryTemplate.argp = 0.0;
......@@ -342,7 +342,12 @@ int main(int argc, char *argv[]){
XLALGPSSetREAL8( &thisBinaryTemplate.tp, uvar.orbitTimeAsc);
thisBinaryTemplate.ecc = 0.0;
thisBinaryTemplate.argp = 0.0;
dopplerpos.orbit = &thisBinaryTemplate;
/* copy to dopplerpos */
dopplerpos.asini = thisBinaryTemplate.asini;
dopplerpos.period = thisBinaryTemplate.period;
dopplerpos.tp = thisBinaryTemplate.tp;
dopplerpos.ecc = thisBinaryTemplate.ecc;
dopplerpos.argp = thisBinaryTemplate.argp;
/* spacing in frequency from diagff */
REAL8 dFreq = uvar.mismatchF/sqrt(diagff);
......@@ -393,7 +398,7 @@ int main(int argc, char *argv[]){
/* Might want to be clever about checking whether we've changed the orbital parameters or only the frequency */
if (dopplerShiftFlag == TRUE)
{
if ( (XLALAddMultiBinaryTimes( &multiBinaryTimes, multiSSBTimes, dopplerpos.orbit ) != XLAL_SUCCESS ) ) {
if ( (XLALAddMultiBinaryTimes( &multiBinaryTimes, multiSSBTimes, &dopplerpos ) != XLAL_SUCCESS ) ) {
LogPrintf ( LOG_CRITICAL, "%s: XLALAddMultiBinaryTimes() failed with errno=%d\n", __func__, xlalErrno );
XLAL_ERROR( XLAL_EFUNC );
}
......@@ -577,12 +582,12 @@ int XLALDestroyConfigVars (ConfigVariables *config)
/** FIXME: spacings and min, max values of binary parameters are not used yet */
int GetNextCrossCorrTemplate(BOOLEAN *binaryParamsFlag, PulsarDopplerParams *dopplerpos, REAL8 dFreq, BinaryOrbitParams *binaryTemplateSpacings, BinaryOrbitParams *minBinaryTemplate, BinaryOrbitParams *maxBinaryTemplate, REAL8 f0, REAL8 freq_hi)
int GetNextCrossCorrTemplate(BOOLEAN *binaryParamsFlag, PulsarDopplerParams *dopplerpos, REAL8 dFreq, PulsarDopplerParams *binaryTemplateSpacings, PulsarDopplerParams *minBinaryTemplate, PulsarDopplerParams *maxBinaryTemplate, REAL8 f0, REAL8 freq_hi)
{
REAL8 new_freq = dopplerpos->fkdot[0];
REAL8 new_asini = dopplerpos->orbit->asini;
REAL8 new_tp = XLALGPSGetREAL8(&(dopplerpos->orbit->tp));
REAL8 new_asini = dopplerpos->asini;
REAL8 new_tp = XLALGPSGetREAL8(&(dopplerpos->tp));
REAL8 tp_hi = XLALGPSGetREAL8(&(maxBinaryTemplate->tp));
/* basic sanity checks */
......@@ -608,8 +613,8 @@ int GetNextCrossCorrTemplate(BOOLEAN *binaryParamsFlag, PulsarDopplerParams *dop
{
if (new_asini <= maxBinaryTemplate->asini) /*after looping all f, initialize f and loop over a_p*/
{
new_asini = dopplerpos->orbit->asini + binaryTemplateSpacings->asini;
dopplerpos->orbit->asini = new_asini;
new_asini = dopplerpos->asini + binaryTemplateSpacings->asini;
dopplerpos->asini = new_asini;
new_freq = f0;
dopplerpos->fkdot[0] = new_freq;
*binaryParamsFlag = TRUE;
......@@ -619,10 +624,10 @@ int GetNextCrossCorrTemplate(BOOLEAN *binaryParamsFlag, PulsarDopplerParams *dop
{
if (new_tp <= tp_hi) /*after looping the plane of f and a_p, initialize f, a_p and loop over T*/
{
new_tp = XLALGPSGetREAL8(XLALGPSAddGPS(&(dopplerpos->orbit->tp), &(binaryTemplateSpacings->tp)));
XLALGPSSetREAL8(&(dopplerpos->orbit->tp),new_tp);
new_tp = XLALGPSGetREAL8(XLALGPSAddGPS(&(dopplerpos->tp), &(binaryTemplateSpacings->tp)));
XLALGPSSetREAL8(&(dopplerpos->tp),new_tp);
new_asini = minBinaryTemplate->asini;
dopplerpos->orbit->asini = new_asini;
dopplerpos->asini = new_asini;
new_freq = f0;
dopplerpos->fkdot[0] = new_freq;
*binaryParamsFlag = TRUE;
......
......@@ -615,7 +615,7 @@ int main(int argc, char *argv[]){
sftParams.Tsft = timeBase;
sftParams.noiseSFTs = NULL;
params.orbit = NULL;
params.orbit.asini = 0 /* isolated pulsar */;
/* params.transferFunction = NULL; */
params.ephemerides = edat;
params.startTimeGPS.gpsSeconds = firstTimeStamp.gpsSeconds; /* start time of output time series */
......
......@@ -639,7 +639,7 @@ int main(int argc, char *argv[]){
sftParams.Tsft = timeBase;
sftParams.noiseSFTs = NULL;
params.orbit = NULL;
params.orbit.asini = 0 /* isolated pulsar */;
/* params.transferFunction = NULL; */
params.ephemerides = edat;
params.startTimeGPS.gpsSeconds = firstTimeStamp.gpsSeconds; /* start time of output time series */
......
......@@ -602,7 +602,7 @@ int main(int argc, char *argv[]){
sftParams.noiseSFTs = NULL; /* or =inputSFTs; */
/* ****************************************************************/
params.orbit = NULL;
params.orbit.asini = 0 /* isolated pulsar */;
/* params.transferFunction = NULL; */
params.site = &(detector);
params.ephemerides = edat;
......
......@@ -821,7 +821,7 @@ int MAIN( int argc, char *argv[]) {
/* thisPoint.refTime = tStartGPS; */
thisPoint.refTime = tMidGPS;
/* binary orbit and higher spindowns not considered */
thisPoint.orbit = NULL;
thisPoint.asini = 0 /* isolated pulsar */;
INIT_MEM ( thisPoint.fkdot );
......
......@@ -370,7 +370,7 @@ int main( int argc, char *argv[]){
sftParams.noiseSFTs = inputSFTs;
/* signal generation parameters */
params.orbit = NULL;
params.orbit.asini = 0 /* isolated pulsar */;
/* params.transferFunction = NULL; */
params.site = &(detector);
params.ephemerides = edat;
......
......@@ -481,7 +481,7 @@ int main( int argc, char *argv[]){
sftParams.noiseSFTs = inputSFTs;
/* signal generation parameters */
params.orbit = NULL;
params.orbit.asini = 0 /* isolated pulsar */;
/* params.transferFunction = NULL; */
params.site = &(detector);
params.ephemerides = edat;
......
......@@ -760,7 +760,7 @@ int MAIN( int argc, char *argv[]) {
/* thisPoint.refTime = tStartGPS; */
thisPoint.refTime = tMidGPS;
/* binary orbit and higher spindowns not considered */
thisPoint.orbit = NULL;
thisPoint.asini = 0 /* isolated pulsar */;
INIT_MEM ( thisPoint.fkdot );
/* set up some semiCoherent parameters */
......
......@@ -196,7 +196,7 @@ void StackSlideVecF(LALStatus *status, /**< pointer to LALStatus structure */
/* The input parameter space point */
inputPoint.refTime = refTimeGPS;
inputPoint.orbit = NULL;
inputPoint.asini = 0 /* isolated pulsar */;
INIT_MEM ( inputPoint.fkdot );
inputPoint.fkdot[0] = fmid;
inputPoint.fkdot[1] = fdot;
......@@ -205,12 +205,12 @@ void StackSlideVecF(LALStatus *status, /**< pointer to LALStatus structure */
/* Values for output parameter space point that do not change */
outputPoint.refTime = refTimeGPS;
outputPoint.orbit = NULL;
outputPoint.asini = 0 /* isolated pulsar */;
INIT_MEM ( outputPoint.fkdot );
/* uncertainties in the output parameter space point */
outputPointUnc.refTime = refTimeGPS;
outputPointUnc.orbit = NULL;
outputPointUnc.asini = 0 /* isolated pulsar */;
INIT_MEM ( outputPointUnc.fkdot );
outputPointUnc.fkdot[0] = deltaF;
outputPointUnc.fkdot[1] = dfdot;
......
......@@ -468,7 +468,7 @@ XLALInitCode ( ConfigVariables *cfg, const UserVariables_t *uvar, const char *ap
dop->fkdot[1] = uvar->f1dot;
dop->fkdot[2] = uvar->f2dot;
dop->fkdot[3] = uvar->f3dot;
dop->orbit = NULL;
dop->asini = 0 /* isolated pulsar */;
}
/* ----- initialize IFOs and (Multi-)DetectorStateSeries ----- */
......@@ -588,15 +588,14 @@ XLALOutputDopplerMetric ( FILE *fp, const DopplerMetric *metric, const ResultHis
fprintf ( fp, "refTime = %.1f;\n", XLALGPSGetREAL8 ( &doppler->refTime ) );
fprintf ( fp, "Alpha = %f;\nDelta = %f;\n", doppler->Alpha, doppler->Delta );
fprintf ( fp, "fkdot = [%f, %g, %g, %g ];\n", doppler->fkdot[0], doppler->fkdot[1], doppler->fkdot[2], doppler->fkdot[3] );
if ( doppler->orbit )
if ( doppler->asini > 0 )
{
const BinaryOrbitParams *orbit = doppler->orbit;
fprintf ( fp, "%%%% orbit = { \n");
fprintf ( fp, "%%%% tp = {%d, %d}\n", orbit->tp.gpsSeconds, orbit->tp.gpsNanoSeconds );
fprintf ( fp, "%%%% argp = %g\n", orbit->argp );
fprintf ( fp, "%%%% asini = %g\n", orbit->asini );
fprintf ( fp, "%%%% ecc = %g\n", orbit->ecc );
fprintf ( fp, "%%%% period = %g\n", orbit->period );
fprintf ( fp, "%%%% tp = {%d, %d}\n", doppler->tp.gpsSeconds, doppler->tp.gpsNanoSeconds );
fprintf ( fp, "%%%% argp = %g\n", doppler->argp );
fprintf ( fp, "%%%% asini = %g\n", doppler->asini );
fprintf ( fp, "%%%% ecc = %g\n", doppler->ecc );
fprintf ( fp, "%%%% period = %g\n", doppler->period );
fprintf ( fp, "%%%% }\n");
} /* if doppler->orbit */
fprintf ( fp, "%%%% }\n");
......
......@@ -400,7 +400,11 @@ XLALGenerateCWSignalTS ( const PulsarParams *pulsarParams, ///< input CW pulsar-
params.pulsar.psi = pulsarParams->Amp.psi;
params.pulsar.f0 = pulsarParams->Doppler.fkdot[0];
params.pulsar.spindown = spindown;
params.orbit = pulsarParams->Doppler.orbit;
params.orbit.tp = pulsarParams->Doppler.tp;
params.orbit.argp = pulsarParams->Doppler.argp;
params.orbit.asini = pulsarParams->Doppler.asini;
params.orbit.ecc = pulsarParams->Doppler.ecc;
params.orbit.period = pulsarParams->Doppler.period;
params.transfer = NULL;
params.ephemerides = edat;
params.fHeterodyne = fHet;
......@@ -585,8 +589,6 @@ XLALDestroyPulsarParamsVector ( PulsarParamsVector *ppvect )
{
for ( UINT4 i = 0 ; i < numPulsars; i ++ )
{
BinaryOrbitParams *orbit = ppvect->data[i].Doppler.orbit;
XLALFree ( orbit );
XLALFree ( ppvect->data[i].name );
} // for i < numPulsars
XLALFree ( ppvect->data );
......@@ -607,7 +609,6 @@ XLALDestroyPulsarParams ( PulsarParams *params )
return;
}
XLALFree ( params->name );
XLALFree ( params->Doppler.orbit );
XLALFree ( params );
return;
......@@ -647,7 +648,6 @@ XLALReadPulsarParams ( PulsarParams *pulsarParams, ///< [out] pulsar parameters
)
{
XLAL_CHECK ( pulsarParams != NULL, XLAL_EINVAL );
XLAL_CHECK ( pulsarParams->Doppler.orbit == NULL, XLAL_EINVAL );
XLAL_CHECK ( cfgdata != NULL, XLAL_EINVAL );
INIT_MEM ( (*pulsarParams) ); // wipe input struct clean
......@@ -761,7 +761,7 @@ XLALReadPulsarParams ( PulsarParams *pulsarParams, ///< [out] pulsar parameters
XLAL_CHECK ( XLALReadConfigREAL8Variable ( &orbitTpSSB, cfgdata, secName, "orbitTpSSB", &have_orbitTpSSB ) == XLAL_SUCCESS, XLAL_EFUNC );
REAL8 orbitArgp = 0; BOOLEAN have_orbitArgp;
XLAL_CHECK ( XLALReadConfigREAL8Variable ( &orbitArgp, cfgdata, secName, "orbitArgp", &have_orbitArgp ) == XLAL_SUCCESS, XLAL_EFUNC );
REAL8 orbitasini = 0; BOOLEAN have_orbitasini;
REAL8 orbitasini = 0 /* isolated pulsar */; BOOLEAN have_orbitasini;
XLAL_CHECK ( XLALReadConfigREAL8Variable ( &orbitasini, cfgdata, secName, "orbitasini", &have_orbitasini ) == XLAL_SUCCESS, XLAL_EFUNC );
REAL8 orbitEcc = 0; BOOLEAN have_orbitEcc;
XLAL_CHECK ( XLALReadConfigREAL8Variable ( &orbitEcc, cfgdata, secName, "orbitEcc", &have_orbitEcc ) == XLAL_SUCCESS, XLAL_EFUNC );
......@@ -774,17 +774,13 @@ XLALReadPulsarParams ( PulsarParams *pulsarParams, ///< [out] pulsar parameters
XLAL_CHECK ( (orbitasini == 0) || ( have_orbitEcc && have_orbitPeriod && have_orbitArgp && have_orbitTpSSB ), XLAL_EINVAL );
XLAL_CHECK ( (orbitEcc >= 0) && (orbitEcc <= 1), XLAL_EDOM );
BinaryOrbitParams *orbit;
XLAL_CHECK ( ( orbit = XLALCalloc ( 1, sizeof(BinaryOrbitParams))) != NULL, XLAL_ENOMEM );
/* fill in orbital parameter structure */
XLAL_CHECK ( XLALGPSSetREAL8 ( &(orbit->tp), orbitTpSSB ) != NULL, XLAL_EFUNC );
orbit->argp = orbitArgp;
orbit->asini = orbitasini;
orbit->ecc = orbitEcc;
orbit->period = orbitPeriod;
XLAL_CHECK ( XLALGPSSetREAL8 ( &(pulsarParams->Doppler.tp), orbitTpSSB ) != NULL, XLAL_EFUNC );
pulsarParams->Doppler.argp = orbitArgp;
pulsarParams->Doppler.asini = orbitasini;
pulsarParams->Doppler.ecc = orbitEcc;
pulsarParams->Doppler.period = orbitPeriod;
pulsarParams->Doppler.orbit = orbit;
} // if have non-trivial orbit
// ---------- transientWindow_t ----------
......
......@@ -289,7 +289,7 @@ XLALComputeFstat(
XLAL_CHECK(Fstats != NULL, XLAL_EFAULT);
XLAL_CHECK(input != NULL, XLAL_EFAULT);
XLAL_CHECK(doppler != NULL, XLAL_EFAULT);
XLAL_CHECK(doppler->orbit == NULL, XLAL_EINVAL, "Binary parameters are currently not supported!");
XLAL_CHECK(doppler->asini >= 0, XLAL_EINVAL);
XLAL_CHECK(dFreq > 0 || (numFreqBins == 1 && dFreq >= 0), XLAL_EINVAL);
XLAL_CHECK(numFreqBins > 0, XLAL_EINVAL);
XLAL_CHECK(0 < whatToCompute && whatToCompute < FSTATQ_LAST, XLAL_EINVAL);
......
......@@ -971,10 +971,10 @@ ComputeFStat ( LALStatus *status, /* pointer to LALStatus structure */
} /* could not reuse previously buffered quantites */
/* new orbital parameter corrections if not already buffered */
if ( doppler->orbit )
if ( doppler->asini > 0 )
{
/* compute binary time corrections to the SSB time delays and SSB time derivitive */
if ( XLALAddMultiBinaryTimes ( &multiBinary, multiSSB, doppler->orbit ) != XLAL_SUCCESS )
if ( XLALAddMultiBinaryTimes ( &multiBinary, multiSSB, doppler ) != XLAL_SUCCESS )
{
XLALPrintError("XLALAddMultiBinaryTimes() failed with xlalErrno = %d\n\n", xlalErrno );
ABORTXLAL ( status );
......@@ -1448,7 +1448,7 @@ LocalComputeFStat ( LALStatus *status, /* pointer to LALStatus structur
ASSERT ( multiWeights->length == numDetectors , status, COMPUTEFSTATC_EINPUT, COMPUTEFSTATC_MSGEINPUT );
}
if ( doppler->orbit ) {
if ( doppler->asini > 0 ) {
XLALPrintError ("\nSorry, binary-pulsar search not yet implemented in LALComputeFStat()\n\n");
ABORT ( status, COMPUTEFSTATC_EINPUT, COMPUTEFSTATC_MSGEINPUT );
}
......
......@@ -502,7 +502,7 @@ XLALNextDopplerPos(PulsarDopplerParams *pos, DopplerFullScanState *scan)
pos->fkdot[1] = scan->thisGridPoint->entry.data[3];
pos->fkdot[2] = scan->thisGridPoint->entry.data[4];
pos->fkdot[3] = scan->thisGridPoint->entry.data[5];
pos->orbit = NULL;
pos->asini = 0; // isolated pulsar
/* advance to next grid point */
if ( ( scan->thisGridPoint = scan->thisGridPoint->next ) == NULL )
scan->state = STATE_FINISHED;
......
......@@ -497,7 +497,7 @@ XLALgetCurrentDopplerPos ( PulsarDopplerParams *pos, const DopplerLatticeScan *s