From e55ff6e03039b01c5592ad4eef35fbf48256f18c Mon Sep 17 00:00:00 2001 From: thijs snijder <snijder@astron.nl> Date: Wed, 21 Sep 2022 11:45:47 +0200 Subject: [PATCH] polished the code a bit --- .../tangostationcontrol/statistics/reader.py | 13 ++++--------- .../tangostationcontrol/statistics/writer/hdf5.py | 3 --- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/statistics/reader.py b/tangostationcontrol/tangostationcontrol/statistics/reader.py index ef065ab80..20d3537ed 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/reader.py +++ b/tangostationcontrol/tangostationcontrol/statistics/reader.py @@ -198,9 +198,10 @@ 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')}") + + self.data_id_signal_input_index = file[group_key].attrs["data_id_signal_input_index"] + + # check if the dataset is empty or not. if empty, set to None, if not get the value if file.get(f'{group_key}/rcu_attenuator_dB').shape is None: self.rcu_attenuator_dB = None @@ -217,12 +218,6 @@ class statistics_data: 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")) - # get XST specific stuff if self.marker == "X": self.data_id_subband_index = file[group_key].attrs["data_id_subband_index"] diff --git a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py index a59a38418..5f1d1b95c 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py +++ b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py @@ -318,7 +318,6 @@ class SstHdf5Writer(HDF5Writer): compression="gzip", ) except AttributeError: - logger.debug("set rcu_attenuator_dB_data to None") current_group.create_dataset( name="rcu_attenuator_dB", data=h5py.Empty("f"), @@ -331,7 +330,6 @@ class SstHdf5Writer(HDF5Writer): compression="gzip", ) except AttributeError: - logger.debug("set rcu_band_select_data to None") current_group.create_dataset( name="rcu_band_select", data=h5py.Empty("f"), @@ -344,7 +342,6 @@ class SstHdf5Writer(HDF5Writer): compression="gzip", ) except AttributeError: - logger.debug("set rcu_dth_on to None") current_group.create_dataset( name="rcu_dth_on", data=h5py.Empty("f"), -- GitLab