From 4e50c88bcf9e88beb341d513b6db8e9c844907cd Mon Sep 17 00:00:00 2001 From: Eva Date: Wed, 5 Jun 2024 11:31:27 +0100 Subject: [PATCH] added new `:DATASET` pv to capture records --- src/pandablocks_ioc/_pvi.py | 9 ++++++++- src/pandablocks_ioc/ioc.py | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/pandablocks_ioc/_pvi.py b/src/pandablocks_ioc/_pvi.py index 293bee17..22237f95 100644 --- a/src/pandablocks_ioc/_pvi.py +++ b/src/pandablocks_ioc/_pvi.py @@ -164,7 +164,7 @@ def add_automatic_pvi_info( _positions_table_group = Group( name="PositionsTable", layout=Grid(labelled=True), children=[] ) -_positions_table_headers = ["VALUE", "UNITS", "SCALE", "OFFSET", "CAPTURE"] +_positions_table_headers = ["VALUE", "UNITS", "SCALE", "OFFSET", "DATASET", "CAPTURE"] # TODO: Replicate this for the BITS table @@ -174,6 +174,7 @@ def add_positions_table_row( units_record_name: EpicsName, scale_record_name: EpicsName, offset_record_name: EpicsName, + dataset_record_name: EpicsName, capture_record_name: EpicsName, ) -> None: """Add a Row to the Positions table""" @@ -205,6 +206,12 @@ def add_positions_table_row( pv=offset_record_name, widget=TextWrite(), ), + SignalRW( + name=epics_to_pvi_name(dataset_record_name), + label=dataset_record_name, + pv=dataset_record_name, + widget=TextWrite(), + ), SignalRW( name=epics_to_pvi_name(capture_record_name), label=capture_record_name, diff --git a/src/pandablocks_ioc/ioc.py b/src/pandablocks_ioc/ioc.py index eb2b4697..7774bb34 100644 --- a/src/pandablocks_ioc/ioc.py +++ b/src/pandablocks_ioc/ioc.py @@ -917,6 +917,16 @@ def _make_pos_out( DESC="Value with scaling applied", ) + dataset_record_name = EpicsName(record_name + ":DATASET") + record_dict[dataset_record_name] = self._create_record_info( + dataset_record_name, + "Used to adjust the dataset name to one more scientifically relevant", + builder.stringOut, + str, + PviGroup.CAPTURE, + initial_value=values.get(dataset_record_name, ""), + ) + # Create the POSITIONS "table" of records. Most are aliases of the records # created above. positions_record_name = f"POSITIONS:{self._pos_out_row_counter}" @@ -957,6 +967,13 @@ def _make_pos_out( + ":" + units_record_name.split(":")[-1] ) + record_dict[dataset_record_name].record.add_alias( + self._record_prefix + + ":" + + positions_record_name + + ":" + + dataset_record_name.split(":")[-1] + ) self._pos_out_row_counter += 1 add_positions_table_row( @@ -965,6 +982,7 @@ def _make_pos_out( units_record_name, scale_record_name, offset_record_name, + dataset_record_name, capture_record_name, )