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

updated code

parent 3923bc9f
No related branches found
No related tags found
1 merge request!421Resolve L2SS-920 "Make statistics writer tolerant"
...@@ -143,9 +143,9 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase): ...@@ -143,9 +143,9 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase):
self.assertIsNotNone(stat) self.assertIsNotNone(stat)
self.assertEqual(121, stat.data_id_signal_input_index) self.assertEqual(121, stat.data_id_signal_input_index)
# Test RECV attributes # Test RECV attributes
self.assertEqual(stat.rcu_attenuator_dB.tolist(), None) self.assertEqual(stat.rcu_attenuator_dB, None)
self.assertEqual(stat.rcu_band_select.tolist(), None) self.assertEqual(stat.rcu_band_select, None)
self.assertEqual(stat.rcu_dth_on.tolist(), None) self.assertEqual(stat.rcu_dth_on, None)
def test_SST_statistics_with_device_in_off(self): def test_SST_statistics_with_device_in_off(self):
self.setup_recv_proxy() self.setup_recv_proxy()
...@@ -183,6 +183,6 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase): ...@@ -183,6 +183,6 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase):
self.assertIsNotNone(stat) self.assertIsNotNone(stat)
self.assertEqual(121, stat.data_id_signal_input_index) self.assertEqual(121, stat.data_id_signal_input_index)
# Test RECV attributes # Test RECV attributes
self.assertEqual(stat.rcu_attenuator_dB.tolist(), None) self.assertEqual(stat.rcu_attenuator_dB, None)
self.assertEqual(stat.rcu_band_select.tolist(), None) self.assertEqual(stat.rcu_band_select, None)
self.assertEqual(stat.rcu_dth_on.tolist(), None) self.assertEqual(stat.rcu_dth_on, None)
...@@ -198,11 +198,31 @@ class statistics_data: ...@@ -198,11 +198,31 @@ class statistics_data:
# get SST specific stuff # get SST specific stuff
if self.marker == "S": if self.marker == "S":
self.data_id_signal_input_index = file[group_key].attrs["data_id_signal_input_index"] logger.debug(f"rcu_attenuator_dB: {file.get(f'{group_key}/rcu_attenuator_dB')}")
logger.debug(f"rcu_band_select: {file.get(f'{group_key}/rcu_band_select')}")
logger.debug(f"rcu_dth_on is: {file.get(f'{group_key}/rcu_dth_on')}")
if file.get(f'{group_key}/rcu_attenuator_dB').shape is None:
self.rcu_attenuator_dB = None
else:
self.rcu_attenuator_dB = numpy.array(file.get(f"{group_key}/rcu_attenuator_dB")) self.rcu_attenuator_dB = numpy.array(file.get(f"{group_key}/rcu_attenuator_dB"))
if file.get(f'{group_key}/rcu_band_select').shape is None:
self.rcu_band_select = None
else:
self.rcu_band_select = numpy.array(file.get(f"{group_key}/rcu_band_select")) self.rcu_band_select = numpy.array(file.get(f"{group_key}/rcu_band_select"))
if file.get(f'{group_key}/rcu_dth_on').shape is None:
self.rcu_dth_on = None
else:
self.rcu_dth_on = numpy.array(file.get(f"{group_key}/rcu_dth_on")) self.rcu_dth_on = numpy.array(file.get(f"{group_key}/rcu_dth_on"))
self.data_id_signal_input_index = file[group_key].attrs["data_id_signal_input_index"]
# self.rcu_attenuator_dB = numpy.array(file.get(f"{group_key}/rcu_attenuator_dB"))
# self.rcu_band_select = numpy.array(file.get(f"{group_key}/rcu_band_select"))
# self.rcu_dth_on = numpy.array(file.get(f"{group_key}/rcu_dth_on"))
# get XST specific stuff # get XST specific stuff
if self.marker == "X": if self.marker == "X":
self.data_id_subband_index = file[group_key].attrs["data_id_subband_index"] self.data_id_subband_index = file[group_key].attrs["data_id_subband_index"]
......
...@@ -321,9 +321,7 @@ class SstHdf5Writer(HDF5Writer): ...@@ -321,9 +321,7 @@ class SstHdf5Writer(HDF5Writer):
logger.debug("set rcu_attenuator_dB_data to None") logger.debug("set rcu_attenuator_dB_data to None")
current_group.create_dataset( current_group.create_dataset(
name="rcu_attenuator_dB", name="rcu_attenuator_dB",
data=None, data=h5py.Empty("f"),
shape=(1,),
compression="gzip",
) )
try: try:
...@@ -336,9 +334,7 @@ class SstHdf5Writer(HDF5Writer): ...@@ -336,9 +334,7 @@ class SstHdf5Writer(HDF5Writer):
logger.debug("set rcu_band_select_data to None") logger.debug("set rcu_band_select_data to None")
current_group.create_dataset( current_group.create_dataset(
name="rcu_band_select", name="rcu_band_select",
data=None, data=h5py.Empty("f"),
shape=(1,),
compression="gzip",
) )
try: try:
...@@ -351,12 +347,11 @@ class SstHdf5Writer(HDF5Writer): ...@@ -351,12 +347,11 @@ class SstHdf5Writer(HDF5Writer):
logger.debug("set rcu_dth_on to None") logger.debug("set rcu_dth_on to None")
current_group.create_dataset( current_group.create_dataset(
name="rcu_dth_on", name="rcu_dth_on",
data=None, data=h5py.Empty("f"),
shape=(1,),
compression="gzip",
) )
class BstHdf5Writer(HDF5Writer): class BstHdf5Writer(HDF5Writer):
def __init__( def __init__(
self, new_file_time_interval, file_location, decimation_factor self, new_file_time_interval, file_location, decimation_factor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment