diff --git a/LCS/MSLofar/include/MSLofar/MSLofarFieldColumns.h b/LCS/MSLofar/include/MSLofar/MSLofarFieldColumns.h index 715bcb06c297728ab3188021db05f0bd06dc98b2..502835b6e87c5f354f361ada338056e7f1a5fe3b 100644 --- a/LCS/MSLofar/include/MSLofar/MSLofarFieldColumns.h +++ b/LCS/MSLofar/include/MSLofar/MSLofarFieldColumns.h @@ -106,6 +106,11 @@ namespace LOFAR { { return rwTileBeamDirMeas_p; } // </group> + // Set the direction reference type for the various direction columns. + // This can only be done when the table has no rows. + // Trying to do so at other times will throw an exception. + void setDirectionRef(casa::MDirection::Types ref); + protected: //# Default constructor creates a object that is not usable. Use the attach //# function correct this. diff --git a/LCS/MSLofar/src/MSLofarFieldColumns.cc b/LCS/MSLofar/src/MSLofarFieldColumns.cc index dc766036fff77c6e46263af2a81125ee7c9ceda2..f0b3843cbaba3acdd409146a52655d26863c31e4 100644 --- a/LCS/MSLofar/src/MSLofarFieldColumns.cc +++ b/LCS/MSLofar/src/MSLofarFieldColumns.cc @@ -72,4 +72,10 @@ namespace LOFAR { rwTileBeamDirMeas_p.attach (msLofarField, "LOFAR_TILE_BEAM_DIR"); } + void MSLofarFieldColumns::setDirectionRef(MDirection::Types ref) + { + rwTileBeamDirMeas_p.setDescRefCode (ref); + MSFieldColumns::setDirectionRef (ref); + } + } //# end namespace diff --git a/LCS/MSLofar/test/tMSLofar.cc b/LCS/MSLofar/test/tMSLofar.cc index e8684704d19179935ea6160ff5891a691827f4ef..61c344371fea37571bd04219817198826058b3ce 100644 --- a/LCS/MSLofar/test/tMSLofar.cc +++ b/LCS/MSLofar/test/tMSLofar.cc @@ -40,13 +40,15 @@ using namespace LOFAR; using namespace casa; using namespace std; -void createMS() +void createMS (MDirection::Types dirRef) { Timer timer; TableDesc td(MSLofar::requiredTableDesc()); SetupNewTable setup("tMSLofar_tmp.ms", td, Table::New); MSLofar ms(setup); ms.createDefaultSubtables(Table::New); + MSLofarFieldColumns fieldCols(ms.field()); + fieldCols.setDirectionRef (dirRef); ms.flush(); timer.show("create"); } @@ -171,7 +173,7 @@ void checkMS (const MSLofar& ms) ASSERT (fld.flagRow()(0) == False); MDirection tileBeamDir = fld.tileBeamDirMeasCol()(0); tileBeamDir.print(cout); - cout<<endl; + cout << ' ' << tileBeamDir.getRefString() << endl; ASSERT (obs.telescopeName()(0) == "LOFAR"); ASSERT (allEQ(obs.timeRange()(0), Vector<double>(2,10.))); @@ -220,7 +222,13 @@ void checkMS (const MSLofar& ms) int main() { try { - createMS(); + // Create for a J2000 direction. + createMS (MDirection::J2000); + openMS(); + fillMS(); + checkMS (MSLofar("tMSLofar_tmp.ms")); + // Create for a SUN direction. + createMS (MDirection::SUN); openMS(); fillMS(); checkMS (MSLofar("tMSLofar_tmp.ms"));