From 72282a4508560c82dd0057038ad39c6ec11e7bfb Mon Sep 17 00:00:00 2001
From: Jakob Maljaars <jakob.maljaars@stcorp.nl>
Date: Thu, 25 Jun 2020 16:33:06 +0200
Subject: [PATCH] Resolve "Refactor code to get a clean source tree."

---
 .gitignore                                    |   5 +
 .gitlab-ci.yml                                |  47 ++++---
 CMake/config.h.in                             |   6 +-
 CMakeLists.txt                                | 119 +++++++-----------
 MathUtil.cc                                   |  25 ----
 Types.cc                                      |  25 ----
 {lobes => coeffs}/CS302_coords.mat            | Bin
 {hamaker => coeffs}/HamakerHBACoeff.h5        | Bin
 {hamaker => coeffs}/HamakerLBACoeff.h5        | Bin
 {hamaker => coeffs}/element_beam_HBA.coeff    |   0
 {hamaker => coeffs}/element_beam_LBA.coeff    |   0
 Antenna.cc => cpp/Antenna.cc                  |   2 +-
 Antenna.h => cpp/Antenna.h                    |   2 +-
 BeamFormer.cc => cpp/BeamFormer.cc            |   6 +-
 BeamFormer.h => cpp/BeamFormer.h              |   2 +-
 cpp/CMakeLists.txt                            |  48 +++++++
 Element.cc => cpp/Element.cc                  |   2 +-
 Element.h => cpp/Element.h                    |   2 +-
 ElementResponse.cc => cpp/ElementResponse.cc  |   0
 ElementResponse.h => cpp/ElementResponse.h    |   9 +-
 .../LofarMetaDataUtil.cc                      |  12 +-
 .../LofarMetaDataUtil.h                       |   0
 Station.cc => cpp/Station.cc                  |  12 +-
 Station.h => cpp/Station.h                    |   9 +-
 cpp/common/CMakeLists.txt                     |   8 ++
 Constants.h => cpp/common/Constants.h         |   6 +-
 MathUtil.h => cpp/common/MathUtil.h           |   0
 MutablePtr.h => cpp/common/MutablePtr.h       |   3 +-
 Singleton.h => cpp/common/Singleton.h         |   3 +-
 Types.h => cpp/common/Types.h                 |   0
 cpp/coords/CMakeLists.txt                     |   6 +
 .../coords/ITRFConverter.cc                   |   6 +-
 ITRFConverter.h => cpp/coords/ITRFConverter.h |   5 +-
 .../coords/ITRFDirection.cc                   |   6 +-
 ITRFDirection.h => cpp/coords/ITRFDirection.h |   6 +-
 {hamaker => cpp/hamaker}/CMakeLists.txt       |   4 +-
 {hamaker => cpp/hamaker}/HamakerCoeff.cc      |   0
 {hamaker => cpp/hamaker}/HamakerCoeff.h       |   0
 .../hamaker}/HamakerElementResponse.cc        |   9 +-
 .../hamaker}/HamakerElementResponse.h         |   0
 cpp/lobes/CMakeLists.txt                      |  34 +++++
 {lobes => cpp/lobes}/DefaultCoeffHBA.cc       |   0
 {lobes => cpp/lobes}/DefaultCoeffLBA.cc       |   0
 {lobes => cpp/lobes}/ElementResponse.cc       |   0
 {lobes => cpp/lobes}/ElementResponse.h        |   0
 {lobes => cpp/lobes}/LOBESElementResponse.cc  |   0
 {lobes => cpp/lobes}/LOBESElementResponse.h   |   0
 .../makeresponseimage.cc                      |   0
 {oskar => cpp/oskar}/CMakeLists.txt           |   7 +-
 {oskar => cpp/oskar}/OSKARDatafile.cc         |   0
 {oskar => cpp/oskar}/OSKARDatafile.h          |   0
 {oskar => cpp/oskar}/OSKARDataset.cc          |   0
 {oskar => cpp/oskar}/OSKARDataset.h           |   0
 {oskar => cpp/oskar}/OSKARElementResponse.cc  |   2 +-
 {oskar => cpp/oskar}/OSKARElementResponse.h   |   6 +-
 {oskar => cpp/oskar}/oskar.h                  |   0
 .../oskar}/oskar_evaluate_dipole_pattern.cc   |   0
 .../oskar_evaluate_spherical_wave_sum.cc      |   0
 {oskar => cpp/oskar}/oskar_helper.h           |   0
 {oskar => cpp/oskar}/oskar_vector_types.h     |   0
 cpp/test/CMakeLists.txt                       |   9 ++
 cpp/test/tstation.cc                          |  39 ++++++
 {test => demo}/CMakeLists.txt                 |  38 +++---
 {test => demo}/beam-helper.cpp                |   6 +-
 {test => demo}/beam-helper.h                  |   8 +-
 {test => demo}/tDockerDP3                     |   0
 {test => demo}/tElementBeamCommon.h           |   0
 {test => demo}/tElementBeamHamaker.cc         |   0
 {test => demo}/tElementBeamOSKARDipole.cc     |   0
 .../tElementBeamOSKARSphericalWave.cc         |   0
 {test => demo}/tStation.cc                    |   0
 {test => demo}/tStationBeamCommon.h           |   0
 {test => demo}/tStationBeamHamaker.cc         |   0
 {test => demo}/tStationBeamOSKARDipole.cc     |   0
 .../tStationBeamOSKARSphericalWave.cc         |   0
 {test => docker}/Dockerfile-base              |   0
 {test => docker}/Dockerfile-dp3               |   0
 docker/Dockerfile-everybeam                   |  18 +++
 {test => docker}/Dockerfile-wsclean           |   0
 Doxyfile.in => docs/Doxyfile.in               |   0
 lobes/CMakeLists.txt                          |  27 ----
 {lobes => python/lobes}/lobes.cc              |   0
 {lobes => python/lobes}/lobes.h               |   0
 python/placeholder.md                         |   1 +
 pyeverybeam.cc => python/pyeverybeam.cc.tmp   |   0
 .../coeff_scripts}/convert_coeff.py           |   9 ++
 .../coeff_scripts}/oskar_matlab_to_csv.m      |   0
 .../coeff_scripts}/oskar_matlab_to_hdf5.py    |   0
 {lobes => scripts/misc}/F4far_new.py          |   0
 .../misc}/calc_modes_1deg_noback.py           |   0
 {lobes => scripts/misc}/hamaker_vs_lobes.py   |   0
 {lobes => scripts/misc}/test_beam_model.py    |   0
 lobes/test.py => scripts/misc/test_lobes.py   |   0
 test/Dockerfile-lofarbeam                     |  18 ---
 94 files changed, 346 insertions(+), 271 deletions(-)
 create mode 100644 .gitignore
 delete mode 100644 MathUtil.cc
 delete mode 100644 Types.cc
 rename {lobes => coeffs}/CS302_coords.mat (100%)
 rename {hamaker => coeffs}/HamakerHBACoeff.h5 (100%)
 rename {hamaker => coeffs}/HamakerLBACoeff.h5 (100%)
 rename {hamaker => coeffs}/element_beam_HBA.coeff (100%)
 rename {hamaker => coeffs}/element_beam_LBA.coeff (100%)
 rename Antenna.cc => cpp/Antenna.cc (92%)
 rename Antenna.h => cpp/Antenna.h (99%)
 rename BeamFormer.cc => cpp/BeamFormer.cc (97%)
 rename BeamFormer.h => cpp/BeamFormer.h (99%)
 create mode 100644 cpp/CMakeLists.txt
 rename Element.cc => cpp/Element.cc (97%)
 rename Element.h => cpp/Element.h (98%)
 rename ElementResponse.cc => cpp/ElementResponse.cc (100%)
 rename ElementResponse.h => cpp/ElementResponse.h (91%)
 rename LofarMetaDataUtil.cc => cpp/LofarMetaDataUtil.cc (98%)
 rename LofarMetaDataUtil.h => cpp/LofarMetaDataUtil.h (100%)
 rename Station.cc => cpp/Station.cc (97%)
 rename Station.h => cpp/Station.h (99%)
 create mode 100644 cpp/common/CMakeLists.txt
 rename Constants.h => cpp/common/Constants.h (92%)
 rename MathUtil.h => cpp/common/MathUtil.h (100%)
 rename MutablePtr.h => cpp/common/MutablePtr.h (98%)
 rename Singleton.h => cpp/common/Singleton.h (92%)
 rename Types.h => cpp/common/Types.h (100%)
 create mode 100644 cpp/coords/CMakeLists.txt
 rename ITRFConverter.cc => cpp/coords/ITRFConverter.cc (96%)
 rename ITRFConverter.h => cpp/coords/ITRFConverter.h (94%)
 rename ITRFDirection.cc => cpp/coords/ITRFDirection.cc (96%)
 rename ITRFDirection.h => cpp/coords/ITRFDirection.h (96%)
 rename {hamaker => cpp/hamaker}/CMakeLists.txt (70%)
 rename {hamaker => cpp/hamaker}/HamakerCoeff.cc (100%)
 rename {hamaker => cpp/hamaker}/HamakerCoeff.h (100%)
 rename {hamaker => cpp/hamaker}/HamakerElementResponse.cc (95%)
 rename {hamaker => cpp/hamaker}/HamakerElementResponse.h (100%)
 create mode 100644 cpp/lobes/CMakeLists.txt
 rename {lobes => cpp/lobes}/DefaultCoeffHBA.cc (100%)
 rename {lobes => cpp/lobes}/DefaultCoeffLBA.cc (100%)
 rename {lobes => cpp/lobes}/ElementResponse.cc (100%)
 rename {lobes => cpp/lobes}/ElementResponse.h (100%)
 rename {lobes => cpp/lobes}/LOBESElementResponse.cc (100%)
 rename {lobes => cpp/lobes}/LOBESElementResponse.h (100%)
 rename makeresponseimage.cc => cpp/makeresponseimage.cc (100%)
 rename {oskar => cpp/oskar}/CMakeLists.txt (59%)
 rename {oskar => cpp/oskar}/OSKARDatafile.cc (100%)
 rename {oskar => cpp/oskar}/OSKARDatafile.h (100%)
 rename {oskar => cpp/oskar}/OSKARDataset.cc (100%)
 rename {oskar => cpp/oskar}/OSKARDataset.h (100%)
 rename {oskar => cpp/oskar}/OSKARElementResponse.cc (98%)
 rename {oskar => cpp/oskar}/OSKARElementResponse.h (86%)
 rename {oskar => cpp/oskar}/oskar.h (100%)
 rename {oskar => cpp/oskar}/oskar_evaluate_dipole_pattern.cc (100%)
 rename {oskar => cpp/oskar}/oskar_evaluate_spherical_wave_sum.cc (100%)
 rename {oskar => cpp/oskar}/oskar_helper.h (100%)
 rename {oskar => cpp/oskar}/oskar_vector_types.h (100%)
 create mode 100644 cpp/test/CMakeLists.txt
 create mode 100644 cpp/test/tstation.cc
 rename {test => demo}/CMakeLists.txt (72%)
 rename {test => demo}/beam-helper.cpp (97%)
 rename {test => demo}/beam-helper.h (94%)
 rename {test => demo}/tDockerDP3 (100%)
 rename {test => demo}/tElementBeamCommon.h (100%)
 rename {test => demo}/tElementBeamHamaker.cc (100%)
 rename {test => demo}/tElementBeamOSKARDipole.cc (100%)
 rename {test => demo}/tElementBeamOSKARSphericalWave.cc (100%)
 rename {test => demo}/tStation.cc (100%)
 rename {test => demo}/tStationBeamCommon.h (100%)
 rename {test => demo}/tStationBeamHamaker.cc (100%)
 rename {test => demo}/tStationBeamOSKARDipole.cc (100%)
 rename {test => demo}/tStationBeamOSKARSphericalWave.cc (100%)
 rename {test => docker}/Dockerfile-base (100%)
 rename {test => docker}/Dockerfile-dp3 (100%)
 create mode 100644 docker/Dockerfile-everybeam
 rename {test => docker}/Dockerfile-wsclean (100%)
 rename Doxyfile.in => docs/Doxyfile.in (100%)
 delete mode 100644 lobes/CMakeLists.txt
 rename {lobes => python/lobes}/lobes.cc (100%)
 rename {lobes => python/lobes}/lobes.h (100%)
 create mode 100644 python/placeholder.md
 rename pyeverybeam.cc => python/pyeverybeam.cc.tmp (100%)
 rename {hamaker => scripts/coeff_scripts}/convert_coeff.py (94%)
 rename {oskar => scripts/coeff_scripts}/oskar_matlab_to_csv.m (100%)
 rename {oskar => scripts/coeff_scripts}/oskar_matlab_to_hdf5.py (100%)
 rename {lobes => scripts/misc}/F4far_new.py (100%)
 rename {lobes => scripts/misc}/calc_modes_1deg_noback.py (100%)
 rename {lobes => scripts/misc}/hamaker_vs_lobes.py (100%)
 rename {lobes => scripts/misc}/test_beam_model.py (100%)
 rename lobes/test.py => scripts/misc/test_lobes.py (100%)
 delete mode 100644 test/Dockerfile-lofarbeam

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..bfa1a8d1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+# Files
+#
+# Directories
+.vscode/
+build/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bf560c71..1d0fe948 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,7 @@
 stages:
   - build-base
-  - clang-format
-  - build-lofarbeam
+  - format-and-test
+  - build-everybeam
   - build-doc
   - deploy-doc
   # - build-dependency
@@ -16,20 +16,39 @@ build-base:
       docker build
       --build-arg CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
       --tag $CI_REGISTRY_IMAGE:base
-      -f ./test/Dockerfile-base .
+      -f ./docker/Dockerfile-base .
     - docker push $CI_REGISTRY_IMAGE:base
 
 clang-format:
-  stage: clang-format
+  stage: format-and-test
   image: $CI_REGISTRY_IMAGE:base
-  script: 
-    # - apt-get update && apt-get -y install clang-format
+  before_script:
     - apt-get -y install python3-pip
     - pip3 install clang-format
+  script: 
     - ./scripts/clang-format-check.sh
 
-build-lofarbeam:
-  stage: build-lofarbeam
+# Build a debug version of EveryBeam from the base image
+test-and-coverage:
+  stage: format-and-test
+  image: $CI_REGISTRY_IMAGE:base
+  dependencies: 
+    - build-base
+  before_script:
+    - apt-get -y install python3-pip
+    - pip3 install gcovr
+  script:
+    - mkdir -p /opt/everybeam/build
+    - cd /opt/everybeam && git clone https://git.astron.nl/RD/EveryBeam.git EveryBeam
+    - cd /opt/everybeam/EveryBeam && git checkout ${CI_COMMIT_SHORT_SHA}
+    - cd /opt/everybeam/build
+    - cmake -DCMAKE_INSTALL_PREFIX=.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-coverage" -DCMAKE_EXE_LINKER_FLAGS="-coverage" ../EveryBeam/
+    - make install -j8
+    - ctest -T test
+    - gcovr -r .. -e '.*/external/.*' -e '.*/CompilerIdCXX/.*' -e '.*/test/.*' -e '.*/demo/.*'
+
+build-everybeam:
+  stage: build-everybeam
   script:
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
     - >
@@ -37,7 +56,7 @@ build-lofarbeam:
       --build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE
       --build-arg CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
       --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
-      -f ./test/Dockerfile-lofarbeam .
+      -f ./docker/Dockerfile-everybeam .
     - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
 
 build-doc:
@@ -46,10 +65,10 @@ build-doc:
   - >
     docker run
     --name $CI_COMMIT_SHORT_SHA
-    --workdir /opt/lofarbeam/build/
+    --workdir /opt/everybeam/build/
     $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
     sh -c 'make doc'
-  - docker cp $CI_COMMIT_SHORT_SHA:/opt/lofarbeam/build/doc/html htmldoc
+  - docker cp $CI_COMMIT_SHORT_SHA:/opt/everybeam/build/doc/html htmldoc
   - docker rm $CI_COMMIT_SHORT_SHA
   artifacts:
     paths:
@@ -79,7 +98,7 @@ deploy-doc:
 #       --build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE
 #       --build-arg CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
 #       --tag $CI_REGISTRY_IMAGE:dp3-$CI_COMMIT_SHORT_SHA
-#       -f ./test/Dockerfile-dp3 .
+#       -f ./docker/Dockerfile-dp3 .
 #     - docker push $CI_REGISTRY_IMAGE:dp3-$CI_COMMIT_SHORT_SHA
 
 # build-wsclean:
@@ -91,7 +110,7 @@ deploy-doc:
 #       --build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE
 #       --build-arg CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
 #       --tag $CI_REGISTRY_IMAGE:wsclean-$CI_COMMIT_SHORT_SHA
-#       -f ./test/Dockerfile-wsclean .
+#       -f ./docker/Dockerfile-wsclean .
 #     - docker push $CI_REGISTRY_IMAGE:wsclean-$CI_COMMIT_SHORT_SHA
 
 # test-dp3:
@@ -103,7 +122,7 @@ deploy-doc:
 #     - >
 #       docker run
 #       $CI_REGISTRY_IMAGE:dp3-$CI_COMMIT_SHORT_SHA
-#       /opt/lofarbeam/lofarbeam/test/tDockerDP3
+#       /opt/everybeam/everybeam/docker/tDockerDP3
 
 # test-wsclean:
 #   variables:
diff --git a/CMake/config.h.in b/CMake/config.h.in
index cec47a52..5a723152 100644
--- a/CMake/config.h.in
+++ b/CMake/config.h.in
@@ -1,7 +1,7 @@
-#ifndef LOFARBEAM_CONFIG_H_
-#define LOFARBEAM_CONFIG_H_
+#ifndef EVERYBEAM_CONFIG_H_
+#define EVERYBEAM_CONFIG_H_
 
-#define LOFARBEAM_DATA_DIR "@CMAKE_INSTALL_DATA_DIR@"
+#define EVERYBEAM_DATA_DIR "@CMAKE_INSTALL_DATA_DIR@"
 #define TEST_MEASUREMENTSET "@TEST_MEASUREMENTSET@"
 
 #endif
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7feb4f23..257feac9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,105 +1,74 @@
+#------------------------------------------------------------------------------
+# Top level CMakeLists.txt file for EveryBeam
 cmake_minimum_required(VERSION 3.0.0)
 
-project(EveryBeam)
+#------------------------------------------------------------------------------
+# Set project name and version number
+project(EveryBeam VERSION 5.0.0)
 
 string(TOLOWER ${CMAKE_PROJECT_NAME} projectname )
 
+# Set the path to CMake modules
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
+
 # Configure directory for data files
 set(CMAKE_INSTALL_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/${projectname}")
 message("Storing data in: " ${CMAKE_INSTALL_DATA_DIR})
 configure_file(${CMAKE_SOURCE_DIR}/CMake/config.h.in ${CMAKE_BINARY_DIR}/config.h)
 
-add_subdirectory(external)
+# Find and include HDF5
+find_package(HDF5 COMPONENTS C CXX REQUIRED)
+add_definitions(${HDF5_DEFINITIONS})
+include_directories(${HDF5_INCLUDE_DIR})
 
+# Find and include Casacore
+set(CASACORE_MAKE_REQUIRED_EXTERNALS_OPTIONAL TRUE)
+find_package(Casacore REQUIRED COMPONENTS casa ms tables measures fits)
+include_directories(${CASACORE_INCLUDE_DIR})
+
+# Find and include OpenMP
+find_package(OpenMP REQUIRED)
+
+#------------------------------------------------------------------------------
+# Set CMake and compiler options
 if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
     include(CTest)
 endif()
 
-# Add tests
-if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
-    add_subdirectory(test)
-endif()
-
 if (POLICY CMP0074)
 cmake_policy(SET CMP0074 NEW)
 endif()
 
-find_package(HDF5 COMPONENTS C CXX REQUIRED)
-add_definitions(${HDF5_DEFINITIONS})
-include_directories(${HDF5_INCLUDE_DIR})
+# Set compile options
+add_compile_options(-std=c++11 "${OpenMP_CXX_FLAGS}" -Wall -DNDEBUG -Wl,--no-undefined)
 
-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
+#------------------------------------------------------------------------------
+# Find/load top level dependencies
+add_subdirectory(external)
 
-set(CASACORE_MAKE_REQUIRED_EXTERNALS_OPTIONAL TRUE)
-find_package(Casacore REQUIRED COMPONENTS casa ms tables measures fits)
-include_directories(${CASACORE_INCLUDE_DIR})
+#------------------------------------------------------------------------------
+# Add source
+add_subdirectory(cpp)
 
-# Add element models
-add_subdirectory(hamaker)
-add_subdirectory(lobes)
-add_subdirectory(oskar)
-
-add_compile_options(-std=c++11 -Wall -DNDEBUG -Wl,--no-undefined)
-
-add_library(everybeam SHARED
-  Antenna.cc
-  ElementResponse.cc
-  BeamFormer.cc
-  Element.cc
-  ITRFConverter.cc
-  ITRFDirection.cc
-  LofarMetaDataUtil.cc
-  MathUtil.cc
-  Station.cc
-  Types.cc
-)
-
-set_target_properties(everybeam PROPERTIES
-    CXX_STANDARD 17
-    VERSION 3
-)
-
-target_include_directories(everybeam PUBLIC ${CASACORE_INCLUDE_DIR})
-
-target_link_libraries(everybeam PUBLIC ${CASACORE_LIBRARIES})
-
-target_link_libraries(everybeam PUBLIC hamaker lobes oskar)
-
-install (
-  TARGETS everybeam
-  EXPORT EveryBeamTargets
-  DESTINATION lib)
-
-install (FILES
-  Antenna.h
-  BeamFormer.h
-  Constants.h
-  Element.h
-  ElementResponse.h
-  LofarMetaDataUtil.h
-  MathUtil.h
-  MutablePtr.h
-  Station.h
-  Types.h
-  ITRFConverter.h
-  ITRFDirection.h
-DESTINATION "include/${CMAKE_PROJECT_NAME}")
-
-install(
-  EXPORT EveryBeamTargets
-  FILE EveryBeamConfig.cmake
-  NAMESPACE EveryBeam::
-  DESTINATION "lib/${projectname}"
-)
+#------------------------------------------------------------------------------
+# Add tests
+if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
+   add_subdirectory(cpp/test)
+   # TODO: compiling the demos should probably be a different cmake project
+   # in which we use find_package(EveryBeam)
+   add_subdirectory(demo)
+endif()
 
+#------------------------------------------------------------------------------
+# Documentation
 find_package(Doxygen)
 
 if(DOXYGEN_FOUND)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
 add_custom_target(doc
-        ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-        COMMENT "Generating developer API documentation with Doxygen" VERBATIM)
+       ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+       WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+       COMMENT "Generating developer API documentation with Doxygen" VERBATIM)
 elseif(DOXYGEN_FOUND)
 
 endif(DOXYGEN_FOUND)
diff --git a/MathUtil.cc b/MathUtil.cc
deleted file mode 100644
index 005e0897..00000000
--- a/MathUtil.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// MathUtil.cc: Various mathematical operations on vectors and matrices.
-//
-// Copyright (C) 2013
-// ASTRON (Netherlands Institute for Radio Astronomy)
-// P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
-//
-// This file is part of the LOFAR software suite.
-// The LOFAR software suite is free software: you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as published
-// by the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The LOFAR software suite is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
-//
-// $Id$
-
-#include "MathUtil.h"
-
-namespace everybeam {}  // namespace everybeam
diff --git a/Types.cc b/Types.cc
deleted file mode 100644
index f75ae165..00000000
--- a/Types.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Types.cc: Declaration of types used in this library.
-//
-// Copyright (C) 2013
-// ASTRON (Netherlands Institute for Radio Astronomy)
-// P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
-//
-// This file is part of the LOFAR software suite.
-// The LOFAR software suite is free software: you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as published
-// by the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The LOFAR software suite is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
-//
-// $Id$
-
-#include "Types.h"
-
-namespace everybeam {}  // namespace everybeam
diff --git a/lobes/CS302_coords.mat b/coeffs/CS302_coords.mat
similarity index 100%
rename from lobes/CS302_coords.mat
rename to coeffs/CS302_coords.mat
diff --git a/hamaker/HamakerHBACoeff.h5 b/coeffs/HamakerHBACoeff.h5
similarity index 100%
rename from hamaker/HamakerHBACoeff.h5
rename to coeffs/HamakerHBACoeff.h5
diff --git a/hamaker/HamakerLBACoeff.h5 b/coeffs/HamakerLBACoeff.h5
similarity index 100%
rename from hamaker/HamakerLBACoeff.h5
rename to coeffs/HamakerLBACoeff.h5
diff --git a/hamaker/element_beam_HBA.coeff b/coeffs/element_beam_HBA.coeff
similarity index 100%
rename from hamaker/element_beam_HBA.coeff
rename to coeffs/element_beam_HBA.coeff
diff --git a/hamaker/element_beam_LBA.coeff b/coeffs/element_beam_LBA.coeff
similarity index 100%
rename from hamaker/element_beam_LBA.coeff
rename to coeffs/element_beam_LBA.coeff
diff --git a/Antenna.cc b/cpp/Antenna.cc
similarity index 92%
rename from Antenna.cc
rename to cpp/Antenna.cc
index 7316941b..4d5f7e4c 100644
--- a/Antenna.cc
+++ b/cpp/Antenna.cc
@@ -1,6 +1,6 @@
 #include "Antenna.h"
 
-#include "MathUtil.h"
+#include "common/MathUtil.h"
 
 namespace everybeam {
 vector3r_t Antenna::transform_to_local_direction(const vector3r_t &direction) {
diff --git a/Antenna.h b/cpp/Antenna.h
similarity index 99%
rename from Antenna.h
rename to cpp/Antenna.h
index 0d1f69de..87b603e1 100644
--- a/Antenna.h
+++ b/cpp/Antenna.h
@@ -5,7 +5,7 @@
 #include <memory>
 #include <iostream>
 
-#include "Types.h"
+#include "common/Types.h"
 
 namespace everybeam {
 
diff --git a/BeamFormer.cc b/cpp/BeamFormer.cc
similarity index 97%
rename from BeamFormer.cc
rename to cpp/BeamFormer.cc
index 8f63c24c..c436f057 100644
--- a/BeamFormer.cc
+++ b/cpp/BeamFormer.cc
@@ -1,7 +1,7 @@
 #include "BeamFormer.h"
 
-#include "MathUtil.h"
-#include "Constants.h"
+#include "common/Constants.h"
+#include "common/MathUtil.h"
 
 #include <cmath>
 
@@ -33,7 +33,7 @@ std::vector<std::complex<double>> BeamFormer::compute_geometric_response(
                       direction[2] * (antenna->m_phase_reference_position[2] -
                                       m_local_phase_reference_position[2]);
 
-    double phase = -2 * M_PI * dl / (constants::c / freq);
+    double phase = -2 * M_PI * dl / (common::c / freq);
     result.push_back({std::sin(phase), std::cos(phase)});
   }
   return result;
diff --git a/BeamFormer.h b/cpp/BeamFormer.h
similarity index 99%
rename from BeamFormer.h
rename to cpp/BeamFormer.h
index 38b1bb15..f57c8bd1 100644
--- a/BeamFormer.h
+++ b/cpp/BeamFormer.h
@@ -5,7 +5,7 @@
 #include <vector>
 
 #include "Element.h"
-#include "Types.h"
+#include "common/Types.h"
 
 namespace everybeam {
 class BeamFormer : public Antenna {
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
new file mode 100644
index 00000000..81b81be4
--- /dev/null
+++ b/cpp/CMakeLists.txt
@@ -0,0 +1,48 @@
+#------------------------------------------------------------------------------
+# Add relevant subdirs
+add_subdirectory(common)
+add_subdirectory(coords)
+
+add_subdirectory(hamaker)
+add_subdirectory(lobes)
+add_subdirectory(oskar)
+
+#------------------------------------------------------------------------------
+add_library(everybeam SHARED
+  Antenna.cc
+  ElementResponse.cc
+  BeamFormer.cc
+  Element.cc
+  coords/ITRFConverter.cc
+  coords/ITRFDirection.cc
+  LofarMetaDataUtil.cc
+  Station.cc
+)
+
+target_include_directories(everybeam PUBLIC ${CASACORE_INCLUDE_DIR})
+target_link_libraries(everybeam PUBLIC ${CASACORE_LIBRARIES})
+target_link_libraries(everybeam PUBLIC hamaker lobes oskar)
+
+install (
+  TARGETS everybeam
+  EXPORT EveryBeamTargets
+  DESTINATION lib)
+
+#------------------------------------------------------------------------------
+# Install headers  
+install (FILES
+  Antenna.h
+  BeamFormer.h
+  Element.h
+  ElementResponse.h
+  LofarMetaDataUtil.h
+  Station.h
+DESTINATION "include/${CMAKE_PROJECT_NAME}")
+
+install(
+  EXPORT EveryBeamTargets
+  FILE EveryBeamConfig.cmake
+  NAMESPACE EveryBeam::
+  DESTINATION "lib/${projectname}"
+)
+
diff --git a/Element.cc b/cpp/Element.cc
similarity index 97%
rename from Element.cc
rename to cpp/Element.cc
index cfa6be3c..6b5c640e 100644
--- a/Element.cc
+++ b/cpp/Element.cc
@@ -1,5 +1,5 @@
 #include "Element.h"
-#include "MathUtil.h"
+#include "common/MathUtil.h"
 
 namespace everybeam {
 matrix22c_t Element::local_response(real_t time, real_t freq,
diff --git a/Element.h b/cpp/Element.h
similarity index 98%
rename from Element.h
rename to cpp/Element.h
index ad5acf35..60af4ac1 100644
--- a/Element.h
+++ b/cpp/Element.h
@@ -6,7 +6,7 @@
 
 #include "Antenna.h"
 #include "ElementResponse.h"
-#include "Types.h"
+#include "common/Types.h"
 
 namespace everybeam {
 
diff --git a/ElementResponse.cc b/cpp/ElementResponse.cc
similarity index 100%
rename from ElementResponse.cc
rename to cpp/ElementResponse.cc
diff --git a/ElementResponse.h b/cpp/ElementResponse.h
similarity index 91%
rename from ElementResponse.h
rename to cpp/ElementResponse.h
index 8ac85f15..3ca690cb 100644
--- a/ElementResponse.h
+++ b/cpp/ElementResponse.h
@@ -4,10 +4,15 @@
 #include <complex>
 #include <ostream>
 
-#include "MutablePtr.h"
+#include "common/MutablePtr.h"
 
 namespace everybeam {
 
+namespace common {
+template <typename T>
+class MutablePtr;
+}
+
 enum ElementResponseModel {
   Unknown,
   Hamaker,
@@ -25,7 +30,7 @@ std::ostream& operator<<(std::ostream& os, ElementResponseModel model);
  */
 class ElementResponse {
  public:
-  typedef MutablePtr<ElementResponse>
+  typedef common::MutablePtr<ElementResponse>
       Ptr;  //!< Pointer to ElementResponse object
 
   /**
diff --git a/LofarMetaDataUtil.cc b/cpp/LofarMetaDataUtil.cc
similarity index 98%
rename from LofarMetaDataUtil.cc
rename to cpp/LofarMetaDataUtil.cc
index fc151d33..1a5572a3 100644
--- a/LofarMetaDataUtil.cc
+++ b/cpp/LofarMetaDataUtil.cc
@@ -22,11 +22,7 @@
 // $Id$
 
 #include "LofarMetaDataUtil.h"
-// #include "AntennaFieldLBA.h"
-// #include "AntennaFieldHBA.h"
-#include "MathUtil.h"
-// #include "TileAntenna.h"
-// #include "DualDipoleAntenna.h"
+#include "common/MathUtil.h"
 
 #include <casacore/measures/Measures/MDirection.h>
 #include <casacore/measures/Measures/MPosition.h>
@@ -95,11 +91,13 @@ Table getSubTable(const Table &table, const string &name) {
 TileConfig readTileConfig(const Table &table, unsigned int row) {
   ROArrayQuantColumn<Double> c_tile_offset(table, "TILE_ELEMENT_OFFSET", "m");
 
-  // Read tile configuration for HBA antenna fields.
+  // Read tile configuration for HBA antenna fields, assert validity of aips
+  // offset.
   Matrix<Quantity> aips_offset = c_tile_offset(row);
-  assert(aips_offset.ncolumn() == TileAntenna::TileConfig::size());
 
   TileConfig config;
+  assert(aips_offset.ncolumn() == config.size());
+
   for (unsigned int i = 0; i < config.size(); ++i) {
     config[i][0] = aips_offset(0, i).getValue();
     config[i][1] = aips_offset(1, i).getValue();
diff --git a/LofarMetaDataUtil.h b/cpp/LofarMetaDataUtil.h
similarity index 100%
rename from LofarMetaDataUtil.h
rename to cpp/LofarMetaDataUtil.h
diff --git a/Station.cc b/cpp/Station.cc
similarity index 97%
rename from Station.cc
rename to cpp/Station.cc
index bf611b88..e5f3a22c 100644
--- a/Station.cc
+++ b/cpp/Station.cc
@@ -21,15 +21,13 @@
 // $Id$
 
 #include "Station.h"
-#include "MathUtil.h"
+#include "common/MathUtil.h"
 
 #include "hamaker/HamakerElementResponse.h"
 #include "oskar/OSKARElementResponse.h"
 #include "lobes/LOBESElementResponse.h"
-// #include "DualDipoleAntenna.h"
-// #include "TileAntenna.h"
 
-namespace everybeam {
+using namespace everybeam;
 
 Station::Station(const std::string &name, const vector3r_t &position,
                  const ElementResponseModel model)
@@ -39,9 +37,9 @@ Station::Station(const std::string &name, const vector3r_t &position,
       itsElementResponse(nullptr) {
   setModel(model);
   vector3r_t ncp = {{0.0, 0.0, 1.0}};
-  itsNCP.reset(new ITRFDirection(ncp));
+  itsNCP.reset(new coords::ITRFDirection(ncp));
   vector3r_t ncppol0 = {{1.0, 0.0, 0.0}};
-  itsNCPPol0.reset(new ITRFDirection(ncppol0));
+  itsNCPPol0.reset(new coords::ITRFDirection(ncppol0));
 }
 
 void Station::setModel(const ElementResponseModel model) {
@@ -235,5 +233,3 @@ matrix22r_t Station::rotation(real_t time, const vector3r_t &direction) const {
 vector3r_t Station::ncp(real_t time) const { return itsNCP->at(time); }
 
 vector3r_t Station::ncppol0(real_t time) const { return itsNCPPol0->at(time); }
-
-}  // namespace everybeam
diff --git a/Station.h b/cpp/Station.h
similarity index 99%
rename from Station.h
rename to cpp/Station.h
index c0b9bb26..978efe5e 100644
--- a/Station.h
+++ b/cpp/Station.h
@@ -29,13 +29,14 @@
 #include "ElementResponse.h"
 #include "Antenna.h"
 #include "BeamFormer.h"
-#include "ITRFDirection.h"
-#include "Types.h"
+#include "coords/ITRFDirection.h"
+#include "common/Types.h"
 
 #include <memory>
 #include <vector>
 
 namespace everybeam {
+
 class Station {
  public:
   typedef std::shared_ptr<Station> Ptr;
@@ -350,7 +351,7 @@ class Station {
 
   Antenna::Ptr itsAntenna;
 
-  ITRFDirection::Ptr itsNCP;
+  coords::ITRFDirection::Ptr itsNCP;
   /** Reference direction for NCP observations.
    *
    * NCP pol0 is the direction used as reference in the coordinate system
@@ -361,7 +362,7 @@ class Station {
    *
    * Added by Maaijke Mevius, December 2018.
    */
-  ITRFDirection::Ptr itsNCPPol0;
+  coords::ITRFDirection::Ptr itsNCPPol0;
 };
 
 // ------------------------------------------------------------------------- //
diff --git a/cpp/common/CMakeLists.txt b/cpp/common/CMakeLists.txt
new file mode 100644
index 00000000..656f29ab
--- /dev/null
+++ b/cpp/common/CMakeLists.txt
@@ -0,0 +1,8 @@
+#------------------------------------------------------------------------------
+# Install headers
+install (FILES
+  Constants.h
+  MathUtil.h
+  MutablePtr.h
+  Types.h
+DESTINATION "include/${CMAKE_PROJECT_NAME}/common")
\ No newline at end of file
diff --git a/Constants.h b/cpp/common/Constants.h
similarity index 92%
rename from Constants.h
rename to cpp/common/Constants.h
index e335df7f..4abe366f 100644
--- a/Constants.h
+++ b/cpp/common/Constants.h
@@ -29,12 +29,10 @@
 #include "Types.h"
 
 namespace everybeam {
-
-/** %Constants used in this library. */
-namespace constants {
+namespace common {
 /** Speed of light (m/s) */
 const real_t c = 2.99792458e+08;
-}  // namespace constants
+}  // namespace common
 }  // namespace everybeam
 
 #endif
diff --git a/MathUtil.h b/cpp/common/MathUtil.h
similarity index 100%
rename from MathUtil.h
rename to cpp/common/MathUtil.h
diff --git a/MutablePtr.h b/cpp/common/MutablePtr.h
similarity index 98%
rename from MutablePtr.h
rename to cpp/common/MutablePtr.h
index c8affd89..264f685d 100644
--- a/MutablePtr.h
+++ b/cpp/common/MutablePtr.h
@@ -26,7 +26,7 @@
 #include <memory>
 
 namespace everybeam {
-
+namespace common {
 /*!
  * \brief MutablePtr is a mutable smart pointer derived from std::shared_ptr.
  *
@@ -83,5 +83,6 @@ class MutablePtr : public std::shared_ptr<std::shared_ptr<T>> {
   void set(std::shared_ptr<T> ptr) { *(this->get()) = ptr; }
   explicit operator bool() const noexcept { return **this; }
 };
+}  // namespace common
 }  // namespace everybeam
 #endif
diff --git a/Singleton.h b/cpp/common/Singleton.h
similarity index 92%
rename from Singleton.h
rename to cpp/common/Singleton.h
index e0b80efa..c5e8897c 100644
--- a/Singleton.h
+++ b/cpp/common/Singleton.h
@@ -1,5 +1,5 @@
 namespace everybeam {
-
+namespace common {
 template <typename T>
 class Singleton {
  public:
@@ -16,4 +16,5 @@ class Singleton {
   Singleton(Singleton const&) = delete;
   void operator=(Singleton const&) = delete;
 };
+}  // namespace common
 }  // namespace everybeam
diff --git a/Types.h b/cpp/common/Types.h
similarity index 100%
rename from Types.h
rename to cpp/common/Types.h
diff --git a/cpp/coords/CMakeLists.txt b/cpp/coords/CMakeLists.txt
new file mode 100644
index 00000000..6022220e
--- /dev/null
+++ b/cpp/coords/CMakeLists.txt
@@ -0,0 +1,6 @@
+#------------------------------------------------------------------------------
+# Install headers
+install (FILES
+  ITRFConverter.h
+  ITRFDirection.h
+DESTINATION "include/${CMAKE_PROJECT_NAME}/coords")
diff --git a/ITRFConverter.cc b/cpp/coords/ITRFConverter.cc
similarity index 96%
rename from ITRFConverter.cc
rename to cpp/coords/ITRFConverter.cc
index e51b7aed..bada341f 100644
--- a/ITRFConverter.cc
+++ b/cpp/coords/ITRFConverter.cc
@@ -7,7 +7,9 @@
 #include <casacore/measures/Measures/MDirection.h>
 #include <casacore/measures/Measures/MEpoch.h>
 
-namespace everybeam {
+// namespace everybeam {
+using namespace everybeam;
+using namespace everybeam::coords;
 
 // TODO: Initialize converter with a time (and fixed position) and convert
 // specific directions.
@@ -79,4 +81,4 @@ casacore::MDirection ITRFConverter::toDirection(
   return itsConverter(direction);
 }
 
-}  // namespace everybeam
+// }  // namespace everybeam
diff --git a/ITRFConverter.h b/cpp/coords/ITRFConverter.h
similarity index 94%
rename from ITRFConverter.h
rename to cpp/coords/ITRFConverter.h
index 706d6ead..78e7c57d 100644
--- a/ITRFConverter.h
+++ b/cpp/coords/ITRFConverter.h
@@ -6,7 +6,7 @@
 // \file
 // Functor that maps J2000 to an ITRF direction.
 
-#include "Types.h"
+#include "./../common/Types.h"
 
 #include <casacore/measures/Measures/MeasFrame.h>
 #include <casacore/measures/Measures/MeasConvert.h>
@@ -15,7 +15,7 @@
 #include <memory>
 
 namespace everybeam {
-
+namespace coords {
 /**
  * @brief Class providing utilities for coordinate transformations
  * to and from ITRF (International Terrestrial Reference Frame)
@@ -40,5 +40,6 @@ class ITRFConverter {
   casacore::MeasFrame itsFrame;
   mutable casacore::MDirection::Convert itsConverter;
 };
+}  // namespace coords
 }  // namespace everybeam
 #endif
diff --git a/ITRFDirection.cc b/cpp/coords/ITRFDirection.cc
similarity index 96%
rename from ITRFDirection.cc
rename to cpp/coords/ITRFDirection.cc
index 50fe889d..e5a736b1 100644
--- a/ITRFDirection.cc
+++ b/cpp/coords/ITRFDirection.cc
@@ -26,7 +26,9 @@
 #include <casacore/measures/Measures/MDirection.h>
 #include <casacore/measures/Measures/MEpoch.h>
 
-namespace everybeam {
+// namespace everybeam {
+using namespace everybeam;
+using namespace everybeam::coords;
 
 // ITRF position of CS002LBA, just to use a fixed reference
 const vector3r_t ITRFDirection::itsLOFARPosition = {
@@ -90,4 +92,4 @@ vector3r_t ITRFDirection::at(real_t time) const {
   return itrf;
 }
 
-}  // namespace everybeam
+// }  // namespace everybeam
diff --git a/ITRFDirection.h b/cpp/coords/ITRFDirection.h
similarity index 96%
rename from ITRFDirection.h
rename to cpp/coords/ITRFDirection.h
index 4dc8e43b..633532fa 100644
--- a/ITRFDirection.h
+++ b/cpp/coords/ITRFDirection.h
@@ -26,7 +26,7 @@
 // \file
 // Functor that maps time to an ITRF direction.
 
-#include "Types.h"
+#include "./../common/Types.h"
 
 #include <casacore/measures/Measures/MeasFrame.h>
 #include <casacore/measures/Measures/MeasConvert.h>
@@ -36,7 +36,7 @@
 #include <mutex>
 
 namespace everybeam {
-
+namespace coords {
 class ITRFDirection {
  public:
   typedef std::shared_ptr<ITRFDirection> Ptr;
@@ -59,7 +59,7 @@ class ITRFDirection {
   mutable casacore::MDirection::Convert itsConverter;
   mutable std::mutex itsMutex;
 };
-
+}  // namespace coords
 }  // namespace everybeam
 
 #endif
diff --git a/hamaker/CMakeLists.txt b/cpp/hamaker/CMakeLists.txt
similarity index 70%
rename from hamaker/CMakeLists.txt
rename to cpp/hamaker/CMakeLists.txt
index 6043cfd0..08934498 100644
--- a/hamaker/CMakeLists.txt
+++ b/cpp/hamaker/CMakeLists.txt
@@ -16,5 +16,5 @@ install(
 
 # install coefficients
 message("install hamaker in: " ${CMAKE_INSTALL_DATA_DIR})
-install(FILES "${CMAKE_SOURCE_DIR}/hamaker/HamakerHBACoeff.h5" DESTINATION ${CMAKE_INSTALL_DATA_DIR})
-install(FILES "${CMAKE_SOURCE_DIR}/hamaker/HamakerLBACoeff.h5" DESTINATION ${CMAKE_INSTALL_DATA_DIR})
+install(FILES "${CMAKE_SOURCE_DIR}/coeffs/HamakerHBACoeff.h5" DESTINATION ${CMAKE_INSTALL_DATA_DIR})
+install(FILES "${CMAKE_SOURCE_DIR}/coeffs/HamakerLBACoeff.h5" DESTINATION ${CMAKE_INSTALL_DATA_DIR})
diff --git a/hamaker/HamakerCoeff.cc b/cpp/hamaker/HamakerCoeff.cc
similarity index 100%
rename from hamaker/HamakerCoeff.cc
rename to cpp/hamaker/HamakerCoeff.cc
diff --git a/hamaker/HamakerCoeff.h b/cpp/hamaker/HamakerCoeff.h
similarity index 100%
rename from hamaker/HamakerCoeff.h
rename to cpp/hamaker/HamakerCoeff.h
diff --git a/hamaker/HamakerElementResponse.cc b/cpp/hamaker/HamakerElementResponse.cc
similarity index 95%
rename from hamaker/HamakerElementResponse.cc
rename to cpp/hamaker/HamakerElementResponse.cc
index f48ad4a8..4b97940b 100644
--- a/hamaker/HamakerElementResponse.cc
+++ b/cpp/hamaker/HamakerElementResponse.cc
@@ -7,17 +7,17 @@
 #include "config.h"
 
 #include "HamakerElementResponse.h"
-#include "../Singleton.h"
+#include "../common/Singleton.h"
 
 namespace everybeam {
 
 std::shared_ptr<HamakerElementResponse> HamakerElementResponse::getInstance(
     const std::string& name) {
   if (name.find("LBA") != std::string::npos) {
-    return Singleton<HamakerElementResponseLBA>::getInstance();
+    return common::Singleton<HamakerElementResponseLBA>::getInstance();
   }
   if (name.find("HBA") != std::string::npos) {
-    return Singleton<HamakerElementResponseHBA>::getInstance();
+    return common::Singleton<HamakerElementResponseHBA>::getInstance();
   }
   throw std::invalid_argument(
       "HamakerElementResponse::getInstance: name should end in either 'LBA' or "
@@ -26,7 +26,7 @@ std::shared_ptr<HamakerElementResponse> HamakerElementResponse::getInstance(
 
 std::string HamakerElementResponse::get_path(const char* filename) const {
   std::stringstream ss;
-  ss << LOFARBEAM_DATA_DIR << "/";
+  ss << EVERYBEAM_DATA_DIR << "/";
   ss << filename;
   return ss.str();
 }
@@ -122,5 +122,4 @@ HamakerElementResponseLBA::HamakerElementResponseLBA() {
   std::string path = get_path("HamakerLBACoeff.h5");
   m_coeffs.reset(new HamakerCoefficients(path));
 }
-
 }  // namespace everybeam
diff --git a/hamaker/HamakerElementResponse.h b/cpp/hamaker/HamakerElementResponse.h
similarity index 100%
rename from hamaker/HamakerElementResponse.h
rename to cpp/hamaker/HamakerElementResponse.h
diff --git a/cpp/lobes/CMakeLists.txt b/cpp/lobes/CMakeLists.txt
new file mode 100644
index 00000000..7e9d0778
--- /dev/null
+++ b/cpp/lobes/CMakeLists.txt
@@ -0,0 +1,34 @@
+#------------------------------------------------------------------------------
+# Required packages for lobes
+# pybind and eigen not required here, will be moved to python dir with pybindings
+# find_package(pybind11 REQUIRED)
+# find_package (Eigen3 REQUIRED NO_MODULE)
+
+# pybind11_add_module(pylobes SHARED lobes.cc ElementResponse.cc LOBESElementResponse.cc)
+# target_link_libraries (pylobes PUBLIC Eigen3::Eigen ${HDF5_LIBRARIES})
+
+add_library(lobes SHARED LOBESElementResponse.cc)
+string(TOLOWER ${CMAKE_PROJECT_NAME} projectname )
+set_target_properties(lobes PROPERTIES LIBRARY_OUTPUT_NAME "${projectname}-lobes")
+
+#------------------------------------------------------------------------------
+# Install
+install(
+  TARGETS lobes
+  EXPORT EveryBeamTargets
+  DESTINATION lib)
+
+#------------------------------------------------------------------------------
+# TODO: can't we remove all this?
+set(MISC_DIR ${CMAKE_SOURCE_DIR}/scripts/misc)
+configure_file(${MISC_DIR}/test_lobes.py ${CMAKE_CURRENT_BINARY_DIR}/test_lobes.py COPYONLY)
+
+configure_file(${MISC_DIR}/F4far_new.py ${CMAKE_CURRENT_BINARY_DIR}/F4far_new.py COPYONLY)
+configure_file(${MISC_DIR}/calc_modes_1deg_noback.py ${CMAKE_CURRENT_BINARY_DIR}/calc_modes_1deg_noback.py COPYONLY)
+configure_file(${MISC_DIR}/hamaker_vs_lobes.py ${CMAKE_CURRENT_BINARY_DIR}/hamaker_vs_lobes.py COPYONLY)
+configure_file(${MISC_DIR}/test_beam_model.py ${CMAKE_CURRENT_BINARY_DIR}/test_beam_model.py COPYONLY)
+
+configure_file(${CMAKE_SOURCE_DIR}/coeffs/CS302_coords.mat ${CMAKE_CURRENT_BINARY_DIR}/CS302_coords.mat COPYONLY)
+
+# TODO Too large for git repo, get file from somewhere else
+# configure_file(LBA_CS302_fine.mat LBA_CS302_fine.mat COPYONLY)
diff --git a/lobes/DefaultCoeffHBA.cc b/cpp/lobes/DefaultCoeffHBA.cc
similarity index 100%
rename from lobes/DefaultCoeffHBA.cc
rename to cpp/lobes/DefaultCoeffHBA.cc
diff --git a/lobes/DefaultCoeffLBA.cc b/cpp/lobes/DefaultCoeffLBA.cc
similarity index 100%
rename from lobes/DefaultCoeffLBA.cc
rename to cpp/lobes/DefaultCoeffLBA.cc
diff --git a/lobes/ElementResponse.cc b/cpp/lobes/ElementResponse.cc
similarity index 100%
rename from lobes/ElementResponse.cc
rename to cpp/lobes/ElementResponse.cc
diff --git a/lobes/ElementResponse.h b/cpp/lobes/ElementResponse.h
similarity index 100%
rename from lobes/ElementResponse.h
rename to cpp/lobes/ElementResponse.h
diff --git a/lobes/LOBESElementResponse.cc b/cpp/lobes/LOBESElementResponse.cc
similarity index 100%
rename from lobes/LOBESElementResponse.cc
rename to cpp/lobes/LOBESElementResponse.cc
diff --git a/lobes/LOBESElementResponse.h b/cpp/lobes/LOBESElementResponse.h
similarity index 100%
rename from lobes/LOBESElementResponse.h
rename to cpp/lobes/LOBESElementResponse.h
diff --git a/makeresponseimage.cc b/cpp/makeresponseimage.cc
similarity index 100%
rename from makeresponseimage.cc
rename to cpp/makeresponseimage.cc
diff --git a/oskar/CMakeLists.txt b/cpp/oskar/CMakeLists.txt
similarity index 59%
rename from oskar/CMakeLists.txt
rename to cpp/oskar/CMakeLists.txt
index f8f3f56b..4a166f99 100644
--- a/oskar/CMakeLists.txt
+++ b/cpp/oskar/CMakeLists.txt
@@ -1,6 +1,8 @@
+#------------------------------------------------------------------------------
 # directory for config.h
 include_directories(${CMAKE_BINARY_DIR})
 
+#------------------------------------------------------------------------------
 # build liboskar.so
 add_library(oskar SHARED
     OSKARElementResponse.cc
@@ -12,8 +14,11 @@ add_library(oskar SHARED
 string(TOLOWER ${CMAKE_PROJECT_NAME} projectname )
 set_target_properties(oskar PROPERTIES LIBRARY_OUTPUT_NAME "${projectname}-oskar")
 
-target_link_libraries(oskar ${HDF5_LIBRARIES} ${HDF5_CXX_LIBRARIES})
+#------------------------------------------------------------------------------
+# Link against HDF5 and OpenMP
+target_link_libraries(oskar ${HDF5_LIBRARIES} ${HDF5_CXX_LIBRARIES} ${OpenMP_CXX_FLAGS})
 
+#------------------------------------------------------------------------------
 # install libeverybeam-oskar.so
 install(
   TARGETS oskar
diff --git a/oskar/OSKARDatafile.cc b/cpp/oskar/OSKARDatafile.cc
similarity index 100%
rename from oskar/OSKARDatafile.cc
rename to cpp/oskar/OSKARDatafile.cc
diff --git a/oskar/OSKARDatafile.h b/cpp/oskar/OSKARDatafile.h
similarity index 100%
rename from oskar/OSKARDatafile.h
rename to cpp/oskar/OSKARDatafile.h
diff --git a/oskar/OSKARDataset.cc b/cpp/oskar/OSKARDataset.cc
similarity index 100%
rename from oskar/OSKARDataset.cc
rename to cpp/oskar/OSKARDataset.cc
diff --git a/oskar/OSKARDataset.h b/cpp/oskar/OSKARDataset.h
similarity index 100%
rename from oskar/OSKARDataset.h
rename to cpp/oskar/OSKARDataset.h
diff --git a/oskar/OSKARElementResponse.cc b/cpp/oskar/OSKARElementResponse.cc
similarity index 98%
rename from oskar/OSKARElementResponse.cc
rename to cpp/oskar/OSKARElementResponse.cc
index 69891d1a..175c8d78 100644
--- a/oskar/OSKARElementResponse.cc
+++ b/cpp/oskar/OSKARElementResponse.cc
@@ -54,7 +54,7 @@ void OSKARElementResponseSphericalWave::response(
 std::string OSKARElementResponseSphericalWave::get_path(
     const char* filename) const {
   std::stringstream ss;
-  ss << LOFARBEAM_DATA_DIR << "/";
+  ss << EVERYBEAM_DATA_DIR << "/";
   ss << filename;
   return ss.str();
 }
diff --git a/oskar/OSKARElementResponse.h b/cpp/oskar/OSKARElementResponse.h
similarity index 86%
rename from oskar/OSKARElementResponse.h
rename to cpp/oskar/OSKARElementResponse.h
index 4ff3f20c..b7e175b8 100644
--- a/oskar/OSKARElementResponse.h
+++ b/cpp/oskar/OSKARElementResponse.h
@@ -2,7 +2,7 @@
 #define OSKAR_ELEMENTRESPONSE_H
 
 #include "../ElementResponse.h"
-#include "../Singleton.h"
+#include "../common/Singleton.h"
 
 #include "OSKARDatafile.h"
 
@@ -14,7 +14,7 @@ namespace everybeam {
 class OSKARElementResponseDipole : public ElementResponse {
  public:
   static std::shared_ptr<OSKARElementResponseDipole> getInstance() {
-    return Singleton<OSKARElementResponseDipole>::getInstance();
+    return common::Singleton<OSKARElementResponseDipole>::getInstance();
   }
 
   virtual void response(
@@ -26,7 +26,7 @@ class OSKARElementResponseDipole : public ElementResponse {
 class OSKARElementResponseSphericalWave : public ElementResponse {
  public:
   static std::shared_ptr<OSKARElementResponseSphericalWave> getInstance() {
-    return Singleton<OSKARElementResponseSphericalWave>::getInstance();
+    return common::Singleton<OSKARElementResponseSphericalWave>::getInstance();
   }
 
   OSKARElementResponseSphericalWave();
diff --git a/oskar/oskar.h b/cpp/oskar/oskar.h
similarity index 100%
rename from oskar/oskar.h
rename to cpp/oskar/oskar.h
diff --git a/oskar/oskar_evaluate_dipole_pattern.cc b/cpp/oskar/oskar_evaluate_dipole_pattern.cc
similarity index 100%
rename from oskar/oskar_evaluate_dipole_pattern.cc
rename to cpp/oskar/oskar_evaluate_dipole_pattern.cc
diff --git a/oskar/oskar_evaluate_spherical_wave_sum.cc b/cpp/oskar/oskar_evaluate_spherical_wave_sum.cc
similarity index 100%
rename from oskar/oskar_evaluate_spherical_wave_sum.cc
rename to cpp/oskar/oskar_evaluate_spherical_wave_sum.cc
diff --git a/oskar/oskar_helper.h b/cpp/oskar/oskar_helper.h
similarity index 100%
rename from oskar/oskar_helper.h
rename to cpp/oskar/oskar_helper.h
diff --git a/oskar/oskar_vector_types.h b/cpp/oskar/oskar_vector_types.h
similarity index 100%
rename from oskar/oskar_vector_types.h
rename to cpp/oskar/oskar_vector_types.h
diff --git a/cpp/test/CMakeLists.txt b/cpp/test/CMakeLists.txt
new file mode 100644
index 00000000..6eb6fe91
--- /dev/null
+++ b/cpp/test/CMakeLists.txt
@@ -0,0 +1,9 @@
+#------------------------------------------------------------------------------
+# Add executable(s)
+add_executable(tstation tstation.cc)
+target_link_libraries(tstation PUBLIC everybeam)
+target_link_libraries(tstation PUBLIC OpenMP::OpenMP_CXX)
+
+#------------------------------------------------------------------------------
+# Add test
+add_test(station-tests tstation)
\ No newline at end of file
diff --git a/cpp/test/tstation.cc b/cpp/test/tstation.cc
new file mode 100644
index 00000000..f9ced645
--- /dev/null
+++ b/cpp/test/tstation.cc
@@ -0,0 +1,39 @@
+#include "./../Station.h"
+
+int main() {
+  const everybeam::vector3r_t position = {{1.0, 2.0, 3.0}};
+
+  std::string name = "station0_LBA";
+  auto model = everybeam::ElementResponseModel::Hamaker;
+
+  // Create station.
+  everybeam::Station::Ptr station(
+      new everybeam::Station(name, position, model));
+
+  auto element_response = station->get_element_response();
+
+  double freq = 50e6;
+  double theta = 0.0;
+  double phi = 0.0;
+  std::complex<double> response[2][2];
+
+  constexpr int N = 100;
+  std::vector<std::complex<double>> result(N * N * 2 * 2);
+  typedef std::complex<double> result_arr_t[N][N][2][2];
+
+  result_arr_t &result_arr = *(result_arr_t *)result.data();
+
+  for (int i = 0; i < N; ++i) {
+    double x = (2.0 * i) / (N - 1) - 1.0;
+    for (int j = 0; j < N; ++j) {
+      double y = (2.0 * j) / (N - 1) - 1.0;
+      double theta = asin(sqrt(x * x + y * y));
+      double phi = atan2(y, x);
+
+      double az = M_PI - phi;
+      double el = M_PI_2 - theta;
+      element_response->response(0, freq, theta, phi, result_arr[i][j]);
+    }
+  }
+  return 0;
+}
diff --git a/test/CMakeLists.txt b/demo/CMakeLists.txt
similarity index 72%
rename from test/CMakeLists.txt
rename to demo/CMakeLists.txt
index dcfd18e3..afcb9d06 100644
--- a/test/CMakeLists.txt
+++ b/demo/CMakeLists.txt
@@ -1,6 +1,3 @@
-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
-find_package(Casacore REQUIRED COMPONENTS casa ms tables measures)
-
 set(TEST_MEASUREMENTSET CACHE STRING "measurement set used for testing")
 
 if (TEST_MEASUREMENTSET)
@@ -48,7 +45,7 @@ if (CFITSIO_FOUND)
   target_include_directories(beamhelper PUBLIC ${CFITSIO_INCLUDE_DIR})
   target_link_libraries(beamhelper PUBLIC everybeam)
   target_link_libraries(beamhelper PUBLIC ${CFITSIO_LIBRARY})
-
+  
   add_executable(tStationBeamHamaker tStationBeamHamaker.cc)
   target_link_libraries(tStationBeamHamaker PUBLIC beamhelper)
   target_include_directories(tStationBeamHamaker PUBLIC ${CMAKE_BINARY_DIR})
@@ -73,21 +70,20 @@ if (CFITSIO_FOUND)
   target_link_libraries(tElementBeamOSKARSphericalWave PUBLIC beamhelper)
   target_include_directories(tElementBeamOSKARSphericalWave PUBLIC ${CMAKE_BINARY_DIR})
 
-  find_package(OpenMP)
-  if (OpenMP_CXX_FOUND)
-      target_link_libraries(tStationBeamHamaker PUBLIC OpenMP::OpenMP_CXX)
-      target_link_libraries(tStationBeamOSKARDipole PUBLIC OpenMP::OpenMP_CXX)
-      target_link_libraries(tStationBeamOSKARSphericalWave PUBLIC OpenMP::OpenMP_CXX)
-      target_link_libraries(tElementBeamHamaker PUBLIC OpenMP::OpenMP_CXX)
-      target_link_libraries(tElementBeamOSKARDipole PUBLIC OpenMP::OpenMP_CXX)
-      target_link_libraries(tElementBeamOSKARSphericalWave PUBLIC OpenMP::OpenMP_CXX)
-  endif()
-
-  add_test(stationbeam-hamaker tStationBeamHamaker)
-  add_test(stationbeam-oskardipole tStationBeamOSKARDipole)
-  add_test(stationbeam-oskarsphericalwave tStationBeamOSKARSphericalWave)
-  add_test(elementbeam-hamaker tElementBeamHamaker)
-  add_test(elementbeam-oskardipole tElementBeamOSKARDipole)
-  add_test(elementbeam-oskarsphericalwave tElementBeamOSKARSphericalWave)
-
+  target_link_libraries(tStationBeamHamaker PUBLIC OpenMP::OpenMP_CXX)
+  target_link_libraries(tStationBeamOSKARDipole PUBLIC OpenMP::OpenMP_CXX)
+  target_link_libraries(tStationBeamOSKARSphericalWave PUBLIC OpenMP::OpenMP_CXX)
+  target_link_libraries(tElementBeamHamaker PUBLIC OpenMP::OpenMP_CXX)
+  target_link_libraries(tElementBeamOSKARDipole PUBLIC OpenMP::OpenMP_CXX)
+  target_link_libraries(tElementBeamOSKARSphericalWave PUBLIC OpenMP::OpenMP_CXX)
+
+  # These are not "tests" in the strict sense of the word, so don't add them to test stack
+  # NOTE: tests should go to cpp/test
+
+  # add_test(stationbeam-hamaker tStationBeamHamaker)
+  # add_test(stationbeam-oskardipole tStationBeamOSKARDipole)
+  # add_test(stationbeam-oskarsphericalwave tStationBeamOSKARSphericalWave)
+  # add_test(elementbeam-hamaker tElementBeamHamaker)
+  # add_test(elementbeam-oskardipole tElementBeamOSKARDipole)
+  # add_test(elementbeam-oskarsphericalwave tElementBeamOSKARSphericalWave)
 endif()
diff --git a/test/beam-helper.cpp b/demo/beam-helper.cpp
similarity index 97%
rename from test/beam-helper.cpp
rename to demo/beam-helper.cpp
index bb771a46..f5b804b5 100644
--- a/test/beam-helper.cpp
+++ b/demo/beam-helper.cpp
@@ -2,7 +2,9 @@
 
 #include <fitsio.h>
 
-#include "MathUtil.h"
+#include "./../cpp/common/MathUtil.h"
+// #include "./../cpp/coords/ITRFDirection.h"
+#include "./../cpp/coords/ITRFConverter.h"
 
 void GetPhaseCentreInfo(
     casacore::MeasurementSet& ms,
@@ -85,7 +87,7 @@ void GetITRFDirections(
 
             const casacore::Unit radUnit("rad");
 
-            ITRFConverter itrfConverter(time);
+            coords::ITRFConverter itrfConverter(time);
 
             casacore::MDirection lDir(casacore::MVDirection(
                 casacore::Quantity(ra + M_PI/2, radUnit),
diff --git a/test/beam-helper.h b/demo/beam-helper.h
similarity index 94%
rename from test/beam-helper.h
rename to demo/beam-helper.h
index 5566fa0e..4bfbab9e 100644
--- a/test/beam-helper.h
+++ b/demo/beam-helper.h
@@ -1,8 +1,6 @@
-#include <ITRFDirection.h>
-#include <ITRFConverter.h>
-#include <ElementResponse.h>
-#include <Station.h>
-#include <LofarMetaDataUtil.h>
+#include "./../cpp/ElementResponse.h"
+#include "./../cpp/Station.h"
+#include "./../cpp/LofarMetaDataUtil.h"
 
 #include <casacore/measures/Measures/MPosition.h>
 #include <casacore/measures/Measures/MEpoch.h>
diff --git a/test/tDockerDP3 b/demo/tDockerDP3
similarity index 100%
rename from test/tDockerDP3
rename to demo/tDockerDP3
diff --git a/test/tElementBeamCommon.h b/demo/tElementBeamCommon.h
similarity index 100%
rename from test/tElementBeamCommon.h
rename to demo/tElementBeamCommon.h
diff --git a/test/tElementBeamHamaker.cc b/demo/tElementBeamHamaker.cc
similarity index 100%
rename from test/tElementBeamHamaker.cc
rename to demo/tElementBeamHamaker.cc
diff --git a/test/tElementBeamOSKARDipole.cc b/demo/tElementBeamOSKARDipole.cc
similarity index 100%
rename from test/tElementBeamOSKARDipole.cc
rename to demo/tElementBeamOSKARDipole.cc
diff --git a/test/tElementBeamOSKARSphericalWave.cc b/demo/tElementBeamOSKARSphericalWave.cc
similarity index 100%
rename from test/tElementBeamOSKARSphericalWave.cc
rename to demo/tElementBeamOSKARSphericalWave.cc
diff --git a/test/tStation.cc b/demo/tStation.cc
similarity index 100%
rename from test/tStation.cc
rename to demo/tStation.cc
diff --git a/test/tStationBeamCommon.h b/demo/tStationBeamCommon.h
similarity index 100%
rename from test/tStationBeamCommon.h
rename to demo/tStationBeamCommon.h
diff --git a/test/tStationBeamHamaker.cc b/demo/tStationBeamHamaker.cc
similarity index 100%
rename from test/tStationBeamHamaker.cc
rename to demo/tStationBeamHamaker.cc
diff --git a/test/tStationBeamOSKARDipole.cc b/demo/tStationBeamOSKARDipole.cc
similarity index 100%
rename from test/tStationBeamOSKARDipole.cc
rename to demo/tStationBeamOSKARDipole.cc
diff --git a/test/tStationBeamOSKARSphericalWave.cc b/demo/tStationBeamOSKARSphericalWave.cc
similarity index 100%
rename from test/tStationBeamOSKARSphericalWave.cc
rename to demo/tStationBeamOSKARSphericalWave.cc
diff --git a/test/Dockerfile-base b/docker/Dockerfile-base
similarity index 100%
rename from test/Dockerfile-base
rename to docker/Dockerfile-base
diff --git a/test/Dockerfile-dp3 b/docker/Dockerfile-dp3
similarity index 100%
rename from test/Dockerfile-dp3
rename to docker/Dockerfile-dp3
diff --git a/docker/Dockerfile-everybeam b/docker/Dockerfile-everybeam
new file mode 100644
index 00000000..123e43e2
--- /dev/null
+++ b/docker/Dockerfile-everybeam
@@ -0,0 +1,18 @@
+#
+# base
+#
+ARG CI_REGISTRY_IMAGE
+FROM ${CI_REGISTRY_IMAGE}:base
+ENV INSTALLDIR /opt
+
+#
+# install-everybeam
+#
+ARG CI_COMMIT_SHORT_SHA
+ENV EVERYBEAM_COMMIT ${CI_COMMIT_SHORT_SHA}
+RUN mkdir -p ${INSTALLDIR}/everybeam/build
+RUN cd ${INSTALLDIR}/everybeam && git clone https://git.astron.nl/RD/EveryBeam.git EveryBeam
+RUN cd ${INSTALLDIR}/everybeam/EveryBeam && git checkout ${EVERYBEAM_COMMIT}
+RUN cd ${INSTALLDIR}/everybeam/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/everybeam ../EveryBeam
+RUN cd ${INSTALLDIR}/everybeam/build && make -j 8
+RUN cd ${INSTALLDIR}/everybeam/build && make install
diff --git a/test/Dockerfile-wsclean b/docker/Dockerfile-wsclean
similarity index 100%
rename from test/Dockerfile-wsclean
rename to docker/Dockerfile-wsclean
diff --git a/Doxyfile.in b/docs/Doxyfile.in
similarity index 100%
rename from Doxyfile.in
rename to docs/Doxyfile.in
diff --git a/lobes/CMakeLists.txt b/lobes/CMakeLists.txt
deleted file mode 100644
index 926d7723..00000000
--- a/lobes/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-find_package(pybind11 REQUIRED)
-find_package (Eigen3 REQUIRED NO_MODULE)
-find_package(HDF5 COMPONENTS C CXX REQUIRED)
-
-# pybind11_add_module(pylobes SHARED lobes.cc ElementResponse.cc LOBESElementResponse.cc)
-# target_link_libraries (pylobes PUBLIC Eigen3::Eigen ${HDF5_LIBRARIES})
-
-add_library(lobes SHARED LOBESElementResponse.cc)
-string(TOLOWER ${CMAKE_PROJECT_NAME} projectname )
-set_target_properties(lobes PROPERTIES LIBRARY_OUTPUT_NAME "${projectname}-lobes")
-
-install(
-  TARGETS lobes
-  EXPORT EveryBeamTargets
-  DESTINATION lib)
-
-configure_file(test.py test.py COPYONLY)
-
-configure_file(F4far_new.py F4far_new.py COPYONLY)
-configure_file(calc_modes_1deg_noback.py calc_modes_1deg_noback.py COPYONLY)
-configure_file(hamaker_vs_lobes.py hamaker_vs_lobes.py COPYONLY)
-configure_file(test_beam_model.py test_beam_model.py COPYONLY)
-
-configure_file(CS302_coords.mat CS302_coords.mat COPYONLY)
-
-# TODO Too large for git repo, get file from somewhere else
-# configure_file(LBA_CS302_fine.mat LBA_CS302_fine.mat COPYONLY)
diff --git a/lobes/lobes.cc b/python/lobes/lobes.cc
similarity index 100%
rename from lobes/lobes.cc
rename to python/lobes/lobes.cc
diff --git a/lobes/lobes.h b/python/lobes/lobes.h
similarity index 100%
rename from lobes/lobes.h
rename to python/lobes/lobes.h
diff --git a/python/placeholder.md b/python/placeholder.md
new file mode 100644
index 00000000..ed8b205f
--- /dev/null
+++ b/python/placeholder.md
@@ -0,0 +1 @@
+# Python bindings go here
\ No newline at end of file
diff --git a/pyeverybeam.cc b/python/pyeverybeam.cc.tmp
similarity index 100%
rename from pyeverybeam.cc
rename to python/pyeverybeam.cc.tmp
diff --git a/hamaker/convert_coeff.py b/scripts/coeff_scripts/convert_coeff.py
similarity index 94%
rename from hamaker/convert_coeff.py
rename to scripts/coeff_scripts/convert_coeff.py
index 562c4712..4d909ba9 100755
--- a/hamaker/convert_coeff.py
+++ b/scripts/coeff_scripts/convert_coeff.py
@@ -55,6 +55,15 @@ def regex(name, type, signed = True):
     return "(?P<%s>%s)" % (name, expr)
 
 def main(args):
+    """
+    Main function for the conversion of of a coefficient file to a *.cc file. Typical usage is
+    ./convert_coeff.py [FILE_IN] [FILE_OUT] [TYPE]
+
+    Examples:
+
+    ./convert_coeff.py element_beam_LBA.coeff DefaultCoeffLBA.cc default_lba 
+    ./convert_coeff.py element_beam_HBA.coeff DefaultCoeffHBA.cc default_hba 
+    """
     print "converting %s -> %s (variable name: %s)" % (args[0], args[1], args[2])
 
     HEADER, COEFF = range(2)
diff --git a/oskar/oskar_matlab_to_csv.m b/scripts/coeff_scripts/oskar_matlab_to_csv.m
similarity index 100%
rename from oskar/oskar_matlab_to_csv.m
rename to scripts/coeff_scripts/oskar_matlab_to_csv.m
diff --git a/oskar/oskar_matlab_to_hdf5.py b/scripts/coeff_scripts/oskar_matlab_to_hdf5.py
similarity index 100%
rename from oskar/oskar_matlab_to_hdf5.py
rename to scripts/coeff_scripts/oskar_matlab_to_hdf5.py
diff --git a/lobes/F4far_new.py b/scripts/misc/F4far_new.py
similarity index 100%
rename from lobes/F4far_new.py
rename to scripts/misc/F4far_new.py
diff --git a/lobes/calc_modes_1deg_noback.py b/scripts/misc/calc_modes_1deg_noback.py
similarity index 100%
rename from lobes/calc_modes_1deg_noback.py
rename to scripts/misc/calc_modes_1deg_noback.py
diff --git a/lobes/hamaker_vs_lobes.py b/scripts/misc/hamaker_vs_lobes.py
similarity index 100%
rename from lobes/hamaker_vs_lobes.py
rename to scripts/misc/hamaker_vs_lobes.py
diff --git a/lobes/test_beam_model.py b/scripts/misc/test_beam_model.py
similarity index 100%
rename from lobes/test_beam_model.py
rename to scripts/misc/test_beam_model.py
diff --git a/lobes/test.py b/scripts/misc/test_lobes.py
similarity index 100%
rename from lobes/test.py
rename to scripts/misc/test_lobes.py
diff --git a/test/Dockerfile-lofarbeam b/test/Dockerfile-lofarbeam
deleted file mode 100644
index b4e6613b..00000000
--- a/test/Dockerfile-lofarbeam
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# base
-#
-ARG CI_REGISTRY_IMAGE
-FROM ${CI_REGISTRY_IMAGE}:base
-ENV INSTALLDIR /opt
-
-#
-# install-lofarbeam
-#
-ARG CI_COMMIT_SHORT_SHA
-ENV LOFARBEAM_COMMIT ${CI_COMMIT_SHORT_SHA}
-RUN mkdir -p ${INSTALLDIR}/lofarbeam/build
-RUN cd ${INSTALLDIR}/lofarbeam && git clone https://git.astron.nl/RD/LOFARBeam.git lofarbeam
-RUN cd ${INSTALLDIR}/lofarbeam/lofarbeam && git checkout ${LOFARBEAM_COMMIT}
-RUN cd ${INSTALLDIR}/lofarbeam/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/lofarbeam ../lofarbeam
-RUN cd ${INSTALLDIR}/lofarbeam/build && make -j 8
-RUN cd ${INSTALLDIR}/lofarbeam/build && make install
-- 
GitLab