From 2542e1e7204f85f06435036d89d41ea49274e18e Mon Sep 17 00:00:00 2001
From: Ger van Diepen <diepen@astron.nl>
Date: Fri, 14 Jul 2006 14:23:07 +0000
Subject: [PATCH] BugId: 711 Added strategy, step, and solve properties

---
 CEP/BB/BBS/src/SolveProp.h                    | 123 +++++++++++++++
 CEP/BB/BBS/src/StepProp.cc                    | 127 +++++++++++++++
 CEP/BB/BBS/src/StepProp.h                     | 144 ++++++++++++++++++
 CEP/BB/BBS/src/StrategyProp.cc                |  64 ++++++++
 CEP/BB/BBS/src/StrategyProp.h                 | 100 ++++++++++++
 .../BBSKernel/include/BBSKernel/SolveProp.h   | 123 +++++++++++++++
 CEP/BB/BBSKernel/include/BBSKernel/StepProp.h | 144 ++++++++++++++++++
 .../include/BBSKernel/StrategyProp.h          | 100 ++++++++++++
 CEP/BB/BBSKernel/src/SolveProp.h              | 123 +++++++++++++++
 CEP/BB/BBSKernel/src/StepProp.cc              | 127 +++++++++++++++
 CEP/BB/BBSKernel/src/StepProp.h               | 144 ++++++++++++++++++
 CEP/BB/BBSKernel/src/StrategyProp.cc          |  64 ++++++++
 CEP/BB/BBSKernel/src/StrategyProp.h           | 100 ++++++++++++
 13 files changed, 1483 insertions(+)
 create mode 100644 CEP/BB/BBS/src/SolveProp.h
 create mode 100644 CEP/BB/BBS/src/StepProp.cc
 create mode 100644 CEP/BB/BBS/src/StepProp.h
 create mode 100644 CEP/BB/BBS/src/StrategyProp.cc
 create mode 100644 CEP/BB/BBS/src/StrategyProp.h
 create mode 100644 CEP/BB/BBSKernel/include/BBSKernel/SolveProp.h
 create mode 100644 CEP/BB/BBSKernel/include/BBSKernel/StepProp.h
 create mode 100644 CEP/BB/BBSKernel/include/BBSKernel/StrategyProp.h
 create mode 100644 CEP/BB/BBSKernel/src/SolveProp.h
 create mode 100644 CEP/BB/BBSKernel/src/StepProp.cc
 create mode 100644 CEP/BB/BBSKernel/src/StepProp.h
 create mode 100644 CEP/BB/BBSKernel/src/StrategyProp.cc
 create mode 100644 CEP/BB/BBSKernel/src/StrategyProp.h

