Skip to content

Commit eebe278

Browse files
committed
added new :DATASET pv to capture records
1 parent 8e25d64 commit eebe278

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/pandablocks_ioc/_pvi.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def add_automatic_pvi_info(
164164
_positions_table_group = Group(
165165
name="PositionsTable", layout=Grid(labelled=True), children=[]
166166
)
167-
_positions_table_headers = ["VALUE", "UNITS", "SCALE", "OFFSET", "CAPTURE"]
167+
_positions_table_headers = ["VALUE", "UNITS", "SCALE", "OFFSET", "DATASET", "CAPTURE"]
168168

169169

170170
# TODO: Replicate this for the BITS table
@@ -174,6 +174,7 @@ def add_positions_table_row(
174174
units_record_name: EpicsName,
175175
scale_record_name: EpicsName,
176176
offset_record_name: EpicsName,
177+
dataset_record_name: EpicsName,
177178
capture_record_name: EpicsName,
178179
) -> None:
179180
"""Add a Row to the Positions table"""
@@ -205,6 +206,12 @@ def add_positions_table_row(
205206
pv=offset_record_name,
206207
widget=TextWrite(),
207208
),
209+
SignalRW(
210+
name=epics_to_pvi_name(dataset_record_name),
211+
label=dataset_record_name,
212+
pv=dataset_record_name,
213+
widget=TextWrite(),
214+
),
208215
SignalRW(
209216
name=epics_to_pvi_name(capture_record_name),
210217
label=capture_record_name,

src/pandablocks_ioc/ioc.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,16 @@ def _make_pos_out(
917917
DESC="Value with scaling applied",
918918
)
919919

920+
dataset_record_name = EpicsName(record_name + ":DATASET")
921+
record_dict[dataset_record_name] = self._create_record_info(
922+
dataset_record_name,
923+
"Used to adjust the dataset name to one more scientifically relevant",
924+
builder.stringOut,
925+
str,
926+
PviGroup.CAPTURE,
927+
initial_value=values.get(dataset_record_name, ""),
928+
)
929+
920930
# Create the POSITIONS "table" of records. Most are aliases of the records
921931
# created above.
922932
positions_record_name = f"POSITIONS:{self._pos_out_row_counter}"
@@ -957,6 +967,13 @@ def _make_pos_out(
957967
+ ":"
958968
+ units_record_name.split(":")[-1]
959969
)
970+
record_dict[dataset_record_name].record.add_alias(
971+
self._record_prefix
972+
+ ":"
973+
+ positions_record_name
974+
+ ":"
975+
+ dataset_record_name.split(":")[-1]
976+
)
960977

961978
self._pos_out_row_counter += 1
962979
add_positions_table_row(
@@ -965,6 +982,7 @@ def _make_pos_out(
965982
units_record_name,
966983
scale_record_name,
967984
offset_record_name,
985+
dataset_record_name,
968986
capture_record_name,
969987
)
970988

tests/test_ioc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,15 @@ def idfn(val):
201201
f"{TEST_RECORD}:CAPTURE": "Diff",
202202
f"{TEST_RECORD}:OFFSET": "5",
203203
f"{TEST_RECORD}:SCALE": "0.5",
204+
f"{TEST_RECORD}:DATASET": "",
204205
f"{TEST_RECORD}:UNITS": "MyUnits",
205206
},
206207
[
207208
f"{TEST_RECORD}",
208209
f"{TEST_RECORD}:CAPTURE",
209210
f"{TEST_RECORD}:OFFSET",
210211
f"{TEST_RECORD}:SCALE",
212+
f"{TEST_RECORD}:DATASET",
211213
f"{TEST_RECORD}:UNITS",
212214
],
213215
),

0 commit comments

Comments
 (0)