diff --git a/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py b/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py index d8932263df5079790e14cdd988f73c3224e8c53a..c52ac447223c079359aae4655346031862ac175a 100644 --- a/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py +++ b/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py @@ -143,9 +143,9 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase): self.assertIsNotNone(stat) self.assertEqual(121, stat.data_id_signal_input_index) # Test RECV attributes - self.assertEqual(stat.rcu_attenuator_dB.tolist(), None) - self.assertEqual(stat.rcu_band_select.tolist(), None) - self.assertEqual(stat.rcu_dth_on.tolist(), None) + self.assertEqual(stat.rcu_attenuator_dB, None) + self.assertEqual(stat.rcu_band_select, None) + self.assertEqual(stat.rcu_dth_on, None) def test_SST_statistics_with_device_in_off(self): self.setup_recv_proxy() @@ -183,6 +183,6 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase): self.assertIsNotNone(stat) self.assertEqual(121, stat.data_id_signal_input_index) # Test RECV attributes - self.assertEqual(stat.rcu_attenuator_dB.tolist(), None) - self.assertEqual(stat.rcu_band_select.tolist(), None) - self.assertEqual(stat.rcu_dth_on.tolist(), None) + self.assertEqual(stat.rcu_attenuator_dB, None) + self.assertEqual(stat.rcu_band_select, None) + self.assertEqual(stat.rcu_dth_on, None) diff --git a/tangostationcontrol/tangostationcontrol/statistics/reader.py b/tangostationcontrol/tangostationcontrol/statistics/reader.py index 72660cb7dcad42d5a8df16c221249a2825090473..ef065ab8016ce9ca42de910c1c6d4438376245c3 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/reader.py +++ b/tangostationcontrol/tangostationcontrol/statistics/reader.py @@ -161,7 +161,7 @@ class statistics_data: "source_info_fsub_type", "source_info_beam_repositioning_flag", "source_info_antenna_band_index", "source_info__raw", "observation_id", "nof_statistics_per_packet", "nof_signal_inputs", "nof_bytes_per_statistic", "marker", "integration_interval_raw", "integration_interval", "data_id__raw", "block_serial_number", "block_period_raw", "block_period", "data_id_signal_input_index", - "data_id_subband_index", "data_id_first_baseline", "data_id_beamlet_index", "nof_valid_payloads", "nof_payload_errors", "values", + "data_id_subband_index", "data_id_first_baseline", "data_id_beamlet_index", "nof_valid_payloads", "nof_payload_errors", "values", "rcu_attenuator_dB", "rcu_band_select", "rcu_dth_on") def __init__(self, file, group_key): @@ -198,10 +198,30 @@ class statistics_data: # get SST specific stuff if self.marker == "S": + 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")) + + 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")) + + 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.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")) + # 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 if self.marker == "X": diff --git a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py index 382abfd5acbd08e127993e6a03e1cde11b4d4607..a59a3841866be9b994d6d65875eb62c21336ba48 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py +++ b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py @@ -321,9 +321,7 @@ class SstHdf5Writer(HDF5Writer): logger.debug("set rcu_attenuator_dB_data to None") current_group.create_dataset( name="rcu_attenuator_dB", - data=None, - shape=(1,), - compression="gzip", + data=h5py.Empty("f"), ) try: @@ -336,9 +334,7 @@ class SstHdf5Writer(HDF5Writer): logger.debug("set rcu_band_select_data to None") current_group.create_dataset( name="rcu_band_select", - data=None, - shape=(1,), - compression="gzip", + data=h5py.Empty("f"), ) try: @@ -351,12 +347,11 @@ class SstHdf5Writer(HDF5Writer): logger.debug("set rcu_dth_on to None") current_group.create_dataset( name="rcu_dth_on", - data=None, - shape=(1,), - compression="gzip", + data=h5py.Empty("f"), ) + class BstHdf5Writer(HDF5Writer): def __init__( self, new_file_time_interval, file_location, decimation_factor