From ed542022cb6bb9529f16990aeeb3ee52a343c47b Mon Sep 17 00:00:00 2001 From: Adriaan Renting <renting@astron.nl> Date: Wed, 12 Aug 2009 09:38:21 +0000 Subject: [PATCH] Bug #1373: Changed handling of ColumnDesc.shape() --- CEP/DP3/DPPP/include/DPPP/MsFile.h | 1 + CEP/DP3/DPPP/src/MsFile.cc | 28 +++++++++++++++------- CEP/DP3/DPPP/src/PipelineProcessControl.cc | 15 +++++++++++- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/CEP/DP3/DPPP/include/DPPP/MsFile.h b/CEP/DP3/DPPP/include/DPPP/MsFile.h index 1d5eff859bd..c8db55cdbd4 100644 --- a/CEP/DP3/DPPP/include/DPPP/MsFile.h +++ b/CEP/DP3/DPPP/include/DPPP/MsFile.h @@ -69,6 +69,7 @@ namespace LOFAR casa::IPosition ipos, std::string name, casa::Table& table); + casa::Vector<casa::Int> DetermineDATAshape(casa::MeasurementSet& MS); casa::Block<casa::String> SELECTblock; std::string InName; std::string OutName; diff --git a/CEP/DP3/DPPP/src/MsFile.cc b/CEP/DP3/DPPP/src/MsFile.cc index 463b6afc577..35c90eabd68 100644 --- a/CEP/DP3/DPPP/src/MsFile.cc +++ b/CEP/DP3/DPPP/src/MsFile.cc @@ -92,10 +92,24 @@ void MsFile::TableResize(TableDesc tdesc, IPosition ipos, string name, Table& ta 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 <<<=============== 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); tempblock.resize(21); tempblock[20] = "FLAG"; @@ -110,11 +124,8 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing) InMS = new MeasurementSet(InName); OutMS = new MeasurementSet(OutName, Table::Update); //some magic to create a new DATA column - TableDesc tdesc = InMS->tableDesc(); - 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; + Vector<Int> temp_pos = DetermineDATAshape(*InMS); + int old_nchan = temp_pos(1); int new_nchan; if (Squashing) @@ -124,12 +135,11 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing) else { new_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; IPosition data_ipos(temp_pos); + TableDesc tdesc = InMS->tableDesc(); if (tdesc.isColumn("WEIGHT_SPECTRUM")) { tdesc.removeColumn("WEIGHT_SPECTRUM"); } @@ -148,7 +158,7 @@ void MsFile::Init(MsInfo& Info, RunDetails& Details, int Squashing) TableResize(tdesc, data_ipos, "CORRECTED_DATA", *OutMS); cout << "MODEL_DATA detected for processing" << endl; - desc = tdesc.rwColumnDesc("MODEL_DATA"); + ColumnDesc desc = tdesc.rwColumnDesc("MODEL_DATA"); desc.setOptions(0); desc.setShape(data_ipos); desc.setOptions(4); diff --git a/CEP/DP3/DPPP/src/PipelineProcessControl.cc b/CEP/DP3/DPPP/src/PipelineProcessControl.cc index 4eafef0d540..9ece1ac68df 100644 --- a/CEP/DP3/DPPP/src/PipelineProcessControl.cc +++ b/CEP/DP3/DPPP/src/PipelineProcessControl.cc @@ -92,10 +92,23 @@ namespace LOFAR itsBandpass = ParamSet->getUint32("bandpass", 0); itsFlagger = ParamSet->getUint32("flagger", 0); itsSquasher = ParamSet->getUint32("squasher", 0); - myDetails->PrintInfo(); if (myDetails->CheckValues()) { 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; } -- GitLab