From d57daccfa9cce37fe0a3561be321d35fe7e5b9f0 Mon Sep 17 00:00:00 2001
From: Tammo Jan Dijkema <dijkema@astron.nl>
Date: Wed, 19 Apr 2017 12:41:21 +0000
Subject: [PATCH] Task #10738: remove casacore warnings

---
 CEP/DP3/DPPP/include/DPPP/ApplyBeam.h         |  10 +-
 CEP/DP3/DPPP/include/DPPP/ApplyBeam.tcc       |  12 +-
 CEP/DP3/DPPP/include/DPPP/ApplyCal.h          |  32 ++---
 CEP/DP3/DPPP/include/DPPP/Averager.h          |  14 +-
 CEP/DP3/DPPP/include/DPPP/BaselineSelection.h |  18 +--
 CEP/DP3/DPPP/include/DPPP/CursorUtilCasa.h    |  12 +-
 CEP/DP3/DPPP/include/DPPP/DPBuffer.h          |  56 ++++----
 CEP/DP3/DPPP/include/DPPP/DPInfo.h            | 126 +++++++++---------
 CEP/DP3/DPPP/include/DPPP/DPInput.h           |  32 ++---
 CEP/DP3/DPPP/include/DPPP/DPRun.h             |   2 +-
 CEP/DP3/DPPP/include/DPPP/DemixInfo.h         |  20 +--
 CEP/DP3/DPPP/include/DPPP/DemixWorker.h       |  98 +++++++-------
 CEP/DP3/DPPP/include/DPPP/Demixer.h           |  40 +++---
 CEP/DP3/DPPP/include/DPPP/EstimateNew.h       |   6 +-
 CEP/DP3/DPPP/include/DPPP/Filter.h            |  22 +--
 CEP/DP3/DPPP/include/DPPP/FlagCounter.h       |   8 +-
 CEP/DP3/DPPP/include/DPPP/GainCal.h           |  30 ++---
 CEP/DP3/DPPP/include/DPPP/H5Parm.h            |   4 +-
 CEP/DP3/DPPP/include/DPPP/MSReader.h          |  62 ++++-----
 CEP/DP3/DPPP/include/DPPP/MSUpdater.h         |  34 ++---
 CEP/DP3/DPPP/include/DPPP/MSWriter.h          |  64 ++++-----
 CEP/DP3/DPPP/include/DPPP/MedFlagger.h        |   2 +-
 CEP/DP3/DPPP/include/DPPP/MultiMSReader.h     |  12 +-
 CEP/DP3/DPPP/include/DPPP/PhaseShift.h        |  12 +-
 CEP/DP3/DPPP/include/DPPP/PreFlagger.h        |  34 ++---
 CEP/DP3/DPPP/include/DPPP/Predict.h           |  22 +--
 CEP/DP3/DPPP/include/DPPP/ScaleData.h         |   4 +-
 CEP/DP3/DPPP/include/DPPP/Simulate.h          |   8 +-
 CEP/DP3/DPPP/include/DPPP/Simulator.h         |  24 ++--
 CEP/DP3/DPPP/include/DPPP/StManParsetKeys.h   |   8 +-
 CEP/DP3/DPPP/include/DPPP/StationAdder.h      |   8 +-
 CEP/DP3/DPPP/include/DPPP/StefCal.h           |  30 ++---
 CEP/DP3/DPPP/include/DPPP/UVWFlagger.h        |   2 +-
 CEP/DP3/DPPP/src/ApplyBeam.cc                 |  14 +-
 CEP/DP3/DPPP/src/ApplyCal.cc                  |  14 +-
 CEP/DP3/DPPP/src/Averager.cc                  |   4 +-
 CEP/DP3/DPPP/src/BaselineSelection.cc         |   2 +-
 CEP/DP3/DPPP/src/Counter.cc                   |   2 +-
 CEP/DP3/DPPP/src/DPBuffer.cc                  |   2 +-
 CEP/DP3/DPPP/src/DPInfo.cc                    |  12 +-
 CEP/DP3/DPPP/src/DPInput.cc                   |  12 +-
 CEP/DP3/DPPP/src/DPRun.cc                     |  34 ++---
 CEP/DP3/DPPP/src/DemixInfo.cc                 |  16 +--
 CEP/DP3/DPPP/src/DemixWorker.cc               |  30 ++---
 CEP/DP3/DPPP/src/Demixer.cc                   |  24 ++--
 CEP/DP3/DPPP/src/DemixerNew.cc                |   4 +-
 CEP/DP3/DPPP/src/EstimateMixed.cc             |  10 +-
 CEP/DP3/DPPP/src/EstimateNew.cc               |  10 +-
 CEP/DP3/DPPP/src/Filter.cc                    |  12 +-
 CEP/DP3/DPPP/src/FlagCounter.cc               |  18 +--
 CEP/DP3/DPPP/src/GainCal.cc                   |  26 ++--
 CEP/DP3/DPPP/src/MSReader.cc                  |  42 +++---
 CEP/DP3/DPPP/src/MSUpdater.cc                 |  24 ++--
 CEP/DP3/DPPP/src/MSWriter.cc                  |  30 ++---
 CEP/DP3/DPPP/src/MedFlagger.cc                |  12 +-
 CEP/DP3/DPPP/src/MultiMSReader.cc             |  26 ++--
 CEP/DP3/DPPP/src/NDPPP.cc                     |   6 +-
 CEP/DP3/DPPP/src/PhaseShift.cc                |  14 +-
 CEP/DP3/DPPP/src/PointSource.cc               |   4 +-
 CEP/DP3/DPPP/src/PreFlagger.cc                |  26 ++--
 CEP/DP3/DPPP/src/Predict.cc                   |  14 +-
 CEP/DP3/DPPP/src/ScaleData.cc                 |  18 +--
 CEP/DP3/DPPP/src/Simulate.cc                  |  16 +--
 CEP/DP3/DPPP/src/Simulator.cc                 |  38 +++---
 CEP/DP3/DPPP/src/SourceDBUtil.cc              |   4 +-
 CEP/DP3/DPPP/src/StationAdder.cc              |  24 ++--
 CEP/DP3/DPPP/src/StefCal.cc                   |   4 +-
 .../DPPP/src/UVWCalculator/UVWCalculator.cc   |   6 +-
 .../DPPP/src/UVWCalculator/UVWCalculator.h    |  40 +++---
 CEP/DP3/DPPP/src/UVWFlagger.cc                |  14 +-
 .../DPPP_DDECal/include/DPPP_DDECal/DDECal.h  |  18 +--
 .../include/DPPP_DDECal/PiercePoint.h         |  28 ++--
 CEP/DP3/DPPP_DDECal/src/DDECal.cc             |  34 ++---
 CEP/DP3/DPPP_DDECal/src/PiercePoint.cc        |  26 ++--
 CEP/DP3/DPPP_DDECal/src/ScreenConstraint.cc   |  10 +-
 75 files changed, 796 insertions(+), 796 deletions(-)

diff --git a/CEP/DP3/DPPP/include/DPPP/ApplyBeam.h b/CEP/DP3/DPPP/include/DPPP/ApplyBeam.h
index c27c34e2af0..b8cf9b7611e 100644
--- a/CEP/DP3/DPPP/include/DPPP/ApplyBeam.h
+++ b/CEP/DP3/DPPP/include/DPPP/ApplyBeam.h
@@ -32,7 +32,7 @@
 #include <DPPP/Position.h>
 #include <StationResponse/Station.h>
 #include <StationResponse/Types.h>
