Skip to content
Snippets Groups Projects
Commit 2245f40b authored by Adriaan Renting's avatar Adriaan Renting
Browse files

BugId: 1049

Fixed a bug in writing the CHAN_FREQ
parent 6e41a0d2
Branches
Tags
No related merge requests found
......@@ -96,7 +96,7 @@ namespace LOFAR
int outcounter = 0;
bool flagrow = true;
Vector<Complex> values(itsNumPolarizations, 0);
//Vector<Float> temp(itsNumPolarizations, ); // a bit bigger to get rounding errors right
Vector<Complex> weights(itsNumPolarizations, 0);
while (incounter < NChan)
{
for (int i = 0; i < itsNumPolarizations; i++)
......@@ -104,17 +104,22 @@ namespace LOFAR
if (!oldFlags(i, Start + incounter))
{ //weight is not handled here, maybe sometime in the future?
values(i) += oldData(i, Start + incounter);
weights(i) += 1;
flagrow = false;
}
}
incounter++;
if ((incounter) % Step == 0)
{
for (int i = 0; i < itsNumPolarizations; i++)
{ values(i) = values(i) / weights(i);
}
newData.column(outcounter) = values;
for (int i = 0; i < itsNumPolarizations; i++) // I can't get anyGT or something like that to work
flagrow = flagrow || (threshold * 1.001 >= abs(values[i]));
newFlags.column(outcounter) = flagrow;
values = 0;
weights = 0;
outcounter++;
flagrow = true;
}
......@@ -133,7 +138,7 @@ namespace LOFAR
int step = outMS.nrow() / 10 + 1; //not exact but it'll do
int row = 0;
bool rwFlags = newFlags.nrow() > 0;
if (!rwFlags)
if (!rwFlags) //we are able to re-use the same flags
{ newFlags.resize(itsNumPolarizations, NChan/Step, itsNumSamples);
}
......
......@@ -28,12 +28,13 @@
#include <CS1_DataSquasher/SquasherProcessControl.h>
#include "DataSquasher.h"
#define SQUASHER_VERSION "0.41"
#define SQUASHER_VERSION "0.42"
//0.20 Added handling MODEL and CORRECTED DATA
//0.30 Added handling threshold and weights
//0.31 Added handing MODEL_DATA and CORRECTED_DATA keywords for imager
//0.40 Changed creation mechnism of the destination MS
//0.41 Cleaned up the code for readability
//0.42 Fixed the incorect weighting of partially flagged bands
namespace LOFAR
{
......@@ -192,7 +193,13 @@ namespace LOFAR
{
for (int j = 0; j < new_nchan; j++)
{ inFREQ.get(i, old_temp);
new_temp(j) = old_temp(itsStart + j*itsStep + itsNChan/2);
if (itsStep % 2) //odd number of channels in step
{ new_temp(j) = old_temp(itsStart + j*itsStep + (itsStep + 1)/2);
}
else //even number of channels in step
{ new_temp(j) = 0.5 * (old_temp(itsStart + j*itsStep + itsStep/2 -1)
+ old_temp(itsStart + j*itsStep + itsStep/2));
}
outFREQ.put(i, new_temp);
}
for (int j = 0; j < new_nchan; j++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment