Skip to content
Snippets Groups Projects
Commit a3e9526c authored by Tyson Littenberg's avatar Tyson Littenberg
Browse files

Merge branch 'i_hate_cit' into 'master'

Catch if using simulated data. If so, make sure fmin is filled

See merge request lscsoft/bayeswave!68
parents f5f35530 4c86e520
No related branches found
No related tags found
No related merge requests found
......@@ -170,21 +170,34 @@ int main(int argc, char *argv[])
ifo=0;
imin = (int)(fmin*Tobs);
imax = (int)(fmax*Tobs);
bool simDataFlag = False;
while(dataPtr!=NULL)
{
//read in time domain data from LALInference data structre
for(i=0; i<N; i++)
{
timeData[ifo][i] = dataPtr->timeData->data->data[i];
//timeData remains uninitialized if simulating data
if(timeData[ifo][i]!=timeData[ifo][i])
{
simDataFlag = True;
timeData[ifo][i] = 0.0;
}
}
//read in frequency domain data from LALInference data structure
for(i=0; i<N/2; i++)
{
if(simDataFlag)
{
dataPtr->freqData->data->data[imin] = dataPtr->freqData->data->data[imin+1];
dataPtr->oneSidedNoisePowerSpectrum->data->data[imin] = dataPtr->oneSidedNoisePowerSpectrum->data->data[imin+1];
}
if(i<imin)
{
freqData[ifo][2*i] = 0.0;
freqData[ifo][2*i+1] = 0.0;
psd[ifo][i] = 1.0;
freqData[ifo][2*i] = creal(dataPtr->freqData->data->data[imin]);
freqData[ifo][2*i+1] = cimag(dataPtr->freqData->data->data[imin]);
psd[ifo][i] = dataPtr->oneSidedNoisePowerSpectrum->data->data[imin]*Tobs/2.0;
}
else
{
......@@ -201,7 +214,11 @@ int main(int argc, char *argv[])
dataPtr = dataPtr->next;
ifo++;
}
if(simDataFlag)
{
fprintf(stdout,"Detected run is using simulated data\n");
fprintf(stdout,"copied d(fmin+1/t) to d(f<=fmin)\n\n");
}
/******************************************************************************/
/* */
/* Setup DATA, CHAIN, PRIOR, MODEL structures */
......@@ -352,10 +369,10 @@ int main(int argc, char *argv[])
//copy frequency domain data into timeData array for inplace iFFT
for(i=0; i<N; i++) timeData[ifo][i] = data->s[ifo][i];
//pad frequencies below fmin, just in case
for(i=0; i<imin; i++)
for(i=0; i<=imin; i++)
{
timeData[ifo][2*i] = data->s[ifo][2*i];
timeData[ifo][2*i+1] = data->s[ifo][2*i+1];
timeData[ifo][2*i] = data->s[ifo][2*(imin+1)];
timeData[ifo][2*i+1] = data->s[ifo][2*(imin+1)+1];
}
fftw_wrapper(timeData[ifo],data->N,-1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment