From e33c95a64ab0d47bff76104504e5837ea9288876 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 8 Oct 2024 16:41:24 +0200
Subject: [PATCH] add regression against LOFAR1

---
 .../test/common/test_calibration.py            | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tangostationcontrol/test/common/test_calibration.py b/tangostationcontrol/test/common/test_calibration.py
index 36f789a49..7b801d6a8 100644
--- a/tangostationcontrol/test/common/test_calibration.py
+++ b/tangostationcontrol/test/common/test_calibration.py
@@ -281,3 +281,21 @@ class TestDelayCompensation(base.TestCase):
         # should not result in any sample shifts
         self.assertEqual(2, sample_shift[0])
         self.assertEqual(0, sample_shift[1])
+
+    def test_delay_against_LOFAR1(self):
+        """Test correctness of the delay compensation regression against LOFAR1."""
+
+        # INT HBA: 130m, 115m, 85m
+        delay_seconds = numpy.array([530.6981e-9, 465.5254e-9, 342.5133e-9])
+        sample_shift = delay_compensation(delay_seconds, 200_000_000)
+        self.assertListEqual([0, 13, 38], sample_shift.tolist())
+
+        # RS HBA: 115m, 85m
+        delay_seconds = numpy.array([465.5254e-9, 342.5133e-9])
+        sample_shift = delay_compensation(delay_seconds, 200_000_000)
+        self.assertListEqual([0, 25], sample_shift.tolist())
+
+        # LBA: 115m, 80m, 50m
+        delay_seconds = numpy.array([465.5254e-9, 326.9640e-9, 199.2573e-9])
+        sample_shift = delay_compensation(delay_seconds, 200_000_000)
+        self.assertListEqual([0, 28, 53], sample_shift.tolist())
-- 
GitLab