Skip to content

Commit

Permalink
added new :DATASET pv to capture records
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Jun 5, 2024
1 parent 8e25d64 commit eebe278
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pandablocks_ioc/_pvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"""
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 18 additions & 0 deletions src/pandablocks_ioc/ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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(
Expand All @@ -965,6 +982,7 @@ def _make_pos_out(
units_record_name,
scale_record_name,
offset_record_name,
dataset_record_name,
capture_record_name,
)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,15 @@ def idfn(val):
f"{TEST_RECORD}:CAPTURE": "Diff",
f"{TEST_RECORD}:OFFSET": "5",
f"{TEST_RECORD}:SCALE": "0.5",
f"{TEST_RECORD}:DATASET": "",
f"{TEST_RECORD}:UNITS": "MyUnits",
},
[
f"{TEST_RECORD}",
f"{TEST_RECORD}:CAPTURE",
f"{TEST_RECORD}:OFFSET",
f"{TEST_RECORD}:SCALE",
f"{TEST_RECORD}:DATASET",
f"{TEST_RECORD}:UNITS",
],
),
Expand Down

0 comments on commit eebe278

Please sign in to comment.