From c9918673769cd572cfad83f8cf2e2582eef9c370 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Mon, 2 May 2022 11:11:59 +0200
Subject: [PATCH] L2SS-769: Don't let Nyquist zone attribute fail too easily in
 tests

---
 tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py b/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py
index b740bad55..c5b2968d9 100644
--- a/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py
+++ b/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py
@@ -217,7 +217,11 @@ class SDP(opcua_device):
             raise ValueError(f"Could not determine Nyquist zone for antenna type {self.AntennaType} with clock {clock} Hz")
 
     def read_nyquist_zone_R(self):
-        return self._nyquist_zone(self.read_attribute("clock_RW"))
+        try:
+            return self._nyquist_zone(self.read_attribute("clock_RW"))
+        except ValueError:
+            # Supply a sane default for computations in tests until L2SDP-725 allows us to read back the set clock
+            return 0
 
     def read_clock_RW(self):
         # We can only return a single value, so we assume the FPGA is configured coherently. Which is something
-- 
GitLab