From ecc6e65e2212c88e70084f0e76ae393090922ae0 Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Fri, 21 Jul 2006 14:08:17 +0000
Subject: [PATCH] BugID: 753

Changed Station ID's into Station names; both for `Strategy.Stations' and for
`Baselines.Station[12]'.
---
 .../include/BBSControl/BBSStrategy.h          |  9 +-
 .../include/BBSControl/BBSStructs.h           | 27 +++++-
 CEP/BB/BBSControl/src/BBSStrategy.cc          |  2 +-
 CEP/BB/BBSControl/test/tBBSControl.parset     | 92 ++++++++++---------
 CEP/BB/BBSControl/test/tBBSStrategy.parset    | 92 ++++++++++---------
 5 files changed, 122 insertions(+), 100 deletions(-)

diff --git a/CEP/BB/BBSControl/include/BBSControl/BBSStrategy.h b/CEP/BB/BBSControl/include/BBSControl/BBSStrategy.h
index 410f7c95aaf..e6ddc3c9983 100644
--- a/CEP/BB/BBSControl/include/BBSControl/BBSStrategy.h
+++ b/CEP/BB/BBSControl/include/BBSControl/BBSStrategy.h
@@ -56,9 +56,6 @@ namespace LOFAR
       // Print the contents of \c this into the output stream \a os.
       void print(ostream& os) const;
 
-//       // Add a BBS step to the solve strategy.
-//       void addStep(const BBSStep*& aStep);
-
     private:
 
       // Name of the Measurement Set
@@ -73,8 +70,10 @@ namespace LOFAR
       // Sequence of steps that comprise this solve strategy.
       vector<const BBSStep*> itsSteps;
 
-      // ID's of the stations to use
-      vector<uint32>         itsStations;
+      // Names of the stations to use. Names may contains wildcards, like \c *
+      // and \c ?. Expansion of wildcards will be done in the BBS kernel, so
+      // they will be passed unaltered by BBS control.
+      vector<string>         itsStations;
 
       // Name of the MS input data column
       string                 itsInputData;
diff --git a/CEP/BB/BBSControl/include/BBSControl/BBSStructs.h b/CEP/BB/BBSControl/include/BBSControl/BBSStructs.h
index bf7c08dcc0c..61d521d3c9d 100644
--- a/CEP/BB/BBSControl/include/BBSControl/BBSStructs.h
+++ b/CEP/BB/BBSControl/include/BBSControl/BBSStructs.h
@@ -91,12 +91,31 @@ namespace LOFAR
       double deltaTime;     ///< time integration interval: t(s)
     };
 
-    // Two vectors of stations ID's, which, when paired element-wise, define
-    // the baselines to be used in the current step.
+    // Two vectors of stations names, which, when paired element-wise, define
+    // the baselines to be used in the current step. Names may contain
+    // wildcards, like \c * and \c ?. If they do, then all possible baselines
+    // will be constructed from the expanded names. Expansion of wildcards
+    // will be done in the BBS kernel.
+    // 
+    // For example, suppose that: 
+    // \verbatim 
+    // station1 = ["CS*", "RS1"]
+    // station2 = ["CS*", "RS2"] 
+    // \endverbatim
+    // Furthermore, suppose that \c CS* expands to \c CS1, \c CS2, and \c
+    // CS3. Then, in the BBS kernel, seven baselines will be constructed:
+    // \verbatim
+    // [ CS1:CS1, CS1:CS2, CS1:CS3, CS2:CS2, CS2:CS3, CS3:CS3, RS1:RS2 ]
+    // \endverbatim
+    // 
+    // \note Station names are \e not expanded by matching with all existing
+    // %LOFAR stations, but only with those that took part in a particular
+    // observation; i.e., only those stations that are mentioned in the \c
+    // ANTENNA table in the Measurement Set.
     struct Baselines
     {
-      vector<uint32> station1;
-      vector<uint32> station2;
+      vector<string> station1;
+      vector<string> station2;
     };
 
 
diff --git a/CEP/BB/BBSControl/src/BBSStrategy.cc b/CEP/BB/BBSControl/src/BBSStrategy.cc
index 3d58780e840..88aa924fee8 100644
--- a/CEP/BB/BBSControl/src/BBSStrategy.cc
+++ b/CEP/BB/BBSControl/src/BBSStrategy.cc
@@ -68,7 +68,7 @@ namespace LOFAR
       }
 
       // ID's of the stations to be used by this strategy.
-      itsStations = ps.getUint32Vector("Stations");
+      itsStations = ps.getStringVector("Stations");
 
       // Get the name of the MS input data column
       itsInputData = ps.getString("InputData");
diff --git a/CEP/BB/BBSControl/test/tBBSControl.parset b/CEP/BB/BBSControl/test/tBBSControl.parset
index d52ff3752b8..5a796170bac 100644
--- a/CEP/BB/BBSControl/test/tBBSControl.parset
+++ b/CEP/BB/BBSControl/test/tBBSControl.parset
@@ -1,63 +1,65 @@
-DataSet                  = "test.ms"        # name of Measurement Set
+DataSet                 = test.ms           # name of Measurement Set
 
-Strategy.Steps           = ["xyz1", "xyz2"] # steps
-Strategy.Stations        = [ 0, 1, 2, 3 ]   # ID's of stations to use
-Strategy.InputData       = "INDATA"         # MS input data column 
+Strategy.Steps          = [ xyz1, xyz2 ]    # steps
+Strategy.Stations       = [ CS*, RS1*, RS2*, DE* ]   # names of stations to use
+Strategy.InputData      = INDATA            # MS input data column 
 Strategy.Correlation.Selection = ALL        # one of AUTO, CROSS, ALL
-Strategy.Correlation.Type = ["XX", "YY"]    # which (cross)correlations to use
+Strategy.Correlation.Type = [ XX, YY ]      # which (cross)correlations to use
 Strategy.WorkDomainSize.Freq = 1e+6         # work domain size: f(Hz) 
 Strategy.WorkDomainSize.Time = 10           # work domain size: t(s)
 Strategy.Integration.Freq = 1;              # integration interval: f(Hz)
 Strategy.Integration.Time = 0.1;            # integration interval: t(s)
 
-BBDB.Host                = "127.0.0.1"      # hostname/ipaddr of BB DBMS
-BBDB.Port                = 12345            # port used by BB DBMS
-BBDB.DBName              = "blackboard"     # name of the BB database
-BBDB.UserName            = "postgres"       # username for accessing the DBMS
-BBDB.PassWord            = ""               # password for accessing the DBMS
-
-ParmDB.Instrument        = "test.mep"       # instrument parameters (MS table)
-ParmDB.LocalSky          = "test.gsm"       # local sky parameters (MS table)
-
-Step.xyz1.Steps          = ["sl1", "sl2"]
-Step.xyz1.Baselines.Station1 = [0, 0, 0, 1, 1, 2] # baselines to use 
-Step.xyz1.Baselines.Station2 = [0, 1, 2, 1, 2, 2] # (all if empty)
-Step.xyz1.Sources        = ["3C343"]        # list of sources
-Step.xyz1.ExtraSources   = ["M81"]          # list of sources outside patch
-Step.xyz1.InstrumentModel = ["Bandpass",  \ # Instrument model
-                           "DirGain", "Phase"]
+BBDB.Host               = 127.0.0.1         # hostname/ipaddr of BB DBMS
+BBDB.Port               = 12345             # port used by BB DBMS
+BBDB.DBName             = blackboard        # name of the BB database
+BBDB.UserName           = postgres          # username for accessing the DBMS
+BBDB.PassWord           =                   # password for accessing the DBMS
+
+ParmDB.Instrument       = test.mep          # instrument parameters (MS table)
+ParmDB.LocalSky         = test.gsm          # local sky parameters (MS table)
+
+Step.xyz1.Steps         = [ sl1, sl2 ]      # names of substeps
+Step.xyz1.Baselines.Station1 =            \ # baselines to use 
+      [ CS*, CS*,  CS*,  RS1*, RS1*, RS2* ]
+Step.xyz1.Baselines.Station2 =            \ # (all if empty)
+      [ CS*, RS1*, RS2*, RS1*, RS2*, RS2* ]
+Step.xyz1.Sources       = [ 3C343 ]         # list of sources
+Step.xyz1.ExtraSources  = [ M81 ]           # list of sources outside patch
+Step.xyz1.InstrumentModel = [ Bandpass,   \ # Instrument model
+                           DirGain, Phase ]
 Step.xyz1.Integration.Freq = 2;             # integration interval: f(Hz)
 Step.xyz1.Integration.Time = 0.5;           # integration interval: t(s)
 Step.xyz1.Correlation.Selection = CROSS     # one of AUTO, CROSS, ALL
-Step.xyz1.Correlation.Type = ["XX", "XY", \ # which (cross) correlations to use
-                              "YX", "YY"]
-
-Step.xyz2.Steps          = ["sl1", "sl3"]
-Step.xyz2.Baselines.Station1 = [0, 0, 1]    # baselines to use
-Step.xyz2.Baselines.Station2 = [0, 1, 1]    # (all if empty)
-Step.xyz2.Sources        = ["3C343"]        # sources in the source model
-Step.xyz2.InstrumentModel = ["Bandpass"]    # Instrument model
-
-Step.sl1.Baselines.Station1 = [0, 1]        # baselines to use
-Step.sl1.Baselines.Station2 = [1, 2]        # (all if empty)
-Step.sl1.Operation       = SOLVE          \ # one of SOLVE, SUBTRACT, CORRECT,
+Step.xyz1.Correlation.Type = [ XX, XY,    \ # which (cross) correlations to use
+                               YX, YY ]
+
+Step.xyz2.Steps         = [ sl1, sl3 ]      # names of substeps
+Step.xyz2.Baselines.Station1 = [ CS*, CS*,  RS1* ] # baselines to use
+Step.xyz2.Baselines.Station2 = [ CS*, RS1*, RS1* ] # (all if empty)
+Step.xyz2.Sources       = [ 3C343 ]         # sources in the source model
+Step.xyz2.InstrumentModel = [ Bandpass ]    # Instrument model
+
+Step.sl1.Baselines.Station1 = [ CS*,  RS1* ] # baselines to use
+Step.sl1.Baselines.Station2 = [ RS1*, RS2* ] # (all if empty)
+Step.sl1.Operation      = SOLVE           \ # one of SOLVE, SUBTRACT, CORRECT,
                                             # PREDICT, SHIFT, REFIT
-Step.sl1.OutputData      = "OUTDATA1"       # MS output data column
-Step.sl1.Solve.MaxIter   = 10               # maximum number of iterations
-Step.sl1.Solve.Epsilon   = 1e-7             # convergence threshold
+Step.sl1.OutputData     = OUTDATA1          # MS output data column
+Step.sl1.Solve.MaxIter  = 10                # maximum number of iterations
+Step.sl1.Solve.Epsilon  = 1e-7              # convergence threshold
 Step.sl1.Solve.MinConverged = 0.95          # fraction that must have converged
-Step.sl1.Solve.Parms     = ["PHASE:*"]      # names of solvable parameters
-Step.sl1.Solve.ExclParms = [""]             # parameters excluded from solve
+Step.sl1.Solve.Parms    = [ PHASE:* ]       # names of solvable parameters
+Step.sl1.Solve.ExclParms = []               # parameters excluded from solve
 Step.sl1.Solve.DomainSize.Freq = 1000       # f(Hz)
 Step.sl1.Solve.DomainSize.Time = 1          # t(s)
-Step.sl1.InstrumentModel = ["Bandpass", "Phase"]
+Step.sl1.InstrumentModel = [ Bandpass, Phase ]
 
-Step.sl2.Operation       = CORRECT        \ # one of SOLVE, SUBTRACT, CORRECT,
+Step.sl2.Operation      = CORRECT         \ # one of SOLVE, SUBTRACT, CORRECT,
                                             # PREDICT, SHIFT, REFIT
-Step.sl2.OutputData      = "OUTDATA2"       # MS output data column
-Step.sl2.InstrumentModel = ["DirGain", "Phase"]
+Step.sl2.OutputData     = OUTDATA2          # MS output data column
+Step.sl2.InstrumentModel = [ DirGain, Phase ]
 
-Step.sl3.Operation       = PREDICT        \ # one of SOLVE, SUBTRACT, CORRECT,
+Step.sl3.Operation      = PREDICT         \ # one of SOLVE, SUBTRACT, CORRECT,
                                             # PREDICT, SHIFT, REFIT
-Step.sl3.OutputData      = "OUTDATA3"       # MS output data column
-Step.sl3.InstrumentModel = ["Phase"]
+Step.sl3.OutputData     = OUTDATA3          # MS output data column
+Step.sl3.InstrumentModel = [ Phase ]
diff --git a/CEP/BB/BBSControl/test/tBBSStrategy.parset b/CEP/BB/BBSControl/test/tBBSStrategy.parset
index d52ff3752b8..5a796170bac 100644
--- a/CEP/BB/BBSControl/test/tBBSStrategy.parset
+++ b/CEP/BB/BBSControl/test/tBBSStrategy.parset
@@ -1,63 +1,65 @@
-DataSet                  = "test.ms"        # name of Measurement Set
+DataSet                 = test.ms           # name of Measurement Set
 
-Strategy.Steps           = ["xyz1", "xyz2"] # steps
-Strategy.Stations        = [ 0, 1, 2, 3 ]   # ID's of stations to use
-Strategy.InputData       = "INDATA"         # MS input data column 
+Strategy.Steps          = [ xyz1, xyz2 ]    # steps
+Strategy.Stations       = [ CS*, RS1*, RS2*, DE* ]   # names of stations to use
+Strategy.InputData      = INDATA            # MS input data column 
 Strategy.Correlation.Selection = ALL        # one of AUTO, CROSS, ALL
-Strategy.Correlation.Type = ["XX", "YY"]    # which (cross)correlations to use
+Strategy.Correlation.Type = [ XX, YY ]      # which (cross)correlations to use
 Strategy.WorkDomainSize.Freq = 1e+6         # work domain size: f(Hz) 
 Strategy.WorkDomainSize.Time = 10           # work domain size: t(s)
 Strategy.Integration.Freq = 1;              # integration interval: f(Hz)
 Strategy.Integration.Time = 0.1;            # integration interval: t(s)
 
-BBDB.Host                = "127.0.0.1"      # hostname/ipaddr of BB DBMS
-BBDB.Port                = 12345            # port used by BB DBMS
-BBDB.DBName              = "blackboard"     # name of the BB database
-BBDB.UserName            = "postgres"       # username for accessing the DBMS
-BBDB.PassWord            = ""               # password for accessing the DBMS
-
-ParmDB.Instrument        = "test.mep"       # instrument parameters (MS table)
-ParmDB.LocalSky          = "test.gsm"       # local sky parameters (MS table)
-
-Step.xyz1.Steps          = ["sl1", "sl2"]
-Step.xyz1.Baselines.Station1 = [0, 0, 0, 1, 1, 2] # baselines to use 
-Step.xyz1.Baselines.Station2 = [0, 1, 2, 1, 2, 2] # (all if empty)
-Step.xyz1.Sources        = ["3C343"]        # list of sources
-Step.xyz1.ExtraSources   = ["M81"]          # list of sources outside patch
-Step.xyz1.InstrumentModel = ["Bandpass",  \ # Instrument model
-                           "DirGain", "Phase"]
+BBDB.Host               = 127.0.0.1         # hostname/ipaddr of BB DBMS
+BBDB.Port               = 12345             # port used by BB DBMS
+BBDB.DBName             = blackboard        # name of the BB database
+BBDB.UserName           = postgres          # username for accessing the DBMS
+BBDB.PassWord           =                   # password for accessing the DBMS
+
+ParmDB.Instrument       = test.mep          # instrument parameters (MS table)
+ParmDB.LocalSky         = test.gsm          # local sky parameters (MS table)
+
+Step.xyz1.Steps         = [ sl1, sl2 ]      # names of substeps
+Step.xyz1.Baselines.Station1 =            \ # baselines to use 
+      [ CS*, CS*,  CS*,  RS1*, RS1*, RS2* ]
+Step.xyz1.Baselines.Station2 =            \ # (all if empty)
+      [ CS*, RS1*, RS2*, RS1*, RS2*, RS2* ]
+Step.xyz1.Sources       = [ 3C343 ]         # list of sources
+Step.xyz1.ExtraSources  = [ M81 ]           # list of sources outside patch
+Step.xyz1.InstrumentModel = [ Bandpass,   \ # Instrument model
+                           DirGain, Phase ]
 Step.xyz1.Integration.Freq = 2;             # integration interval: f(Hz)
 Step.xyz1.Integration.Time = 0.5;           # integration interval: t(s)
 Step.xyz1.Correlation.Selection = CROSS     # one of AUTO, CROSS, ALL
-Step.xyz1.Correlation.Type = ["XX", "XY", \ # which (cross) correlations to use
-                              "YX", "YY"]
-
-Step.xyz2.Steps          = ["sl1", "sl3"]
-Step.xyz2.Baselines.Station1 = [0, 0, 1]    # baselines to use
-Step.xyz2.Baselines.Station2 = [0, 1, 1]    # (all if empty)
-Step.xyz2.Sources        = ["3C343"]        # sources in the source model
-Step.xyz2.InstrumentModel = ["Bandpass"]    # Instrument model
-
-Step.sl1.Baselines.Station1 = [0, 1]        # baselines to use
-Step.sl1.Baselines.Station2 = [1, 2]        # (all if empty)
-Step.sl1.Operation       = SOLVE          \ # one of SOLVE, SUBTRACT, CORRECT,
+Step.xyz1.Correlation.Type = [ XX, XY,    \ # which (cross) correlations to use
+                               YX, YY ]
+
+Step.xyz2.Steps         = [ sl1, sl3 ]      # names of substeps
+Step.xyz2.Baselines.Station1 = [ CS*, CS*,  RS1* ] # baselines to use
+Step.xyz2.Baselines.Station2 = [ CS*, RS1*, RS1* ] # (all if empty)
+Step.xyz2.Sources       = [ 3C343 ]         # sources in the source model
+Step.xyz2.InstrumentModel = [ Bandpass ]    # Instrument model
+
+Step.sl1.Baselines.Station1 = [ CS*,  RS1* ] # baselines to use
+Step.sl1.Baselines.Station2 = [ RS1*, RS2* ] # (all if empty)
+Step.sl1.Operation      = SOLVE           \ # one of SOLVE, SUBTRACT, CORRECT,
                                             # PREDICT, SHIFT, REFIT
-Step.sl1.OutputData      = "OUTDATA1"       # MS output data column
-Step.sl1.Solve.MaxIter   = 10               # maximum number of iterations
-Step.sl1.Solve.Epsilon   = 1e-7             # convergence threshold
+Step.sl1.OutputData     = OUTDATA1          # MS output data column
+Step.sl1.Solve.MaxIter  = 10                # maximum number of iterations
+Step.sl1.Solve.Epsilon  = 1e-7              # convergence threshold
 Step.sl1.Solve.MinConverged = 0.95          # fraction that must have converged
-Step.sl1.Solve.Parms     = ["PHASE:*"]      # names of solvable parameters
-Step.sl1.Solve.ExclParms = [""]             # parameters excluded from solve
+Step.sl1.Solve.Parms    = [ PHASE:* ]       # names of solvable parameters
+Step.sl1.Solve.ExclParms = []               # parameters excluded from solve
 Step.sl1.Solve.DomainSize.Freq = 1000       # f(Hz)
 Step.sl1.Solve.DomainSize.Time = 1          # t(s)
-Step.sl1.InstrumentModel = ["Bandpass", "Phase"]
+Step.sl1.InstrumentModel = [ Bandpass, Phase ]
 
-Step.sl2.Operation       = CORRECT        \ # one of SOLVE, SUBTRACT, CORRECT,
+Step.sl2.Operation      = CORRECT         \ # one of SOLVE, SUBTRACT, CORRECT,
                                             # PREDICT, SHIFT, REFIT
-Step.sl2.OutputData      = "OUTDATA2"       # MS output data column
-Step.sl2.InstrumentModel = ["DirGain", "Phase"]
+Step.sl2.OutputData     = OUTDATA2          # MS output data column
+Step.sl2.InstrumentModel = [ DirGain, Phase ]
 
-Step.sl3.Operation       = PREDICT        \ # one of SOLVE, SUBTRACT, CORRECT,
+Step.sl3.Operation      = PREDICT         \ # one of SOLVE, SUBTRACT, CORRECT,
                                             # PREDICT, SHIFT, REFIT
-Step.sl3.OutputData      = "OUTDATA3"       # MS output data column
-Step.sl3.InstrumentModel = ["Phase"]
+Step.sl3.OutputData     = OUTDATA3          # MS output data column
+Step.sl3.InstrumentModel = [ Phase ]
-- 
GitLab