From ba6d8d6256a71d9f13c5a5ee19b38e83f70992de Mon Sep 17 00:00:00 2001 From: thijs snijder <snijder@astron.nl> Date: Thu, 15 Sep 2022 16:44:37 +0200 Subject: [PATCH] added ignoring attributeError for the receiver --- .../statistics/writer/hdf5.py | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py index 274a96081..4a3d11adc 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py +++ b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py @@ -312,43 +312,49 @@ class SstHdf5Writer(HDF5Writer): ) try: - try: - rcu_attenuator_dB_data = self.current_matrix.parameters["rcu_attenuator_dB"].astype(numpy.int64) - except: - rcu_attenuator_dB_data = None - current_group.create_dataset( name="rcu_attenuator_dB", - data=rcu_attenuator_dB_data, + data=self.current_matrix.parameters["rcu_attenuator_dB"].astype(numpy.int64), + compression="gzip", + ) + except AttributeError: + logger.debug("set rcu_attenuator_dB_data to None") + current_group.create_dataset( + name="rcu_attenuator_dB", + data=None, + shape=(1,), compression="gzip", ) - try: - rcu_band_select_data = self.current_matrix.parameters["rcu_band_select"].astype(numpy.int64) - except: - rcu_band_select_data = None - + try: current_group.create_dataset( name="rcu_band_select", - data=rcu_band_select_data, + data=self.current_matrix.parameters["rcu_band_select"].astype(numpy.int64), + compression="gzip", + ) + except AttributeError: + logger.debug("set rcu_band_select_data to None") + current_group.create_dataset( + name="rcu_band_select", + data=None, + shape=(1,), compression="gzip", ) - try: - rcu_dth_on_data = self.current_matrix.parameters["rcu_dth_on"].astype(numpy.bool_) - except: - rcu_dth_on_data = None - + try: current_group.create_dataset( name="rcu_dth_on", - data=rcu_dth_on_data, + data=self.current_matrix.parameters["rcu_dth_on"].astype(numpy.bool_), + compression="gzip", + ) + except AttributeError: + logger.debug("set rcu_dth_on to None") + current_group.create_dataset( + name="rcu_dth_on", + data=None, + shape=(1,), compression="gzip", ) - - except AttributeError as e: - logger.warning("AttributeError: Device values not written.") - except Exception as e: - logger.warning("Device values not written.") class BstHdf5Writer(HDF5Writer): -- GitLab