diff --git a/CEP/BB/BBS/src/SolveProp.h b/CEP/BB/BBS/src/SolveProp.h
new file mode 100644
index 00000000000..3875b0478b1
--- /dev/null
+++ b/CEP/BB/BBS/src/SolveProp.h
@@ -0,0 +1,123 @@
+//# SolveProp.h: Solve properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_SOLVEPROP_H
+#define LOFAR_BB_BBS_SOLVEPROP_H
+
+// \file
+// Solve properties.
+
+#include <BBS/MNS/MeqDomain.h>
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class SolveProp
+{
+public:
+  // Default constructor (for containers).
+  SolveProp()
+    : itsMaxIter(10), itsEpsilon(1e-5), itsFraction(0.95), itsUseSVD(true)
+    {}
+
+  // Set/get the parameter name patterns.
+  // <group>
+  void setParmPatterns (const vector<string>& parms)
+    { itsParmPatterns = parms; }
+  const vector<string>& getParmPatterns() const
+    { return itsParmPatterns; }
+  // </group>
+
+  // Set/get the parameter name patterns to be excluded.
+  // <group>
+  void setExclPatterns (const vector<string>& parms)
+    { itsExclPatterns = parms; }
+  const vector<string>& getExclPatterns() const
+    { return itsExclPatterns; }
+  // </group>
+
+  // Set/get the solve domains.
+  // <group>
+  void setDomains (const vector<MeqDomain>& domains)
+    { itsDomains = domains; }
+  const vector<MeqDomain>& getDomains() const
+    { return itsDomains; }
+  // </group>
+
+  // Set/get the max nr of iterations.
+  // By default it is 10.
+  // <group>
+  void setMaxIter (int maxIter)
+    { itsMaxIter = maxIter; }
+  int getMaxIter() const
+    { return itsMaxIter; }
+  // </group>
+
+  // Set/get the convergence epsilon.
+  // A fitter has converged if
+  //    abs(sol - lastsol) / max(abs(lastsol), abs(sol)) < epsilon.
+  // By default it is 1e-5.
+  // <group>
+  void setEpsilon (double epsilon)
+    { itsEpsilon = epsilon; }
+  double getEpsilon() const
+    { return itsEpsilon; }
+  // </group>
+
+  // Set/get the fraction of fitters that have to converge.
+  // By default it is 0.95.
+  // <group>
+  void setFraction (double fraction)
+    { itsFraction = fraction; }
+  double getFraction() const
+    { return itsFraction; }
+  // </group>
+
+  // Set/get if Singular Value Decompostion has to be used.
+  // By default it is used.
+  // <group>
+  void setUseSVD (double useSVD)
+    { itsUseSVD = useSVD; }
+  double getUseSVD() const
+    { return itsUseSVD; }
+  // </group>
+
+private:
+  vector<string>    itsParmPatterns;
+  vector<string>    itsExclPatterns;
+  vector<MeqDomain> itsDomains;
+  int               itsMaxIter;
+  double            itsEpsilon;
+  double            itsFraction;    // fraction of fitters to be converged
+  bool              itsUseSVD;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
diff --git a/CEP/BB/BBS/src/StepProp.cc b/CEP/BB/BBS/src/StepProp.cc
new file mode 100644
index 00000000000..0b4aadb8f2a
--- /dev/null
+++ b/CEP/BB/BBS/src/StepProp.cc
@@ -0,0 +1,127 @@
+//# Stepprop.cc: Calibration step properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#include <BBS/StepProp.h>
+#include <Common/LofarLogger.h>
+
+using namespace casa;
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+void StepProp::setBaselines (const vector<int>& ant1Nrs,
+			     const vector<int>& ant2Nrs)
+{
+  ASSERT (ant1Nrs.size() == ant2Nrs.size());
+  itsAnt1 = ant1Nrs;
+  itsAnt2 = ant2Nrs;
+}
+
+void StepProp::setBaselines (const vector<vector<int> >& ant1Groups,
+			     const vector<vector<int> >& ant2Groups)
+{
+  ASSERT (ant1Groups.size() == ant2Groups.size());
+  itsAnt1.clear();
+  itsAnt2.clear();
+  // Combine the antennae in each group of ant1 and ant2.
+  vector<vector<int> >::const_iterator iter1;
+  vector<vector<int> >::const_iterator iter2;
+  for (iter1 = ant1Groups.begin(), iter2 = ant2Groups.begin();
+       iter1 != ant1Groups.end();
+       iter1++, iter2++) {
+    formBaselines (*iter1, *iter2);
+  }
+}
+
+void StepProp::formBaselines (const vector<int>& ant1,
+			      const vector<int>& ant2) const
+{
+  for (vector<int>::const_iterator a1 = ant1.begin();
+       a1 != ant1.end();
+       a1++) {
+    for (vector<int>::const_iterator a2 = ant2.begin();
+	 a2 != ant2.end();
+	 a2++) {
+      itsAnt1.push_back (*a1);
+      itsAnt2.push_back (*a2);
+    }
+  }
+}
+
+void StepProp::setBaselines (const vector<string>& ant1NamePatterns,
+			     const vector<string>& ant2NamePatterns)
+{
+  ASSERT (ant1NamePatterns.size() == ant2NamePatterns.size());
+  itsAnt1Regex.clear();
+  itsAnt2Regex.clear();
+  // Convert the patterns to proper Regex-es.
+  vector<string>::const_iterator iter1;
+  vector<string>::const_iterator iter2;
+  for (iter1 = ant1NamePatterns.begin(), iter2 = ant2NamePatterns.begin();
+       iter1 != ant1NamePatterns.end();
+       iter1++, iter2++) {
+    itsAnt1Regex.push_back (Regex::fromPattern (*iter1));
+    itsAnt2Regex.push_back (Regex::fromPattern (*iter2));
+  }
+}
+
+void StepProp::expandPatterns (const vector<string>& antNames) const
+{
+  if (! itsAnt1Regex.empty()) {
+    itsAnt1.clear();
+    itsAnt2.clear();
+    // Loop through all Regex-es.
+    vector<int> ant1;
+    vector<int> ant2;
+    vector<Regex>::const_iterator iter1;
+    vector<Regex>::const_iterator iter2;
+    for (iter1 = itsAnt1Regex.begin(), iter2 = itsAnt2Regex.begin();
+	 iter1 != itsAnt1Regex.end();
+	 iter1++, iter2++) {
+      ant1.clear();
+      ant2.clear();
+      // If a names matches, add its antennanr to the vector.
+      for (uint i=0; i<antNames.size(); ++i) {
+	String name = antNames[i];
+	if (name.matches (*iter1)) {
+	  ant1.push_back (i);
+	}
+	if (name.matches (*iter2)) {
+	  ant2.push_back (i);
+	}
+      }
+      // Add all baselines formed by this group.
+      formBaselines (ant1, ant2);
+    }
+    // If no baselines selected, add a non-existing one.
+    // (because an empty vector means all).
+    if (itsAnt1.size() == 0) {
+      itsAnt1.push_back (antNames.size());
+      itsAnt2.push_back (antNames.size());
+    }
+  }
+}
+
+} // namespace LOFAR
diff --git a/CEP/BB/BBS/src/StepProp.h b/CEP/BB/BBS/src/StepProp.h
new file mode 100644
index 00000000000..2f06b145b4a
--- /dev/null
+++ b/CEP/BB/BBS/src/StepProp.h
@@ -0,0 +1,144 @@
+//# Stepprop.h: Calibration step properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_STEPPROP_H
+#define LOFAR_BB_BBS_STEPPROP_H
+
+// \file
+// Calibration step properties.
+
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+#include <casa/Utilities/Regex.h>
+#include <casa/Arrays/Vector.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class StepProp
+{
+public:
+  // Default constructor (for containers).
+  StepProp()
+    : itsOutColumn("CORRECTED_DATA"), itsAutoCorr(false)
+    {}
+
+  // Set/get the instrument model.
+  // <group>
+  void setModel (const vector<string>& model)
+    { itsModel = model; }
+  const vector<string>& getModel() const
+    { return itsModel; }
+  // </group>
+
+  // Set/get the output column to use.
+  // <group>
+  void setOutColumn (const string& outColumn)
+    { itsOutColumn = outColumn; }
+  const string& getOutColumn() const
+    { return itsOutColumn; }
+  // </group>
+
+  // Set/get the sources to use.
+  // <group>
+  void setSources (const vector<string>& sources)
+    { itsSources = sources; }
+  const vector<string>& getSources() const
+    { return itsSources; }
+  // </group>
+
+  // Set/get the baselines to use (0-based antenna numbers).
+  // <group>
+  void setBaselines (const vector<int>& ant1Nrs, const vector<int>& ant2Nrs);
+  const vector<int>& getAnt1() const
+    { return itsAnt1; }
+  const vector<int>& getAnt2() const
+    { return itsAnt2; }
+  // </group>
+
+  // Set baselines by groups.
+  // Baselines are formed by combining the antennae in the
+  // corresponding groups.
+  void setBaselines (const vector<vector<int> >& ant1Groups,
+		     const vector<vector<int> >& ant2Groups);
+
+  // Set baselines by name patterns.
+  // Each name can be a filename-like pattern.
+  // Baselines are formed by function expandPatterns which expands each
+  // pattern into a group of numbers of antenna names matching the pattern.
+  // <group>
+  void setBaselines (const vector<string>& ant1NamePatterns,
+		     const vector<string>& ant2NamePatterns);
+  void expandPatterns (const vector<string>& antNames) const;
+  // </group>
+
+  // Set/get the autocorrelations flag.
+  // <group>
+  void setAutoCorr (bool autoCorr)
+    { itsAutoCorr = autoCorr; }
+  bool getAutoCorr() const
+    { return itsAutoCorr; }
+  // </group>
+
+  // Set/get the correlations to use.
+  // <group>
+  void setCorr (const vector<bool>& corr)
+    { itsCorr = corr; }
+  const vector<bool>& getCorr() const
+    { return itsCorr; }
+  // </group>
+
+  // Set/get the phase center.
+  // <group>
+  void setPhaseCenter (double ra, double dec)
+    { itsPCRA = ra; itsPCDEC = dec; }
+  double getPCRA() const
+    { return itsPCRA; }
+  double getPCDEC() const
+    { return itsPCDEC; }
+  // </group>
+
+private:
+  // Form baselines by combining the antennae.
+  void formBaselines (const vector<int>& ant1, const vector<int>& ant2) const;
+
+  vector<string>      itsModel;
+  string              itsOutColumn;
+  vector<string>      itsSources;
+  mutable vector<int> itsAnt1;
+  mutable vector<int> itsAnt2;
+  vector<casa::Regex> itsAnt1Regex;
+  vector<casa::Regex> itsAnt2Regex;
+  bool                itsAutoCorr;
+  vector<bool>        itsCorr;
+  double              itsPCRA;
+  double              itsPCDEC;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
diff --git a/CEP/BB/BBS/src/StrategyProp.cc b/CEP/BB/BBS/src/StrategyProp.cc
new file mode 100644
index 00000000000..2d69832a938
--- /dev/null
+++ b/CEP/BB/BBS/src/StrategyProp.cc
@@ -0,0 +1,64 @@
+//# Strategyprop.cc: Calibration strategy properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#include <BBS/StrategyProp.h>
+#include <Common/LofarLogger.h>
+
+using namespace casa;
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+void StrategyProp::setAntennas (const vector<string>& antNamePatterns)
+{
+  itsAntRegex.clear();
+  // Convert the patterns to proper Regex-es.
+  for (vector<string>::const_iterator iter = antNamePatterns.begin();
+       iter != antNamePatterns.end();
+       iter++) {
+    itsAntRegex.push_back (Regex::fromPattern (*iter));
+  }
+}
+
+void StrategyProp::expandPatterns (const vector<string>& antNames) const
+{
+  if (! itsAntRegex.empty()) {
+    itsAntNrs.clear();
+    // Loop through all Regex-es.
+    for (vector<Regex>::const_iterator iter = itsAntRegex.begin();
+	 iter != itsAntRegex.end();
+	 iter++) {
+      // If a names matches, add its antennanr to the vector.
+      for (uint i=0; i<antNames.size(); ++i) {
+	String name (antNames[i]);
+	if (name.matches (*iter)) {
+	  itsAntNrs.push_back (i);
+	}
+      }
+    }
+  }
+}
+
+} // namespace LOFAR
diff --git a/CEP/BB/BBS/src/StrategyProp.h b/CEP/BB/BBS/src/StrategyProp.h
new file mode 100644
index 00000000000..d12fa87be77
--- /dev/null
+++ b/CEP/BB/BBS/src/StrategyProp.h
@@ -0,0 +1,100 @@
+//# Strategyprop.h: Calibration strategy properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_STRATEGYPROP_H
+#define LOFAR_BB_BBS_STRATEGYPROP_H
+
+// \file
+// Calibration strategy properties.
+
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+#include <casa/Utilities/Regex.h>
+#include <casa/Arrays/Vector.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class StrategyProp
+{
+public:
+  // Default constructor (for containers).
+  StrategyProp()
+    : itsInColumn("DATA"), itsAutoCorr(false)
+    {}
+
+  // Set/get the input data column to use.
+  // <group>
+  void setInColumn (const string inColumn)
+    { itsInColumn = inColumn; }
+  const string& getInColumn() const
+    { return itsInColumn; }
+  // </group>
+
+  // Set/get the antennas to use (0-based numbers).
+  // <group>
+  void setAntennas (const vector<int>& antNrs)
+    { itsAntNrs = antNrs; }
+  const vector<int>& getAntennas() const
+    { return itsAntNrs; }
+  // </group>
+
+  // Set antennas by name patterns.
+  // Each name can be a filename-like pattern.
+  // <group>
+  void setAntennas (const vector<string>& antNamePatterns);
+  void expandPatterns (const vector<string>& antNames) const;
+  // </group>
+
+  // Set/get the autocorrelations flag.
+  // <group>
+  void setAutoCorr (bool autoCorr)
+    { itsAutoCorr = autoCorr; }
+  bool getAutoCorr() const
+    { return itsAutoCorr; }
+  // </group>
+
+  // Set/get the correlations to use.
+  // <group>
+  void setCorr (const vector<bool>& corr)
+    { itsCorr = corr; }
+  const vector<bool>& getCorr() const
+    { return itsCorr; }
+  // </group>
+
+
+private:
+  string              itsInColumn;
+  mutable vector<int> itsAntNrs;
+  vector<casa::Regex> itsAntRegex;
+  bool                itsAutoCorr;
+  vector<bool>        itsCorr;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
diff --git a/CEP/BB/BBSKernel/include/BBSKernel/SolveProp.h b/CEP/BB/BBSKernel/include/BBSKernel/SolveProp.h
new file mode 100644
index 00000000000..3875b0478b1
--- /dev/null
+++ b/CEP/BB/BBSKernel/include/BBSKernel/SolveProp.h
@@ -0,0 +1,123 @@
+//# SolveProp.h: Solve properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_SOLVEPROP_H
+#define LOFAR_BB_BBS_SOLVEPROP_H
+
+// \file
+// Solve properties.
+
+#include <BBS/MNS/MeqDomain.h>
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class SolveProp
+{
+public:
+  // Default constructor (for containers).
+  SolveProp()
+    : itsMaxIter(10), itsEpsilon(1e-5), itsFraction(0.95), itsUseSVD(true)
+    {}
+
+  // Set/get the parameter name patterns.
+  // <group>
+  void setParmPatterns (const vector<string>& parms)
+    { itsParmPatterns = parms; }
+  const vector<string>& getParmPatterns() const
+    { return itsParmPatterns; }
+  // </group>
+
+  // Set/get the parameter name patterns to be excluded.
+  // <group>
+  void setExclPatterns (const vector<string>& parms)
+    { itsExclPatterns = parms; }
+  const vector<string>& getExclPatterns() const
+    { return itsExclPatterns; }
+  // </group>
+
+  // Set/get the solve domains.
+  // <group>
+  void setDomains (const vector<MeqDomain>& domains)
+    { itsDomains = domains; }
+  const vector<MeqDomain>& getDomains() const
+    { return itsDomains; }
+  // </group>
+
+  // Set/get the max nr of iterations.
+  // By default it is 10.
+  // <group>
+  void setMaxIter (int maxIter)
+    { itsMaxIter = maxIter; }
+  int getMaxIter() const
+    { return itsMaxIter; }
+  // </group>
+
+  // Set/get the convergence epsilon.
+  // A fitter has converged if
+  //    abs(sol - lastsol) / max(abs(lastsol), abs(sol)) < epsilon.
+  // By default it is 1e-5.
+  // <group>
+  void setEpsilon (double epsilon)
+    { itsEpsilon = epsilon; }
+  double getEpsilon() const
+    { return itsEpsilon; }
+  // </group>
+
+  // Set/get the fraction of fitters that have to converge.
+  // By default it is 0.95.
+  // <group>
+  void setFraction (double fraction)
+    { itsFraction = fraction; }
+  double getFraction() const
+    { return itsFraction; }
+  // </group>
+
+  // Set/get if Singular Value Decompostion has to be used.
+  // By default it is used.
+  // <group>
+  void setUseSVD (double useSVD)
+    { itsUseSVD = useSVD; }
+  double getUseSVD() const
+    { return itsUseSVD; }
+  // </group>
+
+private:
+  vector<string>    itsParmPatterns;
+  vector<string>    itsExclPatterns;
+  vector<MeqDomain> itsDomains;
+  int               itsMaxIter;
+  double            itsEpsilon;
+  double            itsFraction;    // fraction of fitters to be converged
+  bool              itsUseSVD;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
diff --git a/CEP/BB/BBSKernel/include/BBSKernel/StepProp.h b/CEP/BB/BBSKernel/include/BBSKernel/StepProp.h
new file mode 100644
index 00000000000..2f06b145b4a
--- /dev/null
+++ b/CEP/BB/BBSKernel/include/BBSKernel/StepProp.h
@@ -0,0 +1,144 @@
+//# Stepprop.h: Calibration step properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_STEPPROP_H
+#define LOFAR_BB_BBS_STEPPROP_H
+
+// \file
+// Calibration step properties.
+
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+#include <casa/Utilities/Regex.h>
+#include <casa/Arrays/Vector.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class StepProp
+{
+public:
+  // Default constructor (for containers).
+  StepProp()
+    : itsOutColumn("CORRECTED_DATA"), itsAutoCorr(false)
+    {}
+
+  // Set/get the instrument model.
+  // <group>
+  void setModel (const vector<string>& model)
+    { itsModel = model; }
+  const vector<string>& getModel() const
+    { return itsModel; }
+  // </group>
+
+  // Set/get the output column to use.
+  // <group>
+  void setOutColumn (const string& outColumn)
+    { itsOutColumn = outColumn; }
+  const string& getOutColumn() const
+    { return itsOutColumn; }
+  // </group>
+
+  // Set/get the sources to use.
+  // <group>
+  void setSources (const vector<string>& sources)
+    { itsSources = sources; }
+  const vector<string>& getSources() const
+    { return itsSources; }
+  // </group>
+
+  // Set/get the baselines to use (0-based antenna numbers).
+  // <group>
+  void setBaselines (const vector<int>& ant1Nrs, const vector<int>& ant2Nrs);
+  const vector<int>& getAnt1() const
+    { return itsAnt1; }
+  const vector<int>& getAnt2() const
+    { return itsAnt2; }
+  // </group>
+
+  // Set baselines by groups.
+  // Baselines are formed by combining the antennae in the
+  // corresponding groups.
+  void setBaselines (const vector<vector<int> >& ant1Groups,
+		     const vector<vector<int> >& ant2Groups);
+
+  // Set baselines by name patterns.
+  // Each name can be a filename-like pattern.
+  // Baselines are formed by function expandPatterns which expands each
+  // pattern into a group of numbers of antenna names matching the pattern.
+  // <group>
+  void setBaselines (const vector<string>& ant1NamePatterns,
+		     const vector<string>& ant2NamePatterns);
+  void expandPatterns (const vector<string>& antNames) const;
+  // </group>
+
+  // Set/get the autocorrelations flag.
+  // <group>
+  void setAutoCorr (bool autoCorr)
+    { itsAutoCorr = autoCorr; }
+  bool getAutoCorr() const
+    { return itsAutoCorr; }
+  // </group>
+
+  // Set/get the correlations to use.
+  // <group>
+  void setCorr (const vector<bool>& corr)
+    { itsCorr = corr; }
+  const vector<bool>& getCorr() const
+    { return itsCorr; }
+  // </group>
+
+  // Set/get the phase center.
+  // <group>
+  void setPhaseCenter (double ra, double dec)
+    { itsPCRA = ra; itsPCDEC = dec; }
+  double getPCRA() const
+    { return itsPCRA; }
+  double getPCDEC() const
+    { return itsPCDEC; }
+  // </group>
+
+private:
+  // Form baselines by combining the antennae.
+  void formBaselines (const vector<int>& ant1, const vector<int>& ant2) const;
+
+  vector<string>      itsModel;
+  string              itsOutColumn;
+  vector<string>      itsSources;
+  mutable vector<int> itsAnt1;
+  mutable vector<int> itsAnt2;
+  vector<casa::Regex> itsAnt1Regex;
+  vector<casa::Regex> itsAnt2Regex;
+  bool                itsAutoCorr;
+  vector<bool>        itsCorr;
+  double              itsPCRA;
+  double              itsPCDEC;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
diff --git a/CEP/BB/BBSKernel/include/BBSKernel/StrategyProp.h b/CEP/BB/BBSKernel/include/BBSKernel/StrategyProp.h
new file mode 100644
index 00000000000..d12fa87be77
--- /dev/null
+++ b/CEP/BB/BBSKernel/include/BBSKernel/StrategyProp.h
@@ -0,0 +1,100 @@
+//# Strategyprop.h: Calibration strategy properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_STRATEGYPROP_H
+#define LOFAR_BB_BBS_STRATEGYPROP_H
+
+// \file
+// Calibration strategy properties.
+
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+#include <casa/Utilities/Regex.h>
+#include <casa/Arrays/Vector.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class StrategyProp
+{
+public:
+  // Default constructor (for containers).
+  StrategyProp()
+    : itsInColumn("DATA"), itsAutoCorr(false)
+    {}
+
+  // Set/get the input data column to use.
+  // <group>
+  void setInColumn (const string inColumn)
+    { itsInColumn = inColumn; }
+  const string& getInColumn() const
+    { return itsInColumn; }
+  // </group>
+
+  // Set/get the antennas to use (0-based numbers).
+  // <group>
+  void setAntennas (const vector<int>& antNrs)
+    { itsAntNrs = antNrs; }
+  const vector<int>& getAntennas() const
+    { return itsAntNrs; }
+  // </group>
+
+  // Set antennas by name patterns.
+  // Each name can be a filename-like pattern.
+  // <group>
+  void setAntennas (const vector<string>& antNamePatterns);
+  void expandPatterns (const vector<string>& antNames) const;
+  // </group>
+
+  // Set/get the autocorrelations flag.
+  // <group>
+  void setAutoCorr (bool autoCorr)
+    { itsAutoCorr = autoCorr; }
+  bool getAutoCorr() const
+    { return itsAutoCorr; }
+  // </group>
+
+  // Set/get the correlations to use.
+  // <group>
+  void setCorr (const vector<bool>& corr)
+    { itsCorr = corr; }
+  const vector<bool>& getCorr() const
+    { return itsCorr; }
+  // </group>
+
+
+private:
+  string              itsInColumn;
+  mutable vector<int> itsAntNrs;
+  vector<casa::Regex> itsAntRegex;
+  bool                itsAutoCorr;
+  vector<bool>        itsCorr;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
diff --git a/CEP/BB/BBSKernel/src/SolveProp.h b/CEP/BB/BBSKernel/src/SolveProp.h
new file mode 100644
index 00000000000..3875b0478b1
--- /dev/null
+++ b/CEP/BB/BBSKernel/src/SolveProp.h
@@ -0,0 +1,123 @@
+//# SolveProp.h: Solve properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_SOLVEPROP_H
+#define LOFAR_BB_BBS_SOLVEPROP_H
+
+// \file
+// Solve properties.
+
+#include <BBS/MNS/MeqDomain.h>
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class SolveProp
+{
+public:
+  // Default constructor (for containers).
+  SolveProp()
+    : itsMaxIter(10), itsEpsilon(1e-5), itsFraction(0.95), itsUseSVD(true)
+    {}
+
+  // Set/get the parameter name patterns.
+  // <group>
+  void setParmPatterns (const vector<string>& parms)
+    { itsParmPatterns = parms; }
+  const vector<string>& getParmPatterns() const
+    { return itsParmPatterns; }
+  // </group>
+
+  // Set/get the parameter name patterns to be excluded.
+  // <group>
+  void setExclPatterns (const vector<string>& parms)
+    { itsExclPatterns = parms; }
+  const vector<string>& getExclPatterns() const
+    { return itsExclPatterns; }
+  // </group>
+
+  // Set/get the solve domains.
+  // <group>
+  void setDomains (const vector<MeqDomain>& domains)
+    { itsDomains = domains; }
+  const vector<MeqDomain>& getDomains() const
+    { return itsDomains; }
+  // </group>
+
+  // Set/get the max nr of iterations.
+  // By default it is 10.
+  // <group>
+  void setMaxIter (int maxIter)
+    { itsMaxIter = maxIter; }
+  int getMaxIter() const
+    { return itsMaxIter; }
+  // </group>
+
+  // Set/get the convergence epsilon.
+  // A fitter has converged if
+  //    abs(sol - lastsol) / max(abs(lastsol), abs(sol)) < epsilon.
+  // By default it is 1e-5.
+  // <group>
+  void setEpsilon (double epsilon)
+    { itsEpsilon = epsilon; }
+  double getEpsilon() const
+    { return itsEpsilon; }
+  // </group>
+
+  // Set/get the fraction of fitters that have to converge.
+  // By default it is 0.95.
+  // <group>
+  void setFraction (double fraction)
+    { itsFraction = fraction; }
+  double getFraction() const
+    { return itsFraction; }
+  // </group>
+
+  // Set/get if Singular Value Decompostion has to be used.
+  // By default it is used.
+  // <group>
+  void setUseSVD (double useSVD)
+    { itsUseSVD = useSVD; }
+  double getUseSVD() const
+    { return itsUseSVD; }
+  // </group>
+
+private:
+  vector<string>    itsParmPatterns;
+  vector<string>    itsExclPatterns;
+  vector<MeqDomain> itsDomains;
+  int               itsMaxIter;
+  double            itsEpsilon;
+  double            itsFraction;    // fraction of fitters to be converged
+  bool              itsUseSVD;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
diff --git a/CEP/BB/BBSKernel/src/StepProp.cc b/CEP/BB/BBSKernel/src/StepProp.cc
new file mode 100644
index 00000000000..0b4aadb8f2a
--- /dev/null
+++ b/CEP/BB/BBSKernel/src/StepProp.cc
@@ -0,0 +1,127 @@
+//# Stepprop.cc: Calibration step properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#include <BBS/StepProp.h>
+#include <Common/LofarLogger.h>
+
+using namespace casa;
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+void StepProp::setBaselines (const vector<int>& ant1Nrs,
+			     const vector<int>& ant2Nrs)
+{
+  ASSERT (ant1Nrs.size() == ant2Nrs.size());
+  itsAnt1 = ant1Nrs;
+  itsAnt2 = ant2Nrs;
+}
+
+void StepProp::setBaselines (const vector<vector<int> >& ant1Groups,
+			     const vector<vector<int> >& ant2Groups)
+{
+  ASSERT (ant1Groups.size() == ant2Groups.size());
+  itsAnt1.clear();
+  itsAnt2.clear();
+  // Combine the antennae in each group of ant1 and ant2.
+  vector<vector<int> >::const_iterator iter1;
+  vector<vector<int> >::const_iterator iter2;
+  for (iter1 = ant1Groups.begin(), iter2 = ant2Groups.begin();
+       iter1 != ant1Groups.end();
+       iter1++, iter2++) {
+    formBaselines (*iter1, *iter2);
+  }
+}
+
+void StepProp::formBaselines (const vector<int>& ant1,
+			      const vector<int>& ant2) const
+{
+  for (vector<int>::const_iterator a1 = ant1.begin();
+       a1 != ant1.end();
+       a1++) {
+    for (vector<int>::const_iterator a2 = ant2.begin();
+	 a2 != ant2.end();
+	 a2++) {
+      itsAnt1.push_back (*a1);
+      itsAnt2.push_back (*a2);
+    }
+  }
+}
+
+void StepProp::setBaselines (const vector<string>& ant1NamePatterns,
+			     const vector<string>& ant2NamePatterns)
+{
+  ASSERT (ant1NamePatterns.size() == ant2NamePatterns.size());
+  itsAnt1Regex.clear();
+  itsAnt2Regex.clear();
+  // Convert the patterns to proper Regex-es.
+  vector<string>::const_iterator iter1;
+  vector<string>::const_iterator iter2;
+  for (iter1 = ant1NamePatterns.begin(), iter2 = ant2NamePatterns.begin();
+       iter1 != ant1NamePatterns.end();
+       iter1++, iter2++) {
+    itsAnt1Regex.push_back (Regex::fromPattern (*iter1));
+    itsAnt2Regex.push_back (Regex::fromPattern (*iter2));
+  }
+}
+
+void StepProp::expandPatterns (const vector<string>& antNames) const
+{
+  if (! itsAnt1Regex.empty()) {
+    itsAnt1.clear();
+    itsAnt2.clear();
+    // Loop through all Regex-es.
+    vector<int> ant1;
+    vector<int> ant2;
+    vector<Regex>::const_iterator iter1;
+    vector<Regex>::const_iterator iter2;
+    for (iter1 = itsAnt1Regex.begin(), iter2 = itsAnt2Regex.begin();
+	 iter1 != itsAnt1Regex.end();
+	 iter1++, iter2++) {
+      ant1.clear();
+      ant2.clear();
+      // If a names matches, add its antennanr to the vector.
+      for (uint i=0; i<antNames.size(); ++i) {
+	String name = antNames[i];
+	if (name.matches (*iter1)) {
+	  ant1.push_back (i);
+	}
+	if (name.matches (*iter2)) {
+	  ant2.push_back (i);
+	}
+      }
+      // Add all baselines formed by this group.
+      formBaselines (ant1, ant2);
+    }
+    // If no baselines selected, add a non-existing one.
+    // (because an empty vector means all).
+    if (itsAnt1.size() == 0) {
+      itsAnt1.push_back (antNames.size());
+      itsAnt2.push_back (antNames.size());
+    }
+  }
+}
+
+} // namespace LOFAR
diff --git a/CEP/BB/BBSKernel/src/StepProp.h b/CEP/BB/BBSKernel/src/StepProp.h
new file mode 100644
index 00000000000..2f06b145b4a
--- /dev/null
+++ b/CEP/BB/BBSKernel/src/StepProp.h
@@ -0,0 +1,144 @@
+//# Stepprop.h: Calibration step properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_STEPPROP_H
+#define LOFAR_BB_BBS_STEPPROP_H
+
+// \file
+// Calibration step properties.
+
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+#include <casa/Utilities/Regex.h>
+#include <casa/Arrays/Vector.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class StepProp
+{
+public:
+  // Default constructor (for containers).
+  StepProp()
+    : itsOutColumn("CORRECTED_DATA"), itsAutoCorr(false)
+    {}
+
+  // Set/get the instrument model.
+  // <group>
+  void setModel (const vector<string>& model)
+    { itsModel = model; }
+  const vector<string>& getModel() const
+    { return itsModel; }
+  // </group>
+
+  // Set/get the output column to use.
+  // <group>
+  void setOutColumn (const string& outColumn)
+    { itsOutColumn = outColumn; }
+  const string& getOutColumn() const
+    { return itsOutColumn; }
+  // </group>
+
+  // Set/get the sources to use.
+  // <group>
+  void setSources (const vector<string>& sources)
+    { itsSources = sources; }
+  const vector<string>& getSources() const
+    { return itsSources; }
+  // </group>
+
+  // Set/get the baselines to use (0-based antenna numbers).
+  // <group>
+  void setBaselines (const vector<int>& ant1Nrs, const vector<int>& ant2Nrs);
+  const vector<int>& getAnt1() const
+    { return itsAnt1; }
+  const vector<int>& getAnt2() const
+    { return itsAnt2; }
+  // </group>
+
+  // Set baselines by groups.
+  // Baselines are formed by combining the antennae in the
+  // corresponding groups.
+  void setBaselines (const vector<vector<int> >& ant1Groups,
+		     const vector<vector<int> >& ant2Groups);
+
+  // Set baselines by name patterns.
+  // Each name can be a filename-like pattern.
+  // Baselines are formed by function expandPatterns which expands each
+  // pattern into a group of numbers of antenna names matching the pattern.
+  // <group>
+  void setBaselines (const vector<string>& ant1NamePatterns,
+		     const vector<string>& ant2NamePatterns);
+  void expandPatterns (const vector<string>& antNames) const;
+  // </group>
+
+  // Set/get the autocorrelations flag.
+  // <group>
+  void setAutoCorr (bool autoCorr)
+    { itsAutoCorr = autoCorr; }
+  bool getAutoCorr() const
+    { return itsAutoCorr; }
+  // </group>
+
+  // Set/get the correlations to use.
+  // <group>
+  void setCorr (const vector<bool>& corr)
+    { itsCorr = corr; }
+  const vector<bool>& getCorr() const
+    { return itsCorr; }
+  // </group>
+
+  // Set/get the phase center.
+  // <group>
+  void setPhaseCenter (double ra, double dec)
+    { itsPCRA = ra; itsPCDEC = dec; }
+  double getPCRA() const
+    { return itsPCRA; }
+  double getPCDEC() const
+    { return itsPCDEC; }
+  // </group>
+
+private:
+  // Form baselines by combining the antennae.
+  void formBaselines (const vector<int>& ant1, const vector<int>& ant2) const;
+
+  vector<string>      itsModel;
+  string              itsOutColumn;
+  vector<string>      itsSources;
+  mutable vector<int> itsAnt1;
+  mutable vector<int> itsAnt2;
+  vector<casa::Regex> itsAnt1Regex;
+  vector<casa::Regex> itsAnt2Regex;
+  bool                itsAutoCorr;
+  vector<bool>        itsCorr;
+  double              itsPCRA;
+  double              itsPCDEC;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
diff --git a/CEP/BB/BBSKernel/src/StrategyProp.cc b/CEP/BB/BBSKernel/src/StrategyProp.cc
new file mode 100644
index 00000000000..2d69832a938
--- /dev/null
+++ b/CEP/BB/BBSKernel/src/StrategyProp.cc
@@ -0,0 +1,64 @@
+//# Strategyprop.cc: Calibration strategy properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#include <BBS/StrategyProp.h>
+#include <Common/LofarLogger.h>
+
+using namespace casa;
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+void StrategyProp::setAntennas (const vector<string>& antNamePatterns)
+{
+  itsAntRegex.clear();
+  // Convert the patterns to proper Regex-es.
+  for (vector<string>::const_iterator iter = antNamePatterns.begin();
+       iter != antNamePatterns.end();
+       iter++) {
+    itsAntRegex.push_back (Regex::fromPattern (*iter));
+  }
+}
+
+void StrategyProp::expandPatterns (const vector<string>& antNames) const
+{
+  if (! itsAntRegex.empty()) {
+    itsAntNrs.clear();
+    // Loop through all Regex-es.
+    for (vector<Regex>::const_iterator iter = itsAntRegex.begin();
+	 iter != itsAntRegex.end();
+	 iter++) {
+      // If a names matches, add its antennanr to the vector.
+      for (uint i=0; i<antNames.size(); ++i) {
+	String name (antNames[i]);
+	if (name.matches (*iter)) {
+	  itsAntNrs.push_back (i);
+	}
+      }
+    }
+  }
+}
+
+} // namespace LOFAR
diff --git a/CEP/BB/BBSKernel/src/StrategyProp.h b/CEP/BB/BBSKernel/src/StrategyProp.h
new file mode 100644
index 00000000000..d12fa87be77
--- /dev/null
+++ b/CEP/BB/BBSKernel/src/StrategyProp.h
@@ -0,0 +1,100 @@
+//# Strategyprop.h: Calibration strategy properties
+//#
+//# Copyright (C) 2006
+//# ASTRON (Netherlands Foundation for Research in Astronomy)
+//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//# This program is free software; you can redistribute it and/or modify
+//# it under the terms of the GNU General Public License as published by
+//# the Free Software Foundation; either version 2 of the License, or
+//# (at your option) any later version.
+//#
+//# This program is distributed in the hope that it will be useful,
+//# but WITHOUT ANY WARRANTY; without even the implied warranty of
+//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//# GNU General Public License for more details.
+//#
+//# You should have received a copy of the GNU General Public License
+//# along with this program; if not, write to the Free Software
+//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//# $Id$
+
+#ifndef LOFAR_BB_BBS_STRATEGYPROP_H
+#define LOFAR_BB_BBS_STRATEGYPROP_H
+
+// \file
+// Calibration strategy properties.
+
+#include <Common/lofar_vector.h>
+#include <Common/lofar_string.h>
+#include <casa/Utilities/Regex.h>
+#include <casa/Arrays/Vector.h>
+
+namespace LOFAR
+{
+
+// \addtogroup BBS
+// @{
+
+class StrategyProp
+{
+public:
+  // Default constructor (for containers).
+  StrategyProp()
+    : itsInColumn("DATA"), itsAutoCorr(false)
+    {}
+
+  // Set/get the input data column to use.
+  // <group>
+  void setInColumn (const string inColumn)
+    { itsInColumn = inColumn; }
+  const string& getInColumn() const
+    { return itsInColumn; }
+  // </group>
+
+  // Set/get the antennas to use (0-based numbers).
+  // <group>
+  void setAntennas (const vector<int>& antNrs)
+    { itsAntNrs = antNrs; }
+  const vector<int>& getAntennas() const
+    { return itsAntNrs; }
+  // </group>
+
+  // Set antennas by name patterns.
+  // Each name can be a filename-like pattern.
+  // <group>
+  void setAntennas (const vector<string>& antNamePatterns);
+  void expandPatterns (const vector<string>& antNames) const;
+  // </group>
+
+  // Set/get the autocorrelations flag.
+  // <group>
+  void setAutoCorr (bool autoCorr)
+    { itsAutoCorr = autoCorr; }
+  bool getAutoCorr() const
+    { return itsAutoCorr; }
+  // </group>
+
+  // Set/get the correlations to use.
+  // <group>
+  void setCorr (const vector<bool>& corr)
+    { itsCorr = corr; }
+  const vector<bool>& getCorr() const
+    { return itsCorr; }
+  // </group>
+
+
+private:
+  string              itsInColumn;
+  mutable vector<int> itsAntNrs;
+  vector<casa::Regex> itsAntRegex;
+  bool                itsAutoCorr;
+  vector<bool>        itsCorr;
+};
+
+// @}
+
+} // namespace LOFAR
+
+#endif
-- 
GitLab