From 6e81fe914160cc31a49b5977efdddde7ba8b37b2 Mon Sep 17 00:00:00 2001 From: stedif <stefano.difrischia@inaf.it> Date: Fri, 9 Sep 2022 13:30:04 +0200 Subject: [PATCH] L2SS-871: fix writer bugs --- .../tangostationcontrol/statistics/reader.py | 6 +++++- .../tangostationcontrol/statistics/writer/hdf5.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/statistics/reader.py b/tangostationcontrol/tangostationcontrol/statistics/reader.py index cb9370fd2..eb1594540 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/reader.py +++ b/tangostationcontrol/tangostationcontrol/statistics/reader.py @@ -156,7 +156,7 @@ class statistics_data: # we will be creating potentially tens of thousands of these object. Using __slots__ makes them faster and uses less memory. At the cost of # having to list all self attributes here. - __slots__ = ("version_id", "timestamp", "station_id", "source_info_t_adc", "source_info_subband_calibrated_flag", "source_info_payload_error", + __slots__ = ("version_id", "station_version_id", "writer_version_id", "timestamp", "station_id", "source_info_t_adc", "source_info_subband_calibrated_flag", "source_info_payload_error", "source_info_payload_error", "source_info_payload_error", "source_info_nyquist_zone_index", "source_info_gn_index", "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", @@ -169,6 +169,10 @@ class statistics_data: # get all the general header info self.version_id = file[group_key].attrs["version_id"] self.station_id = file[group_key].attrs["station_id"] + + # get software version info + self.station_version_id = file[group_key].attrs["station_version_id"] + self.writer_version_id = file[group_key].attrs["writer_version_id"] # convert string timestamp to datetime object self.timestamp = datetime.datetime.fromisoformat(file[group_key].attrs["timestamp"]) diff --git a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py index b05220fda..a22c909fd 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py +++ b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py @@ -36,14 +36,14 @@ __all__ = [ def _get_lsc_version() -> str: """ Retrieve the Lofar Station Control software version """ - filepath = os.path.join(os.environ.get('LOFAR20_DIR'), 'tangostationcontrol/VERSION') + filepath = os.path.join(os.path.realpath('../'), 'tangostationcontrol/VERSION') with open(filepath) as f: version = f.readline().strip() return version or "" def _get_writer_version() -> str: """ Retrieve the Statistics Writer software version """ - filepath = os.path.join(os.path.dirname(__file__), '/VERSION') + filepath = os.path.join(os.path.dirname(__file__), 'VERSION') with open(filepath) as f: version = f.readline().strip() return version or "" -- GitLab