From 40d39e3acf9115d3f8ffc140d0fc0f86149adb8f Mon Sep 17 00:00:00 2001
From: Ger van Diepen <diepen@astron.nl>
Date: Wed, 5 Dec 2012 14:49:24 +0000
Subject: [PATCH] Task #2699 Fixed performance issue when using msin.baselines
 (problem found by Olaf)

---
 CEP/DP3/DPPP/src/MSReader.cc | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/CEP/DP3/DPPP/src/MSReader.cc b/CEP/DP3/DPPP/src/MSReader.cc
index 979828123b8..883e389a0fd 100644
--- a/CEP/DP3/DPPP/src/MSReader.cc
+++ b/CEP/DP3/DPPP/src/MSReader.cc
@@ -28,6 +28,7 @@
 #include <DPPP/DPLogger.h>
 #include <DPPP/ParSet.h>
 #include <Common/LofarLogger.h>
+
 #include <tables/Tables/TableRecord.h>
 #include <tables/Tables/ScalarColumn.h>
 #include <tables/Tables/ArrayColumn.h>
@@ -89,6 +90,7 @@ namespace LOFAR {
       // See if a selection on band needs to be done.
       // We assume that DATA_DESC_ID and SPW_ID map 1-1.
       if (itsSpw >= 0) {
+	DPLOG_INFO_STR (" MSReader selecting spectral window " << itsSpw << " ...");
         Table subset = itsMS (itsMS.col("DATA_DESC_ID") == itsSpw);
         // If not all is selected, use the selection.
         if (subset.nrow() < itsMS.nrow()) {
@@ -101,6 +103,7 @@ namespace LOFAR {
       }
       // See if a selection on baseline needs to be done.
       if (! itsSelBL.empty()) {
+	DPLOG_INFO_STR (" MSReader selecting baselines ...");
         MSSelection select;
         // Set given selection strings.
         select.setAntennaExpr (itsSelBL);
@@ -210,8 +213,8 @@ namespace LOFAR {
           // Skip time slot and give warning if MS data is not in time order.
           if (mstime < itsLastMSTime) {
             LOG_WARN_STR ("Time at rownr "
-                          << itsIter.table().rowNumbers(itsMS)[0]
-                          << " of MS " << itsMS.tableName()
+                          << itsIter.table().rowNumbers()[0]
+                          << " of MS " << itsMSName
                           << " is less than previous time slot");
           } else {
             // Use the time slot if near or < nexttime, but > starttime.
@@ -251,7 +254,7 @@ namespace LOFAR {
           calcUVW();
           itsNrInserted++;
         } else {
-          itsBuffer.setRowNrs (itsIter.table().rowNumbers(itsMS));
+          itsBuffer.setRowNrs (itsIter.table().rowNumbers(itsMS, True));
           if (itsMissingData) {
             // Data column not present, so fill a fully flagged time slot.
             itsBuffer.setExposure (itsTimeInterval);
@@ -467,7 +470,7 @@ namespace LOFAR {
       ROScalarColumn<Int> ant2col(itsIter.table(), "ANTENNA2");
       // Keep the row numbers of the first part to be used for the meta info
       // of possibly missing time slots.
-      itsBaseRowNrs = itsIter.table().rowNumbers(itsMS);
+      itsBaseRowNrs = itsIter.table().rowNumbers(itsMS, True);
       // Get the antenna names and positions.
       Table anttab(itsMS.keywordSet().asTable("ANTENNA"));
       ROScalarColumn<String> nameCol (anttab, "NAME");
@@ -553,8 +556,8 @@ namespace LOFAR {
         // Skip time slot and give warning if MS data is not in time order.
         if (mstime < itsLastMSTime) {
           LOG_WARN_STR ("Time at rownr "
-                        << itsIter.table().rowNumbers(itsMS)[0]
-                        << " of MS " << itsMS.tableName()
+                        << itsIter.table().rowNumbers()[0]
+                        << " of MS " << itsMSName
                         << " is less than previous time slot");
         } else {
           // Stop skipping if time equal to itsFirstTime.
-- 
GitLab