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

changes

parent 53152f99
No related branches found
No related tags found
1 merge request!421Resolve L2SS-920 "Make statistics writer tolerant"
...@@ -274,6 +274,8 @@ def main(): ...@@ -274,6 +274,8 @@ def main():
# set up everything # set up everything
stat_parser = setup_stat_parser() stat_parser = setup_stat_parser()
logger.debug("test")
# get a single numpy array of all the statistics stored. # get a single numpy array of all the statistics stored.
array = stat_parser.collect_values() array = stat_parser.collect_values()
logger.debug(f"Collected the statistics values of {stat_parser.get_statistics_count()} statistics in to one gaint array of shape: {array.shape} and type: {array.dtype}") logger.debug(f"Collected the statistics values of {stat_parser.get_statistics_count()} statistics in to one gaint array of shape: {array.shape} and type: {array.dtype}")
...@@ -281,3 +283,6 @@ def main(): ...@@ -281,3 +283,6 @@ def main():
# Get a list of all the statistics timestamps we have # Get a list of all the statistics timestamps we have
statistics = stat_parser.list_statistics() statistics = stat_parser.list_statistics()
logger.debug(f"These are all the statistics parsed: {statistics}") logger.debug(f"These are all the statistics parsed: {statistics}")
for i in array:
logger.debug(i.rcu_attenuator_dB)
\ No newline at end of file
...@@ -24,7 +24,7 @@ from lofar_station_client.statistics.packet import BSTPacket ...@@ -24,7 +24,7 @@ from lofar_station_client.statistics.packet import BSTPacket
from lofar_station_client.statistics.packet import SSTPacket from lofar_station_client.statistics.packet import SSTPacket
from lofar_station_client.statistics.packet import XSTPacket from lofar_station_client.statistics.packet import XSTPacket
from tango import DeviceProxy from tango import DeviceProxy, exception
logger = logging.getLogger("statistics_writer") logger = logging.getLogger("statistics_writer")
...@@ -310,37 +310,41 @@ class SstHdf5Writer(HDF5Writer): ...@@ -310,37 +310,41 @@ class SstHdf5Writer(HDF5Writer):
].astype(numpy.float32), ].astype(numpy.float32),
compression="gzip", compression="gzip",
) )
try:
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( current_group.create_dataset(
name="rcu_attenuator_dB", name="rcu_attenuator_dB",
data=self.current_matrix.parameters["rcu_attenuator_dB"].astype( data=rcu_attenuator_dB_data,
numpy.int64
),
compression="gzip", compression="gzip",
) )
except:
pass
try: try:
rcu_band_select_data = self.current_matrix.parameters["rcu_band_select"].astype(numpy.int64)
except:
rcu_band_select_data = None
current_group.create_dataset( current_group.create_dataset(
name="rcu_band_select", name="rcu_band_select",
data=self.current_matrix.parameters["rcu_band_select"].astype( data=rcu_band_select_data,
numpy.int64
),
compression="gzip", compression="gzip",
) )
except:
pass
try: try:
rcu_dth_on_data = self.current_matrix.parameters["rcu_dth_on"].astype(numpy.bool_)
except:
rcu_dth_on_data = None
current_group.create_dataset( current_group.create_dataset(
name="rcu_dth_on", name="rcu_dth_on",
data=self.current_matrix.parameters["rcu_dth_on"].astype( data=rcu_dth_on_data,
numpy.bool_
),
compression="gzip", compression="gzip",
) )
except:
pass
try:
except AttributeError as e: except AttributeError as e:
logger.warning("AttributeError: Device values not written.") logger.warning("AttributeError: Device values not written.")
except Exception as e: except Exception as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment