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

changed wrong constantt used to right one

parent 7e0fb448
Branches
Tags
1 merge request!465added constants.py and replaced most magic numbers
......@@ -19,7 +19,7 @@ from tango.server import device_property, attribute, command
from tangostationcontrol.common.type_checking import type_not_sequence
from tangostationcontrol.common.entrypoint import entry
from tangostationcontrol.common.lofar_logging import device_logging_to_python, log_exceptions
from tangostationcontrol.common.constants import N_elements, MAX_INPUTS, N_pol, N_xyz, N_latlong, MAX_ANTENNA, N_rcu, N_rcu_inp
from tangostationcontrol.common.constants import N_elements, MAX_ANTENNA, N_pol, N_xyz, N_latlong, N_rcu, N_rcu_inp
from tangostationcontrol.devices.lofar_device import lofar_device
from tangostationcontrol.devices.device_decorators import fault_on_error
from tangostationcontrol.beam.geo import ETRS_to_ITRF, ITRF_to_GEO, GEO_to_GEOHASH
......@@ -97,7 +97,7 @@ class AntennaField(lofar_device):
doc="Name of each antenna",
dtype='DevVarStringArray',
mandatory=False,
default_value=[f'Antenna{n + 1}' for n in range(MAX_INPUTS)]
default_value=[f'Antenna{n + 1}' for n in range(MAX_ANTENNA)]
)
# ----- Antenna states
......@@ -106,14 +106,14 @@ class AntennaField(lofar_device):
doc="Operational quality state of each antenna",
dtype='DevVarUShortArray',
mandatory=False,
default_value=numpy.array([AntennaQuality.OK] * MAX_INPUTS)
default_value=numpy.array([AntennaQuality.OK] * MAX_ANTENNA)
)
Antenna_Use = device_property(
doc="Operational State of each antenna",
dtype='DevVarUShortArray',
mandatory=False,
default_value=numpy.array([AntennaUse.AUTO] * MAX_INPUTS)
default_value=numpy.array([AntennaUse.AUTO] * MAX_ANTENNA)
)
# ----- Antenna properties
......@@ -129,7 +129,7 @@ class AntennaField(lofar_device):
doc="Whether to provide power to each antenna (False for noise sources)",
dtype='DevVarBooleanArray',
mandatory=False,
default_value=numpy.array([False] * MAX_INPUTS)
default_value=numpy.array([False] * MAX_ANTENNA)
)
# ----- Position information
......@@ -175,7 +175,7 @@ class AntennaField(lofar_device):
doc='Rotation of each tile in the PQ plane ("horizontal") in degrees.',
dtype='DevVarFloatArray',
mandatory=False,
default_value=[0.0] * MAX_INPUTS
default_value=[0.0] * MAX_ANTENNA
)
PQR_to_ETRS_rotation_matrix = device_property(
......@@ -200,7 +200,7 @@ class AntennaField(lofar_device):
Antenna_to_SDP_Mapping = device_property(
dtype=(numpy.int32,),
doc='The mapping of Antennas to FPGA input pairs. Each FPGA can handle 6 inputs, and SDP has 16 FPGAs. Each antenna is represented with a (fpga, input) value pair. The array is flattened, so must be reshaped upon use. An input=-1 means the antenna is unconnected.',
default_value=numpy.array([-1] * MAX_INPUTS * 2, dtype=numpy.int32)
default_value=numpy.array([-1] * MAX_ANTENNA * 2, dtype=numpy.int32)
)
SDP_device = device_property(
......@@ -216,14 +216,14 @@ class AntennaField(lofar_device):
dtype=(numpy.int32,),
doc='The mapping of Antenna power lines to RECV mapping. Each RECV can handle 96 inputs. The Antenna number is the index and the value shows to which receiver device it is connected and on which input. The first integer is the input. The second integer is the RECV id. Example: [0, 3] = first receiver of property RECV_devices with input 3. -1 means that the Antenna is not connected. The property is stored in a one dimensional structure. It needs to be reshaped to a list of lists of two items.',
mandatory=False,
default_value=[-1] * MAX_INPUTS * 2
default_value=[-1] * MAX_ANTENNA * 2
)
Control_to_RECV_mapping = device_property(
dtype=(numpy.int32,),
doc='The mapping of Antenna control lines to RECV mapping. Each RECV can handle 96 inputs. The Antenna number is the index and the value shows to which receiver device it is connected and on which input. The first integer is the input. The second interger is the RECV id. Example: [1, 3] = STAT/RECV/1 with input 3. -1 means that the Antenna is not connected. The property is stored in a one dimensional structure. It needs to be reshaped to a list of lists of two items.',
mandatory=False,
default_value=[-1] * MAX_INPUTS * 2
default_value=[-1] * MAX_ANTENNA * 2
)
RECV_devices = device_property(
......@@ -237,48 +237,48 @@ class AntennaField(lofar_device):
dtype=str)
Antenna_Names_R = attribute(access=AttrWriteType.READ,
dtype=(str,), max_dim_x=MAX_INPUTS)
dtype=(str,), max_dim_x=MAX_ANTENNA)
Antenna_Quality_R = attribute(doc='The quality of each antenna. 0=OK, 1=SUSPICIOUS, 2=BROKEN, 3=BEYOND_REPAIR.',
dtype=(numpy.uint32,), max_dim_x=MAX_INPUTS)
dtype=(numpy.uint32,), max_dim_x=MAX_ANTENNA)
Antenna_Use_R = attribute(
doc='Whether each antenna should be used. 0=AUTO, 1=ON, 2=OFF. In AUTO mode, the antenna is used if it is not BROKEN or BEYOND_REPAIR.',
dtype=(numpy.uint32,), max_dim_x=MAX_INPUTS)
dtype=(numpy.uint32,), max_dim_x=MAX_ANTENNA)
Antenna_Quality_str_R = attribute(doc='The quality of each antenna, as a string.',
dtype=(str,), max_dim_x=MAX_INPUTS)
dtype=(str,), max_dim_x=MAX_ANTENNA)
Antenna_Use_str_R = attribute(doc='Whether each antenna should be used, as a string.',
dtype=(str,), max_dim_x=MAX_INPUTS)
dtype=(str,), max_dim_x=MAX_ANTENNA)
Antenna_Usage_Mask_R = attribute(doc='Whether each antenna will be used.',
dtype=(bool,), max_dim_x=MAX_INPUTS)
dtype=(bool,), max_dim_x=MAX_ANTENNA)
Antenna_to_SDP_Mapping_R = attribute(doc='To which (fpga, input) pair each antenna is connected. -1=unconnected.',
dtype=((numpy.int32,),), max_dim_x=N_pol, max_dim_y=MAX_INPUTS)
dtype=((numpy.int32,),), max_dim_x=N_pol, max_dim_y=MAX_ANTENNA)
ANT_mask_RW = mapped_attribute("ANT_mask_RW", dtype=(bool,), max_dim_x=MAX_INPUTS,
ANT_mask_RW = mapped_attribute("ANT_mask_RW", dtype=(bool,), max_dim_x=MAX_ANTENNA,
access=AttrWriteType.READ_WRITE)
RCU_PWR_ANT_on_R = mapped_attribute("RCU_PWR_ANT_on_R", dtype=(bool,), max_dim_x=MAX_INPUTS)
RCU_PWR_ANT_on_RW = mapped_attribute("RCU_PWR_ANT_on_RW", dtype=(bool,), max_dim_x=MAX_INPUTS,
RCU_PWR_ANT_on_R = mapped_attribute("RCU_PWR_ANT_on_R", dtype=(bool,), max_dim_x=MAX_ANTENNA)
RCU_PWR_ANT_on_RW = mapped_attribute("RCU_PWR_ANT_on_RW", dtype=(bool,), max_dim_x=MAX_ANTENNA,
access=AttrWriteType.READ_WRITE)
HBAT_BF_delay_steps_R = mapped_attribute("HBAT_BF_delay_steps_R", dtype=((numpy.int64,),),
max_dim_x=N_elements * N_pol, max_dim_y=MAX_INPUTS)
max_dim_x=N_elements * N_pol, max_dim_y=MAX_ANTENNA)
HBAT_BF_delay_steps_RW = mapped_attribute("HBAT_BF_delay_steps_RW", dtype=((numpy.int64,),),
max_dim_x=N_elements * N_pol, max_dim_y=MAX_INPUTS,
max_dim_x=N_elements * N_pol, max_dim_y=MAX_ANTENNA,
access=AttrWriteType.READ_WRITE)
HBAT_LED_on_R = mapped_attribute("HBAT_LED_on_R", dtype=((bool,),), max_dim_x=N_elements * N_pol,
max_dim_y=MAX_INPUTS)
max_dim_y=MAX_ANTENNA)
HBAT_LED_on_RW = mapped_attribute("HBAT_LED_on_RW", dtype=((bool,),), max_dim_x=N_elements * N_pol,
max_dim_y=MAX_INPUTS, access=AttrWriteType.READ_WRITE)
max_dim_y=MAX_ANTENNA, access=AttrWriteType.READ_WRITE)
HBAT_PWR_LNA_on_R = mapped_attribute("HBAT_PWR_LNA_on_R", dtype=((bool,),),
max_dim_x=N_elements * N_pol, max_dim_y=MAX_INPUTS)
max_dim_x=N_elements * N_pol, max_dim_y=MAX_ANTENNA)
HBAT_PWR_LNA_on_RW = mapped_attribute("HBAT_PWR_LNA_on_RW", dtype=((bool,),),
max_dim_x=N_elements * N_pol, max_dim_y=MAX_INPUTS,
max_dim_x=N_elements * N_pol, max_dim_y=MAX_ANTENNA,
access=AttrWriteType.READ_WRITE)
HBAT_PWR_on_R = mapped_attribute("HBAT_PWR_on_R", dtype=((bool,),), max_dim_x=N_elements * N_pol,
max_dim_y=MAX_INPUTS)
max_dim_y=MAX_ANTENNA)
HBAT_PWR_on_RW = mapped_attribute("HBAT_PWR_on_RW", dtype=((bool,),), max_dim_x=N_elements * N_pol,
max_dim_y=MAX_INPUTS, access=AttrWriteType.READ_WRITE)
RCU_band_select_RW = mapped_attribute("RCU_band_select_RW", dtype=(numpy.int64,), max_dim_x=MAX_INPUTS,
max_dim_y=MAX_ANTENNA, access=AttrWriteType.READ_WRITE)
RCU_band_select_RW = mapped_attribute("RCU_band_select_RW", dtype=(numpy.int64,), max_dim_x=MAX_ANTENNA,
access=AttrWriteType.READ_WRITE)
# ----- Position information
......@@ -297,20 +297,20 @@ class AntennaField(lofar_device):
HBAT_antenna_ITRF_offsets_R = attribute(access=AttrWriteType.READ,
doc='For each tile, the offsets of the antennas within that, in ITRF ("iHBADeltas"). True shape: nrtiles x 16 x 3.',
dtype=((numpy.float64,),), max_dim_x=MAX_INPUTS * N_xyz,
max_dim_y=MAX_INPUTS)
dtype=((numpy.float64,),), max_dim_x=MAX_ANTENNA * N_xyz,
max_dim_y=MAX_ANTENNA)
Antenna_Reference_ITRF_R = attribute(access=AttrWriteType.READ,
doc='Absolute reference position of each tile, in ITRF (XYZ)',
dtype=((numpy.float64,),), max_dim_x=N_xyz, max_dim_y=MAX_INPUTS)
dtype=((numpy.float64,),), max_dim_x=N_xyz, max_dim_y=MAX_ANTENNA)
Antenna_Reference_GEO_R = attribute(access=AttrWriteType.READ,
doc='Absolute reference position of each tile, in latitude/longitude (degrees)',
dtype=((numpy.float64,),), max_dim_x=N_latlong, max_dim_y=MAX_INPUTS)
dtype=((numpy.float64,),), max_dim_x=N_latlong, max_dim_y=MAX_ANTENNA)
Antenna_Reference_GEOHASH_R = attribute(access=AttrWriteType.READ,
doc='Absolute reference position of each tile, as geohash strings',
dtype=(str,), max_dim_x=MAX_INPUTS, )
dtype=(str,), max_dim_x=MAX_ANTENNA, )
nr_antennas_R = attribute(
doc='Number of Antennas in this field',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment