Skip to content
Snippets Groups Projects
Commit 00d54abc authored by Ger van Diepen's avatar Ger van Diepen
Browse files

bug 1446:

Fixed bug where XY, YX, and YY were not averaged
parent 415175f5
No related branches found
No related tags found
No related merge requests found
......@@ -123,39 +123,42 @@ void DataSquasher::Squash(vector<Matrix<Complex> >& oldData,
int Start, int Step, int NChan)
{ //We only add to weight as it can have multiple timesteps integrated
int nDataCol = oldData.size();
int incounter = 0;
int outcounter = 0;
bool flagnew = true;
Vector<Complex> values(nDataCol);
Vector<Complex> allvalues(nDataCol);
Vector<Complex> tmpvalues(nDataCol);
// Use raw pointer as it is faster.
Complex* tmpval = tmpvalues.data();
Float weight = 0;
for (int i = 0; i < itsNumPolarizations; i++)
{
int incounter = 0;
int outcounter = 0;
int nstep = 0;
while (incounter < NChan)
{
++nstep;
for (int j=0; j<nDataCol; ++j) {
allvalues[j] += oldData[j](i, Start + incounter);
tmpval[j] = oldData[j](i, Start + incounter);
}
if (!oldFlags(i, Start + incounter))
{
for (int j=0; j<nDataCol; ++j) {
values[j] += oldData[j](i, Start + incounter);
}
allvalues += tmpvalues;
if (!oldFlags(i, Start + incounter)) {
values += tmpvalues;
weight += 1.0; //should be += old Weight?
flagnew = false;
}
incounter++;
if ((incounter) % Step == 0)
if (incounter == NChan-1 || incounter%Step == 0)
{
if (flagnew) {
// Everything is flagged
// take all values and set weight to 1.0
values = allvalues;
newWeights(i, outcounter) += 1.0; //should be += old Weight * Step?
newWeights(i, outcounter) += 1.0; //should be += old Weight * nstep?
} else {
//Not everything is flagged
values /= weight;
newWeights(i, outcounter) += abs(weight) / Step;
newWeights(i, outcounter) += abs(weight) / nstep;
}
for (int j=0; j<nDataCol; ++j) {
newData[j](i, outcounter) += values[j];
......@@ -166,6 +169,7 @@ void DataSquasher::Squash(vector<Matrix<Complex> >& oldData,
weight = 0.;
outcounter++;
flagnew = true;
nstep = 0;
}
}
}
......
fixed=5
freqwindow=1
timewindow=7
treshold=1.0
min=10
max=12
existing=False
nchan=128
start=32
step=16
timestep=5
skipflags=True
allcolumns=False
allcolumns=True
msin=test.MS
msout=test_out1.MS
#msin=test_out1.MS
......@@ -17,4 +17,5 @@ msout=test_out1.MS
clusterdesc=/Users/diepen/Mac.clusterdesc
bandpass=0
flagger=1
squasher=0
squasher=1
datacolumn=DATA
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