From 05bd95747eb87b55ce4bbeb4c2bc4c02f15d41f1 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Tue, 3 May 2022 22:22:17 +0200 Subject: [PATCH] L2SS-785: Added test --- .../tangostationcontrol/test/beam/test_geo.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tangostationcontrol/tangostationcontrol/test/beam/test_geo.py b/tangostationcontrol/tangostationcontrol/test/beam/test_geo.py index 5694376be..ecc81b6c4 100644 --- a/tangostationcontrol/tangostationcontrol/test/beam/test_geo.py +++ b/tangostationcontrol/tangostationcontrol/test/beam/test_geo.py @@ -70,3 +70,29 @@ class TestETRS_to_GEO(base.TestCase): LOFAR1_CS001_LBA_GEO = [52.911, 6.868] numpy.testing.assert_almost_equal(CS001_LBA_GEO, LOFAR1_CS001_LBA_GEO, decimal=3) + +class TestGEO_to_GEOHASH(base.TestCase): + def test_convert_single_coordinate(self): + """ Convert a single coordinate. """ + GEO_coords = numpy.array([1.0, 1.0]) + GEOHASH_coords = GEO_to_GEOHASH(GEO_coords) + + self.assertEqual((1,), GEOHASH_coords.shape) + + def test_convert_array(self): + """ Convert an array of coordinates. """ + GEO_coords = numpy.array([ [1.0, 1.0], [2.0, 2.0], [3.0, 3.0] ]) + GEOHASH_coords = GEO_to_GEOHASH(GEO_coords) + + self.assertEqual((3,1), GEOHASH_coords.shape) + + def test_CS001_LBA_regression(self): + """ Verify if the calculated CS001LBA phase center match fixed values, to detect changes in computation. """ + + CS001_LBA_GEO = [52.911, 6.868] + + # Convert to GEO + CS001_LBA_GEOHASH = GEO_to_GEOHASH(numpy.array(CS001_LBA_GEO)) + + # verify against precomputed value + self.assertEqual('u1kvh21hgvrcpm28', CS001_LBA_GEOHASH) -- GitLab