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

Bug #1373: Changed handling of ColumnDesc.shape()

parent 78d1a061
No related branches found
No related tags found
No related merge requests found
...@@ -69,6 +69,7 @@ namespace LOFAR ...@@ -69,6 +69,7 @@ namespace LOFAR
casa::IPosition ipos, casa::IPosition ipos,
std::string name, std::string name,
casa::Table& table); casa::Table& table);
casa::Vector<casa::Int> DetermineDATAshape(casa::MeasurementSet& MS);
casa::Block<casa::String> SELECTblock; casa::Block<casa::String> SELECTblock;
std::string InName; std::string InName;
std::string OutName; std::string OutName;
......
...@@ -92,10 +92,24 @@ void MsFile::TableResize(TableDesc tdesc, IPosition ipos, string name, Table& ta ...@@ -92,10 +92,24 @@ void MsFile::TableResize(TableDesc tdesc, IPosition ipos, string name, Table& ta
table.addColumn(desc); table.addColumn(desc);
} }
//===============>>> MsFile::Init <<<===============
Vector<Int> MsFile::DetermineDATAshape(MeasurementSet& MS)
{
ROArrayColumn<Complex> temp_column(MS, "DATA");
Matrix<Complex> temp_cell;
temp_column.get(0, temp_cell);
IPosition ipos = temp_cell.shape();
Vector<Int> temp_pos = ipos.asVector();
std::cout << "Old shape: " << temp_pos(0) << ":" << temp_pos(1) << std::endl;
return temp_pos;
}
//===============>>> MsFile::Init <<<=============== //===============>>> MsFile::Init <<<===============
void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing) void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing)
{ {
cout << "Please wait, preparing output MS" << endl; std::cout << "Please wait, preparing output MS" << std::endl;
Block<String> tempblock(SELECTblock); Block<String> tempblock(SELECTblock);
tempblock.resize(21); tempblock.resize(21);
tempblock[20] = "FLAG"; tempblock[20] = "FLAG";
...@@ -110,11 +124,8 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing) ...@@ -110,11 +124,8 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing)
InMS = new MeasurementSet(InName); InMS = new MeasurementSet(InName);
OutMS = new MeasurementSet(OutName, Table::Update); OutMS = new MeasurementSet(OutName, Table::Update);
//some magic to create a new DATA column //some magic to create a new DATA column
TableDesc tdesc = InMS->tableDesc(); Vector<Int> temp_pos = DetermineDATAshape(*InMS);
ColumnDesc desc = tdesc.rwColumnDesc("DATA");
IPosition ipos = desc.shape();
Vector<Int> temp_pos = ipos.asVector();
std::cout << "Old shape: " << temp_pos(0) << ":" << temp_pos(1) << std::endl;
int old_nchan = temp_pos(1); int old_nchan = temp_pos(1);
int new_nchan; int new_nchan;
if (Squashing) if (Squashing)
...@@ -124,12 +135,11 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing) ...@@ -124,12 +135,11 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing)
else else
{ new_nchan = old_nchan; { new_nchan = old_nchan;
Details.NChan = old_nchan; Details.NChan = old_nchan;
Details.Step = 1;
Details.Start = 0;
} }
std::cout << "New shape: " << temp_pos(0) << ":" << temp_pos(1) << std::endl; std::cout << "New shape: " << temp_pos(0) << ":" << temp_pos(1) << std::endl;
IPosition data_ipos(temp_pos); IPosition data_ipos(temp_pos);
TableDesc tdesc = InMS->tableDesc();
if (tdesc.isColumn("WEIGHT_SPECTRUM")) if (tdesc.isColumn("WEIGHT_SPECTRUM"))
{ tdesc.removeColumn("WEIGHT_SPECTRUM"); { tdesc.removeColumn("WEIGHT_SPECTRUM");
} }
...@@ -148,7 +158,7 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing) ...@@ -148,7 +158,7 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing)
TableResize(tdesc, data_ipos, "CORRECTED_DATA", *OutMS); TableResize(tdesc, data_ipos, "CORRECTED_DATA", *OutMS);
cout << "MODEL_DATA detected for processing" << endl; cout << "MODEL_DATA detected for processing" << endl;
desc = tdesc.rwColumnDesc("MODEL_DATA"); ColumnDesc desc = tdesc.rwColumnDesc("MODEL_DATA");
desc.setOptions(0); desc.setOptions(0);
desc.setShape(data_ipos); desc.setShape(data_ipos);
desc.setOptions(4); desc.setOptions(4);
......
...@@ -92,10 +92,23 @@ namespace LOFAR ...@@ -92,10 +92,23 @@ namespace LOFAR
itsBandpass = ParamSet->getUint32("bandpass", 0); itsBandpass = ParamSet->getUint32("bandpass", 0);
itsFlagger = ParamSet->getUint32("flagger", 0); itsFlagger = ParamSet->getUint32("flagger", 0);
itsSquasher = ParamSet->getUint32("squasher", 0); itsSquasher = ParamSet->getUint32("squasher", 0);
myDetails->PrintInfo();
if (myDetails->CheckValues()) if (myDetails->CheckValues())
{ return false; { return false;
} }
if (itsFlagger == 0
&& (myDetails->FreqWindow != 1 || myDetails->TimeWindow != 1))
{ myDetails->FreqWindow = 1;
myDetails->TimeWindow = 1;
std::cout << "No flagger, time and frequency windows reset to 1x1" << std::endl;
}
if (itsSquasher == 0
&& (myDetails->Step != 1 || myDetails->Start != 0 || myDetails->TimeStep != 1))
{ myDetails->Step = 1;
myDetails->Start = 0;
myDetails->TimeStep = 1;
std::cout << "No squasher, step, start and timestep sizes reset" << std::endl;
}
myDetails->PrintInfo();
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment