Commit c5f01d5b authored by Tyson Littenberg's avatar Tyson Littenberg
Browse files

fix normalization error for NIFO>2 in TFQprop

parent 2d5b60e0
......@@ -1339,9 +1339,31 @@ void TFprop_signal(struct Data *data, double **range, struct TimeFrequencyMap *t
int ifo;
norm=0.0;
/*
Initialize tfden to reference IFO
*/
for(m = 0; m < nQ; m++) // loop over Q
{
for(j = 0; j < nf; j++)
{
for(i = 0; i < nt; i++)
{
tsnr = tfsnr[0][m][j][i];
if(data->logClusterProposalFlag)
tfden[data->NI][m][j][i] = tsnr/2.;
else
tfden[data->NI][m][j][i] = exp(tsnr/2.0);
}
}
}
/*
add other IFOs contribution
*/
for(m = 0; m < nQ; m++) // loop over Q
{
// x = 0.0;
for(ifo=1; ifo<data->NI; ifo++)
{
......@@ -1353,22 +1375,42 @@ void TFprop_signal(struct Data *data, double **range, struct TimeFrequencyMap *t
ii = i - ioff;
if(ii < 0 || ii >= nt)
{
tsnr = tfsnr[0][m][j][i]; // leave out second detector if mapped out of time window (small edge effect)
//tsnr = tfsnr[0][m][j][i]; // leave out second detector if mapped out of time window (small edge effect)
tsnr = 0.0;
}
else
{
tsnr = tfsnr[0][m][j][i] + tfsnr[ifo][m][j][ii];
//tsnr = tfsnr[0][m][j][i] + tfsnr[ifo][m][j][ii];
tsnr = tfsnr[ifo][m][j][ii];
}
if(data->logClusterProposalFlag)
tfden[data->NI][m][j][i] = tsnr/2.;
tfden[data->NI][m][j][i] += tsnr/2.;
else
tfden[data->NI][m][j][i] = exp(tsnr/2.0)-1.0;
norm += tfden[data->NI][m][j][i];
tfden[data->NI][m][j][i] *= exp(tsnr/2.0);
}
}
}
}
/*
Get normalization
*/
for(m = 0; m < nQ; m++) // loop over Q
{
for(j = 0; j < nf; j++)
{
for(i = 0; i < nt; i++)
{
if(!data->logClusterProposalFlag) tfden[data->NI][m][j][i] -= 1.0;
norm += tfden[data->NI][m][j][i];
}
}
}
/*
Turn each cell into a probability density
*/
tfmax[data->NI][0] = 0.0;
for(m = 0; m < nQ; m++) // loop over Q
{
......
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