-#include <casa/Arrays/Cube.h>
+#include <casacore/casa/Arrays/Cube.h>
 
 namespace LOFAR {
 
@@ -93,8 +93,8 @@ namespace LOFAR {
 
       private:
         StationResponse::vector3r_t dir2Itrf(
-            const casa::MDirection& dir,
-            casa::MDirection::Convert& measConverter);
+            const casacore::MDirection& dir,
+            casacore::MDirection::Convert& measConverter);
 
         //# Data members.
         DPInput*             itsInput;
@@ -110,8 +110,8 @@ namespace LOFAR {
 
         // The info needed to calculate the station beams.
         vector<vector<StationResponse::Station::Ptr> > itsAntBeamInfo;
-        vector<casa::MeasFrame> itsMeasFrames;
-        vector<casa::MDirection::Convert> itsMeasConverters;
+        vector<casacore::MeasFrame> itsMeasFrames;
+        vector<casacore::MDirection::Convert> itsMeasConverters;
         vector<vector<StationResponse::matrix22c_t> > itsBeamValues;
 
         NSTimer itsTimer;
diff --git a/CEP/DP3/DPPP/include/DPPP/ApplyBeam.tcc b/CEP/DP3/DPPP/include/DPPP/ApplyBeam.tcc
index d241f43c03c..40b9869f637 100644
--- a/CEP/DP3/DPPP/include/DPPP/ApplyBeam.tcc
+++ b/CEP/DP3/DPPP/include/DPPP/ApplyBeam.tcc
@@ -46,12 +46,12 @@
 #include <DPPP/GaussianSource.h>
 #include <ParmDB/SourceDB.h>
 
-#include <casa/Arrays/Array.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Quanta/Quantum.h>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MeasConvert.h>
-#include <tables/Tables/RefRows.h>
+#include <casacore/casa/Arrays/Array.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/tables/Tables/RefRows.h>
 
 #include <stddef.h>
 #include <string>
diff --git a/CEP/DP3/DPPP/include/DPPP/ApplyCal.h b/CEP/DP3/DPPP/include/DPPP/ApplyCal.h
index 73252a864c8..e4c08521e31 100644
--- a/CEP/DP3/DPPP/include/DPPP/ApplyCal.h
+++ b/CEP/DP3/DPPP/include/DPPP/ApplyCal.h
@@ -32,8 +32,8 @@
 #include <ParmDB/ParmFacade.h>
 #include <ParmDB/ParmSet.h>
 #include <ParmDB/Parm.h>
-#include <casa/Arrays/Cube.h>
-#include <casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
 #include <DPPP/FlagCounter.h>
 
 namespace LOFAR {
@@ -76,27 +76,27 @@ namespace LOFAR {
       }
 
       // Invert a 2x2 matrix in place
-      static void invert (casa::DComplex* v, double sigmaMMSE=0);
+      static void invert (casacore::DComplex* v, double sigmaMMSE=0);
 
       // Apply a diagonal Jones matrix to the 2x2 visibilities matrix: A.V.B^H
-      static void applyDiag (const casa::DComplex* gainA,
-                             const casa::DComplex* gainB,
-                             casa::Complex* vis, float* weight, bool* flag,
+      static void applyDiag (const casacore::DComplex* gainA,
+                             const casacore::DComplex* gainB,
+                             casacore::Complex* vis, float* weight, bool* flag,
                              uint bl, uint chan, bool updateWeights,
                              FlagCounter& flagCounter);
 
       // Apply a diagonal Jones matrix to the 2x2 visibilities matrix: A.V.B^H,
       // where the solution is equal for both polarizations
-      static void applyScalar(const casa::DComplex* gainA,
-                              const casa::DComplex* gainB,
-                              casa::Complex* vis, float* weight, bool* flag,
+      static void applyScalar(const casacore::DComplex* gainA,
+                              const casacore::DComplex* gainB,
+                              casacore::Complex* vis, float* weight, bool* flag,
                               uint bl, uint chan, bool updateWeights,
                               FlagCounter& flagCounter);
 
       // Apply a full Jones matrix to the 2x2 visibilities matrix: A.V.B^H
-      static void applyFull (const casa::DComplex* gainA,
-                             const casa::DComplex* gainB,
-                             casa::Complex* vis, float* weight, bool* flag,
+      static void applyFull (const casacore::DComplex* gainA,
+                             const casacore::DComplex* gainB,
+                             casacore::Complex* vis, float* weight, bool* flag,
                              uint bl, uint chan, bool updateWeights,
                              FlagCounter& flagCounter);
 
@@ -108,8 +108,8 @@ namespace LOFAR {
       // The input covariance matrix C is assumed to be diagonal with elements
       // w_i (the weights), the result the diagonal of
       // (gainA kronecker gainB^H).C.(gainA kronecker gainB^H)^H
-      static void applyWeights (const casa::DComplex* gainA,
-                                const casa::DComplex* gainB,
+      static void applyWeights (const casacore::DComplex* gainA,
+                                const casacore::DComplex* gainB,
                                 float* weight);
 
     private:
@@ -136,10 +136,10 @@ namespace LOFAR {
       uint             itsCount; // number of steps
 
       // Expressions to search for in itsParmDB
-      vector<casa::String>   itsParmExprs;
+      vector<casacore::String>   itsParmExprs;
 
       // parameters, numparms, antennas, time x frequency
-      casa::Cube<casa::DComplex> itsParms;
+      casacore::Cube<casacore::DComplex> itsParms;
       uint            itsTimeStep; // time step within current chunk
       uint            itsNCorr;
       double          itsTimeInterval;
diff --git a/CEP/DP3/DPPP/include/DPPP/Averager.h b/CEP/DP3/DPPP/include/DPPP/Averager.h
index 5b43c5ef46d..90e40f47688 100644
--- a/CEP/DP3/DPPP/include/DPPP/Averager.h
+++ b/CEP/DP3/DPPP/include/DPPP/Averager.h
@@ -29,7 +29,7 @@
 
 #include <DPPP/DPInput.h>
 #include <DPPP/DPBuffer.h>
-#include <casa/Arrays/Cube.h>
+#include <casacore/casa/Arrays/Cube.h>
 
 namespace LOFAR {
 
@@ -87,8 +87,8 @@ namespace LOFAR {
       // Copy the fullRes flags in the input buffer to the correct
       // time index in the output buffer.
       // If a flag is set, set all flags in corresponding FullRes window.
-      void copyFullResFlags (const casa::Cube<bool>& fullResFlags,
-                             const casa::Cube<bool>& flags,
+      void copyFullResFlags (const casacore::Cube<bool>& fullResFlags,
+                             const casacore::Cube<bool>& flags,
                              int timeIndex);
 
       // Get the value in Hertz of a string like "1000 MHz". If unit is
@@ -101,10 +101,10 @@ namespace LOFAR {
       DPBuffer        itsBuf;
       DPBuffer        itsBufTmp;
       DPBuffer        itsBufOut;
-      casa::Cube<int> itsNPoints;
-      casa::Cube<casa::Complex> itsAvgAll;
-      casa::Cube<float>         itsWeightAll;
-      casa::Cube<bool>          itsFullResFlags;
+      casacore::Cube<int> itsNPoints;
+      casacore::Cube<casacore::Complex> itsAvgAll;
+      casacore::Cube<float>         itsWeightAll;
+      casacore::Cube<bool>          itsFullResFlags;
       double          itsFreqResolution;
       double          itsTimeResolution;
       uint            itsNChanAvg;
diff --git a/CEP/DP3/DPPP/include/DPPP/BaselineSelection.h b/CEP/DP3/DPPP/include/DPPP/BaselineSelection.h
index 32bd1e5929d..62239cb5ac6 100644
--- a/CEP/DP3/DPPP/include/DPPP/BaselineSelection.h
+++ b/CEP/DP3/DPPP/include/DPPP/BaselineSelection.h
@@ -28,8 +28,8 @@
 // @brief Class to handle the baseline selection
 
 #include <DPPP/DPInfo.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Arrays/Matrix.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Matrix.h>
 
 namespace LOFAR {
   class ParameterSet;
@@ -68,26 +68,26 @@ namespace LOFAR {
 
       // Form the selection matrix telling for each baseline if it is selected.
       // If no selection is made, all values in the matrix are true.
-      casa::Matrix<bool> apply (const DPInfo& info) const;
+      casacore::Matrix<bool> apply (const DPInfo& info) const;
 
       // Form the selection vector telling if a baseline in the DPInfo object
       // is selected.
-      casa::Vector<bool> applyVec (const DPInfo& info) const;
+      casacore::Vector<bool> applyVec (const DPInfo& info) const;
 
     private:
       // Convert the baseline selection string.
-      void handleBL (casa::Matrix<bool>& selectBL,
+      void handleBL (casacore::Matrix<bool>& selectBL,
                      const DPInfo& info) const;
 
       // Handle a vector of baseline specifications.
-      casa::Matrix<bool> handleBLVector (const ParameterValue& pvBL,
-                                         const casa::Vector<casa::String>&) const;
+      casacore::Matrix<bool> handleBLVector (const ParameterValue& pvBL,
+                                         const casacore::Vector<casacore::String>&) const;
 
       // Handle the correlation type selection.
-      void handleCorrType (casa::Matrix<bool>& selectBL) const;
+      void handleCorrType (casacore::Matrix<bool>& selectBL) const;
 
       // Handle the baseline length selection.
-      void handleLength (casa::Matrix<bool>& selectBL,
+      void handleLength (casacore::Matrix<bool>& selectBL,
                          const DPInfo& info) const;
 
       //# Data members
diff --git a/CEP/DP3/DPPP/include/DPPP/CursorUtilCasa.h b/CEP/DP3/DPPP/include/DPPP/CursorUtilCasa.h
index d351ce784c8..807a7104328 100644
--- a/CEP/DP3/DPPP/include/DPPP/CursorUtilCasa.h
+++ b/CEP/DP3/DPPP/include/DPPP/CursorUtilCasa.h
@@ -27,7 +27,7 @@
 // Helper functions for creating cursors for CASA arrays.
 
 #include <DPPP/Cursor.h>
-#include <casa/Arrays/Array.h>
+#include <casacore/casa/Arrays/Array.h>
 
 namespace LOFAR
 {
@@ -38,26 +38,26 @@ namespace DPPP
 // @{
 
 template <typename T>
-cursor<T> casa_cursor(casa::Array<T> &array)
+cursor<T> casa_cursor(casacore::Array<T> &array)
 {
     return cursor<T>(array.data(), array.ndim(), array.steps().storage());
 }
 
 template <typename T>
-cursor<T> casa_cursor(casa::Array<T> &array, const casa::IPosition &offset)
+cursor<T> casa_cursor(casacore::Array<T> &array, const casacore::IPosition &offset)
 {
     return cursor<T>(&(array(offset)), array.ndim(), array.steps().storage());
 }
 
 template <typename T>
-const_cursor<T> casa_const_cursor(const casa::Array<T> &array)
+const_cursor<T> casa_const_cursor(const casacore::Array<T> &array)
 {
     return const_cursor<T>(array.data(), array.ndim(), array.steps().storage());
 }
 
 template <typename T>
-const_cursor<T> casa_const_cursor(const casa::Array<T> &array,
-    const casa::IPosition &offset)
+const_cursor<T> casa_const_cursor(const casacore::Array<T> &array,
+    const casacore::IPosition &offset)
 {
     return const_cursor<T>(&(array(offset)), array.ndim(),
         array.steps().storage());
diff --git a/CEP/DP3/DPPP/include/DPPP/DPBuffer.h b/CEP/DP3/DPPP/include/DPPP/DPBuffer.h
index 1a2df9fe617..a5d00d8cde4 100644
--- a/CEP/DP3/DPPP/include/DPPP/DPBuffer.h
+++ b/CEP/DP3/DPPP/include/DPPP/DPBuffer.h
@@ -27,9 +27,9 @@
 /// @file
 /// @brief Buffer holding the data of a timeslot/band
 
-#include <casa/Arrays/Vector.h>
-#include <casa/Arrays/Cube.h>
-#include <casa/BasicSL/Complex.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/BasicSL/Complex.h>
 
 namespace LOFAR {
   namespace DPPP {
@@ -135,35 +135,35 @@ namespace LOFAR {
       void referenceFilled (const DPBuffer& that);
 
       // Set or get the visibility data per corr,chan,baseline.
-      void setData (const casa::Cube<casa::Complex>& data)
+      void setData (const casacore::Cube<casacore::Complex>& data)
         { itsData.reference (data); }
-      const casa::Cube<casa::Complex>& getData() const
+      const casacore::Cube<casacore::Complex>& getData() const
         { return itsData; }
-      casa::Cube<casa::Complex>& getData()
+      casacore::Cube<casacore::Complex>& getData()
         { return itsData; }
 
       // Set or get the flags per corr,chan,baseline.
-      void setFlags (const casa::Cube<bool>& flags)
+      void setFlags (const casacore::Cube<bool>& flags)
         { itsFlags.reference (flags); }
-      const casa::Cube<bool>& getFlags() const
+      const casacore::Cube<bool>& getFlags() const
         { return itsFlags; }
-      casa::Cube<bool>& getFlags()
+      casacore::Cube<bool>& getFlags()
         { return itsFlags; }
 
       // Set or get the weights per corr,chan,baseline.
-      void setWeights (const casa::Cube<float>& weights)
+      void setWeights (const casacore::Cube<float>& weights)
         { itsWeights.reference (weights); }
-      const casa::Cube<float>& getWeights() const
+      const casacore::Cube<float>& getWeights() const
         { return itsWeights; }
-      casa::Cube<float>& getWeights()
+      casacore::Cube<float>& getWeights()
         { return itsWeights; }
 
       // Set or get the flags at the full resolution per chan,timeavg,baseline.
-      void setFullResFlags (const casa::Cube<bool>& flags)
+      void setFullResFlags (const casacore::Cube<bool>& flags)
         { itsFullResFlags.reference (flags); }
-      const casa::Cube<bool>& getFullResFlags() const
+      const casacore::Cube<bool>& getFullResFlags() const
         { return itsFullResFlags; }
-      casa::Cube<bool>& getFullResFlags()
+      casacore::Cube<bool>& getFullResFlags()
         { return itsFullResFlags; }
 
       // Get or set the time.
@@ -180,33 +180,33 @@ namespace LOFAR {
 
       // Get or set the row numbers used by the DPInput class.
       // It can be empty (e.g. when MSReader inserted a dummy time slot).
-      void setRowNrs (const casa::Vector<uint>& rownrs)
+      void setRowNrs (const casacore::Vector<uint>& rownrs)
         { itsRowNrs.reference (rownrs); }
-      const casa::Vector<uint>& getRowNrs() const
+      const casacore::Vector<uint>& getRowNrs() const
         { return itsRowNrs; }
 
       // Get or set the UVW coordinates per baseline.
-      void setUVW (const casa::Matrix<double>& uvw)
+      void setUVW (const casacore::Matrix<double>& uvw)
         { itsUVW.reference (uvw); }
-      const casa::Matrix<double>& getUVW() const
+      const casacore::Matrix<double>& getUVW() const
         { return itsUVW; }
-      casa::Matrix<double>& getUVW()
+      casacore::Matrix<double>& getUVW()
         { return itsUVW; }
 
       // Merge the flags into the pre-average flags.
       // For each flagged point, the corresponding pre-average flags are set.
-      static void mergeFullResFlags (casa::Cube<bool>& fullResFlags,
-                                     const casa::Cube<bool>& flags);
+      static void mergeFullResFlags (casacore::Cube<bool>& fullResFlags,
+                                     const casacore::Cube<bool>& flags);
 
     private:
       double                    itsTime;
       double                    itsExposure;
-      casa::Vector<uint>        itsRowNrs;
-      casa::Cube<casa::Complex> itsData;        //# ncorr,nchan,nbasel
-      casa::Cube<bool>          itsFlags;       //# ncorr,nchan,nbasel
-      casa::Matrix<double>      itsUVW;         //# 3,nbasel
-      casa::Cube<float>         itsWeights;     //# ncorr,nchan,nbasel
-      casa::Cube<bool>          itsFullResFlags; //# fullres_nchan,ntimeavg,nbl
+      casacore::Vector<uint>        itsRowNrs;
+      casacore::Cube<casacore::Complex> itsData;        //# ncorr,nchan,nbasel
+      casacore::Cube<bool>          itsFlags;       //# ncorr,nchan,nbasel
+      casacore::Matrix<double>      itsUVW;         //# 3,nbasel
+      casacore::Cube<float>         itsWeights;     //# ncorr,nchan,nbasel
+      casacore::Cube<bool>          itsFullResFlags; //# fullres_nchan,ntimeavg,nbl
     };
 
   } //# end namespace
diff --git a/CEP/DP3/DPPP/include/DPPP/DPInfo.h b/CEP/DP3/DPPP/include/DPPP/DPInfo.h
index a539ad498e8..e889345b33f 100644
--- a/CEP/DP3/DPPP/include/DPPP/DPInfo.h
+++ b/CEP/DP3/DPPP/include/DPPP/DPInfo.h
@@ -29,11 +29,11 @@
 
 #include <Common/LofarTypes.h>
 #include <Common/lofar_vector.h>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MPosition.h>
-#include <measures/Measures/MeasureHolder.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Containers/Record.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MPosition.h>
+#include <casacore/measures/Measures/MeasureHolder.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Containers/Record.h>
 
 namespace LOFAR {
   namespace DPPP {
@@ -68,33 +68,33 @@ namespace LOFAR {
       // An empty resolutions or effectiveBW is default to chanWidths.
       // If totalBW is 0, it is set to the sum of effectiveBW.
       // If refFreq is 0, it is set to the middle of chanFreqs (mean if even).
-      void set (const casa::Vector<double>& chanFreqs,
-                const casa::Vector<double>& chanWidths,
-                const casa::Vector<double>& resolutions= casa::Vector<double>(),
-                const casa::Vector<double>& effectiveBW= casa::Vector<double>(),
+      void set (const casacore::Vector<double>& chanFreqs,
+                const casacore::Vector<double>& chanWidths,
+                const casacore::Vector<double>& resolutions= casacore::Vector<double>(),
+                const casacore::Vector<double>& effectiveBW= casacore::Vector<double>(),
                 double totalBW = 0,
                 double refFreq = 0);
 
       // Set array info.
-      void set (const casa::MPosition& arrayPos,
-                const casa::MDirection& phaseCenter,
-                const casa::MDirection& delayCenter,
-                const casa::MDirection& tileBeamDir);
+      void set (const casacore::MPosition& arrayPos,
+                const casacore::MDirection& phaseCenter,
+                const casacore::MDirection& delayCenter,
+                const casacore::MDirection& tileBeamDir);
 
       // Set the info for the given antennae and baselines.
-      void set (const casa::Vector<casa::String>& antNames,
-                const casa::Vector<casa::Double>& antDiam,
-                const vector<casa::MPosition>& antPos,
-                const casa::Vector<casa::Int>& ant1,
-                const casa::Vector<casa::Int>& ant2);
+      void set (const casacore::Vector<casacore::String>& antNames,
+                const casacore::Vector<casacore::Double>& antDiam,
+                const vector<casacore::MPosition>& antPos,
+                const casacore::Vector<casacore::Int>& ant1,
+                const casacore::Vector<casacore::Int>& ant2);
 
       // Set the name of the data column
-      void setDataColName(const casa::String& dataColName) {
+      void setDataColName(const casacore::String& dataColName) {
         itsDataColName=dataColName;
       }
 
       // Set the name of the weight column
-      void setWeightColName(const casa::String& weightColName) {
+      void setWeightColName(const casacore::String& weightColName) {
         itsWeightColName=weightColName;
       }
 
@@ -114,7 +114,7 @@ namespace LOFAR {
 
       // Set the phase center.
       // If original=true, it is set to the original phase center.
-      void setPhaseCenter (const casa::MDirection& phaseCenter, bool original)
+      void setPhaseCenter (const casacore::MDirection& phaseCenter, bool original)
         { itsPhaseCenter=phaseCenter; itsPhaseCenterIsOriginal = original; }
 
 
@@ -145,45 +145,45 @@ namespace LOFAR {
         { return itsStartTime; }
       double timeInterval() const
         { return itsTimeInterval; }
-      const casa::Vector<casa::Int>& getAnt1() const
+      const casacore::Vector<casacore::Int>& getAnt1() const
         { return itsAnt1; }
-      const casa::Vector<casa::Int>& getAnt2() const
+      const casacore::Vector<casacore::Int>& getAnt2() const
         { return itsAnt2; }
-      const casa::Vector<casa::String>& antennaNames() const
+      const casacore::Vector<casacore::String>& antennaNames() const
         { return itsAntNames; }
-      const casa::Vector<casa::Double>& antennaDiam() const
+      const casacore::Vector<casacore::Double>& antennaDiam() const
         { return itsAntDiam; }
-      const vector<casa::MPosition>& antennaPos() const
+      const vector<casacore::MPosition>& antennaPos() const
         { return itsAntPos; }
-      const casa::MPosition& arrayPos() const
+      const casacore::MPosition& arrayPos() const
         { return itsArrayPos; }
-      const casa::MPosition arrayPosCopy() const
-        {  return copyMeasure(casa::MeasureHolder(itsArrayPos)).asMPosition(); }
-      const casa::MDirection& phaseCenter() const
+      const casacore::MPosition arrayPosCopy() const
+        {  return copyMeasure(casacore::MeasureHolder(itsArrayPos)).asMPosition(); }
+      const casacore::MDirection& phaseCenter() const
         { return itsPhaseCenter; }
-      const casa::MDirection phaseCenterCopy() const
-      {  return copyMeasure(casa::MeasureHolder(itsPhaseCenter)).asMDirection(); }
+      const casacore::MDirection phaseCenterCopy() const
+      {  return copyMeasure(casacore::MeasureHolder(itsPhaseCenter)).asMDirection(); }
       bool phaseCenterIsOriginal() const
         { return itsPhaseCenterIsOriginal; }
-      const casa::MDirection& delayCenter() const
+      const casacore::MDirection& delayCenter() const
         { return itsDelayCenter; }
-      const casa::MDirection delayCenterCopy() const
-        { return copyMeasure(casa::MeasureHolder(itsDelayCenter)).asMDirection(); }
-      const casa::MDirection& tileBeamDir() const
+      const casacore::MDirection delayCenterCopy() const
+        { return copyMeasure(casacore::MeasureHolder(itsDelayCenter)).asMDirection(); }
+      const casacore::MDirection& tileBeamDir() const
         { return itsTileBeamDir; }
-      const casa::MDirection tileBeamDirCopy() const
-        { return copyMeasure(casa::MeasureHolder(itsTileBeamDir)).asMDirection(); }
-      const casa::Vector<double>& chanFreqs() const
+      const casacore::MDirection tileBeamDirCopy() const
+        { return copyMeasure(casacore::MeasureHolder(itsTileBeamDir)).asMDirection(); }
+      const casacore::Vector<double>& chanFreqs() const
         { return itsChanFreqs; }
-      const casa::Vector<double>& chanWidths() const
+      const casacore::Vector<double>& chanWidths() const
         { return itsChanWidths; }
-      const casa::Vector<double>& resolutions() const
+      const casacore::Vector<double>& resolutions() const
         { return itsResolutions; }
-      const casa::Vector<double>& effectiveBW() const
+      const casacore::Vector<double>& effectiveBW() const
         { return itsEffectiveBW; }
-      const casa::String& getDataColName() const
+      const casacore::String& getDataColName() const
         { return itsDataColName; }
-      const casa::String& getWeightColName() const
+      const casacore::String& getWeightColName() const
         { return itsWeightColName; }
       double totalBW() const
         { return itsTotalBW; }
@@ -245,18 +245,18 @@ namespace LOFAR {
 
       // Convert to a Record.
       // The names of the fields in the record are the data names without 'its'.
-      casa::Record toRecord() const;
+      casacore::Record toRecord() const;
 
       // Update the DPInfo object from a Record.
       // It is possible that only a few fields are defined in the record.
-      void fromRecord (const casa::Record& rec);
+      void fromRecord (const casacore::Record& rec);
 
     private:
       // Set which antennae are actually used.
       void setAntUsed();
 
-      // Creates a real copy of a casa::Measure by exporting to a Record
-      static casa::MeasureHolder copyMeasure(const casa::MeasureHolder fromMeas);
+      // Creates a real copy of a casacore::Measure by exporting to a Record
+      static casacore::MeasureHolder copyMeasure(const casacore::MeasureHolder fromMeas);
 
       //# Data members.
       bool   itsNeedVisData;    //# Are the visibility data needed?
@@ -265,8 +265,8 @@ namespace LOFAR {
       bool   itsWriteWeights;   //# Must the weights be written?
       bool   itsMetaChanged;    //# Are meta data changed? (e.g., by averaging)
       string itsMSName;
-      casa::String itsDataColName;
-      casa::String itsWeightColName;
+      casacore::String itsDataColName;
+      casacore::String itsWeightColName;
       string itsAntennaSet;
       uint   itsNCorr;
       uint   itsStartChan;
@@ -277,24 +277,24 @@ namespace LOFAR {
       uint   itsTimeAvg;
       double itsStartTime;
       double itsTimeInterval;
-      casa::MDirection itsPhaseCenter;
+      casacore::MDirection itsPhaseCenter;
       bool             itsPhaseCenterIsOriginal;
-      casa::MDirection itsDelayCenter;
-      casa::MDirection itsTileBeamDir;
-      casa::MPosition  itsArrayPos;
-      casa::Vector<double>       itsChanFreqs;
-      casa::Vector<double>       itsChanWidths;
-      casa::Vector<double>       itsResolutions;
-      casa::Vector<double>       itsEffectiveBW;
+      casacore::MDirection itsDelayCenter;
+      casacore::MDirection itsTileBeamDir;
+      casacore::MPosition  itsArrayPos;
+      casacore::Vector<double>       itsChanFreqs;
+      casacore::Vector<double>       itsChanWidths;
+      casacore::Vector<double>       itsResolutions;
+      casacore::Vector<double>       itsEffectiveBW;
       double                     itsTotalBW;
       double                     itsRefFreq;
-      casa::Vector<casa::String> itsAntNames;
-      casa::Vector<casa::Double> itsAntDiam;
-      vector<casa::MPosition>    itsAntPos;
+      casacore::Vector<casacore::String> itsAntNames;
+      casacore::Vector<casacore::Double> itsAntDiam;
+      vector<casacore::MPosition>    itsAntPos;
       vector<int>                itsAntUsed;
       vector<int>                itsAntMap;
-      casa::Vector<casa::Int>    itsAnt1;          //# ant1 of all baselines
-      casa::Vector<casa::Int>    itsAnt2;          //# ant2 of all baselines
+      casacore::Vector<casacore::Int>    itsAnt1;          //# ant1 of all baselines
+      casacore::Vector<casacore::Int>    itsAnt2;          //# ant2 of all baselines
       mutable vector<double>     itsBLength;       //# baseline lengths
       mutable vector<int>        itsAutoCorrIndex; //# autocorr index per ant
     };
diff --git a/CEP/DP3/DPPP/include/DPPP/DPInput.h b/CEP/DP3/DPPP/include/DPPP/DPInput.h
index 9cfd2deea7d..2a439714ad3 100644
--- a/CEP/DP3/DPPP/include/DPPP/DPInput.h
+++ b/CEP/DP3/DPPP/include/DPPP/DPInput.h
@@ -34,12 +34,12 @@
 #include <StationResponse/Station.h>
 #include <Common/lofar_vector.h>
 
-#include <tables/Tables/TableIter.h>
-#include <tables/Tables/RefRows.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Arrays/Slicer.h>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MPosition.h>
+#include <casacore/tables/Tables/TableIter.h>
+#include <casacore/tables/Tables/RefRows.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Slicer.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MPosition.h>
 
 namespace LOFAR {
   namespace DPPP {
@@ -67,36 +67,36 @@ namespace LOFAR {
 
       // Read the UVW at the given row numbers into the buffer.
       // The default implementation throws an exception.
-      virtual void getUVW (const casa::RefRows& rowNrs,
+      virtual void getUVW (const casacore::RefRows& rowNrs,
                            double time,
                            DPBuffer&);
 
       // Read the weights at the given row numbers into the buffer.
       // The default implementation throws an exception.
-      virtual void getWeights (const casa::RefRows& rowNrs,
+      virtual void getWeights (const casacore::RefRows& rowNrs,
                                DPBuffer&);
 
       // Read the fullRes flags (LOFAR_FULL_RES_FLAG) at the given row numbers
       // into the buffer.
       // If undefined, false is returned.
       // The default implementation throws an exception.
-      virtual bool getFullResFlags (const casa::RefRows& rowNrs,
+      virtual bool getFullResFlags (const casacore::RefRows& rowNrs,
                                     DPBuffer&);
 
       // Read the model data at the given row numbers into the array.
       // The default implementation throws an exception.
-      virtual void getModelData (const casa::RefRows& rowNrs,
-                                 casa::Cube<casa::Complex>&);
+      virtual void getModelData (const casacore::RefRows& rowNrs,
+                                 casacore::Cube<casacore::Complex>&);
 
       // Get the MS name.
       // The default implementation returns an empty string.
-      virtual casa::String msName() const;
+      virtual casacore::String msName() const;
 
       // Fill the vector with station beam info from the input source (MS).
       // Only fill it for the given station names.
       // The default implementation throws an exception.
       virtual void fillBeamInfo (vector<StationResponse::Station::Ptr>&,
-                                 const casa::Vector<casa::String>& antNames);
+                                 const casacore::Vector<casacore::String>& antNames);
 
       // Fetch the FullRes flags.
       // If defined in the buffer, they are taken from there.
@@ -107,7 +107,7 @@ namespace LOFAR {
       // that if an averaged channel is flagged, the corresponding FullRes
       // flags are set.
       // <br>It does a stop/start of the timer when actually reading the data.
-      const casa::Cube<bool>& fetchFullResFlags (const DPBuffer& bufin,
+      const casacore::Cube<bool>& fetchFullResFlags (const DPBuffer& bufin,
                                                  DPBuffer& bufout,
                                                  NSTimer& timer,
                                                  bool merge=false);
@@ -118,7 +118,7 @@ namespace LOFAR {
       // If they have to be read and if autoweighting is in effect, the buffer
       // must contain DATA to calculate the weights.
       // <br>It does a stop/start of the timer when actually reading the data.
-      const casa::Cube<float>& fetchWeights (const DPBuffer& bufin,
+      const casacore::Cube<float>& fetchWeights (const DPBuffer& bufin,
                                              DPBuffer& bufout,
                                              NSTimer& timer);
 
@@ -126,7 +126,7 @@ namespace LOFAR {
       // If defined in the buffer, they are taken from there.
       // Otherwise there are read from the input.
       // <br>It does a stop/start of the timer when actually reading the data.
-      const casa::Matrix<double>& fetchUVW (const DPBuffer& bufin,
+      const casacore::Matrix<double>& fetchUVW (const DPBuffer& bufin,
                                             DPBuffer& bufout,
                                             NSTimer& timer);
     };
diff --git a/CEP/DP3/DPPP/include/DPPP/DPRun.h b/CEP/DP3/DPPP/include/DPPP/DPRun.h
index 00a9a70ac3b..06121de8e4b 100644
--- a/CEP/DP3/DPPP/include/DPPP/DPRun.h
+++ b/CEP/DP3/DPPP/include/DPPP/DPRun.h
@@ -80,7 +80,7 @@ namespace LOFAR {
       // reader should be the original reader
       static DPStep::ShPtr makeOutputStep(MSReader* reader,
           const ParameterSet& parset, const string& prefix, bool multipleInputs,
-          casa::String& currentMSName);
+          casacore::String& currentMSName);
 
       // The map to create a step object from its type name.
       static std::map<std::string, StepCtor*> theirStepMap;
diff --git a/CEP/DP3/DPPP/include/DPPP/DemixInfo.h b/CEP/DP3/DPPP/include/DPPP/DemixInfo.h
index 9fc1ff9af68..b3959c002f1 100644
--- a/CEP/DP3/DPPP/include/DPPP/DemixInfo.h
+++ b/CEP/DP3/DPPP/include/DPPP/DemixInfo.h
@@ -33,7 +33,7 @@
 #include <DPPP/Patch.h>
 #include <Common/ParameterSet.h>
 
-#include <casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Vector.h>
 
 namespace LOFAR {
   namespace DPPP {
@@ -98,9 +98,9 @@ namespace LOFAR {
       const vector<string>& sourceNames() const  {return itsSourceNames;}
       const Position& phaseRef() const           {return itsPhaseRef;}
       const vector<Baseline>& baselines() const  {return itsBaselines;}
-      const casa::Vector<bool> selTarget() const {return itsSelTarget;}
-      const casa::Vector<double>& freqDemix() const      {return itsFreqDemix;}
-      const casa::Vector<double>& freqSubtr() const      {return itsFreqSubtr;}
+      const casacore::Vector<bool> selTarget() const {return itsSelTarget;}
+      const casacore::Vector<double>& freqDemix() const      {return itsFreqDemix;}
+      const casacore::Vector<double>& freqSubtr() const      {return itsFreqSubtr;}
       const vector<Patch::ConstPtr>& ateamList() const   {return itsAteamList;}
       const vector<Patch::ConstPtr>& targetList() const  {return itsTargetList;}
       const vector<Patch::ConstPtr>& ateamDemixList() const
@@ -109,13 +109,13 @@ namespace LOFAR {
         {return itsTargetDemixList;}
 
       // Get the baselines.
-      const casa::Vector<casa::Int>& getAnt1() const
+      const casacore::Vector<casacore::Int>& getAnt1() const
         { return itsInfoSel.getAnt1(); }
-      const casa::Vector<casa::Int>& getAnt2() const
+      const casacore::Vector<casacore::Int>& getAnt2() const
         { return itsInfoSel.getAnt2(); }
 
       // Get the antenna names and used antennas.
-      const casa::Vector<casa::String>& antennaNames() const
+      const casacore::Vector<casacore::String>& antennaNames() const
         { return itsInfoSel.antennaNames(); }
 
       // Get cosine of the angular distance between two sky positions.
@@ -185,9 +185,9 @@ namespace LOFAR {
       double                  itsTimeIntervalAvg;
       Position                itsPhaseRef;          //# original phaseref
       vector<Baseline>        itsBaselines;
-      casa::Vector<bool>      itsSelTarget;     //# baselines in target estimate
-      casa::Vector<double>    itsFreqDemix;
-      casa::Vector<double>    itsFreqSubtr;
+      casacore::Vector<bool>      itsSelTarget;     //# baselines in target estimate
+      casacore::Vector<double>    itsFreqDemix;
+      casacore::Vector<double>    itsFreqSubtr;
       vector<Patch::ConstPtr> itsAteamList;
       vector<Patch::ConstPtr> itsTargetList;
       vector<Patch::ConstPtr> itsAteamDemixList;
diff --git a/CEP/DP3/DPPP/include/DPPP/DemixWorker.h b/CEP/DP3/DPPP/include/DPPP/DemixWorker.h
index a37a0319467..1e03ddd9097 100644
--- a/CEP/DP3/DPPP/include/DPPP/DemixWorker.h
+++ b/CEP/DP3/DPPP/include/DPPP/DemixWorker.h
@@ -37,14 +37,14 @@
 #include <StationResponse/Station.h>
 #include <ParmDB/ParmDB.h>
 
-#include <casa/Arrays/Cube.h>
-#include <casa/Quanta/Quantum.h>
-#include <measures/Measures/MeasureHolder.h>
-#include <measures/Measures/MeasFrame.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MPosition.h>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MCDirection.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/measures/Measures/MeasureHolder.h>
+#include <casacore/measures/Measures/MeasFrame.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MPosition.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MCDirection.h>
 
 namespace LOFAR {
 
@@ -99,19 +99,19 @@ namespace LOFAR {
       uint nDeprojectTarget() const
         { return itsNrDeprojectTarget; }
       // Get nr of times a source was demixed.
-      const casa::Vector<uint>& nsourcesDemixed() const
+      const casacore::Vector<uint>& nsourcesDemixed() const
         { return itsNrSourcesDemixed; }
       // Get nr of times a station was demixed.
-      const casa::Vector<uint>& nstationsDemixed() const
+      const casacore::Vector<uint>& nstationsDemixed() const
         { return itsNrStationsDemixed; }
       // Get nr of times a station/source was demixed.
-      const casa::Matrix<uint>& statSourceDemixed() const
+      const casacore::Matrix<uint>& statSourceDemixed() const
         { return itsStatSourceDemixed; }
-      const casa::Matrix<double>& amplSubtrMean() const
+      const casacore::Matrix<double>& amplSubtrMean() const
         { return itsAmplSubtrMean; }
-      const casa::Matrix<double>& amplSubtrM2() const
+      const casacore::Matrix<double>& amplSubtrM2() const
         { return itsAmplSubtrM2; }
-      const casa::Matrix<size_t>& amplSubtrNr() const
+      const casacore::Matrix<size_t>& amplSubtrNr() const
         { return itsAmplSubtrNr; }
 
       // Get the timings of the various processing steps.
@@ -140,7 +140,7 @@ namespace LOFAR {
 
       // Find the median ampltitude for the selected baselines.
       // It uses itsTmpAmpl as temporary buffer.
-      float findMedian (const casa::Cube<float>& ampl, const bool* selbl);
+      float findMedian (const casacore::Cube<float>& ampl, const bool* selbl);
 
       // Average the baseline UVWs in bufin and split them into UVW per station.
       // It returns the number of time averages.
@@ -159,7 +159,7 @@ namespace LOFAR {
                          uint ntime, double time, double timeStep);
 
       // Add the StokesI of itsPredictVis to ampl.
-      void addStokesI (casa::Matrix<float>& ampl);
+      void addStokesI (casacore::Matrix<float>& ampl);
 
       // Calculate the beam for demix resolution and apply to itsPredictVis.
       // If apply==False, nothing is done.
@@ -169,15 +169,15 @@ namespace LOFAR {
       // Apply it to the data.
       // If apply==False, nothing is done.
       void applyBeam (double time, const Position& pos, bool apply,
-                      const casa::Vector<double>& chanFreqs,
+                      const casacore::Vector<double>& chanFreqs,
                       dcomplex* data);
 
       // Convert a direction to ITRF.
-      StationResponse::vector3r_t dir2Itrf (const casa::MDirection&);
+      StationResponse::vector3r_t dir2Itrf (const casacore::MDirection&);
 
       // Calculate the StokesI amplitude from the predicted visibilities.
       // (0.5 * (XX+YY))
-      void calcStokesI (casa::Matrix<float>& ampl);
+      void calcStokesI (casacore::Matrix<float>& ampl);
 
       // Simply average the data if no demixing needs to bedone.
       void average (const DPBuffer* bufin, uint nbufin,
@@ -185,18 +185,18 @@ namespace LOFAR {
 
       // Add the decorrelation factor contribution for each time slot.
       void addFactors (const DPBuffer& newBuf,
-                       casa::Array<casa::DComplex>& factorBuf);
+                       casacore::Array<casacore::DComplex>& factorBuf);
 
       // Calculate the decorrelation factors by averaging them.
       // Apply the P matrix to deproject the sources without a model.
-      void makeFactors (const casa::Array<casa::DComplex>& bufIn,
-                        casa::Array<casa::DComplex>& bufOut,
-                        const casa::Cube<float>& weightSums,
+      void makeFactors (const casacore::Array<casacore::DComplex>& bufIn,
+                        casacore::Array<casacore::DComplex>& bufOut,
+                        const casacore::Cube<float>& weightSums,
                         uint nChanOut,
                         uint nChanAvg);
 
       // Deproject the sources without a model.
-      void deproject (casa::Array<casa::DComplex>& factors,
+      void deproject (casacore::Array<casacore::DComplex>& factors,
                       vector<MultiResultStep*> avgResults,
                       uint resultIndex);
 
@@ -237,9 +237,9 @@ namespace LOFAR {
       vector<StationResponse::Station::Ptr> itsAntBeamInfo;
       //# Measure objects unique to this worker (thread).
       //# This is needed because they are not thread-safe.
-      casa::MPosition                       itsArrayPos;
-      casa::MDirection                      itsDelayCenter;
-      casa::MDirection                      itsTileBeamDir;
+      casacore::MPosition                       itsArrayPos;
+      casacore::MDirection                      itsDelayCenter;
+      casacore::MDirection                      itsTileBeamDir;
 
       //# Variables set by setupDemix and used by handleDemix.
       uint                                  itsNDir;
@@ -250,37 +250,37 @@ namespace LOFAR {
       //# Accumulator used for computing the demixing weights at the demix
       //# resolution. The shape of this buffer is #correlations x #channels
       //# x #baselines x #directions x #directions (fastest axis first).
-      casa::Array<casa::DComplex>           itsFactorBuf;
+      casacore::Array<casacore::DComplex>           itsFactorBuf;
       //# Buffer of demixing weights at the demix resolution. Each Array is a
       //# cube of shape #correlations x #channels x #baselines of matrices of
       //# shape #directions x #directions.
-      vector<casa::Array<casa::DComplex> >  itsFactors;
+      vector<casacore::Array<casacore::DComplex> >  itsFactors;
       //# Accumulator used for computing the demixing weights. The shape of this
       //# buffer is #correlations x #channels x #baselines x #directions
       //# x #directions (fastest axis first).
-      casa::Array<casa::DComplex>           itsFactorBufSubtr;
+      casacore::Array<casacore::DComplex>           itsFactorBufSubtr;
       //# Buffer of demixing weights at the subtract resolution. Each Array is a
       //# cube of shape #correlations x #channels x #baselines of matrices of
       //# shape #directions x #directions.
-      vector<casa::Array<casa::DComplex> >  itsFactorsSubtr;
+      vector<casacore::Array<casacore::DComplex> >  itsFactorsSubtr;
 
       //# Variables for conversion of directions to ITRF.
-      casa::MeasFrame                       itsMeasFrame;
-      casa::MDirection::Convert             itsMeasConverter;
+      casacore::MeasFrame                       itsMeasFrame;
+      casacore::MDirection::Convert             itsMeasConverter;
       vector<StationResponse::matrix22c_t>  itsBeamValues;  //# [nst,nch]
 
       //# Indices telling which Ateam sources to use.
       vector<uint>                          itsSrcSet;
       //# UVW per station per demix time slot
-      casa::Cube<double>                    itsStationUVW;  //# UVW per station
-      casa::Matrix<double>                  itsAvgUVW;      //# temp buffer
-      casa::Cube<dcomplex>                  itsPredictVis;  //# temp buffer
+      casacore::Cube<double>                    itsStationUVW;  //# UVW per station
+      casacore::Matrix<double>                  itsAvgUVW;      //# temp buffer
+      casacore::Cube<dcomplex>                  itsPredictVis;  //# temp buffer
       //# #nfreq x #bl x #time StokesI amplitude per A-source.
-      vector<casa::Cube<float> >            itsAteamAmpl;
+      vector<casacore::Cube<float> >            itsAteamAmpl;
       //# #bl x #src telling if baseline has sufficient Ateam flux.
-      casa::Matrix<bool>                    itsAteamAmplSel;
+      casacore::Matrix<bool>                    itsAteamAmplSel;
       //# #nfreq x #bl x #time StokesI amplitude of target.
-      casa::Cube<float>                     itsTargetAmpl;
+      casacore::Cube<float>                     itsTargetAmpl;
       //# Temporary buffer to determine medians.
       vector<float>                         itsTmpAmpl;
       //# Per A-source and for target the min and max amplitude.
@@ -290,16 +290,16 @@ namespace LOFAR {
       double                                itsTargetMaxAmpl;
       //# Per A-source the stations to use (matching the minimum amplitude).
       vector<vector<uint> >                 itsStationsToUse;
-      casa::Block<bool>                     itsSolveStation; //# solve station i?
+      casacore::Block<bool>                     itsSolveStation; //# solve station i?
       //# Per station and source the index in the unknowns vector.
       //# Note there are 8 unknowns (4 pol, ampl/phase) per source/station.
       vector<vector<int> >                  itsUnknownsIndex;
       //# The estimater (solver).
       EstimateNew                           itsEstimate;
       //# Variables for the predict.
-      casa::Matrix<double>                  itsUVW;
-      vector<casa::Cube<dcomplex> >         itsModelVisDemix;
-      vector<casa::Cube<dcomplex> >         itsModelVisSubtr;
+      casacore::Matrix<double>                  itsUVW;
+      vector<casacore::Cube<dcomplex> >         itsModelVisDemix;
+      vector<casacore::Cube<dcomplex> >         itsModelVisSubtr;
       uint                                  itsNTimeOut;
       uint                                  itsNTimeOutSubtr;
       uint                                  itsTimeIndex;
@@ -316,17 +316,17 @@ namespace LOFAR {
       uint                                  itsNrIgnoreTarget;
       uint                                  itsNrDeprojectTarget;
       //# Nr of times a source is demixed.
-      casa::Vector<uint>                    itsNrSourcesDemixed;
+      casacore::Vector<uint>                    itsNrSourcesDemixed;
       //# Nr of times a station is demixed.
-      casa::Vector<uint>                    itsNrStationsDemixed;
+      casacore::Vector<uint>                    itsNrStationsDemixed;
       //# Nr of times a source/station is demixed.
-      casa::Matrix<uint>                    itsStatSourceDemixed;
+      casacore::Matrix<uint>                    itsStatSourceDemixed;
       //# Average amplitude subtracted for middle channel [nbl,nsrc]
-      casa::Matrix<double>                  itsAmplSubtrMean;
+      casacore::Matrix<double>                  itsAmplSubtrMean;
       //# M2n to calculate stddev online in stable way (see Wikipedia)
-      casa::Matrix<double>                  itsAmplSubtrM2;
+      casacore::Matrix<double>                  itsAmplSubtrM2;
       //# N for mean/stddev amplitude calculations.
-      casa::Matrix<size_t>                  itsAmplSubtrNr;
+      casacore::Matrix<size_t>                  itsAmplSubtrNr;
       //# Timers.
       NSTimer                               itsTimer;
       NSTimer                               itsTimerCoarse;
diff --git a/CEP/DP3/DPPP/include/DPPP/Demixer.h b/CEP/DP3/DPPP/include/DPPP/Demixer.h
index dec4eb188ae..da64ad32727 100644
--- a/CEP/DP3/DPPP/include/DPPP/Demixer.h
+++ b/CEP/DP3/DPPP/include/DPPP/Demixer.h
@@ -34,15 +34,15 @@
 #include <DPPP/PhaseShift.h>
 #include <DPPP/Filter.h>
 
-#include <casa/Arrays/Cube.h>
-#include <casa/Quanta/Quantum.h>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MPosition.h>
-#include <measures/Measures/MEpoch.h>
-#include <measures/Measures/MeasFrame.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MCDirection.h>
-#include <measures/Measures/MCPosition.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MPosition.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/measures/Measures/MeasFrame.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/measures/Measures/MCPosition.h>
 
 namespace LOFAR {
 
@@ -93,13 +93,13 @@ namespace LOFAR {
     private:
       // Add the decorrelation factor contribution for each time slot.
       void addFactors (const DPBuffer& newBuf,
-                       casa::Array<casa::DComplex>& factorBuf);
+                       casacore::Array<casacore::DComplex>& factorBuf);
 
       // Calculate the decorrelation factors by averaging them.
       // Apply the P matrix to deproject the sources without a model.
-      void makeFactors (const casa::Array<casa::DComplex>& bufIn,
-                        casa::Array<casa::DComplex>& bufOut,
-                        const casa::Cube<float>& weightSums,
+      void makeFactors (const casacore::Array<casacore::DComplex>& bufIn,
+                        casacore::Array<casacore::DComplex>& bufOut,
+                        const casacore::Cube<float>& weightSums,
                         uint nChanOut,
                         uint nChanAvg);
 
@@ -107,7 +107,7 @@ namespace LOFAR {
       void handleDemix();
 
       // Deproject the sources without a model.
-      void deproject (casa::Array<casa::DComplex>& factors,
+      void deproject (casacore::Array<casacore::DComplex>& factors,
                       vector<MultiResultStep*> avgResults,
                       uint resultIndex);
 
@@ -175,27 +175,27 @@ namespace LOFAR {
       //# Accumulator used for computing the demixing weights at the demix
       //# resolution. The shape of this buffer is #correlations x #channels
       //# x #baselines x #directions x #directions (fastest axis first).
-      casa::Array<casa::DComplex>           itsFactorBuf;
+      casacore::Array<casacore::DComplex>           itsFactorBuf;
       //# Buffer of demixing weights at the demix resolution. Each Array is a
       //# cube of shape #correlations x #channels x #baselines of matrices of
       //# shape #directions x #directions.
-      vector<casa::Array<casa::DComplex> >  itsFactors;
+      vector<casacore::Array<casacore::DComplex> >  itsFactors;
 
       //# Accumulator used for computing the demixing weights. The shape of this
       //# buffer is #correlations x #channels x #baselines x #directions
       //# x #directions (fastest axis first).
-      casa::Array<casa::DComplex>           itsFactorBufSubtr;
+      casacore::Array<casacore::DComplex>           itsFactorBufSubtr;
       //# Buffer of demixing weights at the subtract resolution. Each Array is a
       //# cube of shape #correlations x #channels x #baselines of matrices of
       //# shape #directions x #directions.
-      vector<casa::Array<casa::DComplex> >  itsFactorsSubtr;
+      vector<casacore::Array<casacore::DComplex> >  itsFactorsSubtr;
 
       PatchList                             itsPatchList;
       Position                              itsPhaseRef;
       vector<Baseline>                      itsBaselines;
       vector<int>                           itsUVWSplitIndex;
-      casa::Vector<double>                  itsFreqDemix;
-      casa::Vector<double>                  itsFreqSubtr;
+      casacore::Vector<double>                  itsFreqDemix;
+      casacore::Vector<double>                  itsFreqSubtr;
       vector<double>                        itsUnknowns;
       vector<double>                        itsPrevSolution;
       uint                                  itsTimeIndex;
diff --git a/CEP/DP3/DPPP/include/DPPP/EstimateNew.h b/CEP/DP3/DPPP/include/DPPP/EstimateNew.h
index d65310acb81..cd5fb1c967d 100644
--- a/CEP/DP3/DPPP/include/DPPP/EstimateNew.h
+++ b/CEP/DP3/DPPP/include/DPPP/EstimateNew.h
@@ -35,7 +35,7 @@
 #include <Common/lofar_vector.h>
 
 //# Use Block<bool> instead of vector<bool> (because testing bits is slower).
-#include <casa/Containers/Block.h>
+#include <casacore/casa/Containers/Block.h>
 
 namespace LOFAR {
   namespace DPPP {
@@ -131,8 +131,8 @@ namespace LOFAR {
       size_t itsNrIter;
       size_t itsNrDir;
       bool   itsPropagateSolution;
-      casa::Block<bool>  itsSolveStation;  //# solve station i?
-      vector<casa::uInt> itsDerivIndex;    //# index for LSQFit::makeIndex
+      casacore::Block<bool>  itsSolveStation;  //# solve station i?
+      vector<casacore::uInt> itsDerivIndex;    //# index for LSQFit::makeIndex
       vector<double>     itsUnknowns;
       vector<double>     itsSolution;
       vector<dcomplex>   itsM;
diff --git a/CEP/DP3/DPPP/include/DPPP/Filter.h b/CEP/DP3/DPPP/include/DPPP/Filter.h
index cfbd46b49b0..48b0d525413 100644
--- a/CEP/DP3/DPPP/include/DPPP/Filter.h
+++ b/CEP/DP3/DPPP/include/DPPP/Filter.h
@@ -170,28 +170,28 @@ namespace LOFAR {
     private:
       // Create the mapping from old to new id (e.g. ANTENNA_ID).
       // The removed ids get a mapping -1.
-      casa::Vector<casa::Int>
-      createIdMap (casa::uInt nrId,
-                   const casa::Vector<casa::uInt>& removedIds) const;
+      casacore::Vector<casacore::Int>
+      createIdMap (casacore::uInt nrId,
+                   const casacore::Vector<casacore::uInt>& removedIds) const;
 
       // Remove rows with deleted stations from a subtable.
       // Renumber the ANTENNA_ID of the remaining rows.
       // It fills nrId with the original number of rows in the subtable
       // and returns the vector of removed row numbers.
-      casa::Vector<casa::uInt>
-      renumberSubTable (const casa::Table& ms, const casa::String& name,
-                        const casa::String& colName,
-                        const casa::Vector<casa::uInt>& removedAnt,
-                        const casa::Vector<casa::Int>& antMap,
-                        casa::uInt& nrId) const;
+      casacore::Vector<casacore::uInt>
+      renumberSubTable (const casacore::Table& ms, const casacore::String& name,
+                        const casacore::String& colName,
+                        const casacore::Vector<casacore::uInt>& removedAnt,
+                        const casacore::Vector<casacore::Int>& antMap,
+                        casacore::uInt& nrId) const;
 
       //# Data members.
       DPInput*          itsInput;
       string            itsName;
       DPBuffer          itsBuf;
       DPBuffer          itsBufTmp;
-      casa::String      itsStartChanStr;  //# startchan expression
-      casa::String      itsNrChanStr;     //# nchan expression
+      casacore::String      itsStartChanStr;  //# startchan expression
+      casacore::String      itsNrChanStr;     //# nchan expression
       bool              itsRemoveAnt;     //# Remove from ANTENNA table?
       BaselineSelection itsBaselines;
       uint              itsStartChan;
diff --git a/CEP/DP3/DPPP/include/DPPP/FlagCounter.h b/CEP/DP3/DPPP/include/DPPP/FlagCounter.h
index 92d7a596d2a..538b17c4a31 100644
--- a/CEP/DP3/DPPP/include/DPPP/FlagCounter.h
+++ b/CEP/DP3/DPPP/include/DPPP/FlagCounter.h
@@ -30,7 +30,7 @@
 #include <Common/lofar_vector.h>
 #include <Common/lofar_string.h>
 #include <Common/LofarTypes.h>
-#include <casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Vector.h>
 
 namespace LOFAR {
   class ParameterSet;
@@ -100,12 +100,12 @@ namespace LOFAR {
 
     private:
       // Save the percentages per station in a table.
-      void saveStation (int64 npoints, const casa::Vector<int64>& nused,
-                        const casa::Vector<int64>& count) const;
+      void saveStation (int64 npoints, const casacore::Vector<int64>& nused,
+                        const casacore::Vector<int64>& count) const;
 
       // Save the percentages per channel.
       void saveChannel (int64 npoints,
-                        const casa::Vector<int64>& count) const;
+                        const casacore::Vector<int64>& count) const;
 
       //# Data members.
       const DPInfo* itsInfo;
diff --git a/CEP/DP3/DPPP/include/DPPP/GainCal.h b/CEP/DP3/DPPP/include/DPPP/GainCal.h
index adfc5f0caf1..bc09eed5180 100644
--- a/CEP/DP3/DPPP/include/DPPP/GainCal.h
+++ b/CEP/DP3/DPPP/include/DPPP/GainCal.h
@@ -41,10 +41,10 @@
 #include <StationResponse/Station.h>
 #include <StationResponse/Types.h>
 #include <ParmDB/Parm.h>
-#include <casa/Arrays/Cube.h>
-#include <casa/Quanta/MVEpoch.h>
-#include <measures/Measures/MEpoch.h>
-#include <casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/Quanta/MVEpoch.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
 
 // Convince HDF5 to use new API, even when system is configured to use 1.6 API
 #define H5Acreate_vers 2
@@ -100,14 +100,14 @@ namespace LOFAR {
       bool scalarMode();
 
       // Apply the solution
-      void applySolution(DPBuffer& buf, const casa::Cube<casa::DComplex>& invsol);
+      void applySolution(DPBuffer& buf, const casacore::Cube<casacore::DComplex>& invsol);
 
       // Invert solution (for applying it)
-      casa::Cube<casa::DComplex> invertSol(const casa::Cube<casa::DComplex>& sol);
+      casacore::Cube<casacore::DComplex> invertSol(const casacore::Cube<casacore::DComplex>& sol);
 
       // Fills the matrices itsVis and itsMVis
-      void fillMatrices (casa::Complex* model, casa::Complex* data,
-                         float* weight, const casa::Bool* flag);
+      void fillMatrices (casacore::Complex* model, casacore::Complex* data,
+                         float* weight, const casacore::Bool* flag);
 
       // Initialize the parmdb
       void initParmDB();
@@ -126,7 +126,7 @@ namespace LOFAR {
       string           itsName;
       vector<DPBuffer> itsBuf;
       bool             itsUseModelColumn;
-      casa::Cube<casa::Complex> itsModelData;
+      casacore::Cube<casacore::Complex> itsModelData;
       string           itsParmDBName;
       shared_ptr<BBS::ParmDB> itsParmDB;
 
@@ -137,10 +137,10 @@ namespace LOFAR {
 
       bool             itsApplySolution;
 
-      vector<casa::Cube<casa::DComplex> > itsSols; // for every timeslot, nCr x nSt x nFreqCells
-      vector<casa::Matrix<double> > itsTECSols; // for every timeslot, 2 x nSt (alpha and beta)
+      vector<casacore::Cube<casacore::DComplex> > itsSols; // for every timeslot, nCr x nSt x nFreqCells
+      vector<casacore::Matrix<double> > itsTECSols; // for every timeslot, 2 x nSt (alpha and beta)
 
-      vector<casa::CountedPtr<PhaseFitter> > itsPhaseFitters; // Length nSt
+      vector<casacore::CountedPtr<PhaseFitter> > itsPhaseFitters; // Length nSt
 
       std::vector<StefCal>  iS;
 
@@ -150,9 +150,9 @@ namespace LOFAR {
       bool             itsApplyBeamToModelColumn;
 
       BaselineSelection itsBaselineSelection; // Filter
-      casa::Vector<bool> itsSelectedBL; // Vector (length nBl) telling
+      casacore::Vector<bool> itsSelectedBL; // Vector (length nBl) telling
                                         // which baselines are selected
-      casa::Vector<bool> itsAntennaUsed; // Vector (length nBl) telling
+      casacore::Vector<bool> itsAntennaUsed; // Vector (length nBl) telling
                                          // which stations are solved for
 
       map<string,int>  itsParmIdMap; //# -1 = new parm name
@@ -174,7 +174,7 @@ namespace LOFAR {
       double           itsChunkStartTime; // First time value of chunk to be stored
       uint             itsStepInSolInt;  // Timestep within solint
 
-      casa::Array<casa::DComplex>  itsAllSolutions; // Array that holds all solutions for all iterations
+      casacore::Array<casacore::DComplex>  itsAllSolutions; // Array that holds all solutions for all iterations
 
       FlagCounter      itsFlagCounter;
 
diff --git a/CEP/DP3/DPPP/include/DPPP/H5Parm.h b/CEP/DP3/DPPP/include/DPPP/H5Parm.h
index 3e08821fe23..772c785f766 100644
--- a/CEP/DP3/DPPP/include/DPPP/H5Parm.h
+++ b/CEP/DP3/DPPP/include/DPPP/H5Parm.h
@@ -7,8 +7,8 @@
 #include <H5Cpp.h>
 
 #include <utility>
-#include <casa/Arrays/Vector.h>
-#include <measures/Measures/MPosition.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/measures/Measures/MPosition.h>
 
 namespace LOFAR {
   class H5Parm
diff --git a/CEP/DP3/DPPP/include/DPPP/MSReader.h b/CEP/DP3/DPPP/include/DPPP/MSReader.h
index 372ece399b9..ffb5ca1fbfa 100644
--- a/CEP/DP3/DPPP/include/DPPP/MSReader.h
+++ b/CEP/DP3/DPPP/include/DPPP/MSReader.h
@@ -31,9 +31,9 @@
 #include <DPPP/DPBuffer.h>
 #include <DPPP/UVWCalculator.h>
 #include <DPPP/FlagCounter.h>
-#include <tables/Tables/TableIter.h>
-#include <tables/Tables/RefRows.h>
-#include <casa/Arrays/Slicer.h>
+#include <casacore/tables/Tables/TableIter.h>
+#include <casacore/tables/Tables/RefRows.h>
+#include <casacore/casa/Arrays/Slicer.h>
 #include <Common/lofar_vector.h>
 
 namespace LOFAR {
@@ -166,59 +166,59 @@ namespace LOFAR {
       virtual void showTimings (std::ostream&, double duration) const;
 
       // Read the UVW at the given row numbers into the buffer.
-      virtual void getUVW (const casa::RefRows& rowNrs,
+      virtual void getUVW (const casacore::RefRows& rowNrs,
                            double time,
                            DPBuffer&);
 
       // Read the weights at the given row numbers into the buffer.
       // Note: the buffer must contain DATA if autoweighting is in effect.
-      virtual void getWeights (const casa::RefRows& rowNrs,
+      virtual void getWeights (const casacore::RefRows& rowNrs,
                                DPBuffer&);
 
       // Read the fullRes flags (LOFAR_FULL_RES_FLAG) at the given row numbers
       // into the buffer.
       // If there is no such column, the flags are set to false and false is
       // returned.
-      virtual bool getFullResFlags (const casa::RefRows& rowNrs,
+      virtual bool getFullResFlags (const casacore::RefRows& rowNrs,
                                     DPBuffer&);
 
       // Read the model data at the given row numbers into the array.
-      virtual void getModelData (const casa::RefRows& rowNrs,
-                                 casa::Cube<casa::Complex>&);
+      virtual void getModelData (const casacore::RefRows& rowNrs,
+                                 casacore::Cube<casacore::Complex>&);
 
       // Fill the vector with station beam info from the input MS.
       // Only fill it for the given station names.
       virtual void fillBeamInfo (vector<StationResponse::Station::Ptr>&,
-                                 const casa::Vector<casa::String>& antNames);
+                                 const casacore::Vector<casacore::String>& antNames);
 
       // Tell if the visibility data are to be read.
       virtual void setReadVisData (bool readVisData);
 
       // Get the main MS table.
-      casa::Table& table()
+      casacore::Table& table()
         { return itsMS; }
 
       // Get the name of the data column to be used.
-      const casa::String& dataColumnName() const
+      const casacore::String& dataColumnName() const
         { return itsDataColName; }
 
-      const casa::String& weightColumnName() const
+      const casacore::String& weightColumnName() const
         { return itsWeightColName; }
 
-      const casa::String& modelColumnName() const
+      const casacore::String& modelColumnName() const
         { return itsModelColName; }
 
       // Get the slicer in the FLAG and DATA column.
-      const casa::Slicer& colSlicer() const
+      const casacore::Slicer& colSlicer() const
         { return itsColSlicer; }
 
       // Get the rownrs for meta info of missing time slots.
       // It uses the rows of the first time slot.
-      const casa::Vector<uint>& getBaseRowNrs() const
+      const casacore::Vector<uint>& getBaseRowNrs() const
         { return itsBaseRowNrs; }
 
       // Get the name of the MS.
-      virtual casa::String msName() const;
+      virtual casacore::String msName() const;
 
       // Get the time information.
       double firstTime() const
@@ -258,8 +258,8 @@ namespace LOFAR {
         { return itsBuffer; }
 
       // Flags inf and NaN
-      static void flagInfNaN(const casa::Cube<casa::Complex>& dataCube,
-                       casa::Cube<bool>& flagsCube, FlagCounter& flagCounter);
+      static void flagInfNaN(const casacore::Cube<casacore::Complex>& dataCube,
+                       casacore::Cube<bool>& flagsCube, FlagCounter& flagCounter);
 
     private:
       // Prepare the access to the MS.
@@ -278,19 +278,19 @@ namespace LOFAR {
       void calcUVW (double time, DPBuffer&);
 
       // Calculate the weights from the autocorrelations.
-      void autoWeight (casa::Cube<float>& weights, const DPBuffer& buf);
+      void autoWeight (casacore::Cube<float>& weights, const DPBuffer& buf);
 
     protected:
       //# Data members.
-      casa::String        itsMSName;
-      casa::Table         itsMS;
-      casa::Table         itsSelMS;         //# possible selection of spw, baseline
-      casa::TableIterator itsIter;
-      casa::String        itsDataColName;
-      casa::String        itsWeightColName;
-      casa::String        itsModelColName;
-      casa::String        itsStartChanStr;  //# startchan expression
-      casa::String        itsNrChanStr;     //# nchan expression
+      casacore::String        itsMSName;
+      casacore::Table         itsMS;
+      casacore::Table         itsSelMS;         //# possible selection of spw, baseline
+      casacore::TableIterator itsIter;
+      casacore::String        itsDataColName;
+      casacore::String        itsWeightColName;
+      casacore::String        itsModelColName;
+      casacore::String        itsStartChanStr;  //# startchan expression
+      casacore::String        itsNrChanStr;     //# nchan expression
       string              itsSelBL;         //# Baseline selection string
       bool                itsReadVisData;   //# read visibility data?
       bool                itsNeedSort;      //# sort needed on time,baseline?
@@ -314,14 +314,14 @@ namespace LOFAR {
       double              itsLastMSTime;
       uint                itsNrRead;        //# nr of time slots read from MS
       uint                itsNrInserted;    //# nr of inserted time slots
-      casa::Slicer        itsColSlicer;     //# slice in corr,chan column
-      casa::Slicer        itsArrSlicer;     //# slice in corr,chan,bl array
+      casacore::Slicer        itsColSlicer;     //# slice in corr,chan column
+      casacore::Slicer        itsArrSlicer;     //# slice in corr,chan,bl array
       bool                itsHasFullResFlags;
       uint                itsFullResNChanAvg;
       uint                itsFullResNTimeAvg;
       DPBuffer            itsBuffer;
       UVWCalculator       itsUVWCalc;
-      casa::Vector<uint>  itsBaseRowNrs;    //# rownrs for meta of missing times
+      casacore::Vector<uint>  itsBaseRowNrs;    //# rownrs for meta of missing times
       FlagCounter         itsFlagCounter;
       NSTimer             itsTimer;
     };
diff --git a/CEP/DP3/DPPP/include/DPPP/MSUpdater.h b/CEP/DP3/DPPP/include/DPPP/MSUpdater.h
index 1ce92bdc62e..cd6237b2989 100644
--- a/CEP/DP3/DPPP/include/DPPP/MSUpdater.h
+++ b/CEP/DP3/DPPP/include/DPPP/MSUpdater.h
@@ -31,9 +31,9 @@
 #include <DPPP/StManParsetKeys.h>
 
 #include <Common/LofarTypes.h>
-#include <tables/Tables/ColumnDesc.h>
-#include <tables/Tables/RefRows.h>
-#include <tables/Tables/Table.h>
+#include <casacore/tables/Tables/ColumnDesc.h>
+#include <casacore/tables/Tables/RefRows.h>
+#include <casacore/tables/Tables/Table.h>
 
 namespace LOFAR {
 
@@ -55,7 +55,7 @@ namespace LOFAR {
     class MSUpdater: public DPStep
     {
     public:
-      MSUpdater (MSReader* reader, casa::String msName,
+      MSUpdater (MSReader* reader, casacore::String msName,
                 const ParameterSet& parset, const std::string& prefix,
                 bool writeHistory=true);
 
@@ -84,37 +84,37 @@ namespace LOFAR {
       // Tests if an update of the buffer described in info to the MS msName
       // is possible. When throwError is true, it will throw an error with a
       // descriptive string before returning false
-      static bool updateAllowed (const DPInfo& info, casa::String msName,
+      static bool updateAllowed (const DPInfo& info, casacore::String msName,
                                   bool throwError=true);
 
     private:
       // Write the flags at the given row numbers.
-      void putFlags (const casa::RefRows& rowNrs,
-                     const casa::Cube<bool>& flags);
+      void putFlags (const casacore::RefRows& rowNrs,
+                     const casacore::Cube<bool>& flags);
 
       // Write the weights at the given row numbers
-      void putWeights (const casa::RefRows& rowNrs,
-                       const casa::Cube<float>& weights);
+      void putWeights (const casacore::RefRows& rowNrs,
+                       const casacore::Cube<float>& weights);
 
       // Write the data at the given row numbers.
-      void putData (const casa::RefRows& rowNrs,
-                    const casa::Cube<casa::Complex>& data);
+      void putData (const casacore::RefRows& rowNrs,
+                    const casacore::Cube<casacore::Complex>& data);
 
       // If not existing yet, add the column specified by colname.
       // Column will containt arrays of type datatype.
       // If the column has been added, this function returns true
-      bool addColumn(const string& colname, const casa::DataType dataType,
-          const casa::ColumnDesc& cd);
+      bool addColumn(const string& colname, const casacore::DataType dataType,
+          const casacore::ColumnDesc& cd);
 
       //# Data members
       MSReader*    itsReader;
       string       itsName;
-      casa::String itsMSName;
-      casa::Table  itsMS;
+      casacore::String itsMSName;
+      casacore::Table  itsMS;
       const ParameterSet& itsParset;
       DPBuffer     itsBuffer;
-      casa::String itsDataColName;
-      casa::String itsWeightColName;
+      casacore::String itsDataColName;
+      casacore::String itsWeightColName;
       uint         itsNrTimesFlush; //# flush every N time slots (0=no flush)
       bool         itsWriteData;
       bool         itsWriteWeights;
diff --git a/CEP/DP3/DPPP/include/DPPP/MSWriter.h b/CEP/DP3/DPPP/include/DPPP/MSWriter.h
index bd98edff54e..49004f9d779 100644
--- a/CEP/DP3/DPPP/include/DPPP/MSWriter.h
+++ b/CEP/DP3/DPPP/include/DPPP/MSWriter.h
@@ -31,11 +31,11 @@
 #include <DPPP/MSReader.h>
 #include <DPPP/StManParsetKeys.h>
 
-#include <tables/Tables/Table.h>
-#include <tables/Tables/ColumnDesc.h>
-#include <tables/Tables/ScalarColumn.h>
-#include <tables/Tables/ArrayColumn.h>
-#include <tables/Tables/TiledColumnStMan.h>
+#include <casacore/tables/Tables/Table.h>
+#include <casacore/tables/Tables/ColumnDesc.h>
+#include <casacore/tables/Tables/ScalarColumn.h>
+#include <casacore/tables/Tables/ArrayColumn.h>
+#include <casacore/tables/DataMan/TiledColumnStMan.h>
 
 namespace LOFAR {
   class ParameterSet;
@@ -88,14 +88,14 @@ namespace LOFAR {
       virtual void showTimings (std::ostream&, double duration) const;
 
       // Write the parset info into the HISTORY table of the MS.
-      static void writeHistory (casa::Table& ms,
+      static void writeHistory (casacore::Table& ms,
                                 const ParameterSet& parset);
 
     private:
       // Create an array column description and add to table with given
       // stoage manager (if given).
-      void makeArrayColumn (casa::ColumnDesc desc, const casa::IPosition& shape,
-                            casa::DataManager* dm, casa::Table& table, bool makeDirectColumn = false);
+      void makeArrayColumn (casacore::ColumnDesc desc, const casacore::IPosition& shape,
+                            casacore::DataManager* dm, casacore::Table& table, bool makeDirectColumn = false);
 
       // Create the MS by cloning all subtables from the input MS.
       // All output columns in the main table are using normal storage managers.
@@ -113,54 +113,54 @@ namespace LOFAR {
       void updateField (const string& outName, const DPInfo& info);
 
       // Write the data, flags, etc.
-      void writeData (casa::Table& out, const DPBuffer& buf);
+      void writeData (casacore::Table& out, const DPBuffer& buf);
 
       // Write the full resolution flags (flags before any averaging).
-      void writeFullResFlags (casa::Table& out, const DPBuffer& buf);
+      void writeFullResFlags (casacore::Table& out, const DPBuffer& buf);
 
       // Write all meta data columns for a time slot (ANTENNA1, etc.)
-      void writeMeta (casa::Table& out, const DPBuffer& buf);
+      void writeMeta (casacore::Table& out, const DPBuffer& buf);
 
       // Copy meta data columns for a time slot (ANTENNA1, etc.)
       // It also copies all time info if possible.
-      void copyMeta (const casa::Table& in, casa::Table& out,
+      void copyMeta (const casacore::Table& in, casacore::Table& out,
                      bool copyTimeInfo);
 
       // Copy the contents of a scalar column.
       template<typename T> void fillSca (const T& value,
-                                         casa::Table& out,
-                                         const casa::String& columnName)
+                                         casacore::Table& out,
+                                         const casacore::String& columnName)
       {
-        casa::ScalarColumn<T>  outCol(out, columnName);
+        casacore::ScalarColumn<T>  outCol(out, columnName);
         outCol.fillColumn (value);
       }
 
       // Copy the contents of an array column.
-      template<typename T> void fillArr (const casa::Array<T>& value,
-                                         casa::Table& out,
-                                         const casa::String& columnName)
+      template<typename T> void fillArr (const casacore::Array<T>& value,
+                                         casacore::Table& out,
+                                         const casacore::String& columnName)
       {
-        casa::ArrayColumn<T> outCol(out, columnName);
+        casacore::ArrayColumn<T> outCol(out, columnName);
         outCol.fillColumn (value);
       }
 
       // Copy the contents of a scalar column.
-      template<typename T> void copySca (const casa::Table& in,
-                                         casa::Table& out,
-                                         const casa::String& columnName)
+      template<typename T> void copySca (const casacore::Table& in,
+                                         casacore::Table& out,
+                                         const casacore::String& columnName)
       {
-        casa::ROScalarColumn<T> inCol(in, columnName);
-        casa::ScalarColumn<T>  outCol(out, columnName);
+        casacore::ROScalarColumn<T> inCol(in, columnName);
+        casacore::ScalarColumn<T>  outCol(out, columnName);
         outCol.putColumn (inCol.getColumn());
       }
 
       // Copy the contents of an array column.
-      template<typename T> void copyArr (const casa::Table& in,
-                                         casa::Table& out,
-                                         const casa::String& columnName)
+      template<typename T> void copyArr (const casacore::Table& in,
+                                         casacore::Table& out,
+                                         const casacore::String& columnName)
       {
-        casa::ROArrayColumn<T> inCol(in, columnName);
-        casa::ArrayColumn<T>  outCol(out, columnName);
+        casacore::ROArrayColumn<T> inCol(in, columnName);
+        casacore::ArrayColumn<T>  outCol(out, columnName);
         outCol.putColumn (inCol.getColumn());
       }
 
@@ -169,10 +169,10 @@ namespace LOFAR {
       string          itsName;
       string          itsOutName;
       DPBuffer        itsBuffer;
-      casa::Table     itsMS;
+      casacore::Table     itsMS;
       const ParameterSet&   itsParset; //# parset for writing history
-      casa::String    itsDataColName;
-      casa::String    itsWeightColName;
+      casacore::String    itsDataColName;
+      casacore::String    itsWeightColName;
       double          itsInterval;
       bool            itsOverwrite;   //# Overwrite an existing output MS?
       bool            itsCopyCorrData;
diff --git a/CEP/DP3/DPPP/include/DPPP/MedFlagger.h b/CEP/DP3/DPPP/include/DPPP/MedFlagger.h
index 479ebcd204b..9b02b1c0f70 100644
--- a/CEP/DP3/DPPP/include/DPPP/MedFlagger.h
+++ b/CEP/DP3/DPPP/include/DPPP/MedFlagger.h
@@ -141,7 +141,7 @@ namespace LOFAR {
       double           itsMaxBLength;    //# maximum baseline length
       vector<double>   itsBLength;       //# length of each baseline
       vector<DPBuffer> itsBuf;
-      vector<casa::Cube<float> > itsAmpl; //# amplitudes of the data
+      vector<casacore::Cube<float> > itsAmpl; //# amplitudes of the data
       FlagCounter      itsFlagCounter;
       NSTimer          itsTimer;
       NSTimer          itsComputeTimer;  //# move/median timer
diff --git a/CEP/DP3/DPPP/include/DPPP/MultiMSReader.h b/CEP/DP3/DPPP/include/DPPP/MultiMSReader.h
index 3e9cd334279..e7ef4961790 100644
--- a/CEP/DP3/DPPP/include/DPPP/MultiMSReader.h
+++ b/CEP/DP3/DPPP/include/DPPP/MultiMSReader.h
@@ -31,9 +31,9 @@
 #include <DPPP/DPBuffer.h>
 #include <DPPP/UVWCalculator.h>
 #include <DPPP/FlagCounter.h>
-#include <tables/Tables/TableIter.h>
-#include <tables/Tables/RefRows.h>
-#include <casa/Arrays/Slicer.h>
+#include <casacore/tables/Tables/TableIter.h>
+#include <casacore/tables/Tables/RefRows.h>
+#include <casacore/casa/Arrays/Slicer.h>
 #include <Common/lofar_vector.h>
 
 namespace LOFAR {
@@ -155,18 +155,18 @@ namespace LOFAR {
       virtual void showTimings (std::ostream&, double duration) const;
 
       // Read the UVW at the given row numbers.
-      virtual void getUVW (const casa::RefRows& rowNrs,
+      virtual void getUVW (const casacore::RefRows& rowNrs,
                            double time,
                            DPBuffer& buf);
 
       // Read the weights at the given row numbers.
-      virtual void getWeights (const casa::RefRows& rowNrs,
+      virtual void getWeights (const casacore::RefRows& rowNrs,
                                DPBuffer& buf);
 
       // Read the FullRes flags (LOFAR_FULL_RES_FLAG) at the given row numbers.
       // It returns a 3-dim array [norigchan, ntimeavg, nbaseline].
       // If undefined, false is returned.
-      virtual bool getFullResFlags (const casa::RefRows& rowNrs,
+      virtual bool getFullResFlags (const casacore::RefRows& rowNrs,
                                     DPBuffer& buf);
 
       // Tell if the visibility data are to be read.
diff --git a/CEP/DP3/DPPP/include/DPPP/PhaseShift.h b/CEP/DP3/DPPP/include/DPPP/PhaseShift.h
index ec98944d4cc..94c3f9e9bec 100644
--- a/CEP/DP3/DPPP/include/DPPP/PhaseShift.h
+++ b/CEP/DP3/DPPP/include/DPPP/PhaseShift.h
@@ -29,7 +29,7 @@
 
 #include <DPPP/DPInput.h>
 #include <DPPP/DPBuffer.h>
-#include <casa/Arrays/Matrix.h>
+#include <casacore/casa/Arrays/Matrix.h>
 
 namespace LOFAR {
 
@@ -79,12 +79,12 @@ namespace LOFAR {
       virtual void showTimings (std::ostream&, double duration) const;
 
       // Fill the transformation matrix for given ra/dec.
-      static void fillTransMatrix (casa::Matrix<double>& mat,
+      static void fillTransMatrix (casacore::Matrix<double>& mat,
                                    double ra, double dec);
 
       // Get the phasors resulting from the last process step.
       // This is used in the Demixer.
-      const casa::Matrix<casa::DComplex>& getPhasors() const
+      const casacore::Matrix<casacore::DComplex>& getPhasors() const
         { return itsPhasors; }
 
       // Get the phase center.
@@ -94,7 +94,7 @@ namespace LOFAR {
     private:
       // Interpret the phase center specification.
       // Currently only J2000 RA and DEC can be given.
-      casa::MDirection handleCenter();
+      casacore::MDirection handleCenter();
       
       //# Data members.
       DPInput*             itsInput;
@@ -102,9 +102,9 @@ namespace LOFAR {
       DPBuffer             itsBuf;
       vector<string>       itsCenter;
       vector<double>       itsFreqC;      //# freq/C
-      casa::Matrix<double> itsMat1;       //# TT in phasehift.py
+      casacore::Matrix<double> itsMat1;       //# TT in phasehift.py
       double               itsXYZ[3];     //# numpy.dot((w-w1).T, T)
-      casa::Matrix<casa::DComplex> itsPhasors; //# phase factor per chan,bl
+      casacore::Matrix<casacore::DComplex> itsPhasors; //# phase factor per chan,bl
       NSTimer              itsTimer;
     };
 
diff --git a/CEP/DP3/DPPP/include/DPPP/PreFlagger.h b/CEP/DP3/DPPP/include/DPPP/PreFlagger.h
index 57f1cac32b2..9640841c933 100644
--- a/CEP/DP3/DPPP/include/DPPP/PreFlagger.h
+++ b/CEP/DP3/DPPP/include/DPPP/PreFlagger.h
@@ -31,7 +31,7 @@
 #include <DPPP/DPBuffer.h>
 #include <DPPP/BaselineSelection.h>
 #include <Common/lofar_vector.h>
-#include <measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MDirection.h>
 
 namespace LOFAR {
   class ParameterSet;
@@ -127,8 +127,8 @@ namespace LOFAR {
         PSet (DPInput*, const ParameterSet& parset, const string& prefix);
 
         // Set and return the flags.
-        casa::Cube<bool>* process (const DPBuffer&, DPBuffer&, uint timeSlot,
-                                   const casa::Block<bool>& matchBL,
+        casacore::Cube<bool>* process (const DPBuffer&, DPBuffer&, uint timeSlot,
+                                   const casacore::Block<bool>& matchBL,
                                    NSTimer& timer);
 
         // Update the general info.
@@ -151,7 +151,7 @@ namespace LOFAR {
 
         // Clear itsMatchBL for baselines with mismatching UV distances.
         // If returns false if no matches were found.
-        bool flagUV (const casa::Matrix<double>& uvw);
+        bool flagUV (const casacore::Matrix<double>& uvw);
 
         // Clear itsMatchBL for baselines with mismatching AzEl.
         // If returns false if no matches were found.
@@ -159,19 +159,19 @@ namespace LOFAR {
 
         // Test if azimuth or elevation of given antenna mismatches.
         // If so, clear itsMatchBL for all baselines containing the antenna.
-        void testAzEl (casa::MDirection::Convert& converter,
+        void testAzEl (casacore::MDirection::Convert& converter,
                        uint blnr, int ant,
                        const int* ant1, const int* ant2);
 
         // Set the flags based on amplitude threshold per correlation.
-        void flagAmpl (const casa::Cube<float>& amplitudes);
+        void flagAmpl (const casacore::Cube<float>& amplitudes);
 
         // Set the flags based on phase threshold per correlation.
-        void flagPhase (const casa::Cube<casa::Complex>& data);
+        void flagPhase (const casacore::Cube<casacore::Complex>& data);
 
         // Set the flags based on real/imaginary threshold per correlation.
-        void flagReal (const casa::Cube<casa::Complex>& data);
-        void flagImag (const casa::Cube<casa::Complex>& data);
+        void flagReal (const casacore::Cube<casacore::Complex>& data);
+        void flagImag (const casacore::Cube<casacore::Complex>& data);
 
         // Flag the channels given in itsChannels.
         void flagChannels();
@@ -205,15 +205,15 @@ namespace LOFAR {
 
         // Handle the frequency ranges given and determine which channels
         // have to be flagged.
-        casa::Vector<bool> handleFreqRanges
-        (const casa::Vector<double>& chanFreqs);
+        casacore::Vector<bool> handleFreqRanges
+        (const casacore::Vector<double>& chanFreqs);
 
         // Get the value and possible unit.
         // If no unit is given, the argument is left untouched.
-        void getValue (const string& str, double& value, casa::String& unit);
+        void getValue (const string& str, double& value, casacore::String& unit);
 
         // Get the frequency in Hz using the value and unit.
-        double getFreqHz (double value, const casa::String& unit);
+        double getFreqHz (double value, const casacore::String& unit);
 
         // Convert a PSet expression to Reversed Polish Notation in itsRpn.
         // It returns the names of all PSets.
@@ -236,7 +236,7 @@ namespace LOFAR {
         BaselineSelection  itsSelBL;
         double             itsMinUV;    //# minimum UV distance; <0 means ignore
         double             itsMaxUV;    //# maximum UV distance; <0 means ignore
-        casa::Matrix<bool> itsFlagBL;   //# true = flag baseline [i,j]
+        casacore::Matrix<bool> itsFlagBL;   //# true = flag baseline [i,j]
         vector<double>     itsAzimuth;  //# azimuth ranges to be flagged
         vector<double>     itsElevation;//# elevation ranges to be flagged
         vector<double>     itsTimes;    //# time of day ranges to be flagged
@@ -263,9 +263,9 @@ namespace LOFAR {
         vector<string>     itsStrElev;  //# elevation ranges to be flagged
         vector<int>         itsRpn;     //# PSet expression in RPN form
         vector<PSet::ShPtr> itsPSets;   //# PSets used in itsRpn
-        casa::Matrix<bool>  itsChanFlags; //# flags for channels to be flagged
-        casa::Cube<bool>    itsFlags;
-        casa::Block<bool>   itsMatchBL; //# true = baseline in buffer matches 
+        casacore::Matrix<bool>  itsChanFlags; //# flags for channels to be flagged
+        casacore::Cube<bool>    itsFlags;
+        casacore::Block<bool>   itsMatchBL; //# true = baseline in buffer matches 
       };
 
       // Set the flags in outPtr where inPtr matches mode.
diff --git a/CEP/DP3/DPPP/include/DPPP/Predict.h b/CEP/DP3/DPPP/include/DPPP/Predict.h
index 5783911e215..14b2c083322 100644
--- a/CEP/DP3/DPPP/include/DPPP/Predict.h
+++ b/CEP/DP3/DPPP/include/DPPP/Predict.h
@@ -35,10 +35,10 @@
 #include <DPPP/ModelComponent.h>
 #include <StationResponse/Station.h>
 #include <StationResponse/Types.h>
-#include <casa/Arrays/Cube.h>
-#include <casa/Quanta/MVEpoch.h>
-#include <measures/Measures/MEpoch.h>
-#include <casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/Quanta/MVEpoch.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
 #include <utility>
 
 namespace LOFAR {
@@ -96,8 +96,8 @@ namespace LOFAR {
       std::pair<double, double> getFirstDirection() const;
 
     private:
-      StationResponse::vector3r_t dir2Itrf (const casa::MDirection& dir,
-                                     casa::MDirection::Convert& measConverter);
+      StationResponse::vector3r_t dir2Itrf (const casacore::MDirection& dir,
+                                     casacore::MDirection::Convert& measConverter);
       void addBeamToData (Patch::ConstPtr patch, double time,
                                    const StationResponse::vector3r_t& refdir,
                                    const StationResponse::vector3r_t& tiledir,
@@ -128,12 +128,12 @@ namespace LOFAR {
       vector<int>      itsUVWSplitIndex;
 
       // UVW coordinates per station (3 coordinates per station)
-      casa::Matrix<double>   itsUVW;
+      casacore::Matrix<double>   itsUVW;
 
       // The info needed to calculate the station beams.
       vector<vector<StationResponse::Station::Ptr> > itsAntBeamInfo;
-      vector<casa::MeasFrame>                       itsMeasFrames;
-      vector<casa::MDirection::Convert>             itsMeasConverters;
+      vector<casacore::MeasFrame>                       itsMeasFrames;
+      vector<casacore::MDirection::Convert>             itsMeasConverters;
       vector<vector<StationResponse::matrix22c_t> > itsBeamValues;
       ApplyBeam::BeamMode                           itsBeamMode;
 
@@ -141,8 +141,8 @@ namespace LOFAR {
       vector<Patch::ConstPtr> itsPatchList;
       vector<Source> itsSourceList;
 
-      vector<casa::Cube<dcomplex> > itsModelVis; // one for every thread
-      vector<casa::Cube<dcomplex> > itsModelVisPatch;
+      vector<casacore::Cube<dcomplex> > itsModelVis; // one for every thread
+      vector<casacore::Cube<dcomplex> > itsModelVisPatch;
 
       NSTimer          itsTimer;
       NSTimer          itsTimerPredict;
diff --git a/CEP/DP3/DPPP/include/DPPP/ScaleData.h b/CEP/DP3/DPPP/include/DPPP/ScaleData.h
index 4286f9deb48..0e5504ba587 100644
--- a/CEP/DP3/DPPP/include/DPPP/ScaleData.h
+++ b/CEP/DP3/DPPP/include/DPPP/ScaleData.h
@@ -29,7 +29,7 @@
 
 #include <DPPP/DPInput.h>
 #include <DPPP/DPBuffer.h>
-#include <casa/Arrays/Cube.h>
+#include <casacore/casa/Arrays/Cube.h>
 
 namespace LOFAR {
 
@@ -90,7 +90,7 @@ namespace LOFAR {
       vector<string>     itsStationExp;  // station regex strings
       vector<string>     itsCoeffStr;    // coeff per station regex
       vector<vector<double> > itsStationFactors; // scale factor per station,freq
-      casa::Cube<double> itsFactors;     // scale factor per baseline,freq,pol
+      casacore::Cube<double> itsFactors;     // scale factor per baseline,freq,pol
       NSTimer            itsTimer;
     };
 
diff --git a/CEP/DP3/DPPP/include/DPPP/Simulate.h b/CEP/DP3/DPPP/include/DPPP/Simulate.h
index 7a483f699dd..d0394101923 100644
--- a/CEP/DP3/DPPP/include/DPPP/Simulate.h
+++ b/CEP/DP3/DPPP/include/DPPP/Simulate.h
@@ -57,15 +57,15 @@ namespace DPPP
   // are relative to it using the baseline UVWs.
   // Also note that nr of groups can be derived from the size of the returned
   // vector (because it contains no entry for the first antenna in a group).
-  vector<int> nsetupSplitUVW (uint nant, const casa::Vector<int>& ant1,
-                              const casa::Vector<int>& ant2);
+  vector<int> nsetupSplitUVW (uint nant, const casacore::Vector<int>& ant1,
+                              const casacore::Vector<int>& ant2);
 
   // Do the actual splitting of baseline UVWs into station UVWs using
   // the index vector generated by setupSplitUVW.
   void nsplitUVW (const vector<int>& blindex,
                   const vector<Baseline>& baselines,
-                  const casa::Matrix<double>& uvwbl,
-                  casa::Matrix<double>& uvwant);
+                  const casacore::Matrix<double>& uvwbl,
+                  casacore::Matrix<double>& uvwant);
 
 // Split baseline UVW coordinates into station UVW coordinates (by assuming the
 // station with index 0 has UVW coordinates of (0, 0, 0)).
diff --git a/CEP/DP3/DPPP/include/DPPP/Simulator.h b/CEP/DP3/DPPP/include/DPPP/Simulator.h
index 187b88badc6..139ad1cd036 100644
--- a/CEP/DP3/DPPP/include/DPPP/Simulator.h
+++ b/CEP/DP3/DPPP/include/DPPP/Simulator.h
@@ -33,9 +33,9 @@
 #include <DPPP/ModelComponentVisitor.h>
 #include <DPPP/Position.h>
 
-#include <casa/Arrays/Vector.h>
-#include <casa/Arrays/Matrix.h>
-#include <casa/Arrays/Cube.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Matrix.h>
+#include <casacore/casa/Arrays/Cube.h>
 
 #include <Common/lofar_complex.h>
 #include <Common/lofar_vector.h>
@@ -52,9 +52,9 @@ class Simulator: public ModelComponentVisitor
 {
 public:
     Simulator(const Position &reference, size_t nStation, size_t nBaseline,
-        size_t nChannel, const casa::Vector<Baseline>& baselines,
-        const casa::Vector<double>& freq, const casa::Matrix<double>& uvw,
-        casa::Cube<dcomplex>& buffer, bool stokesIOnly=false);
+        size_t nChannel, const casacore::Vector<Baseline>& baselines,
+        const casacore::Vector<double>& freq, const casacore::Matrix<double>& uvw,
+        casacore::Cube<dcomplex>& buffer, bool stokesIOnly=false);
 
     void simulate(const ModelComponent::ConstPtr &component);
 
@@ -66,12 +66,12 @@ private:
     Position                     itsReference;
     size_t                       itsNStation, itsNBaseline, itsNChannel;
     bool                         itsStokesIOnly;
-    const casa::Vector<Baseline> itsBaselines;
-    const casa::Vector<double>   itsFreq;
-    const casa::Matrix<double>   itsUVW;
-    casa::Cube<dcomplex>         itsBuffer;
-    casa::Matrix<dcomplex>       itsShiftBuffer;
-    casa::Matrix<dcomplex>       itsSpectrumBuffer;
+    const casacore::Vector<Baseline> itsBaselines;
+    const casacore::Vector<double>   itsFreq;
+    const casacore::Matrix<double>   itsUVW;
+    casacore::Cube<dcomplex>         itsBuffer;
+    casacore::Matrix<dcomplex>       itsShiftBuffer;
+    casacore::Matrix<dcomplex>       itsSpectrumBuffer;
 };
 
 // @}
diff --git a/CEP/DP3/DPPP/include/DPPP/StManParsetKeys.h b/CEP/DP3/DPPP/include/DPPP/StManParsetKeys.h
index f513e128b07..b9849826eb8 100644
--- a/CEP/DP3/DPPP/include/DPPP/StManParsetKeys.h
+++ b/CEP/DP3/DPPP/include/DPPP/StManParsetKeys.h
@@ -5,13 +5,13 @@
 
 #include <string>
 
-#include <casa/Containers/Record.h>
+#include <casacore/casa/Containers/Record.h>
 
 namespace LOFAR {
   namespace DPPP {
     struct StManParsetKeys
     {
-      casa::String    stManName;
+      casacore::String    stManName;
       uint            dyscoDataBitRate;     //# Bits per data float, or 0 if data column is not compressed
       uint            dyscoWeightBitRate;   //# Bits per weight float, or 0 if weight column is not compressed
       std::string     dyscoDistribution;    //# Distribution assumed for compression; e.g. "Uniform" or "TruncatedGaussian"
@@ -36,9 +36,9 @@ namespace LOFAR {
         }
       }
       
-      casa::Record GetDyscoSpec() const
+      casacore::Record GetDyscoSpec() const
       {
-        casa::Record dyscoSpec;
+        casacore::Record dyscoSpec;
         dyscoSpec.define ("distribution", dyscoDistribution);
         dyscoSpec.define ("normalization", dyscoNormalization);
         dyscoSpec.define ("distributionTruncation", dyscoDistTruncation);
diff --git a/CEP/DP3/DPPP/include/DPPP/StationAdder.h b/CEP/DP3/DPPP/include/DPPP/StationAdder.h
index 76da17c464a..dd0dbf499b2 100644
--- a/CEP/DP3/DPPP/include/DPPP/StationAdder.h
+++ b/CEP/DP3/DPPP/include/DPPP/StationAdder.h
@@ -31,7 +31,7 @@
 #include <DPPP/DPBuffer.h>
 #include <DPPP/UVWCalculator.h>
 #include <Common/ParameterRecord.h>
-#include <measures/Measures/MPosition.h>
+#include <casacore/measures/Measures/MPosition.h>
 
 namespace LOFAR {
   class ParameterSet;
@@ -93,13 +93,13 @@ namespace LOFAR {
       // way first a broad pattern can be given, which can be narrowed down.
       // A warning is given if a pattern does not match any station name.
       static vector<int> getMatchingStations
-      (const casa::Vector<casa::String>& antennaNames,
+      (const casacore::Vector<casacore::String>& antennaNames,
        const vector<string>& patterns);
 
     private:
       // Update the beam info subtables.
       void updateBeamInfo (const string& msName, uint origNant,
-                           casa::Table& antTab);
+                           casacore::Table& antTab);
 
       //# Data members.
       DPInput*        itsInput;
@@ -107,7 +107,7 @@ namespace LOFAR {
       DPBuffer        itsBuf;
       DPBuffer        itsBufTmp;
       ParameterRecord itsStatRec;     // stations definitions
-      vector<casa::Vector<int> > itsParts;  // the stations in each superstation
+      vector<casacore::Vector<int> > itsParts;  // the stations in each superstation
       vector<vector<int> > itsBufRows; // old baseline rows in each new baseline
       uint            itsMinNPoint  ;  // flag data if too few unflagged data
       bool            itsMakeAutoCorr; // also form new auto-correlations?
diff --git a/CEP/DP3/DPPP/include/DPPP/StefCal.h b/CEP/DP3/DPPP/include/DPPP/StefCal.h
index 51e1c8203f1..f2d3f19d3f3 100644
--- a/CEP/DP3/DPPP/include/DPPP/StefCal.h
+++ b/CEP/DP3/DPPP/include/DPPP/StefCal.h
@@ -26,8 +26,8 @@
 
 // @file
 // @brief DPPP step class to apply a calibration correction to the data
-#include <casa/Arrays/Cube.h>
-#include <casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
 
 namespace LOFAR {
 
@@ -59,7 +59,7 @@ namespace LOFAR {
       // Returns the solution. The return matrix has a length of maxAntennas,
       // which is zero for antennas for which no solution was computed.
       // The mapping is stored in the antenna map
-      casa::Matrix<casa::DComplex> getSolution(bool setNaNs);
+      casacore::Matrix<casacore::DComplex> getSolution(bool setNaNs);
 
       double getWeight() {
         return _totalWeight;
@@ -69,16 +69,16 @@ namespace LOFAR {
       void incrementWeight(float weight);
 
       // Returns a reference to the visibility matrix
-      casa::Array<casa::DComplex>& getVis() {
+      casacore::Array<casacore::DComplex>& getVis() {
         return _vis;
       }
 
       // Returns a reference to the model visibility matrix
-      casa::Array<casa::DComplex>& getMVis() {
+      casacore::Array<casacore::DComplex>& getMVis() {
         return _mvis;
       }
 
-      casa::Vector<bool>& getStationFlagged() {
+      casacore::Vector<bool>& getStationFlagged() {
         return _stationFlagged;
       }
 
@@ -108,15 +108,15 @@ namespace LOFAR {
       double getAverageUnflaggedSolution();
 
       uint _savedNCr;
-      casa::Vector<bool> _stationFlagged ; // Contains true for totally flagged stations
-      casa::Array<casa::DComplex> _vis; // Visibility matrix
-      casa::Array<casa::DComplex> _mvis; // Model visibility matrix
-      casa::Matrix<casa::DComplex> _g; // Solution, indexed by station, correlation
-      casa::Matrix<casa::DComplex> _gx; // Previous solution
-      casa::Matrix<casa::DComplex> _gxx; // Solution before previous solution
-      casa::Matrix<casa::DComplex> _gold; // Previous solution
-      casa::Matrix<casa::DComplex> _h; // Hermitian transpose of previous solution
-      casa::Matrix<casa::DComplex> _z; // Internal stefcal vector
+      casacore::Vector<bool> _stationFlagged ; // Contains true for totally flagged stations
+      casacore::Array<casacore::DComplex> _vis; // Visibility matrix
+      casacore::Array<casacore::DComplex> _mvis; // Model visibility matrix
+      casacore::Matrix<casacore::DComplex> _g; // Solution, indexed by station, correlation
+      casacore::Matrix<casacore::DComplex> _gx; // Previous solution
+      casacore::Matrix<casacore::DComplex> _gxx; // Solution before previous solution
+      casacore::Matrix<casacore::DComplex> _gold; // Previous solution
+      casacore::Matrix<casacore::DComplex> _h; // Hermitian transpose of previous solution
+      casacore::Matrix<casacore::DComplex> _z; // Internal stefcal vector
 
       uint _nSt; // number of stations in the current solution
       uint _nUn; // number of unknowns
diff --git a/CEP/DP3/DPPP/include/DPPP/UVWFlagger.h b/CEP/DP3/DPPP/include/DPPP/UVWFlagger.h
index 831bd329c53..e6490910d59 100644
--- a/CEP/DP3/DPPP/include/DPPP/UVWFlagger.h
+++ b/CEP/DP3/DPPP/include/DPPP/UVWFlagger.h
@@ -110,7 +110,7 @@ namespace LOFAR {
       string               itsName;
       DPBuffer             itsBuffer;
       uint                 itsNTimes;
-      casa::Vector<double> itsRecWavel; //# reciprokes of wavelengths
+      casacore::Vector<double> itsRecWavel; //# reciprokes of wavelengths
       vector<double>       itsRangeUVm; //# UV ranges (in m) to be flagged
       vector<double>       itsRangeUm;  //# U  ranges (in m) to be flagged
       vector<double>       itsRangeVm;  //# V  ranges (in m) to be flagged
diff --git a/CEP/DP3/DPPP/src/ApplyBeam.cc b/CEP/DP3/DPPP/src/ApplyBeam.cc
index 8d1484bb1a0..42d07008d99 100644
--- a/CEP/DP3/DPPP/src/ApplyBeam.cc
+++ b/CEP/DP3/DPPP/src/ApplyBeam.cc
@@ -34,12 +34,12 @@
 #include <DPPP/FlagCounter.h>
 #include <DPPP/Position.h>
 
-#include <casa/Arrays/Array.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Quanta/Quantum.h>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MEpoch.h>
-#include <measures/Measures/MeasConvert.h>
+#include <casacore/casa/Arrays/Array.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/measures/Measures/MeasConvert.h>
 
 #include <stddef.h>
 #include <string>
@@ -47,7 +47,7 @@
 #include <utility>
 #include <vector>
 
-using namespace casa;
+using namespace casacore;
 using namespace LOFAR::BBS;
 
 namespace LOFAR {
diff --git a/CEP/DP3/DPPP/src/ApplyCal.cc b/CEP/DP3/DPPP/src/ApplyCal.cc
index 456a58fa935..66d5f1a8af6 100644
--- a/CEP/DP3/DPPP/src/ApplyCal.cc
+++ b/CEP/DP3/DPPP/src/ApplyCal.cc
@@ -29,12 +29,12 @@
 #include <Common/ParameterSet.h>
 #include <Common/StringUtil.h>
 #include <Common/LofarLogger.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/OS/File.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/OS/File.h>
 #include <iostream>
 #include <iomanip>
 
-using namespace casa;
+using namespace casacore;
 using namespace LOFAR::BBS;
 
 /// Look at BBSKernel MeasurementExprLOFARUtil.cc and Apply.cc
@@ -447,14 +447,14 @@ namespace LOFAR {
           }
           else if (itsCorrectType=="clock") {
             itsParms(0, ant, tf)=polar(1.,
-                parmvalues[0][ant][tf] * freq * casa::C::_2pi);
+                parmvalues[0][ant][tf] * freq * casacore::C::_2pi);
             if (itsParmExprs.size() == 1) { // No Clock:0, only Clock:
               itsParms(1, ant, tf)=polar(1.,
-                  parmvalues[0][ant][tf] * freq * casa::C::_2pi);
+                  parmvalues[0][ant][tf] * freq * casacore::C::_2pi);
             }
             else { // Clock:0 and Clock:1
               itsParms(1, ant, tf)=polar(1.,
-                  parmvalues[1][ant][tf] * freq * casa::C::_2pi);
+                  parmvalues[1][ant][tf] * freq * casacore::C::_2pi);
             }
           }
           else if (itsCorrectType=="rotationangle") {
@@ -470,7 +470,7 @@ namespace LOFAR {
             itsParms(3, ant, tf) =  cosv;
           }
           else if (itsCorrectType=="rotationmeasure") {
-            double lambda2 = casa::C::c / freq;
+            double lambda2 = casacore::C::c / freq;
             lambda2 *= lambda2;
             double chi = parmvalues[0][ant][tf] * lambda2;
             if (itsInvert) {
diff --git a/CEP/DP3/DPPP/src/Averager.cc b/CEP/DP3/DPPP/src/Averager.cc
index b1f739fa3b6..92b43124e39 100644
--- a/CEP/DP3/DPPP/src/Averager.cc
+++ b/CEP/DP3/DPPP/src/Averager.cc
@@ -27,13 +27,13 @@
 #include <DPPP/DPInfo.h>
 #include <Common/ParameterSet.h>
 #include <Common/LofarLogger.h>
-#include <casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
 #include <Common/StringUtil.h>
 
 #include <iostream>
 #include <iomanip>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/BaselineSelection.cc b/CEP/DP3/DPPP/src/BaselineSelection.cc
index 1a98c9c33da..085a6cf0e85 100644
--- a/CEP/DP3/DPPP/src/BaselineSelection.cc
+++ b/CEP/DP3/DPPP/src/BaselineSelection.cc
@@ -31,7 +31,7 @@
 #include <Common/StringUtil.h>
 #include <Common/StreamUtil.h>
 
-using namespace casa;
+using namespace casacore;
 using namespace std;
 
 namespace LOFAR {
diff --git a/CEP/DP3/DPPP/src/Counter.cc b/CEP/DP3/DPPP/src/Counter.cc
index 771580217e1..7f25db6c9e9 100644
--- a/CEP/DP3/DPPP/src/Counter.cc
+++ b/CEP/DP3/DPPP/src/Counter.cc
@@ -27,7 +27,7 @@
 #include <Common/ParameterSet.h>
 #include <iostream>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/DPBuffer.cc b/CEP/DP3/DPPP/src/DPBuffer.cc
index 3d845e45d26..27f2c9a2e78 100644
--- a/CEP/DP3/DPPP/src/DPBuffer.cc
+++ b/CEP/DP3/DPPP/src/DPBuffer.cc
@@ -23,7 +23,7 @@
 
 #include <DPPP/DPBuffer.h>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/DPInfo.cc b/CEP/DP3/DPPP/src/DPInfo.cc
index 3d46c374994..03578710ea5 100644
--- a/CEP/DP3/DPPP/src/DPInfo.cc
+++ b/CEP/DP3/DPPP/src/DPInfo.cc
@@ -25,13 +25,13 @@
 #include <DPPP/DPInfo.h>
 #include <DPPP/DPInput.h>
 #include <Common/LofarLogger.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MCPosition.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/ArrayIO.h>
-#include <casa/Containers/ContainerIO.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MCPosition.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/ArrayIO.h>
+#include <casacore/casa/BasicSL/STLIO.h>
 
-using namespace casa;
+using namespace casacore;
 using namespace std;
 
 namespace LOFAR {
diff --git a/CEP/DP3/DPPP/src/DPInput.cc b/CEP/DP3/DPPP/src/DPInput.cc
index 1a677f9c87c..93a19b23e55 100644
--- a/CEP/DP3/DPPP/src/DPInput.cc
+++ b/CEP/DP3/DPPP/src/DPInput.cc
@@ -24,12 +24,12 @@
 #include <lofar_config.h>
 #include <DPPP/DPInput.h>
 #include <Common/Exception.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MPosition.h>
-#include <measures/Measures/MCPosition.h>
-#include <casa/Utilities/Copy.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MPosition.h>
+#include <casacore/measures/Measures/MCPosition.h>
+#include <casacore/casa/Utilities/Copy.h>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -37,7 +37,7 @@ namespace LOFAR {
     DPInput::~DPInput()
     {}
 
-    casa::String DPInput::msName() const
+    casacore::String DPInput::msName() const
     {
       return String();
     }
diff --git a/CEP/DP3/DPPP/src/DPRun.cc b/CEP/DP3/DPPP/src/DPRun.cc
index 1babeee7186..213a0e7c3f2 100644
--- a/CEP/DP3/DPPP/src/DPRun.cc
+++ b/CEP/DP3/DPPP/src/DPRun.cc
@@ -50,10 +50,10 @@
 #include <Common/StreamUtil.h>
 #include <Common/OpenMP.h>
 
-#include <casa/OS/Path.h>
-#include <casa/OS/DirectoryIterator.h>
-#include <casa/OS/Timer.h>
-#include <casa/OS/DynLib.h>
+#include <casacore/casa/OS/Path.h>
+#include <casacore/casa/OS/DirectoryIterator.h>
+#include <casacore/casa/OS/Timer.h>
+#include <casacore/casa/OS/DynLib.h>
 
 namespace LOFAR {
   namespace DPPP {
@@ -83,7 +83,7 @@ namespace LOFAR {
         libname = libname.substr (0, pos);
       }
       // Try to load and initialize the dynamic library.
-      casa::DynLib dl(libname, string("libdppp_"), "register_"+libname, false);
+      casacore::DynLib dl(libname, string("libdppp_"), "register_"+libname, false);
       if (dl.getHandle()) {
         // See if registered now.
         iter = theirStepMap.find (type);
@@ -99,7 +99,7 @@ namespace LOFAR {
 
     void DPRun::execute (const string& parsetName, int argc, char* argv[])
     {
-      casa::Timer timer;
+      casacore::Timer timer;
       NSTimer nstimer;
       nstimer.start();
       ParameterSet parset;
@@ -243,12 +243,12 @@ namespace LOFAR {
         if (inNames[0].find_first_of ("*?{['") != string::npos) {
           vector<string> names;
           names.reserve (80);
-          casa::Path path(inNames[0]);
-          casa::String dirName(path.dirName());
-          casa::Directory dir(dirName);
+          casacore::Path path(inNames[0]);
+          casacore::String dirName(path.dirName());
+          casacore::Directory dir(dirName);
           // Use the basename as the file name pattern.
-          casa::DirectoryIterator dirIter (dir,
-                                           casa::Regex::fromPattern(path.baseName()));
+          casacore::DirectoryIterator dirIter (dir,
+                                           casacore::Regex::fromPattern(path.baseName()));
           while (!dirIter.pastEnd()) {
             names.push_back (dirName + '/' + dirIter.name());
             dirIter++;
@@ -270,8 +270,8 @@ namespace LOFAR {
       } else {
         reader = new MultiMSReader (inNames, parset, "msin.");
       }
-      casa::Path pathIn (reader->msName());
-      casa::String currentMSName (pathIn.absoluteName());
+      casacore::Path pathIn (reader->msName());
+      casacore::String currentMSName (pathIn.absoluteName());
 
       // Create the other steps.
       firstStep = DPStep::ShPtr (reader);
@@ -352,10 +352,10 @@ namespace LOFAR {
                                          const ParameterSet& parset,
                                          const string& prefix,
                                          bool multipleInputs,
-                                         casa::String& currentMSName)
+                                         casacore::String& currentMSName)
     {
       DPStep::ShPtr step;
-      casa::String outName;
+      casacore::String outName;
       bool doUpdate = false;
       if (prefix == "msout.") {
         // The last output step.
@@ -373,7 +373,7 @@ namespace LOFAR {
         outName  = currentMSName;
         doUpdate = true;
       } else {
-        casa::Path pathOut(outName);
+        casacore::Path pathOut(outName);
         if (currentMSName == pathOut.absoluteName()) {
           outName  = currentMSName;
           doUpdate = true;
@@ -391,7 +391,7 @@ namespace LOFAR {
         step = DPStep::ShPtr(new MSWriter (reader, outName, parset, prefix));
         reader->setReadVisData (true);
       }
-      casa::Path pathOut(outName);
+      casacore::Path pathOut(outName);
       currentMSName = pathOut.absoluteName();
       return step;
     }
diff --git a/CEP/DP3/DPPP/src/DemixInfo.cc b/CEP/DP3/DPPP/src/DemixInfo.cc
index 1cecb61fb97..dae5fdbd1c1 100644
--- a/CEP/DP3/DPPP/src/DemixInfo.cc
+++ b/CEP/DP3/DPPP/src/DemixInfo.cc
@@ -32,11 +32,11 @@
 #include <Common/StreamUtil.h>
 #include <Common/OpenMP.h>
 
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MCDirection.h>
-#include <measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/measures/Measures/MeasConvert.h>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -90,7 +90,7 @@ namespace LOFAR {
       }
       // Get delta in arcsec and take cosine of it (convert to radians first).
       double delta = parset.getDouble (prefix+"target.delta", 60.);
-      itsCosTargetDelta = cos (delta / 3600. * casa::C::pi / 180.);
+      itsCosTargetDelta = cos (delta / 3600. * casacore::C::pi / 180.);
       ASSERTSTR (!(itsTargetModelName.empty() || itsDemixModelName.empty()),
                  "An empty name is given for a sky model");
       // If the estimate source model is given, read it.
@@ -320,7 +320,7 @@ namespace LOFAR {
       os << "  ateam.threshold:    " << itsAteamAmplThreshold << endl;
       os << "  target.threshold:   " << itsTargetAmplThreshold << endl;
       os << "  target.delta:       "
-         << acos(itsCosTargetDelta) * 3600. / casa::C::pi * 180.
+         << acos(itsCosTargetDelta) * 3600. / casacore::C::pi * 180.
          << " arcsec" << endl;
       os << "  distance.threshold: " << itsAngdistThreshold << " deg" << endl;
       os << "  distance.reffreq:   " << itsAngdistRefFreq << " Hz" << endl;
@@ -401,9 +401,9 @@ namespace LOFAR {
           case BBS::SourceInfo::GAUSSIAN:
             {
               GaussianSource::Ptr gauss(new GaussianSource(position, stokes));
-              const double deg2rad = (casa::C::pi / 180.0);
+              const double deg2rad = (casacore::C::pi / 180.0);
               gauss->setPositionAngle(src.getOrientation() * deg2rad);
-              const double arcsec2rad = (casa::C::pi / 3600.0) / 180.0;
+              const double arcsec2rad = (casacore::C::pi / 3600.0) / 180.0;
               gauss->setMajorAxis(src.getMajorAxis() * arcsec2rad);
               gauss->setMinorAxis(src.getMinorAxis() * arcsec2rad);
               source = gauss;
diff --git a/CEP/DP3/DPPP/src/DemixWorker.cc b/CEP/DP3/DPPP/src/DemixWorker.cc
index ac7dd64be59..132cc073e8b 100644
--- a/CEP/DP3/DPPP/src/DemixWorker.cc
+++ b/CEP/DP3/DPPP/src/DemixWorker.cc
@@ -49,24 +49,24 @@
 #include <Common/lofar_iostream.h>
 #include <Common/lofar_fstream.h>
 
-#include <casa/Quanta/MVAngle.h>
-#include <casa/Quanta/MVEpoch.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Arrays/Matrix.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/ArrayIO.h>
-#include <casa/Arrays/MatrixMath.h>
-#include <casa/Arrays/MatrixIter.h>
-#include <casa/Containers/Record.h>
-#include <scimath/Mathematics/MatrixMathLA.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MCDirection.h>
-#include <measures/Measures/MEpoch.h>
-#include <measures/Measures/MeasureHolder.h>
+#include <casacore/casa/Quanta/MVAngle.h>
+#include <casacore/casa/Quanta/MVEpoch.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Matrix.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/ArrayIO.h>
+#include <casacore/casa/Arrays/MatrixMath.h>
+#include <casacore/casa/Arrays/MatrixIter.h>
+#include <casacore/casa/Containers/Record.h>
+#include <casacore/scimath/Mathematics/MatrixMathLA.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/measures/Measures/MeasureHolder.h>
 
 #include <sstream>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/Demixer.cc b/CEP/DP3/DPPP/src/Demixer.cc
index ea208586d15..1ab55014f84 100644
--- a/CEP/DP3/DPPP/src/Demixer.cc
+++ b/CEP/DP3/DPPP/src/Demixer.cc
@@ -51,14 +51,14 @@
 #include <Common/lofar_iostream.h>
 #include <Common/lofar_fstream.h>
 
-#include <casa/Quanta/MVAngle.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Arrays/Matrix.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/MatrixMath.h>
-#include <scimath/Mathematics/MatrixMathLA.h>
+#include <casacore/casa/Quanta/MVAngle.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Matrix.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/MatrixMath.h>
+#include <casacore/scimath/Mathematics/MatrixMathLA.h>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -287,8 +287,8 @@ namespace LOFAR {
       }
 
       // Prepare conversion from relative to absolute UVW
-      casa::Vector<casa::Int> newAnt1(itsNBl);
-      casa::Vector<casa::Int> newAnt2(itsNBl);
+      casacore::Vector<casacore::Int> newAnt1(itsNBl);
+      casacore::Vector<casacore::Int> newAnt2(itsNBl);
       for (uint i=0; i<itsNBl; ++i) {
         newAnt1[i]=antennaMap[infoSel.getAnt1()[i]];
         newAnt2[i]=antennaMap[infoSel.getAnt2()[i]];
@@ -832,9 +832,9 @@ namespace LOFAR {
       struct ThreadPrivateStorage
       {
         vector<double>                unknowns;
-        casa::Matrix<double>          uvw;
-        vector<casa::Cube<dcomplex> > model;
-        casa::Cube<dcomplex>          model_subtr;
+        casacore::Matrix<double>          uvw;
+        vector<casacore::Cube<dcomplex> > model;
+        casacore::Cube<dcomplex>          model_subtr;
         size_t                        count_converged;
       };
 
diff --git a/CEP/DP3/DPPP/src/DemixerNew.cc b/CEP/DP3/DPPP/src/DemixerNew.cc
index aa39ad2e907..e4024c203d0 100644
--- a/CEP/DP3/DPPP/src/DemixerNew.cc
+++ b/CEP/DP3/DPPP/src/DemixerNew.cc
@@ -36,9 +36,9 @@
 #include <Common/lofar_iostream.h>
 #include <Common/lofar_iomanip.h>
 
-#include <casa/Arrays/ArrayPartMath.h>
+#include <casacore/casa/Arrays/ArrayPartMath.h>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/EstimateMixed.cc b/CEP/DP3/DPPP/src/EstimateMixed.cc
index 08247d3b706..b2eb4218e61 100644
--- a/CEP/DP3/DPPP/src/EstimateMixed.cc
+++ b/CEP/DP3/DPPP/src/EstimateMixed.cc
@@ -26,7 +26,7 @@
 #include <lofar_config.h>
 #include <DPPP/EstimateMixed.h>
 #include <Common/LofarLogger.h>
-#include <scimath/Fitting/LSQFit.h>
+#include <casacore/scimath/Fitting/LSQFit.h>
 #include <Common/StreamUtil.h> ///
 
 namespace LOFAR
@@ -78,7 +78,7 @@ bool estimate(size_t nDirection, size_t nStation, size_t nBaseline,
 
     // Initialize LSQ solver.
     const size_t nUnknowns = nDirection * nStation * 4 * 2;
-    casa::LSQFit solver(nUnknowns);
+    casacore::LSQFit solver(nUnknowns);
 
     // Each visibility provides information about two (complex) unknowns per
     // station per direction. A visibility is measured by a specific
@@ -317,7 +317,7 @@ bool estimate(size_t nDirection, size_t nStation, size_t nBaseline,
         baselines -= nBaseline;
 
         // Perform LSQ iteration.
-        casa::uInt rank;
+        casacore::uInt rank;
         bool status = solver.solveLoop(rank, unknowns, true);
         ASSERT(status);
         if (sh) {
@@ -332,8 +332,8 @@ bool estimate(size_t nDirection, size_t nStation, size_t nBaseline,
         ++nIterations;
     }
 
-    const bool converged = (solver.isReady() == casa::LSQFit::SOLINCREMENT
-        || solver.isReady() == casa::LSQFit::DERIVLEVEL);
+    const bool converged = (solver.isReady() == casacore::LSQFit::SOLINCREMENT
+        || solver.isReady() == casacore::LSQFit::DERIVLEVEL);
     return converged;
 }
 
diff --git a/CEP/DP3/DPPP/src/EstimateNew.cc b/CEP/DP3/DPPP/src/EstimateNew.cc
index befb9b58130..ac7c073a312 100644
--- a/CEP/DP3/DPPP/src/EstimateNew.cc
+++ b/CEP/DP3/DPPP/src/EstimateNew.cc
@@ -25,7 +25,7 @@
 #include <Common/LofarLogger.h>
 #include <Common/StreamUtil.h> ///
 
-#include <scimath/Fitting/LSQFit.h>
+#include <casacore/scimath/Fitting/LSQFit.h>
 
 
 namespace LOFAR {
@@ -211,7 +211,7 @@ namespace LOFAR {
         cout<<"unkindex="<<unknownsIndex<<endl;
       }
       // Initialize LSQ solver.
-      casa::LSQFit solver(nUnknowns);
+      casacore::LSQFit solver(nUnknowns);
       // Iterate until convergence.
       itsNrIter = 0;
       while (!solver.isReady()  &&  itsNrIter < itsMaxIter) {
@@ -453,7 +453,7 @@ namespace LOFAR {
         baselines -= itsNrBaselines;
 
         // Perform LSQ iteration.
-        casa::uInt rank;
+        casacore::uInt rank;
         bool status = solver.solveLoop(rank, &(itsUnknowns[0]), true);
         ASSERT(status);
         // Copy the unknowns to the full solution.
@@ -465,8 +465,8 @@ namespace LOFAR {
         // Update iteration count.
         itsNrIter++;
       }
-      bool converged = (solver.isReady() == casa::LSQFit::SOLINCREMENT  ||
-                        solver.isReady() == casa::LSQFit::DERIVLEVEL);
+      bool converged = (solver.isReady() == casacore::LSQFit::SOLINCREMENT  ||
+                        solver.isReady() == casacore::LSQFit::DERIVLEVEL);
       ///      clearNonSolvable (unknownsIndex, srcSet);
       return converged;
     }
diff --git a/CEP/DP3/DPPP/src/Filter.cc b/CEP/DP3/DPPP/src/Filter.cc
index 131367cc0c4..dc4f46cf68d 100644
--- a/CEP/DP3/DPPP/src/Filter.cc
+++ b/CEP/DP3/DPPP/src/Filter.cc
@@ -28,13 +28,13 @@
 #include <DPPP/DPLogger.h>
 #include <Common/ParameterSet.h>
 
-#include <tables/Tables/ScalarColumn.h>
-#include <tables/Tables/TableRecord.h>
-#include <tables/Tables/ExprNode.h>
-#include <tables/Tables/RecordGram.h>
-#include <casa/Containers/Record.h>
+#include <casacore/tables/Tables/ScalarColumn.h>
+#include <casacore/tables/Tables/TableRecord.h>
+#include <casacore/tables/TaQL/ExprNode.h>
+#include <casacore/tables/TaQL/RecordGram.h>
+#include <casacore/casa/Containers/Record.h>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/FlagCounter.cc b/CEP/DP3/DPPP/src/FlagCounter.cc
index 5b96edf8ee6..ecbf2cd0b40 100644
--- a/CEP/DP3/DPPP/src/FlagCounter.cc
+++ b/CEP/DP3/DPPP/src/FlagCounter.cc
@@ -27,19 +27,19 @@
 #include <Common/ParameterSet.h>
 #include <Common/StreamUtil.h>
 #include <Common/LofarLogger.h>
-#include <tables/Tables/Table.h>
-#include <tables/Tables/TableDesc.h>
-#include <tables/Tables/SetupNewTab.h>
-#include <tables/Tables/ScaColDesc.h>
-#include <tables/Tables/ScalarColumn.h>
-#include <casa/Arrays/Matrix.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/ArrayIO.h>
+#include <casacore/tables/Tables/Table.h>
+#include <casacore/tables/Tables/TableDesc.h>
+#include <casacore/tables/Tables/SetupNewTab.h>
+#include <casacore/tables/Tables/ScaColDesc.h>
+#include <casacore/tables/Tables/ScalarColumn.h>
+#include <casacore/casa/Arrays/Matrix.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/ArrayIO.h>
 #include <vector>
 #include <map>
 #include <iomanip>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/GainCal.cc b/CEP/DP3/DPPP/src/GainCal.cc
index 101c88695d5..a24b762ad21 100644
--- a/CEP/DP3/DPPP/src/GainCal.cc
+++ b/CEP/DP3/DPPP/src/GainCal.cc
@@ -43,12 +43,12 @@
 #include <fstream>
 #include <ctime>
 
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/MatrixMath.h>
-#include <measures/Measures/MEpoch.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MCDirection.h>
-#include <casa/OS/File.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/MatrixMath.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/casa/OS/File.h>
 
 #include <vector>
 #include <algorithm>
@@ -57,7 +57,7 @@
 #include <iostream>
 #include <iomanip>
 
-using namespace casa;
+using namespace casacore;
 using namespace LOFAR::BBS;
 
 namespace LOFAR {
@@ -464,8 +464,8 @@ namespace LOFAR {
     // Fills itsVis and itsMVis as matrices with all 00 polarizations in the
     // top left, all 11 polarizations in the bottom right, etc.
     // For TEC fitting, it also sets weights for the frequency cells
-    void GainCal::fillMatrices (casa::Complex* model, casa::Complex* data, float* weight,
-                                const casa::Bool* flag) {
+    void GainCal::fillMatrices (casacore::Complex* model, casacore::Complex* data, float* weight,
+                                const casacore::Bool* flag) {
       const size_t nBl = info().nbaselines();
       const size_t nCh = info().nchan();
       const size_t nCr = 4;
@@ -526,7 +526,7 @@ namespace LOFAR {
 
       uint iter=0;
 
-      casa::Matrix<double> tecsol(itsMode=="tecandphase"?2:1,
+      casacore::Matrix<double> tecsol(itsMode=="tecandphase"?2:1,
                                   info().antennaUsed().size(), 0);
 
       std::vector<StefCal::Status> converged(itsNFreqCells,StefCal::NOTCONVERGED);
@@ -564,13 +564,13 @@ namespace LOFAR {
         if (itsMode=="tec" || itsMode=="tecandphase") {
           itsTimerSolve.stop();
           itsTimerPhaseFit.start();
-          casa::Matrix<casa::DComplex> sols_f(itsNFreqCells, info().antennaUsed().size());
+          casacore::Matrix<casacore::DComplex> sols_f(itsNFreqCells, info().antennaUsed().size());
 
           uint nSt = info().antennaUsed().size();
 
           // TODO: set phase reference so something smarter that station 0
           for (uint freqCell=0; freqCell<itsNFreqCells; ++freqCell) {
-            casa::Matrix<casa::DComplex> sol = iS[freqCell].getSolution(false);
+            casacore::Matrix<casacore::DComplex> sol = iS[freqCell].getSolution(false);
             if (iS[freqCell].getStationFlagged()[0]) {
               // If reference station flagged, flag whole channel
               for (uint st=0; st<info().antennaUsed().size(); ++st) {
@@ -675,7 +675,7 @@ namespace LOFAR {
       uint nSt = info().antennaUsed().size();
 
       for (uint freqCell=0; freqCell<itsNFreqCells; ++freqCell) {
-        casa::Matrix<casa::DComplex> tmpsol = iS[freqCell].getSolution(true);
+        casacore::Matrix<casacore::DComplex> tmpsol = iS[freqCell].getSolution(true);
 
         for (uint st=0; st<nSt; st++) {
           for (uint cr=0; cr<iS[0].nCr(); ++cr) {
diff --git a/CEP/DP3/DPPP/src/MSReader.cc b/CEP/DP3/DPPP/src/MSReader.cc
index 1b6f205db5e..e4e361ec5c8 100644
--- a/CEP/DP3/DPPP/src/MSReader.cc
+++ b/CEP/DP3/DPPP/src/MSReader.cc
@@ -30,27 +30,27 @@
 #include <Common/ParameterSet.h>
 #include <Common/LofarLogger.h>
 
-#include <tables/Tables/TableRecord.h>
-#include <tables/Tables/ScalarColumn.h>
-#include <tables/Tables/ArrayColumn.h>
-#include <tables/Tables/ExprNode.h>
-#include <tables/Tables/RecordGram.h>
-#include <measures/Measures/MeasTable.h>
-#include <measures/TableMeasures/ScalarMeasColumn.h>
-#include <measures/TableMeasures/ArrayMeasColumn.h>
-#include <ms/MeasurementSets/MeasurementSet.h>
+#include <casacore/tables/Tables/TableRecord.h>
+#include <casacore/tables/Tables/ScalarColumn.h>
+#include <casacore/tables/Tables/ArrayColumn.h>
+#include <casacore/tables/TaQL/ExprNode.h>
+#include <casacore/tables/TaQL/RecordGram.h>
+#include <casacore/measures/Measures/MeasTable.h>
+#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
+#include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
+#include <casacore/ms/MeasurementSets/MeasurementSet.h>
 #if defined(casacore)
-#include <ms/MSSel/MSSelection.h>
+#include <casacore/ms/MSSel/MSSelection.h>
 #else
-#include <ms/MeasurementSets/MSSelection.h>
+#include <casacore/ms/MSSel/MSSelection.h>
 #endif
-#include <casa/Containers/Record.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Quanta/MVTime.h>
-#include <casa/OS/Conversion.h>
+#include <casacore/casa/Containers/Record.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Quanta/MVTime.h>
+#include <casacore/casa/OS/Conversion.h>
 #include <iostream>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -202,7 +202,7 @@ namespace LOFAR {
     void MSReader::updateInfo (const DPInfo&)
     {}
 
-    casa::String MSReader::msName() const
+    casacore::String MSReader::msName() const
     {
       return itsMSName;
     }
@@ -343,8 +343,8 @@ namespace LOFAR {
       return true;
     }
 
-    void MSReader::flagInfNaN(const casa::Cube<casa::Complex>& dataCube,
-                              casa::Cube<bool>& flagsCube,
+    void MSReader::flagInfNaN(const casacore::Cube<casacore::Complex>& dataCube,
+                              casacore::Cube<bool>& flagsCube,
                               FlagCounter& flagCounter) {
       int ncorr=dataCube.shape()[0];
       const Complex* dataPtr = dataCube.data();
@@ -823,8 +823,8 @@ namespace LOFAR {
       return true;
     }
 
-    void MSReader::getModelData (const casa::RefRows& rowNrs,
-                                 casa::Cube<casa::Complex>& arr)
+    void MSReader::getModelData (const casacore::RefRows& rowNrs,
+                                 casacore::Cube<casacore::Complex>& arr)
     {
       NSTimer::StartStop sstime(itsTimer);
       if (rowNrs.rowVector().empty()) {
diff --git a/CEP/DP3/DPPP/src/MSUpdater.cc b/CEP/DP3/DPPP/src/MSUpdater.cc
index 08b77e1e95e..5b4d321fbb5 100644
--- a/CEP/DP3/DPPP/src/MSUpdater.cc
+++ b/CEP/DP3/DPPP/src/MSUpdater.cc
@@ -27,19 +27,19 @@
 #include <DPPP/MSWriter.h>
 #include <DPPP/DPBuffer.h>
 #include <Common/ParameterSet.h>
-#include <tables/Tables/Table.h>
-#include <tables/Tables/ArrayColumn.h>
-#include <tables/Tables/ScalarColumn.h>
-#include <tables/Tables/ArrColDesc.h>
-#include <tables/Tables/ColumnDesc.h>
-#include <tables/Tables/StandardStMan.h>
-#include <casa/Containers/Record.h>
-#include <casa/Utilities/LinearSearch.h>
-#include <ms/MeasurementSets/MeasurementSet.h>
+#include <casacore/tables/Tables/Table.h>
+#include <casacore/tables/Tables/ArrayColumn.h>
+#include <casacore/tables/Tables/ScalarColumn.h>
+#include <casacore/tables/Tables/ArrColDesc.h>
+#include <casacore/tables/Tables/ColumnDesc.h>
+#include <casacore/tables/DataMan/StandardStMan.h>
+#include <casacore/casa/Containers/Record.h>
+#include <casacore/casa/Utilities/LinearSearch.h>
+#include <casacore/ms/MeasurementSets/MeasurementSet.h>
 #include <iostream>
 #include <limits>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -69,7 +69,7 @@ namespace LOFAR {
     MSUpdater::~MSUpdater()
     {}
 
-    bool MSUpdater::addColumn (const string& colName, const casa::DataType
+    bool MSUpdater::addColumn (const string& colName, const casacore::DataType
                                dataType, const ColumnDesc& cd)
     {
       if (itsMS.tableDesc().isColumn(colName)) {
@@ -81,7 +81,7 @@ namespace LOFAR {
       }
 
       if (itsStManKeys.stManName == "dysco" && itsStManKeys.dyscoDataBitRate != 0) {
-        casa::Record dyscoSpec = itsStManKeys.GetDyscoSpec();
+        casacore::Record dyscoSpec = itsStManKeys.GetDyscoSpec();
         DataManagerCtor dyscoConstructor = DataManager::getCtor("DyscoStMan");
         CountedPtr<DataManager> dyscoStMan(dyscoConstructor(colName + "_dm", dyscoSpec));
         ColumnDesc directColumnDesc(cd);
diff --git a/CEP/DP3/DPPP/src/MSWriter.cc b/CEP/DP3/DPPP/src/MSWriter.cc
index c1bcf8a69d2..b38453b8ec3 100644
--- a/CEP/DP3/DPPP/src/MSWriter.cc
+++ b/CEP/DP3/DPPP/src/MSWriter.cc
@@ -30,26 +30,26 @@
 #include <DPPP/DPLogger.h>
 #include <MS/VdsMaker.h>
 #include <Common/ParameterSet.h>
-#include <tables/Tables/TableCopy.h>
+#include <casacore/tables/Tables/TableCopy.h>
 #if defined(casacore)
-#include <tables/DataMan/DataManInfo.h>
+#include <casacore/tables/DataMan/DataManInfo.h>
 #else
-#include <tables/Tables/DataManInfo.h>
+#include <casacore/tables/DataMan/DataManInfo.h>
 #endif
-#include <tables/Tables/SetupNewTab.h>
-#include <tables/Tables/ArrColDesc.h>
-#include <tables/DataMan/StandardStMan.h>
-#include <tables/DataMan/TiledStManAccessor.h>
-#include <measures/TableMeasures/ArrayMeasColumn.h>
-#include <measures/Measures/MCDirection.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/ArrayLogical.h>
-#include <casa/Containers/Record.h>
-#include <casa/OS/Path.h>
+#include <casacore/tables/Tables/SetupNewTab.h>
+#include <casacore/tables/Tables/ArrColDesc.h>
+#include <casacore/tables/DataMan/StandardStMan.h>
+#include <casacore/tables/DataMan/TiledStManAccessor.h>
+#include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/ArrayLogical.h>
+#include <casacore/casa/Containers/Record.h>
+#include <casacore/casa/OS/Path.h>
 #include <iostream>
 #include <limits>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -135,7 +135,7 @@ namespace LOFAR {
           if (itsVdsDir[itsVdsDir.size() - 1] != '/') {
             itsVdsDir.append ("/");
           }
-          vdsName = itsVdsDir + string(casa::Path(vdsName).baseName());
+          vdsName = itsVdsDir + string(casacore::Path(vdsName).baseName());
         }
         // Create VDS file without detailed time info.
         LOFAR::VdsMaker::create (itsMS.tableName(), vdsName,
diff --git a/CEP/DP3/DPPP/src/MedFlagger.cc b/CEP/DP3/DPPP/src/MedFlagger.cc
index aeccab37935..5bcfb915efb 100644
--- a/CEP/DP3/DPPP/src/MedFlagger.cc
+++ b/CEP/DP3/DPPP/src/MedFlagger.cc
@@ -28,15 +28,15 @@
 #include <Common/ParameterSet.h>
 #include <Common/StreamUtil.h>
 #include <Common/LofarLogger.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Containers/Record.h>
-#include <casa/Containers/RecordField.h>
-#include <tables/Tables/ExprNode.h>
-#include <tables/Tables/RecordGram.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Containers/Record.h>
+#include <casacore/casa/Containers/RecordField.h>
+#include <casacore/tables/TaQL/ExprNode.h>
+#include <casacore/tables/TaQL/RecordGram.h>
 #include <iostream>
 #include <algorithm>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/MultiMSReader.cc b/CEP/DP3/DPPP/src/MultiMSReader.cc
index a5410c03a7d..f62cdf9becd 100644
--- a/CEP/DP3/DPPP/src/MultiMSReader.cc
+++ b/CEP/DP3/DPPP/src/MultiMSReader.cc
@@ -29,21 +29,21 @@
 #include <Common/ParameterSet.h>
 #include <Common/StreamUtil.h>
 #include <Common/LofarLogger.h>
-#include <tables/Tables/TableRecord.h>
-#include <tables/Tables/ScalarColumn.h>
-#include <tables/Tables/ArrayColumn.h>
-#include <tables/Tables/ExprNode.h>
-#include <tables/Tables/RecordGram.h>
-#include <measures/Measures/MeasTable.h>
-#include <measures/TableMeasures/ScalarMeasColumn.h>
-#include <measures/TableMeasures/ArrayMeasColumn.h>
-#include <casa/Containers/Record.h>
-#include <casa/Quanta/MVTime.h>
-#include <casa/Utilities/GenSort.h>
-#include <casa/OS/Conversion.h>
+#include <casacore/tables/Tables/TableRecord.h>
+#include <casacore/tables/Tables/ScalarColumn.h>
+#include <casacore/tables/Tables/ArrayColumn.h>
+#include <casacore/tables/TaQL/ExprNode.h>
+#include <casacore/tables/TaQL/RecordGram.h>
+#include <casacore/measures/Measures/MeasTable.h>
+#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
+#include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
+#include <casacore/casa/Containers/Record.h>
+#include <casacore/casa/Quanta/MVTime.h>
+#include <casacore/casa/Utilities/GenSort.h>
+#include <casacore/casa/OS/Conversion.h>
 #include <iostream>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/NDPPP.cc b/CEP/DP3/DPPP/src/NDPPP.cc
index f668199eedb..94e70a024c9 100644
--- a/CEP/DP3/DPPP/src/NDPPP.cc
+++ b/CEP/DP3/DPPP/src/NDPPP.cc
@@ -30,7 +30,7 @@
 #include <iostream>
 #include <stdexcept>
 
-#include <casa/OS/File.h>
+#include <casacore/casa/OS/File.h>
 
 using namespace LOFAR::DPPP;
 using namespace LOFAR;
@@ -74,9 +74,9 @@ int main(int argc, char *argv[])
       parsetName = argv[1];
     } else if (argc==1) {
       // No arguments given: try to load [N]DPPP.parset
-      if (casa::File("NDPPP.parset").exists()) {
+      if (casacore::File("NDPPP.parset").exists()) {
         parsetName="NDPPP.parset";
-      } else if (casa::File("DPPP.parset").exists()) {
+      } else if (casacore::File("DPPP.parset").exists()) {
         parsetName="DPPP.parset";
       } else { // No default file, show usage and exit
         showUsage();
diff --git a/CEP/DP3/DPPP/src/PhaseShift.cc b/CEP/DP3/DPPP/src/PhaseShift.cc
index 9ac593170f2..c465a33bc65 100644
--- a/CEP/DP3/DPPP/src/PhaseShift.cc
+++ b/CEP/DP3/DPPP/src/PhaseShift.cc
@@ -28,16 +28,16 @@
 #include <Common/ParameterSet.h>
 #include <Common/LofarLogger.h>
 #include <Common/StreamUtil.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/MatrixMath.h>
-#include <casa/Arrays/ArrayIO.h>
-#include <casa/Quanta/Quantum.h>
-#include <casa/Quanta/MVAngle.h>
-#include <casa/BasicSL/Constants.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/MatrixMath.h>
+#include <casacore/casa/Arrays/ArrayIO.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/casa/Quanta/MVAngle.h>
+#include <casacore/casa/BasicSL/Constants.h>
 #include <iostream>
 #include <iomanip>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/PointSource.cc b/CEP/DP3/DPPP/src/PointSource.cc
index 6cfb47dfdda..e40b05a9038 100644
--- a/CEP/DP3/DPPP/src/PointSource.cc
+++ b/CEP/DP3/DPPP/src/PointSource.cc
@@ -25,7 +25,7 @@
 #include <DPPP/PointSource.h>
 #include <DPPP/ModelComponentVisitor.h>
 #include <Common/lofar_math.h>
-#include <casa/BasicSL/Constants.h>
+#include <casacore/casa/BasicSL/Constants.h>
 
 namespace LOFAR
 {
@@ -101,7 +101,7 @@ Stokes PointSource::stokes(double freq) const
 
     if(hasRotationMeasure())
     {
-        double lambda = casa::C::c / freq;
+        double lambda = casacore::C::c / freq;
         double chi = 2.0 * (itsPolarizationAngle + itsRotationMeasure
             * lambda * lambda);
         double stokesQU = stokes.I * itsPolarizedFraction;
diff --git a/CEP/DP3/DPPP/src/PreFlagger.cc b/CEP/DP3/DPPP/src/PreFlagger.cc
index e87b38683f8..77b51bd7e58 100644
--- a/CEP/DP3/DPPP/src/PreFlagger.cc
+++ b/CEP/DP3/DPPP/src/PreFlagger.cc
@@ -30,22 +30,22 @@
 #include <Common/StreamUtil.h>
 #include <Common/LofarLogger.h>
 
-#include <tables/Tables/ExprNode.h>
-#include <tables/Tables/RecordGram.h>
-#include <casa/Containers/Record.h>
-#include <casa/Arrays/ArrayLogical.h>
-#include <casa/Quanta/Quantum.h>
-#include <casa/Quanta/MVTime.h>
-#include <casa/Quanta/MVAngle.h>
-#include <measures/Measures/MEpoch.h>
-#include <measures/Measures/MeasFrame.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MCDirection.h>
-#include <measures/Measures/MCEpoch.h>
+#include <casacore/tables/TaQL/ExprNode.h>
+#include <casacore/tables/TaQL/RecordGram.h>
+#include <casacore/casa/Containers/Record.h>
+#include <casacore/casa/Arrays/ArrayLogical.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/casa/Quanta/MVTime.h>
+#include <casacore/casa/Quanta/MVAngle.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/measures/Measures/MeasFrame.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/measures/Measures/MCEpoch.h>
 #include <iostream>
 #include <stack>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/Predict.cc b/CEP/DP3/DPPP/src/Predict.cc
index e579731f688..ab7f54a31d3 100644
--- a/CEP/DP3/DPPP/src/Predict.cc
+++ b/CEP/DP3/DPPP/src/Predict.cc
@@ -42,12 +42,12 @@
 #include <DPPP/GaussianSource.h>
 #include <ParmDB/SourceDB.h>
 
-#include <casa/Arrays/Array.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Quanta/Quantum.h>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MeasConvert.h>
-#include <tables/Tables/RefRows.h>
+#include <casacore/casa/Arrays/Array.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/tables/Tables/RefRows.h>
 
 #include <stddef.h>
 #include <string>
@@ -55,7 +55,7 @@
 #include <utility>
 #include <vector>
 
-using namespace casa;
+using namespace casacore;
 using namespace LOFAR::BBS;
 
 namespace LOFAR {
diff --git a/CEP/DP3/DPPP/src/ScaleData.cc b/CEP/DP3/DPPP/src/ScaleData.cc
index ef1bc1a2d2b..962165b421c 100644
--- a/CEP/DP3/DPPP/src/ScaleData.cc
+++ b/CEP/DP3/DPPP/src/ScaleData.cc
@@ -30,18 +30,18 @@
 #include <Common/StreamUtil.h>
 #include <Common/LofarLogger.h>
 
-#include <tables/Tables/Table.h>
-#include <tables/Tables/TableRecord.h>
-#include <tables/Tables/ScalarColumn.h>
-#include <tables/Tables/ArrayColumn.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/ArrayLogical.h>
-#include <casa/Utilities/Regex.h>
+#include <casacore/tables/Tables/Table.h>
+#include <casacore/tables/Tables/TableRecord.h>
+#include <casacore/tables/Tables/ScalarColumn.h>
+#include <casacore/tables/Tables/ArrayColumn.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/ArrayLogical.h>
+#include <casacore/casa/Utilities/Regex.h>
 
 #include <iostream>
 
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -206,7 +206,7 @@ namespace LOFAR {
       arrayContTransform (static_cast<const Array<Complex>&>(buf.getData()),
                           static_cast<const Array<double>&>(itsFactors),
                           data,
-                          casa::Multiplies<Complex,double,Complex>());
+                          casacore::Multiplies<Complex,double,Complex>());
       bufNew.setData (data);
       itsTimer.stop();
       getNextStep()->process (bufNew);
diff --git a/CEP/DP3/DPPP/src/Simulate.cc b/CEP/DP3/DPPP/src/Simulate.cc
index a3cbd470cdf..c6346a359ea 100644
--- a/CEP/DP3/DPPP/src/Simulate.cc
+++ b/CEP/DP3/DPPP/src/Simulate.cc
@@ -26,12 +26,12 @@
 
 // Only required for rotateUVW().
 #include <DPPP/PhaseShift.h>
-#include <casa/Arrays/Vector.h>
-#include <casa/Arrays/Matrix.h>
-#include <casa/Arrays/Cube.h>
-#include <casa/Arrays/MatrixMath.h>
+#include <casacore/casa/Arrays/Vector.h>
+#include <casacore/casa/Arrays/Matrix.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/Arrays/MatrixMath.h>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR
 {
@@ -138,12 +138,12 @@ void nsplitUVW (const vector<int>& blindex,
 void rotateUVW(const Position &from, const Position &to, size_t nUVW,
     double *uvw)
 {
-    casa::Matrix<double> oldUVW(3,3);
-    casa::Matrix<double> newUVW(3,3);
+    casacore::Matrix<double> oldUVW(3,3);
+    casacore::Matrix<double> newUVW(3,3);
     PhaseShift::fillTransMatrix(oldUVW, from[0], from[1]);
     PhaseShift::fillTransMatrix(newUVW, to[0], to[1]);
 
-    casa::Matrix<double> tmp(casa::product(casa::transpose(newUVW), oldUVW));
+    casacore::Matrix<double> tmp(casacore::product(casacore::transpose(newUVW), oldUVW));
     const double *R = tmp.data();
 
     for(size_t i = 0; i < 3*nUVW; i+=3)
diff --git a/CEP/DP3/DPPP/src/Simulator.cc b/CEP/DP3/DPPP/src/Simulator.cc
index c3826a00987..826e6530a34 100644
--- a/CEP/DP3/DPPP/src/Simulator.cc
+++ b/CEP/DP3/DPPP/src/Simulator.cc
@@ -25,7 +25,7 @@
 #include <DPPP/Simulator.h>
 #include <DPPP/GaussianSource.h>
 #include <DPPP/PointSource.h>
-#include <casa/BasicSL/Constants.h>
+#include <casacore/casa/BasicSL/Constants.h>
 #include <Common/StreamUtil.h> ///
 
 namespace LOFAR
@@ -48,18 +48,18 @@ void radec2lmn(const Position &reference, const Position &position,
                double* lmn);
 
 void phases(size_t nStation, size_t nChannel, const double* lmn,
-            const casa::Matrix<double>& uvw, const casa::Vector<double>& freq,
-            casa::Matrix<dcomplex>& shift);
+            const casacore::Matrix<double>& uvw, const casacore::Vector<double>& freq,
+            casacore::Matrix<dcomplex>& shift);
 
 void spectrum(const PointSource &component, size_t nChannel,
-              const casa::Vector<double>& freq,
-              casa::Matrix<dcomplex>& spectrum, bool stokesIOnly);
+              const casacore::Vector<double>& freq,
+              casacore::Matrix<dcomplex>& spectrum, bool stokesIOnly);
 } // Unnamed namespace.
 
 Simulator::Simulator(const Position &reference, size_t nStation,
-    size_t nBaseline, size_t nChannel, const casa::Vector<Baseline>& baselines,
-    const casa::Vector<double>& freq, const casa::Matrix<double>& uvw,
-    casa::Cube<dcomplex>& buffer, bool stokesIOnly)
+    size_t nBaseline, size_t nChannel, const casacore::Vector<Baseline>& baselines,
+    const casacore::Vector<double>& freq, const casacore::Matrix<double>& uvw,
+    casacore::Cube<dcomplex>& buffer, bool stokesIOnly)
     :   itsReference(reference),
         itsNStation(nStation),
         itsNBaseline(nBaseline),
@@ -160,7 +160,7 @@ void Simulator::visit(const GaussianSource &component)
     // Convert position angle from North over East to the angle used to
     // rotate the right-handed UV-plane.
     // TODO: Can probably optimize by changing the rotation matrix instead.
-    const double phi = casa::C::pi_2 + component.positionAngle() + casa::C::pi;
+    const double phi = casacore::C::pi_2 + component.positionAngle() + casacore::C::pi;
     const double cosPhi = cos(phi);
     const double sinPhi = sin(phi);
 
@@ -200,7 +200,7 @@ void Simulator::visit(const GaussianSource &component)
 
             // Compute uPrime^2 + vPrime^2 and pre-multiply with -2.0 * PI^2
             // / C^2.
-            const double uvPrime = (-2.0 * casa::C::pi * casa::C::pi)
+            const double uvPrime = (-2.0 * casacore::C::pi * casacore::C::pi)
                 * (uPrime * uPrime + vPrime * vPrime);
 
             const dcomplex *shiftP = &(itsShiftBuffer(0,p));
@@ -216,7 +216,7 @@ void Simulator::visit(const GaussianSource &component)
                     ++shiftQ;
 
                     const double ampl = exp((itsFreq[ch] * itsFreq[ch])
-                        / (casa::C::c * casa::C::c) * uvPrime);
+                        / (casacore::C::c * casacore::C::c) * uvPrime);
 
                     blShift *= ampl;
 
@@ -232,7 +232,7 @@ void Simulator::visit(const GaussianSource &component)
                     ++shiftQ;
 
                     const double ampl = exp((itsFreq[ch] * itsFreq[ch])
-                        / (casa::C::c * casa::C::c) * uvPrime);
+                        / (casacore::C::c * casacore::C::c) * uvPrime);
 
                     blShift *= ampl;
 
@@ -267,19 +267,19 @@ inline void radec2lmn(const Position &reference, const Position &position,
 
 // Compute station phase shifts.
 inline void phases(size_t nStation, size_t nChannel, const double* lmn,
-                   const casa::Matrix<double>& uvw,
-                   const casa::Vector<double>& freq,
-                   casa::Matrix<dcomplex>& shift)
+                   const casacore::Matrix<double>& uvw,
+                   const casacore::Vector<double>& freq,
+                   casacore::Matrix<dcomplex>& shift)
 {
     dcomplex* shiftdata=shift.data();
     for(size_t st = 0; st < nStation; ++st)
     {
-        const double phase = casa::C::_2pi * (uvw(0,st) * lmn[0]
+        const double phase = casacore::C::_2pi * (uvw(0,st) * lmn[0]
             + uvw(1,st) * lmn[1] + uvw(2,st) * (lmn[2] - 1.0));
 
         for(size_t ch = 0; ch < nChannel; ++ch)
         {
-            const double chPhase = phase * freq[ch] / casa::C::c;
+            const double chPhase = phase * freq[ch] / casacore::C::c;
             *shiftdata = dcomplex(cos(chPhase), sin(chPhase));
             ++shiftdata;
         } // Channels.
@@ -289,8 +289,8 @@ inline void phases(size_t nStation, size_t nChannel, const double* lmn,
 
 // Compute component spectrum.
 inline void spectrum(const PointSource &component, size_t nChannel,
-                     const casa::Vector<double>& freq,
-                     casa::Matrix<dcomplex>& spectrum, bool stokesIOnly=false)
+                     const casacore::Vector<double>& freq,
+                     casacore::Matrix<dcomplex>& spectrum, bool stokesIOnly=false)
 {
     for(size_t ch = 0; ch < nChannel; ++ch)
     {
diff --git a/CEP/DP3/DPPP/src/SourceDBUtil.cc b/CEP/DP3/DPPP/src/SourceDBUtil.cc
index b13af08cc84..1100550144d 100644
--- a/CEP/DP3/DPPP/src/SourceDBUtil.cc
+++ b/CEP/DP3/DPPP/src/SourceDBUtil.cc
@@ -85,10 +85,10 @@ vector<Patch::ConstPtr> makePatches(SourceDB &sourceDB,
             {
                 GaussianSource::Ptr gauss(new GaussianSource(position, stokes));
 
-                const double deg2rad = (casa::C::pi / 180.0);
+                const double deg2rad = (casacore::C::pi / 180.0);
                 gauss->setPositionAngle(src.getOrientation() * deg2rad);
 
-                const double arcsec2rad = (casa::C::pi / 3600.0) / 180.0;
+                const double arcsec2rad = (casacore::C::pi / 3600.0) / 180.0;
                 gauss->setMajorAxis(src.getMajorAxis() * arcsec2rad);
                 gauss->setMinorAxis(src.getMinorAxis() * arcsec2rad);
                 source = gauss;
diff --git a/CEP/DP3/DPPP/src/StationAdder.cc b/CEP/DP3/DPPP/src/StationAdder.cc
index e81f525a3f7..5cb92fd69fd 100644
--- a/CEP/DP3/DPPP/src/StationAdder.cc
+++ b/CEP/DP3/DPPP/src/StationAdder.cc
@@ -29,20 +29,20 @@
 #include <Common/ParameterSet.h>
 #include <Common/ParameterRecord.h>
 
-#include <measures/Measures/MPosition.h>
-#include <measures/Measures/MCPosition.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/TableMeasures/ScalarMeasColumn.h>
-#include <tables/Tables/ScalarColumn.h>
-#include <tables/Tables/ArrayColumn.h>
-#include <tables/Tables/TableRecord.h>
-#include <tables/Tables/TableRow.h>
-#include <casa/Utilities/LinearSearch.h>
-#include <casa/Utilities/Regex.h>
+#include <casacore/measures/Measures/MPosition.h>
+#include <casacore/measures/Measures/MCPosition.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
+#include <casacore/tables/Tables/ScalarColumn.h>
+#include <casacore/tables/Tables/ArrayColumn.h>
+#include <casacore/tables/Tables/TableRecord.h>
+#include <casacore/tables/Tables/TableRow.h>
+#include <casacore/casa/Utilities/LinearSearch.h>
+#include <casacore/casa/Utilities/Regex.h>
 #include <iostream>
 #include <iomanip>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -163,7 +163,7 @@ namespace LOFAR {
             MPosition::Convert (antennaPos[inx], MPosition::ITRF)().getValue();
           const Vector<Double>& diff = mvdiff.getValue();
           double dist = sqrt(std::accumulate(diff.cbegin(), diff.cend(), 0.,
-                                             casa::SumSqr<Double>()));
+                                             casacore::SumSqr<Double>()));
           // Add the radius of the station used.
           maxdist = max (maxdist, dist + 0.5*antennaDiam[inx]);
         }
diff --git a/CEP/DP3/DPPP/src/StefCal.cc b/CEP/DP3/DPPP/src/StefCal.cc
index 908de9682b0..f88a48acbd4 100644
--- a/CEP/DP3/DPPP/src/StefCal.cc
+++ b/CEP/DP3/DPPP/src/StefCal.cc
@@ -31,7 +31,7 @@
 
 #include <iostream>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -358,7 +358,7 @@ namespace LOFAR {
       _totalWeight += weight;
     }
 
-    casa::Matrix<casa::DComplex> StefCal::getSolution(bool setNaNs) {
+    casacore::Matrix<casacore::DComplex> StefCal::getSolution(bool setNaNs) {
       if (setNaNs) {
         for (uint ant=0; ant<_nUn; ++ant) {
           if (_stationFlagged[ant%_nSt]) {
diff --git a/CEP/DP3/DPPP/src/UVWCalculator/UVWCalculator.cc b/CEP/DP3/DPPP/src/UVWCalculator/UVWCalculator.cc
index e6041c83eef..6f582c5a9bc 100644
--- a/CEP/DP3/DPPP/src/UVWCalculator/UVWCalculator.cc
+++ b/CEP/DP3/DPPP/src/UVWCalculator/UVWCalculator.cc
@@ -24,10 +24,10 @@
 // Note: this code is used by LOFAR and APERTIF software.
 
 #include <DPPP/UVWCalculator.h>
-#include <measures/Measures/MEpoch.h>
-#include <measures/Measures/Muvw.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/measures/Measures/Muvw.h>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
diff --git a/CEP/DP3/DPPP/src/UVWCalculator/UVWCalculator.h b/CEP/DP3/DPPP/src/UVWCalculator/UVWCalculator.h
index 2cc9c3f5de2..252f899de4e 100644
--- a/CEP/DP3/DPPP/src/UVWCalculator/UVWCalculator.h
+++ b/CEP/DP3/DPPP/src/UVWCalculator/UVWCalculator.h
@@ -31,15 +31,15 @@
 
 #include <Common/LofarLogger.h>
 #include <Common/lofar_vector.h>
-#include <measures/Measures/MeasFrame.h>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MPosition.h>
-#include <measures/Measures/MBaseline.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MCDirection.h>
-#include <measures/Measures/MCPosition.h>
-#include <measures/Measures/MCBaseline.h>
-#include <casa/Arrays/Vector.h>
+#include <casacore/measures/Measures/MeasFrame.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MPosition.h>
+#include <casacore/measures/Measures/MBaseline.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/measures/Measures/MCPosition.h>
+#include <casacore/measures/Measures/MCBaseline.h>
+#include <casacore/casa/Arrays/Vector.h>
 
 namespace LOFAR {
   namespace DPPP {
@@ -61,22 +61,22 @@ namespace LOFAR {
 
       // Construct the object for the given phase direction, array position,
       // and station positions.
-      UVWCalculator (const casa::MDirection& phaseDir,
-                     const casa::MPosition& arrayPosition,
-                     const vector<casa::MPosition>& stationPositions);
+      UVWCalculator (const casacore::MDirection& phaseDir,
+                     const casacore::MPosition& arrayPosition,
+                     const vector<casacore::MPosition>& stationPositions);
 
       // get the UVW coordinates for the given baseline and time.
-      casa::Vector<double> getUVW (uint ant1, uint ant2, double time);
+      casacore::Vector<double> getUVW (uint ant1, uint ant2, double time);
 
     private:
-      casa::MDirection              itsPhaseDir;
+      casacore::MDirection              itsPhaseDir;
       bool                          itsMovingPhaseDir;  
-      casa::MDirection::Convert     itsDirToJ2000;   //# direction to J2000
-      casa::MBaseline::Convert      itsBLToJ2000;    //# convert ITRF to J2000
-      casa::MeasFrame               itsFrame;
-      vector<casa::MBaseline>       itsAntMB;
-      vector<casa::Vector<double> > itsAntUvw;
-      casa::Block<bool>             itsUvwFilled;
+      casacore::MDirection::Convert     itsDirToJ2000;   //# direction to J2000
+      casacore::MBaseline::Convert      itsBLToJ2000;    //# convert ITRF to J2000
+      casacore::MeasFrame               itsFrame;
+      vector<casacore::MBaseline>       itsAntMB;
+      vector<casacore::Vector<double> > itsAntUvw;
+      casacore::Block<bool>             itsUvwFilled;
       double                        itsLastTime;
     };
 
diff --git a/CEP/DP3/DPPP/src/UVWFlagger.cc b/CEP/DP3/DPPP/src/UVWFlagger.cc
index 49003dfdb84..4da6295808b 100644
--- a/CEP/DP3/DPPP/src/UVWFlagger.cc
+++ b/CEP/DP3/DPPP/src/UVWFlagger.cc
@@ -28,15 +28,15 @@
 #include <Common/ParameterSet.h>
 #include <Common/StreamUtil.h>
 #include <Common/LofarLogger.h>
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/ArrayIO.h>
-#include <casa/Quanta/Quantum.h>
-#include <casa/Quanta/MVAngle.h>
-#include <casa/Utilities/GenSort.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/ArrayIO.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/casa/Quanta/MVAngle.h>
+#include <casacore/casa/Utilities/GenSort.h>
 #include <iostream>
 #include <algorithm>
 
-using namespace casa;
+using namespace casacore;
 
 namespace LOFAR {
   namespace DPPP {
@@ -115,7 +115,7 @@ namespace LOFAR {
       info().setWriteFlags();
       // Convert the given frequencies to possibly averaged frequencies.
       // Divide it by speed of light to get reciproke of wavelengths.
-      itsRecWavel = infoIn.chanFreqs() / casa::C::c;
+      itsRecWavel = infoIn.chanFreqs() / casacore::C::c;
       // Handle the phase center (if given).
       if (! itsCenter.empty()) {
         handleCenter();
diff --git a/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/DDECal.h b/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/DDECal.h
index 319660eeca6..b64c013bd54 100644
--- a/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/DDECal.h
+++ b/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/DDECal.h
@@ -40,10 +40,10 @@
 #include <StationResponse/Station.h>
 #include <StationResponse/Types.h>
 #include <ParmDB/Parm.h>
-#include <casa/Arrays/Cube.h>
-#include <casa/Quanta/MVEpoch.h>
-#include <measures/Measures/MEpoch.h>
-#include <casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/Cube.h>
+#include <casacore/casa/Quanta/MVEpoch.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
 
 namespace LOFAR {
 
@@ -105,18 +105,18 @@ namespace LOFAR {
 
       // The time of the current buffer (in case of solint, average time)
       double           itsAvgTime;
-      std::vector<casa::Complex*> itsDataPtrs;
+      std::vector<casacore::Complex*> itsDataPtrs;
 
       // For each timeslot, a vector of nDir buffers
-      std::vector<std::vector<casa::Complex*> > itsModelDataPtrs;
+      std::vector<std::vector<casacore::Complex*> > itsModelDataPtrs;
 
       // For each time, for each channel block, a vector of size nAntennas * nDirections
-      std::vector<std::vector<std::vector<casa::DComplex> > > itsSols;
+      std::vector<std::vector<std::vector<casacore::DComplex> > > itsSols;
 
       // For each time, for each constraint, a vector of results (e.g. tec and phase)
       std::vector<std::vector<std::vector<Constraint::Result> > > itsConstraintSols;
 
-      casa::Cube<casa::Complex> itsModelData;
+      casacore::Cube<casacore::Complex> itsModelData;
       string           itsH5ParmName;
       H5Parm           itsH5Parm;
 
@@ -127,7 +127,7 @@ namespace LOFAR {
       uint             itsNChan;
       uint             itsNFreqCells;
       vector<vector<string> > itsDirections; // For each direction, a vector of patches
-      vector<casa::CountedPtr<Constraint> > itsConstraints;
+      vector<casacore::CountedPtr<Constraint> > itsConstraints;
 
       vector<Predict>     itsPredictSteps;
       vector<MultiResultStep::ShPtr> itsResultSteps; // For each directions, a multiresultstep with all times
diff --git a/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/PiercePoint.h b/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/PiercePoint.h
index a39ef99a99b..fb28770eefe 100644
--- a/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/PiercePoint.h
+++ b/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/PiercePoint.h
@@ -2,12 +2,12 @@
 #define PIERCEPOINT_H
 
 #include <vector>
-#include <measures/Measures/MDirection.h>
-#include <measures/Measures/MCDirection.h>
-#include <measures/Measures/MCPosition.h>
-#include <measures/Measures/MPosition.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MEpoch.h>
+#include <casacore/measures/Measures/MDirection.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/measures/Measures/MCPosition.h>
+#include <casacore/measures/Measures/MPosition.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MEpoch.h>
 
 #include <armadillo>
 
@@ -17,20 +17,20 @@ class PiercePoint
 {
 public:
   PiercePoint();
-  PiercePoint(const casa::MPosition &ant,const casa::MDirection &source,const double height);
-  PiercePoint(const casa::MPosition &ant,const casa::MDirection &source);
-  void init(const casa::MPosition &ant,const casa::MDirection &source,const double height);
-  void evaluate(casa::MEpoch time);
+  PiercePoint(const casacore::MPosition &ant,const casacore::MDirection &source,const double height);
+  PiercePoint(const casacore::MPosition &ant,const casacore::MDirection &source);
+  void init(const casacore::MPosition &ant,const casacore::MDirection &source,const double height);
+  void evaluate(casacore::MEpoch time);
   Col<double>  getValue() const {return itsValue;} 
-  casa::MPosition  getPos() const {return itsPosition;}
-  casa::MDirection  getDir() const {return itsDirection;}
+  casacore::MPosition  getPos() const {return itsPosition;}
+  casacore::MDirection  getDir() const {return itsDirection;}
 private:
   static const double IONOheight; //default height in meter
   static const double EarthRadius; //default Earth radius in meter
   //station position
-  casa::MPosition     itsPosition;
+  casacore::MPosition     itsPosition;
   //source position
-  casa::MDirection     itsDirection;
+  casacore::MDirection     itsDirection;
   // Ionospheric layer height.
   double              itsIonoHeight;
   //  square of length antenna vector (int ITRF) minus square of vector to piercepoint. This is constant for a assumed spherical Earth
diff --git a/CEP/DP3/DPPP_DDECal/src/DDECal.cc b/CEP/DP3/DPPP_DDECal/src/DDECal.cc
index bb094e25a01..9972613a961 100644
--- a/CEP/DP3/DPPP_DDECal/src/DDECal.cc
+++ b/CEP/DP3/DPPP_DDECal/src/DDECal.cc
@@ -43,13 +43,13 @@
 #include <ctime>
 #include <utility>
 
-#include <casa/Arrays/ArrayMath.h>
-#include <casa/Arrays/MatrixMath.h>
-#include <measures/Measures/MEpoch.h>
-#include <measures/Measures/MeasConvert.h>
-#include <measures/Measures/MCDirection.h>
-#include <casa/Quanta/Quantum.h>
-#include <casa/OS/File.h>
+#include <casacore/casa/Arrays/ArrayMath.h>
+#include <casacore/casa/Arrays/MatrixMath.h>
+#include <casacore/measures/Measures/MEpoch.h>
+#include <casacore/measures/Measures/MeasConvert.h>
+#include <casacore/measures/Measures/MCDirection.h>
+#include <casacore/casa/Quanta/Quantum.h>
+#include <casacore/casa/OS/File.h>
 
 #include <vector>
 #include <algorithm>
@@ -58,7 +58,7 @@
 #include <iostream>
 #include <iomanip>
 
-using namespace casa;
+using namespace casacore;
 using namespace LOFAR::BBS;
 
 namespace LOFAR {
@@ -94,22 +94,22 @@ namespace LOFAR {
 
       itsMode = toLower(parset.getString(prefix + "mode", "complexgain"));
       if(itsCoreConstraint != 0.0) {
-        itsConstraints.push_back(casa::CountedPtr<Constraint>(
+        itsConstraints.push_back(casacore::CountedPtr<Constraint>(
           new CoreConstraint()));
       }
       if (itsMode == "phaseonly") {
-        itsConstraints.push_back(casa::CountedPtr<Constraint>(
+        itsConstraints.push_back(casacore::CountedPtr<Constraint>(
                   new PhaseConstraint()));
       } else if (itsMode == "tec") {
-        itsConstraints.push_back(casa::CountedPtr<Constraint>(
+        itsConstraints.push_back(casacore::CountedPtr<Constraint>(
                   new TECConstraint(TECConstraint::TECOnlyMode)));
       } else if (itsMode == "tecandphase"){
-        itsConstraints.push_back(casa::CountedPtr<Constraint>(
+        itsConstraints.push_back(casacore::CountedPtr<Constraint>(
                   new TECConstraint(TECConstraint::TECAndCommonScalarMode)));
       } else if (itsMode == "complexgain") {
         // no constraints
       } else if (itsMode == "tecscreen") {
-        itsConstraints.push_back(casa::CountedPtr<Constraint>(
+        itsConstraints.push_back(casacore::CountedPtr<Constraint>(
                   new ScreenConstraint()));
       } else {
         THROW (Exception, "Unexpected mode: " << itsMode);
@@ -174,7 +174,7 @@ namespace LOFAR {
         itsNFreqCells++;
       }
 
-      // Convert from casa::Vector to std::vector
+      // Convert from casacore::Vector to std::vector
       vector<int> ant1(info().getAnt1().size());
       vector<int> ant2(info().getAnt2().size());
       for (uint i=0; i<ant1.size(); ++i) {
@@ -187,7 +187,7 @@ namespace LOFAR {
       std::vector<std::vector<double> > antennaPos(info().antennaPos().size());
       for (uint i=0; i<info().antennaNames().size(); ++i) {
         antennaNames[i]=info().antennaNames()[i];
-        casa::Quantum<casa::Vector<double> > pos = info().antennaPos()[i].get("m");
+        casacore::Quantum<casacore::Vector<double> > pos = info().antennaPos()[i].get("m");
         antennaPos[i].resize(3);
         antennaPos[i][0] = pos.getValue()[0];
         antennaPos[i][1] = pos.getValue()[1];
@@ -534,9 +534,9 @@ namespace LOFAR {
 
       if (itsStepInSolInt!=0) {
         //shrink itsDataPtrs, itsModelDataPtrs
-        std::vector<casa::Complex*>(itsDataPtrs.begin(),
+        std::vector<casacore::Complex*>(itsDataPtrs.begin(),
             itsDataPtrs.begin()+itsStepInSolInt).swap(itsDataPtrs);
-        std::vector<std::vector<casa::Complex*> >(itsModelDataPtrs.begin(),
+        std::vector<std::vector<casacore::Complex*> >(itsModelDataPtrs.begin(),
                     itsModelDataPtrs.begin()+itsStepInSolInt).swap(itsModelDataPtrs);
         itsTimerSolve.start();
         itsMultiDirSolver.process(itsDataPtrs, itsModelDataPtrs,
diff --git a/CEP/DP3/DPPP_DDECal/src/PiercePoint.cc b/CEP/DP3/DPPP_DDECal/src/PiercePoint.cc
index 5f9c399c516..362c59506d2 100644
--- a/CEP/DP3/DPPP_DDECal/src/PiercePoint.cc
+++ b/CEP/DP3/DPPP_DDECal/src/PiercePoint.cc
@@ -7,41 +7,41 @@ const double PiercePoint::EarthRadius = 6371000.; //default Earth radius in mete
 PiercePoint::PiercePoint():
   itsValue(3)
 {
-  casa::MPosition ant;//ITRF
-  casa::MDirection source;//J2000 pole
+  casacore::MPosition ant;//ITRF
+  casacore::MDirection source;//J2000 pole
   init(ant,source,PiercePoint::IONOheight);
 }
 
-PiercePoint::PiercePoint(const casa::MPosition &ant,const casa::MDirection &source,const double height):
+PiercePoint::PiercePoint(const casacore::MPosition &ant,const casacore::MDirection &source,const double height):
   itsValue(3)
 {
   init(ant,source,height);
 };
 
-PiercePoint::PiercePoint(const casa::MPosition &ant,const casa::MDirection &source):
+PiercePoint::PiercePoint(const casacore::MPosition &ant,const casacore::MDirection &source):
    itsValue(3)
   { 
     init(ant,source,PiercePoint::IONOheight);
 };
 
-void  PiercePoint::init(const casa::MPosition &ant,const casa::MDirection &source,const double height){
+void  PiercePoint::init(const casacore::MPosition &ant,const casacore::MDirection &source,const double height){
   
-  itsPosition=casa::MPosition::Convert(ant,casa::MPosition::ITRF)();
+  itsPosition=casacore::MPosition::Convert(ant,casacore::MPosition::ITRF)();
   itsDirection=source;
   itsIonoHeight=height;
-  const casa::MVPosition &mPosition = itsPosition.getValue();
+  const casacore::MVPosition &mPosition = itsPosition.getValue();
   itsC = mPosition(0)*mPosition(0)+mPosition(1)*mPosition(1)+mPosition(2)*mPosition(2)-
     (itsIonoHeight+PiercePoint::EarthRadius)*(itsIonoHeight+PiercePoint::EarthRadius);
   
 }
 
-void  PiercePoint::evaluate(casa::MEpoch time){
+void  PiercePoint::evaluate(casacore::MEpoch time){
   //Convert direction to ITRF vector
-  casa::MeasFrame myframe(itsPosition,time);
-  casa::MDirection::Ref myref(casa::MDirection::ITRF,myframe);
-  const casa::MDirection dir = casa::MDirection::Convert(itsDirection,myref)();
-  const casa::MVDirection &mDir = dir.getValue();
-  const casa::MVPosition &mPos = itsPosition.getValue();
+  casacore::MeasFrame myframe(itsPosition,time);
+  casacore::MDirection::Ref myref(casacore::MDirection::ITRF,myframe);
+  const casacore::MDirection dir = casacore::MDirection::Convert(itsDirection,myref)();
+  const casacore::MVDirection &mDir = dir.getValue();
+  const casacore::MVPosition &mPos = itsPosition.getValue();
   double A = mDir(0)*mDir(0)+mDir(1)*mDir(1)+mDir(2)*mDir(2);
   double B = mDir(0)*mPos(0) + mDir(1)*mPos(1) +mDir(2)*mPos(2);
   double alpha = (-B + sqrt(B*B - A*itsC))/A;
diff --git a/CEP/DP3/DPPP_DDECal/src/ScreenConstraint.cc b/CEP/DP3/DPPP_DDECal/src/ScreenConstraint.cc
index 0f00d3e1de6..13c772ee953 100644
--- a/CEP/DP3/DPPP_DDECal/src/ScreenConstraint.cc
+++ b/CEP/DP3/DPPP_DDECal/src/ScreenConstraint.cc
@@ -52,11 +52,11 @@ void ScreenConstraint::setDirections(const std::vector<std::pair<double, double>
 
 void ScreenConstraint::initPiercePoints(){
   for(uint ipos=0;ipos<itsAntennaPos.size();ipos++){
-    casa::MPosition ant(casa::MVPosition(itsAntennaPos[ipos][0],itsAntennaPos[ipos][1],itsAntennaPos[ipos][2]),
-			casa::MPosition::ITRF);
+    casacore::MPosition ant(casacore::MVPosition(itsAntennaPos[ipos][0],itsAntennaPos[ipos][1],itsAntennaPos[ipos][2]),
+			casacore::MPosition::ITRF);
     for(uint isrc=0;isrc<itsSourcePos.size();isrc++){
-      casa::MDirection src(casa::MVDirection(itsSourcePos[isrc][0],itsSourcePos[isrc][1]),
-			   casa::MDirection::J2000);
+      casacore::MDirection src(casacore::MVDirection(itsSourcePos[isrc][0],itsSourcePos[isrc][1]),
+			   casacore::MDirection::J2000);
 	  
       itsPiercePoints[ipos][isrc]=PiercePoint(ant,src);
     }
@@ -77,7 +77,7 @@ void ScreenConstraint::setTime(double time){
 }
 
 void ScreenConstraint::CalculatePiercepoints(){
-   casa::MEpoch time(casa::MVEpoch(itsCurrentTime/(24.*3600.))); //convert to MJD
+   casacore::MEpoch time(casacore::MVEpoch(itsCurrentTime/(24.*3600.))); //convert to MJD
   for (uint i=0;i<itsPiercePoints.size();i++)
     for (uint j=0;j<itsPiercePoints[i].size();j++)
       itsPiercePoints[i][j].evaluate(time);
-- 
GitLab