Skip to content
Snippets Groups Projects
Commit 2de6c8f8 authored by Corné Lukken's avatar Corné Lukken
Browse files

Merge branch 'expose_antenna_type' into 'master'

Expose antenna type instead of having to parse it from the device name

See merge request !777
parents 642c9bea 264b942b
No related branches found
No related tags found
1 merge request!777Expose antenna type instead of having to parse it from the device name
...@@ -20,7 +20,6 @@ from tangostationcontrol.common.constants import ( ...@@ -20,7 +20,6 @@ from tangostationcontrol.common.constants import (
) )
from tangostationcontrol.common.sdp import complex_to_weights, are_subbands_decreasing from tangostationcontrol.common.sdp import complex_to_weights, are_subbands_decreasing
from tangostationcontrol.common.type_checking import device_name_matches from tangostationcontrol.common.type_checking import device_name_matches
from tangostationcontrol.common.antennas import device_member_to_antenna_type
from tangostationcontrol.common.case_insensitive_string import CaseInsensitiveString from tangostationcontrol.common.case_insensitive_string import CaseInsensitiveString
logger = logging.getLogger() logger = logging.getLogger()
...@@ -136,11 +135,11 @@ class CalibrationManager: ...@@ -136,11 +135,11 @@ class CalibrationManager:
) )
antennafield_member = antenna_field.name().split("/")[2] antennafield_member = antenna_field.name().split("/")[2]
antenna_type = device_member_to_antenna_type(antennafield_member) antenna_type = antenna_field.antenna_type_R
rcu_bands = antenna_field.RCU_band_select_RW rcu_bands = antenna_field.RCU_band_select_RW
antenna_names = antenna_field.Antenna_Names_R antenna_names = antenna_field.Antenna_Names_R
is_hba = CaseInsensitiveString(antenna_type) != CaseInsensitiveString("LBA") is_hba = CaseInsensitiveString(antenna_type) == CaseInsensitiveString("HBA")
def get_antenna_calibration(antenna_name: str, rcu_band: int): def get_antenna_calibration(antenna_name: str, rcu_band: int):
"""Return the calibration values for the given antenna and RCU band.""" """Return the calibration values for the given antenna and RCU band."""
......
...@@ -584,6 +584,9 @@ class AF(LOFARDevice): ...@@ -584,6 +584,9 @@ class AF(LOFARDevice):
max_dim_x=MAX_ANTENNA, max_dim_x=MAX_ANTENNA,
) )
antenna_type_R = attribute(
doc="Type of Antennas in this field (f.e. LBA or HBA)", dtype=str
)
nr_antennas_R = attribute(doc="Number of Antennas in this field", dtype=numpy.int32) nr_antennas_R = attribute(doc="Number of Antennas in this field", dtype=numpy.int32)
def __init__(self, cl, name): def __init__(self, cl, name):
...@@ -756,6 +759,9 @@ class AF(LOFARDevice): ...@@ -756,6 +759,9 @@ class AF(LOFARDevice):
# Parsing a property here is quickest, so we chose that. # Parsing a property here is quickest, so we chose that.
return len(self.Control_to_RECV_mapping) // 2 return len(self.Control_to_RECV_mapping) // 2
def read_antenna_type_R(self):
return self.ANTENNA_TYPE
def read_Antenna_Field_Reference_ITRF_R(self): def read_Antenna_Field_Reference_ITRF_R(self):
# provide ITRF field coordinates if they were configured # provide ITRF field coordinates if they were configured
if self.Antenna_Field_Reference_ITRF: if self.Antenna_Field_Reference_ITRF:
......
...@@ -85,6 +85,7 @@ class TestCalibrationManager(base.TestCase): ...@@ -85,6 +85,7 @@ class TestCalibrationManager(base.TestCase):
).reshape(-1, 2), ).reshape(-1, 2),
Antenna_Names_R=[f"T{n + 1}" for n in range(2)], Antenna_Names_R=[f"T{n + 1}" for n in range(2)],
RCU_band_select_RW=numpy.array([[1, 1], [2, 2]]), RCU_band_select_RW=numpy.array([[1, 1], [2, 2]]),
antenna_type_R="HBA",
**{"name.return_value": "Stat/AFH/HBA0"}, **{"name.return_value": "Stat/AFH/HBA0"},
) )
subband_weights = numpy.array([[SDP_UNIT_WEIGHT] * S_pn * N_subbands] * N_pn) subband_weights = numpy.array([[SDP_UNIT_WEIGHT] * S_pn * N_subbands] * N_pn)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment