Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • lofar2.0/tango
  • mckenna/tango
2 results
Show changes
Commits on Source (5)
Showing
with 89 additions and 58 deletions
......@@ -91,6 +91,7 @@ metadata = OptionalDeviceProxy("STAT/Metadata/1")
devices = (
[
stationmanager,
metadata,
observationcontrol,
calibration,
ccd,
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -16,54 +16,54 @@ class TestCalibrationDevice(AbstractTestBases.TestDeviceBase):
"""Integration test class for device calibration"""
HBA_ANTENNA_NAMES = [
"H0",
"H1",
"H2",
"H3",
"H4",
"H5",
"H6",
"H7",
"H8",
"H9",
"H10",
"H11",
"H12",
"H13",
"H14",
"H15",
"H16",
"H17",
"H18",
"H19",
"H20",
"H21",
"H22",
"H23",
"H24",
"H25",
"H26",
"H27",
"H28",
"H29",
"H30",
"H31",
"H32",
"H33",
"H34",
"H35",
"H36",
"H37",
"H38",
"H39",
"H40",
"H41",
"H42",
"H43",
"H44",
"H45",
"H46",
"H47",
"Tile00",
"Tile01",
"Tile02",
"Tile03",
"Tile04",
"Tile05",
"Tile06",
"Tile07",
"Tile08",
"Tile09",
"Tile10",
"Tile11",
"Tile12",
"Tile13",
"Tile14",
"Tile15",
"Tile16",
"Tile17",
"Tile18",
"Tile19",
"Tile20",
"Tile21",
"Tile22",
"Tile23",
"Tile24",
"Tile25",
"Tile26",
"Tile27",
"Tile28",
"Tile29",
"Tile30",
"Tile31",
"Tile32",
"Tile33",
"Tile34",
"Tile35",
"Tile36",
"Tile37",
"Tile38",
"Tile39",
"Tile40",
"Tile41",
"Tile42",
"Tile43",
"Tile44",
"Tile45",
"Tile46",
"Tile47",
]
antennafield_iden = "STAT/AFH/HBA0"
......
......@@ -151,7 +151,9 @@ class CalibrationManager:
f"CalTable-{self._station_name}-{antenna_type}"
f"-{self._band_to_reference_frequency(is_hba, rcu_band)}MHz.h5",
)
with read_hdf5(calibration_filename, CalibrationTable) as table:
logging.debug(f"Load calibration file {calibration_filename}")
f = read_hdf5(calibration_filename, CalibrationTable)
with f as table:
# Retrieve data and convert them in the correct Tango attr shape
if not device_name_matches(
table.observation_station, self._station_name
......@@ -162,7 +164,9 @@ class CalibrationManager:
)
try:
return table.antennas[antenna_name]
data = table.antennas[antenna_name]
f.load(data)
return data
except KeyError as exc:
raise ValueError(
f"Could not find calibration values for field {antennafield_member} \
......@@ -179,12 +183,16 @@ class CalibrationManager:
continue
# set weights, converted from complex to packed uint32
weights_x = complex_to_weights(
get_antenna_calibration(antenna_name, rcu_band_x).x
)
weights_y = complex_to_weights(
get_antenna_calibration(antenna_name, rcu_band_y).y
)
try:
weights_x = complex_to_weights(
get_antenna_calibration(antenna_name, rcu_band_x).x
)
weights_y = complex_to_weights(
get_antenna_calibration(antenna_name, rcu_band_y).y
)
except Exception:
logger.error(f"Issue {antenna_name}")
raise
# check if subband frequencies are decreasing
# X pol
......
......@@ -49,8 +49,8 @@ class ChangeEvents:
if numpy.equal(self.prev_values.get(attr_name), value).all():
# no change
return
except ValueError:
# thrown f.e. if the previous and current values have different dimensions
except (ValueError, TypeError):
# thrown f.e. if the previous and current values have different dimensions or types
pass
# avoid sending spurious changes
......
......@@ -229,6 +229,7 @@ class AttributePoller:
"uptime_R",
"access_count_R",
"available_in_power_state_R",
"tracemalloc_R",
]
)
class LOFARDevice(Device):
......@@ -315,6 +316,25 @@ class LOFARDevice(Device):
polling_period=DEFAULT_POLLING_PERIOD_MS,
)
# Only return the top N tracemalloc statistics
TOPN_TRACEMALLOC_STATISTICS = 16
@attribute(
dtype=(str,),
max_dim_x=TOPN_TRACEMALLOC_STATISTICS,
doc="Python source-code lines that allocated the most memory",
)
def tracemalloc_R(self):
import tracemalloc
# start tracing in case we didn't
tracemalloc.start()
# obtain and return the top statistics per file
snapshot = tracemalloc.take_snapshot()
stats = snapshot.statistics("lineno")
return [str(x) for x in stats[: self.TOPN_TRACEMALLOC_STATISTICS]]
# list of translator property names to be set by set_translator_defaults
TRANSLATOR_DEFAULT_SETTINGS = []
......
......@@ -124,12 +124,14 @@ class TestCalibrationManager(base.TestCase):
CalibrationTable,
),
call().__enter__(),
call().load(caltable_mock.antennas["T1"]),
call().__exit__(None, None, None),
call(
f"{sut._tmp_dir.name}/CalTable-unittest-station-HBA-150MHz.h5",
CalibrationTable,
),
call().__enter__(),
call().load(caltable_mock.antennas["T2"]),
call().__exit__(None, None, None),
]
)
......