Skip to content
Snippets Groups Projects
Commit 987dfdd2 authored by Taya Snijder's avatar Taya Snijder
Browse files

changed constant name

parent ec7f002e
Branches
No related tags found
1 merge request!470Resolve L2SS-1032 "Use constants in tests"
......@@ -95,5 +95,5 @@ MAX_ETH_FRAME_SIZE = 9000
# The default polling period for polled attributes
DEFAULT_POLLING_PERIOD = 1000
# amount of tiles in a HBA
N_HBA_TILES = 48
# default numer tiles in a HBA for the non-international stations.
DEFAULT_N_HBA_TILES = 48
......@@ -13,7 +13,7 @@ import numpy
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
from tangostationcontrol.devices.antennafield import AntennaQuality, AntennaUse
from .base import AbstractTestBases
from tangostationcontrol.common.constants import N_elements, MAX_ANTENNA, N_pol, N_rcu, N_rcu_inp, N_HBA_TILES
from tangostationcontrol.common.constants import N_elements, MAX_ANTENNA, N_pol, N_rcu, N_rcu_inp, DEFAULT_N_HBA_TILES
class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
......@@ -33,8 +33,8 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
def restore_antennafield(self):
self.proxy.put_property({
"RECV_devices": ["STAT/RECV/1"],
"Power_to_RECV_mapping": [-1, -1] * N_HBA_TILES,
"Control_to_RECV_mapping": [-1, -1] * N_HBA_TILES
"Power_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES,
"Control_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES
})
@staticmethod
......@@ -81,10 +81,10 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
}
mapping_properties = {
"RECV_devices": ["STAT/RECV/1"],
"Power_to_RECV_mapping": [-1, -1] * N_HBA_TILES,
"Power_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES,
# Two inputs of recv device connected, only defined for 48 inputs
# each pair is one input
"Control_to_RECV_mapping": [1, 0 , 1, 1] + [-1, -1] * (N_HBA_TILES - 2)
"Control_to_RECV_mapping": [1, 0 , 1, 1] + [-1, -1] * (DEFAULT_N_HBA_TILES - 2)
}
antennafield_proxy.off()
antennafield_proxy.put_property(antenna_properties)
......@@ -99,7 +99,7 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
# Verify only connected inputs + Antenna_Usage_Mask_R are true
# As well as dimensions of ANT_mask_RW must match control mapping
numpy.testing.assert_equal(
numpy.array([True] * 2 + [False] * (N_HBA_TILES - 2)),
numpy.array([True] * 2 + [False] * (DEFAULT_N_HBA_TILES - 2)),
antennafield_proxy.ANT_mask_RW
)
......@@ -124,7 +124,7 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
# Configure control mapping to control all 96 inputs of recv device
mapping_properties = {
"RECV_devices": ["STAT/RECV/1"],
"Power_to_RECV_mapping": [-1, -1] * N_HBA_TILES,
"Power_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES,
"Control_to_RECV_mapping":
# [1, 0, 1, 1, 1, 2, 1, x ... 1, 95]
numpy.array([[1, x] for x in range(0, MAX_ANTENNA)]).flatten()
......@@ -159,8 +159,8 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
# Connect recv/1 device but no control inputs
mapping_properties = {
"RECV_devices": ["STAT/RECV/1"],
"Power_to_RECV_mapping": [-1, -1] * N_HBA_TILES,
"Control_to_RECV_mapping": [-1, -1] * N_HBA_TILES
"Power_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES,
"Control_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES
}
# Cycle device an put properties
......@@ -174,7 +174,7 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
current_values = self.recv_proxy.read_attribute("HBAT_PWR_on_RW").value
# write true through antennafield
antennafield_proxy.write_attribute("HBAT_PWR_on_RW", [[True] * N_elements * N_pol] * N_HBA_TILES)
antennafield_proxy.write_attribute("HBAT_PWR_on_RW", [[True] * N_elements * N_pol] * DEFAULT_N_HBA_TILES)
# Test that original recv values for HBAT_PWR_on_RW match current
numpy.testing.assert_equal(
current_values,
......@@ -189,9 +189,9 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
mapping_properties = {
"RECV_devices": ["STAT/RECV/1"],
"Power_to_RECV_mapping": [-1, -1] * N_HBA_TILES,
"Power_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES,
# Each pair is one mapping so 2 inputs are connected
"Control_to_RECV_mapping": [1, 0, 1, 1] + [-1, -1] * (N_HBA_TILES - 2)
"Control_to_RECV_mapping": [1, 0, 1, 1] + [-1, -1] * (DEFAULT_N_HBA_TILES - 2)
}
antennafield_proxy = self.proxy
......@@ -203,7 +203,7 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
try:
antennafield_proxy.write_attribute(
"HBAT_PWR_on_RW", [[True] * N_elements * N_pol] * N_HBA_TILES
"HBAT_PWR_on_RW", [[True] * N_elements * N_pol] * DEFAULT_N_HBA_TILES
)
numpy.testing.assert_equal(
numpy.array([[True] * N_elements * N_pol] * 2 + [[False] * N_elements * N_pol] * (MAX_ANTENNA - 2)),
......@@ -223,7 +223,7 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
mapping_properties = {
"RECV_devices": ["STAT/RECV/1"],
"Power_to_RECV_mapping": [-1, -1] * N_HBA_TILES,
"Power_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES,
"Control_to_RECV_mapping":
# [1, 0, 1, 1, 1, 2, 1, x ... 1, 95]
numpy.array([[1, x] for x in range(0, MAX_ANTENNA)]).flatten()
......@@ -258,7 +258,7 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase):
mapping_properties = {
"RECV_devices": ["STAT/RECV/1"],
"Power_to_RECV_mapping": [-1, -1] * N_HBA_TILES,
"Power_to_RECV_mapping": [-1, -1] * DEFAULT_N_HBA_TILES,
"Control_to_RECV_mapping":
# [1, 0, 1, 1, 1, 2, 1, x ... 1, 95]
numpy.array([[1, x] for x in range(0, MAX_ANTENNA)]).flatten()
......
......@@ -10,7 +10,7 @@
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
from tangostationcontrol.devices.antennafield import AntennaQuality, AntennaUse
from tangostationcontrol.common.constants import MAX_ANTENNA, N_beamlets_ctrl, N_pn, CLK_200_MHZ, CLK_160_MHZ, N_HBA_TILES
from tangostationcontrol.common.constants import MAX_ANTENNA, N_beamlets_ctrl, N_pn, CLK_200_MHZ, CLK_160_MHZ, DEFAULT_N_HBA_TILES
from .base import AbstractTestBases
......@@ -68,7 +68,7 @@ class TestDeviceDigitalBeam(AbstractTestBases.TestDeviceBase):
def setup_antennafield_proxy(self, antenna_qualities, antenna_use):
# setup AntennaField
NR_TILES = N_HBA_TILES
NR_TILES = DEFAULT_N_HBA_TILES
antennafield_proxy = TestDeviceProxy(self.antennafield_iden)
control_mapping = [[1,i] for i in range(NR_TILES)]
antennafield_proxy.put_property({
......@@ -224,9 +224,9 @@ class TestDeviceDigitalBeam(AbstractTestBases.TestDeviceBase):
numpy.testing.assert_equal(numpy.array([True] * MAX_ANTENNA), antennafield_proxy.Antenna_Usage_Mask_R)
self.setUp()
self.proxy.warm_boot()
expected_input_select = numpy.array([[True] * N_beamlets_ctrl ] * N_HBA_TILES + [[False] * N_beamlets_ctrl] * N_HBA_TILES) # first 48 rows are True
expected_input_select = numpy.array([[True] * N_beamlets_ctrl ] * DEFAULT_N_HBA_TILES + [[False] * N_beamlets_ctrl] * DEFAULT_N_HBA_TILES) # first 48 rows are True
numpy.testing.assert_equal(expected_input_select, self.proxy.input_select_RW)
expected_antenna_select = numpy.array([[True] * N_beamlets_ctrl ] * N_HBA_TILES)
expected_antenna_select = numpy.array([[True] * N_beamlets_ctrl ] * DEFAULT_N_HBA_TILES)
numpy.testing.assert_equal(expected_antenna_select, self.proxy.antenna_select_RW)
def test_input_select_with_only_second_antenna_ok(self):
......@@ -240,7 +240,7 @@ class TestDeviceDigitalBeam(AbstractTestBases.TestDeviceBase):
numpy.testing.assert_equal(numpy.array([False] + [True] + [False] * (MAX_ANTENNA - 2)), antennafield_proxy.Antenna_Usage_Mask_R)
self.setUp()
self.proxy.warm_boot()
expected_input_select = numpy.array([[False] * N_beamlets_ctrl ] + [[True] * N_beamlets_ctrl] + [[False] * N_beamlets_ctrl] * (N_HBA_TILES - 2) + [[False] * N_beamlets_ctrl] * N_HBA_TILES) # first 48 rows are True
expected_input_select = numpy.array([[False] * N_beamlets_ctrl ] + [[True] * N_beamlets_ctrl] + [[False] * N_beamlets_ctrl] * (DEFAULT_N_HBA_TILES - 2) + [[False] * N_beamlets_ctrl] * DEFAULT_N_HBA_TILES) # first 48 rows are True
numpy.testing.assert_equal(expected_input_select, self.proxy.input_select_RW)
expected_antenna_select = numpy.array([[False] * N_beamlets_ctrl ] + [[True] * N_beamlets_ctrl] + [[False] * N_beamlets_ctrl] * (N_HBA_TILES - 2))
expected_antenna_select = numpy.array([[False] * N_beamlets_ctrl ] + [[True] * N_beamlets_ctrl] + [[False] * N_beamlets_ctrl] * (DEFAULT_N_HBA_TILES - 2))
numpy.testing.assert_equal(expected_antenna_select, self.proxy.antenna_select_RW)
......@@ -15,7 +15,7 @@ from tango import DevState, DevFailed
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
from tangostationcontrol.test.devices.test_observation_base import TestObservationBase
from tangostationcontrol.devices.antennafield import AntennaQuality, AntennaUse
from tangostationcontrol.common.constants import N_beamlets_ctrl, MAX_ANTENNA, N_HBA_TILES
from tangostationcontrol.common.constants import N_beamlets_ctrl, MAX_ANTENNA, DEFAULT_N_HBA_TILES
from .base import AbstractTestBases
class TestDeviceObservation(AbstractTestBases.TestDeviceBase):
......@@ -59,7 +59,7 @@ class TestDeviceObservation(AbstractTestBases.TestDeviceBase):
def setup_antennafield_proxy(self):
# setup AntennaField
antennafield_proxy = TestDeviceProxy("STAT/AntennaField/1")
control_mapping = [[1,i] for i in range(N_HBA_TILES)]
control_mapping = [[1,i] for i in range(DEFAULT_N_HBA_TILES)]
antenna_qualities = numpy.array([AntennaQuality.OK] * MAX_ANTENNA)
antenna_use = numpy.array([AntennaUse.AUTO] * MAX_ANTENNA)
antennafield_proxy.put_property({"RECV_devices": ["STAT/RECV/1"],
......@@ -156,10 +156,10 @@ class TestDeviceObservation(AbstractTestBases.TestDeviceBase):
"""Test that attributes antenna_mask and filter are correctly applied"""
self.setup_recv_proxy()
antennafield_proxy = self.setup_antennafield_proxy()
antennafield_proxy.ANT_mask_RW = [True] * N_HBA_TILES # set all masks to True
self.assertListEqual(antennafield_proxy.ANT_mask_RW.tolist(), [True] * N_HBA_TILES)
antennafield_proxy.RCU_band_select_RW = [0] * N_HBA_TILES
self.assertListEqual(antennafield_proxy.RCU_band_select_RW.tolist(), [0] * N_HBA_TILES)
antennafield_proxy.ANT_mask_RW = [True] * DEFAULT_N_HBA_TILES # set all masks to True
self.assertListEqual(antennafield_proxy.ANT_mask_RW.tolist(), [True] * DEFAULT_N_HBA_TILES)
antennafield_proxy.RCU_band_select_RW = [0] * DEFAULT_N_HBA_TILES
self.assertListEqual(antennafield_proxy.RCU_band_select_RW.tolist(), [0] * DEFAULT_N_HBA_TILES)
self.proxy.off()
self.proxy.observation_settings_RW = self.VALID_JSON
self.proxy.Initialise()
......@@ -211,7 +211,7 @@ class TestDeviceObservation(AbstractTestBases.TestDeviceBase):
def test_apply_tilebeam(self):
"""Test that attribute tilebeam is correctly applied"""
tilebeam_proxy = self.setup_tilebeam_proxy()
pointing_direction = [("J2000","0deg","0deg")] * N_HBA_TILES
pointing_direction = [("J2000","0deg","0deg")] * DEFAULT_N_HBA_TILES
tilebeam_proxy.Pointing_direction_RW = pointing_direction
self.assertListEqual(list(tilebeam_proxy.Pointing_direction_RW[0]), ["J2000","0deg","0deg"])
self.proxy.off()
......
......@@ -19,7 +19,7 @@ from tangostationcontrol.test.devices.test_observation_base import TestObservati
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
from .base import AbstractTestBases
from tangostationcontrol.common.constants import N_HBA_TILES
from tangostationcontrol.common.constants import DEFAULT_N_HBA_TILES
class TestObservationControlDevice(AbstractTestBases.TestDeviceBase):
......@@ -62,7 +62,7 @@ class TestObservationControlDevice(AbstractTestBases.TestDeviceBase):
def setup_antennafield_proxy(self):
# setup AntennaField
antennafield_proxy = TestDeviceProxy("STAT/AntennaField/1")
control_mapping = [[1,i] for i in range(N_HBA_TILES)]
control_mapping = [[1,i] for i in range(DEFAULT_N_HBA_TILES)]
antennafield_proxy.put_property({"RECV_devices": ["STAT/RECV/1"],
"Power_to_RECV_mapping": numpy.array(control_mapping).flatten(),
"Antenna_to_SDP_Mapping": self.ANTENNA_TO_SDP_MAPPING})
......
......@@ -14,7 +14,7 @@ import json
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
from tangostationcontrol.devices.antennafield import AntennaQuality, AntennaUse
from tangostationcontrol.common.constants import N_HBA_TILES, MAX_ANTENNA, N_elements, N_pol
from tangostationcontrol.common.constants import DEFAULT_N_HBA_TILES, MAX_ANTENNA, N_elements, N_pol
from .base import AbstractTestBases
......@@ -28,7 +28,7 @@ class NumpyEncoder(json.JSONEncoder):
class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
POINTING_DIRECTION = numpy.array([["J2000","0deg","0deg"]] * N_HBA_TILES).flatten()
POINTING_DIRECTION = numpy.array([["J2000","0deg","0deg"]] * DEFAULT_N_HBA_TILES).flatten()
def setUp(self):
super().setUp("STAT/TileBeam/1")
......@@ -44,7 +44,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
def setup_antennafield_proxy(self):
# setup AntennaField
antennafield_proxy = TestDeviceProxy("STAT/AntennaField/1")
control_mapping = [[1,i] for i in range(N_HBA_TILES)]
control_mapping = [[1,i] for i in range(DEFAULT_N_HBA_TILES)]
antenna_qualities = numpy.array([AntennaQuality.OK] * MAX_ANTENNA)
antenna_use = numpy.array([AntennaUse.AUTO] * MAX_ANTENNA)
antennafield_proxy.put_property({"RECV_devices": ["STAT/RECV/1"],
......@@ -54,7 +54,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
antennafield_proxy.boot()
# check if AntennaField really exposes the expected number of tiles
self.assertEqual(N_HBA_TILES, antennafield_proxy.nr_antennas_R)
self.assertEqual(DEFAULT_N_HBA_TILES, antennafield_proxy.nr_antennas_R)
return antennafield_proxy
def test_delays_dims(self):
......@@ -67,7 +67,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
# verify delays method returns the correct dimensions
delays = self.proxy.delays(self.POINTING_DIRECTION)
self.assertEqual(N_HBA_TILES*N_elements, len(delays))
self.assertEqual(DEFAULT_N_HBA_TILES * N_elements, len(delays))
def test_set_pointing(self):
"""Verify if set pointing procedure is correctly executed"""
......@@ -101,11 +101,11 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
self.proxy.Tracking_enabled_RW = False
# Point to Zenith
self.proxy.set_pointing(numpy.array([["AZELGEO","0deg","90deg"]] * N_HBA_TILES).flatten())
self.proxy.set_pointing(numpy.array([["AZELGEO","0deg","90deg"]] * DEFAULT_N_HBA_TILES).flatten())
calculated_HBAT_delay_steps = numpy.array(antennafield_proxy.read_attribute('HBAT_BF_delay_steps_RW').value)
expected_HBAT_delay_steps = numpy.array([[15] * N_elements * N_pol] * N_HBA_TILES, dtype=numpy.int64)
expected_HBAT_delay_steps = numpy.array([[15] * N_elements * N_pol] * DEFAULT_N_HBA_TILES, dtype=numpy.int64)
numpy.testing.assert_equal(calculated_HBAT_delay_steps, expected_HBAT_delay_steps)
......@@ -118,7 +118,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
self.proxy.Tracking_enabled_RW = False
# point at north on the horizon
self.proxy.set_pointing(["AZELGEO","0deg","0deg"] * N_HBA_TILES)
self.proxy.set_pointing(["AZELGEO","0deg","0deg"] * DEFAULT_N_HBA_TILES)
# obtain delays of the X polarisation of all the elements of the first tile
north_beam_delay_steps = antennafield_proxy.HBAT_BF_delay_steps_RW[0].reshape(4,4,2)[:,:,0]
......@@ -128,7 +128,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
for angle in (90,180,270):
# point at angle degrees (90=E, 180=S, 270=W)
self.proxy.set_pointing(["AZELGEO",f"{angle}deg","0deg"] * N_HBA_TILES)
self.proxy.set_pointing(["AZELGEO",f"{angle}deg","0deg"] * DEFAULT_N_HBA_TILES)
# obtain delays of the X polarisation of all the elements of the first tile
angled_beam_delay_steps = antennafield_proxy.HBAT_BF_delay_steps_RW[0].reshape(4,4,2)[:,:,0]
......@@ -146,7 +146,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
self.proxy.Tracking_enabled_RW = False
# Point to LOFAR 1 ref pointing (0.929342, 0.952579, J2000)
pointings = numpy.array([["J2000", "0.929342rad", "0.952579rad"]] * N_HBA_TILES).flatten()
pointings = numpy.array([["J2000", "0.929342rad", "0.952579rad"]] * DEFAULT_N_HBA_TILES).flatten()
# Need to set the time to '2022-01-18 11:19:35'
timestamp = datetime.datetime(2022, 1, 18, 11, 19, 35).timestamp()
......@@ -158,7 +158,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
json_string = json.dumps(parameters, cls=NumpyEncoder)
self.proxy.set_pointing_for_specific_time(json_string)
calculated_HBAT_delay_steps = numpy.array(antennafield_proxy.read_attribute('HBAT_BF_delay_steps_RW').value) # dims (N_HBA_TILES, 32)
calculated_HBAT_delay_steps = numpy.array(antennafield_proxy.read_attribute('HBAT_BF_delay_steps_RW').value) # dims (DEFAULT_N_HBA_TILES, 32)
# Check all delay steps are zero with small margin
# [24, 25, 27, 28, 17, 18, 20, 21, 10, 11, 13, 14, 3, 4, 5, 7] These are the real values from LOFAR.
......@@ -167,7 +167,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
# they can be explained.
expected_HBAT_delay_steps = numpy.repeat(numpy.array([24, 25, 27, 29, 17, 18, 20, 21, 10, 11, 13, 14, 3, 4, 5, 7], dtype=numpy.int64), 2)
numpy.testing.assert_equal(calculated_HBAT_delay_steps[0], expected_HBAT_delay_steps)
numpy.testing.assert_equal(calculated_HBAT_delay_steps[N_HBA_TILES - 1], expected_HBAT_delay_steps)
numpy.testing.assert_equal(calculated_HBAT_delay_steps[DEFAULT_N_HBA_TILES - 1], expected_HBAT_delay_steps)
def test_tilebeam_tracking(self):
self.setup_recv_proxy()
......@@ -178,7 +178,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
self.assertTrue(self.proxy.Tracking_enabled_R)
# point somewhere
new_pointings = [("J2000",f"{tile}deg","0deg") for tile in range(N_HBA_TILES)]
new_pointings = [("J2000",f"{tile}deg","0deg") for tile in range(DEFAULT_N_HBA_TILES)]
self.proxy.Pointing_direction_RW = new_pointings
# check pointing
......
......@@ -20,7 +20,7 @@ from tangostationcontrol.devices import antennafield
from tangostationcontrol.devices.antennafield import AntennaToRecvMapper, AntennaQuality, AntennaUse
from tangostationcontrol.test import base
from tangostationcontrol.test.devices import device_base
from tangostationcontrol.common.constants import MAX_ANTENNA, N_rcu, N_HBA_TILES
from tangostationcontrol.common.constants import MAX_ANTENNA, N_rcu, DEFAULT_N_HBA_TILES
logger = logging.getLogger()
......@@ -28,18 +28,18 @@ logger = logging.getLogger()
class TestAntennaToRecvMapper(base.TestCase):
# A mapping where Antennas are all not mapped to power RCUs
POWER_NOT_CONNECTED = [[-1, -1]] * N_HBA_TILES
POWER_NOT_CONNECTED = [[-1, -1]] * DEFAULT_N_HBA_TILES
# A mapping where Antennas are all not mapped to control RCUs
CONTROL_NOT_CONNECTED = [[-1, -1]] * N_HBA_TILES
CONTROL_NOT_CONNECTED = [[-1, -1]] * DEFAULT_N_HBA_TILES
# A mapping where first two Antennas are mapped on the first Receiver.
# The first Antenna control line on RCU 1 and the second Antenna control line on RCU 0.
CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1 = [[1, 1], [1, 0]] + [[-1, -1]] * (N_HBA_TILES - 2)
CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1 = [[1, 1], [1, 0]] + [[-1, -1]] * (DEFAULT_N_HBA_TILES - 2)
def test_ant_read_mask_r_no_mapping(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[False] * MAX_ANTENNA, [False] * MAX_ANTENNA, [False] * MAX_ANTENNA]
expected = [False] * N_HBA_TILES
expected = [False] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("ANT_mask_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -47,7 +47,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[False, True, False] + [False, False, False] * (N_rcu - 1), [False] * MAX_ANTENNA, [False] * MAX_ANTENNA]
expected = [True, False] + [False] * (N_HBA_TILES - 2)
expected = [True, False] + [False] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("ANT_mask_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -55,7 +55,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_rcu_band_select_no_mapping(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[0] * MAX_ANTENNA, [0] * MAX_ANTENNA, [0] * MAX_ANTENNA]
expected = [0] * N_HBA_TILES
expected = [0] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("RCU_band_select_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -63,7 +63,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[0] * N_rcu] * MAX_ANTENNA, [[0] * N_rcu] * MAX_ANTENNA, [[0] * N_rcu] * MAX_ANTENNA]
expected = [[0] * N_rcu] * N_HBA_TILES
expected = [[0] * N_rcu] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("HBAT_BF_delay_steps_R", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -71,7 +71,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[2] * N_rcu, [1] * N_rcu] + [[0] * N_rcu] * (MAX_ANTENNA - 2), [[0] * N_rcu] * MAX_ANTENNA, [[0] * N_rcu] * MAX_ANTENNA]
expected = [[1] * N_rcu, [2] * N_rcu] + [[0] * N_rcu] * (N_HBA_TILES - 2)
expected = [[1] * N_rcu, [2] * N_rcu] + [[0] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("HBAT_BF_delay_steps_R", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -80,7 +80,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[0] * N_rcu] * MAX_ANTENNA, [[0] * N_rcu] * MAX_ANTENNA, [[0] * N_rcu] * MAX_ANTENNA]
expected = [[0] * N_rcu] * N_HBA_TILES
expected = [[0] * N_rcu] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("HBAT_BF_delay_steps_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -88,7 +88,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[2] * N_rcu, [1] * N_rcu] + [[0] * N_rcu] * (MAX_ANTENNA - 2), [[0] * N_rcu] * MAX_ANTENNA, [[0] * N_rcu] * MAX_ANTENNA]
expected = [[1] * N_rcu, [2] * N_rcu] + [[0] * N_rcu] * (N_HBA_TILES - 2)
expected = [[1] * N_rcu, [2] * N_rcu] + [[0] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("HBAT_BF_delay_steps_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -97,7 +97,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[False] * N_rcu] * N_HBA_TILES
expected = [[False] * N_rcu] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("HBAT_LED_on_R", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -106,7 +106,7 @@ class TestAntennaToRecvMapper(base.TestCase):
receiver_values = [[[False, True] * 16, [True, False] * 16] + [[False] * N_rcu] * (MAX_ANTENNA - 2), [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (N_HBA_TILES - 2)
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("HBAT_LED_on_R", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -114,7 +114,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[False] * N_rcu] * N_HBA_TILES
expected = [[False] * N_rcu] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("HBAT_LED_on_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -123,7 +123,7 @@ class TestAntennaToRecvMapper(base.TestCase):
receiver_values = [[[False, True] * 16, [True, False] * 16] + [[False] * N_rcu] * (MAX_ANTENNA - 2), [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (N_HBA_TILES - 2)
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("HBAT_LED_on_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -131,7 +131,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[False] * N_rcu] * N_HBA_TILES
expected = [[False] * N_rcu] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("HBAT_PWR_LNA_on_R", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -140,7 +140,7 @@ class TestAntennaToRecvMapper(base.TestCase):
receiver_values = [[[False, True] * 16, [True, False] * 16] + [[False] * N_rcu] * (MAX_ANTENNA - 2), [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (N_HBA_TILES - 2)
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("HBAT_PWR_LNA_on_R", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -148,7 +148,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[False] * N_rcu] * N_HBA_TILES
expected = [[False] * N_rcu] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("HBAT_PWR_LNA_on_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -157,7 +157,7 @@ class TestAntennaToRecvMapper(base.TestCase):
receiver_values = [[[False, True] * 16, [True, False] * 16] + [[False] * N_rcu] * (MAX_ANTENNA - 2), [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (N_HBA_TILES - 2)
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("HBAT_PWR_LNA_on_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -165,7 +165,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[False] * N_rcu] * N_HBA_TILES
expected = [[False] * N_rcu] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("HBAT_PWR_on_R", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -174,7 +174,7 @@ class TestAntennaToRecvMapper(base.TestCase):
receiver_values = [[[False, True] * 16, [True, False] * 16] + [[False] * N_rcu] * (MAX_ANTENNA - 2), [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (N_HBA_TILES - 2)
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("HBAT_PWR_on_R", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -182,7 +182,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 3)
receiver_values = [[[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[False] * N_rcu] * N_HBA_TILES
expected = [[False] * N_rcu] * DEFAULT_N_HBA_TILES
actual = mapper.map_read("HBAT_PWR_on_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -191,7 +191,7 @@ class TestAntennaToRecvMapper(base.TestCase):
receiver_values = [[[False, True] * 16, [True, False] * 16] + [[False] * N_rcu] * (MAX_ANTENNA - 2), [[False] * N_rcu] * MAX_ANTENNA, [[False] * N_rcu] * MAX_ANTENNA]
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (N_HBA_TILES - 2)
expected = [[True, False] * 16, [False, True] * 16] + [[False] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
actual = mapper.map_read("HBAT_PWR_on_RW", receiver_values)
numpy.testing.assert_equal(expected, actual)
......@@ -202,7 +202,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 1)
set_values = [None] * N_HBA_TILES
set_values = [None] * DEFAULT_N_HBA_TILES
expected = [[None] * MAX_ANTENNA]
actual = mapper.map_write("ANT_mask_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -212,7 +212,7 @@ class TestAntennaToRecvMapper(base.TestCase):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 2)
set_values = [None] * N_HBA_TILES
set_values = [None] * DEFAULT_N_HBA_TILES
expected = [[None] * MAX_ANTENNA] * 2
actual = mapper.map_write("ANT_mask_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -220,7 +220,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_ant_mask_rw_hba_0_and_1_on_rcu_1_and_0_of_recv_1(self):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 1)
set_values = [True, False] + [None] * (N_HBA_TILES - 2)
set_values = [True, False] + [None] * (DEFAULT_N_HBA_TILES - 2)
expected = [[False, True] + [None] * (MAX_ANTENNA - 2)]
actual = mapper.map_write("ANT_mask_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -228,7 +228,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_rcu_pwr_ant_on_no_mapping_and_one_receiver(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 1)
set_values = [None] * N_HBA_TILES
set_values = [None] * DEFAULT_N_HBA_TILES
expected = [[[None, None, None]] * N_rcu]
actual = mapper.map_write("RCU_PWR_ANT_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -236,7 +236,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_rcu_pwr_ant_on_no_mapping_and_two_receivers(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 2)
set_values = [None] * N_HBA_TILES
set_values = [None] * DEFAULT_N_HBA_TILES
expected = [[[None, None, None]] * N_rcu] * 2
actual = mapper.map_write("RCU_PWR_ANT_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -244,7 +244,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_rcu_pwr_ant_on_hba_0_and_1_on_rcu_1_and_0_of_recv_1(self):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 1)
set_values = [1, 0] + [None] * (N_HBA_TILES - 2)
set_values = [1, 0] + [None] * (DEFAULT_N_HBA_TILES - 2)
expected = [[[0, 1, None]] + [[None, None, None]] * (N_rcu - 1)]
actual = mapper.map_write("RCU_PWR_ANT_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -252,7 +252,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_rcu_band_select_no_mapping_and_one_receiver(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 1)
set_values = [None] * N_HBA_TILES
set_values = [None] * DEFAULT_N_HBA_TILES
expected = [[[None, None, None]] * N_rcu]
actual = mapper.map_write("RCU_band_select_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -260,7 +260,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_rcu_band_select_no_mapping_and_two_receivers(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 2)
set_values = [None] * N_HBA_TILES
set_values = [None] * DEFAULT_N_HBA_TILES
expected = [[[None, None, None]] * N_rcu] * 2
actual = mapper.map_write("RCU_band_select_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -268,7 +268,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_rcu_band_select_hba_0_and_1_on_rcu_1_and_0_of_recv_1(self):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 1)
set_values = [1, 0] + [None] * (N_HBA_TILES - 2)
set_values = [1, 0] + [None] * (DEFAULT_N_HBA_TILES - 2)
expected = [[[0, 1, None]] + [[None, None, None]] * (N_rcu - 1)]
actual = mapper.map_write("RCU_band_select_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -276,7 +276,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_bf_delay_steps_rw_no_mapping_and_one_receiver(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 1)
set_values = [[1] * N_rcu] * N_HBA_TILES
set_values = [[1] * N_rcu] * DEFAULT_N_HBA_TILES
expected = [[[None] * N_rcu] * MAX_ANTENNA]
actual = mapper.map_write("HBAT_BF_delay_steps_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -284,7 +284,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_bf_delay_steps_rw_no_mapping_and_two_receivers(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 2)
set_values = [[1] * N_rcu] * N_HBA_TILES
set_values = [[1] * N_rcu] * DEFAULT_N_HBA_TILES
expected = [[[None] * N_rcu] * MAX_ANTENNA, [[None] * N_rcu] * MAX_ANTENNA]
actual = mapper.map_write("HBAT_BF_delay_steps_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -292,7 +292,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_bf_delay_steps_rw_hba_0_and_1_on_rcu_1_and_0_of_recv_1(self):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 1)
set_values = [[1] * N_rcu, [2] * N_rcu] + [[None] * N_rcu] * (N_HBA_TILES - 2)
set_values = [[1] * N_rcu, [2] * N_rcu] + [[None] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
expected = [[[2] * N_rcu, [1] * N_rcu] + [[None] * N_rcu] * (MAX_ANTENNA - 2)]
actual = mapper.map_write("HBAT_BF_delay_steps_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -300,7 +300,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_led_on_rw_no_mapping_and_one_receiver(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 1)
set_values = [[None] * N_rcu] * N_HBA_TILES
set_values = [[None] * N_rcu] * DEFAULT_N_HBA_TILES
expected = [[[None] * N_rcu] * MAX_ANTENNA]
actual = mapper.map_write("HBAT_LED_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -308,7 +308,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_led_on_rw_no_mapping_and_two_receivers(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 2)
set_values = [[None] * N_rcu] * N_HBA_TILES
set_values = [[None] * N_rcu] * DEFAULT_N_HBA_TILES
expected = [[[None] * N_rcu] * MAX_ANTENNA, [[None] * N_rcu] * MAX_ANTENNA]
actual = mapper.map_write("HBAT_LED_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -316,7 +316,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_led_on_rw_hba_0_and_1_on_rcu_1_and_0_of_recv_1(self):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 1)
set_values = [[False, True] * 16, [True, False] * 16] + [[None] * N_rcu] * (N_HBA_TILES - 2)
set_values = [[False, True] * 16, [True, False] * 16] + [[None] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
expected = [[[True, False] * 16, [False, True] * 16] + [[None] * N_rcu] * (MAX_ANTENNA - 2)]
actual = mapper.map_write("HBAT_LED_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -324,7 +324,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_pwr_lna_on_rw_no_mapping_and_one_receiver(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 1)
set_values = [[None] * N_rcu] * N_HBA_TILES
set_values = [[None] * N_rcu] * DEFAULT_N_HBA_TILES
expected = [[[None] * N_rcu] * MAX_ANTENNA]
actual = mapper.map_write("HBAT_PWR_LNA_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -332,7 +332,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_pwr_lna_on_rw_no_mapping_and_two_receivers(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 2)
set_values = [[None] * N_rcu] * N_HBA_TILES
set_values = [[None] * N_rcu] * DEFAULT_N_HBA_TILES
expected = [[[None] * N_rcu] * MAX_ANTENNA, [[None] * N_rcu] * MAX_ANTENNA]
actual = mapper.map_write("HBAT_PWR_LNA_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -340,14 +340,14 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_pwr_lna_on_rw_hba_0_and_1_on_rcu_1_and_0_of_recv_1(self):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 1)
set_values = [[False, True] * 16, [True, False] * 16] + [[None] * N_rcu] * (N_HBA_TILES - 2)
set_values = [[False, True] * 16, [True, False] * 16] + [[None] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
expected = [[[True, False] * 16, [False, True] * 16] + [[None] * N_rcu] * (MAX_ANTENNA - 2)]
actual = mapper.map_write("HBAT_PWR_LNA_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
def test_map_write_pwr_on_rw_no_mapping_and_one_receiver(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 1)
set_values = [[None] * N_rcu] * N_HBA_TILES
set_values = [[None] * N_rcu] * DEFAULT_N_HBA_TILES
expected = [[[None] * N_rcu] * MAX_ANTENNA]
actual = mapper.map_write("HBAT_PWR_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -355,7 +355,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_lna_on_rw_no_mapping_and_two_receivers(self):
mapper = AntennaToRecvMapper(self.CONTROL_NOT_CONNECTED, self.POWER_NOT_CONNECTED, 2)
set_values = [[None] * N_rcu] * N_HBA_TILES
set_values = [[None] * N_rcu] * DEFAULT_N_HBA_TILES
expected = [[[None] * N_rcu] * MAX_ANTENNA, [[None] * N_rcu] * MAX_ANTENNA]
actual = mapper.map_write("HBAT_PWR_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -363,7 +363,7 @@ class TestAntennaToRecvMapper(base.TestCase):
def test_map_write_pwr_on_rw_hba_0_and_1_on_rcu_1_and_0_of_recv_1(self):
mapper = AntennaToRecvMapper(self.CONTROL_HBA_0_AND_1_ON_RCU_1_AND_0_OF_RECV_1, self.POWER_NOT_CONNECTED, 1)
set_values = [[False, True] * 16, [True, False] * 16] + [[None] * N_rcu] * (N_HBA_TILES - 2)
set_values = [[False, True] * 16, [True, False] * 16] + [[None] * N_rcu] * (DEFAULT_N_HBA_TILES - 2)
expected = [[[True, False] * 16, [False, True] * 16] + [[None] * N_rcu] * (MAX_ANTENNA - 2)]
actual = mapper.map_write("HBAT_PWR_on_RW", set_values)
numpy.testing.assert_equal(expected, actual)
......@@ -453,7 +453,7 @@ class TestAntennafieldDevice(device_base.DeviceTestCase):
) as proxy:
proxy.boot()
proxy.write_attribute("HBAT_PWR_on_RW", numpy.array([[False] * N_rcu] * N_HBA_TILES))
proxy.write_attribute("HBAT_PWR_on_RW", numpy.array([[False] * N_rcu] * DEFAULT_N_HBA_TILES))
numpy.testing.assert_equal(
m_proxy.return_value.write_attribute.call_args[0][1],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment