Skip to content

Commit

Permalink
changed default hdf pv names to upper snake case
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Apr 8, 2024
1 parent 47637b4 commit 6ea2e84
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 42 deletions.
44 changes: 23 additions & 21 deletions src/pandablocks_ioc/_hdf_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def __init__(self, client: AsyncioClient, record_prefix: str):

# Create the records, including an uppercase alias for each
# Naming convention and settings (mostly) copied from FSCN2 HDF5 records
directory_record_name = EpicsName(self._DATA_PREFIX + ":HDFDirectory")
directory_record_name = EpicsName(self._DATA_PREFIX + ":HDF_DIRECTORY")
self._directory_record = builder.longStringOut(
directory_record_name,
length=path_length,
Expand All @@ -349,10 +349,10 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
builder.longStringOut,
)
self._directory_record.add_alias(
record_prefix + ":" + directory_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":HDFDirectory"
)

file_name_record_name = EpicsName(self._DATA_PREFIX + ":HDFFileName")
file_name_record_name = EpicsName(self._DATA_PREFIX + ":HDF_FILE_NAME")
self._file_name_record = builder.longStringOut(
file_name_record_name,
length=filename_length,
Expand All @@ -367,10 +367,12 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
builder.longStringOut,
)
self._file_name_record.add_alias(
record_prefix + ":" + file_name_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":HDFFileName"
)

full_file_path_record_name = EpicsName(self._DATA_PREFIX + ":HDFFullFilePath")
full_file_path_record_name = EpicsName(
self._DATA_PREFIX + ":HDF_FULL_FILE_PATH"
)
self._full_file_path_record = builder.longStringIn(
full_file_path_record_name,
length=path_length + 1 + filename_length,
Expand All @@ -382,11 +384,11 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
full_file_path_record_name,
builder.longStringIn,
)
self._file_name_record.add_alias(
record_prefix + ":" + full_file_path_record_name.upper()
self._full_file_path_record.add_alias(
record_prefix + ":" + self._DATA_PREFIX + ":HDFFullFilePath"
)

num_capture_record_name = EpicsName(self._DATA_PREFIX + ":NumCapture")
num_capture_record_name = EpicsName(self._DATA_PREFIX + ":NUM_CAPTURE")
self._num_capture_record = builder.longOut(
num_capture_record_name,
initial_value=0, # Infinite capture
Expand All @@ -402,10 +404,10 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
)
# No validate - users are allowed to change this at any time
self._num_capture_record.add_alias(
record_prefix + ":" + num_capture_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":NumCapture"
)

num_captured_record_name = EpicsName(self._DATA_PREFIX + ":NumCaptured")
num_captured_record_name = EpicsName(self._DATA_PREFIX + ":NUM_CAPTURED")
self._num_captured_record = builder.longIn(
num_captured_record_name,
initial_value=0,
Expand All @@ -419,10 +421,10 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
builder.longIn,
)
self._num_captured_record.add_alias(
record_prefix + ":" + num_captured_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":NumCaptured"
)

num_received_record_name = EpicsName(self._DATA_PREFIX + ":NumReceived")
num_received_record_name = EpicsName(self._DATA_PREFIX + ":NUM_RECEIVED")
self._num_received_record = builder.longIn(
num_received_record_name,
initial_value=0,
Expand All @@ -436,10 +438,10 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
builder.longIn,
)
self._num_received_record.add_alias(
record_prefix + ":" + num_received_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":NumReceived"
)

flush_period_record_name = EpicsName(self._DATA_PREFIX + ":FlushPeriod")
flush_period_record_name = EpicsName(self._DATA_PREFIX + ":FLUSH_PERIOD")
self._flush_period_record = builder.aOut(
flush_period_record_name,
initial_value=1.0,
Expand All @@ -453,10 +455,10 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
builder.aOut,
)
self._flush_period_record.add_alias(
record_prefix + ":" + flush_period_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":FlushPeriod"
)

capture_control_record_name = EpicsName(self._DATA_PREFIX + ":Capture")
capture_control_record_name = EpicsName(self._DATA_PREFIX + ":CAPTURE")
self._capture_control_record = builder.boolOut(
capture_control_record_name,
ZNAM=ZNAM_STR,
Expand All @@ -471,10 +473,10 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
self._capture_control_record,
)
self._capture_control_record.add_alias(
record_prefix + ":" + capture_control_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":Capture"
)

capture_mode_record_name = EpicsName(self._DATA_PREFIX + ":CaptureMode")
capture_mode_record_name = EpicsName(self._DATA_PREFIX + ":CAPTURE_MODE")
self._capture_mode_record = builder.mbbOut(
capture_mode_record_name,
*[capture_mode.name for capture_mode in CaptureMode],
Expand All @@ -488,10 +490,10 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
builder.mbbOut,
)
self._capture_mode_record.add_alias(
record_prefix + ":" + capture_mode_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":CaptureMode"
)

status_message_record_name = EpicsName(self._DATA_PREFIX + ":Status")
status_message_record_name = EpicsName(self._DATA_PREFIX + ":STATUS")
self._status_message_record = builder.longStringIn(
status_message_record_name,
initial_value="OK",
Expand All @@ -505,7 +507,7 @@ def __init__(self, client: AsyncioClient, record_prefix: str):
builder.stringIn,
)
self._status_message_record.add_alias(
record_prefix + ":" + status_message_record_name.upper()
record_prefix + ":" + self._DATA_PREFIX + ":Status"
)

def _parameter_validate(self, record: RecordWrapper, new_val) -> bool:
Expand Down
40 changes: 20 additions & 20 deletions tests/test-bobfiles/DATA.bob
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
<transparent>true</transparent>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Hdfdirectory</text>
<text>Hdf Directory</text>
<x>0</x>
<y>0</y>
<width>250</width>
<height>20</height>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:HDFDirectory</pv_name>
<pv_name>TEST_PREFIX:DATA:HDF_DIRECTORY</pv_name>
<x>255</x>
<y>0</y>
<width>205</width>
Expand All @@ -52,15 +52,15 @@
</widget>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Hdffilename</text>
<text>Hdf File Name</text>
<x>0</x>
<y>25</y>
<width>250</width>
<height>20</height>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:HDFFileName</pv_name>
<pv_name>TEST_PREFIX:DATA:HDF_FILE_NAME</pv_name>
<x>255</x>
<y>25</y>
<width>205</width>
Expand All @@ -70,15 +70,15 @@
</widget>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Hdffullfilepath</text>
<text>Hdf Full File Path</text>
<x>0</x>
<y>50</y>
<width>250</width>
<height>20</height>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:HDFFullFilePath</pv_name>
<pv_name>TEST_PREFIX:DATA:HDF_FULL_FILE_PATH</pv_name>
<x>255</x>
<y>50</y>
<width>205</width>
Expand All @@ -100,15 +100,15 @@
<transparent>true</transparent>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Numcapture</text>
<text>Num Capture</text>
<x>0</x>
<y>0</y>
<width>250</width>
<height>20</height>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:NumCapture</pv_name>
<pv_name>TEST_PREFIX:DATA:NUM_CAPTURE</pv_name>
<x>255</x>
<y>0</y>
<width>205</width>
Expand All @@ -117,15 +117,15 @@
</widget>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Numcaptured</text>
<text>Num Captured</text>
<x>0</x>
<y>25</y>
<width>250</width>
<height>20</height>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:NumCaptured</pv_name>
<pv_name>TEST_PREFIX:DATA:NUM_CAPTURED</pv_name>
<x>255</x>
<y>25</y>
<width>205</width>
Expand All @@ -138,15 +138,15 @@
</widget>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Numreceived</text>
<text>Num Received</text>
<x>0</x>
<y>50</y>
<width>250</width>
<height>20</height>
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:NumReceived</pv_name>
<pv_name>TEST_PREFIX:DATA:NUM_RECEIVED</pv_name>
<x>255</x>
<y>50</y>
<width>205</width>
Expand All @@ -159,15 +159,15 @@
</widget>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Flushperiod</text>
<text>Flush Period</text>
<x>0</x>
<y>75</y>
<width>250</width>
<height>20</height>
</widget>
<widget type="textentry" version="3.0.0">
<name>TextEntry</name>
<pv_name>TEST_PREFIX:DATA:FlushPeriod</pv_name>
<pv_name>TEST_PREFIX:DATA:FLUSH_PERIOD</pv_name>
<x>255</x>
<y>75</y>
<width>205</width>
Expand All @@ -184,7 +184,7 @@
</widget>
<widget type="action_button" version="3.0.0">
<name>WritePV</name>
<pv_name>TEST_PREFIX:DATA:Capture</pv_name>
<pv_name>TEST_PREFIX:DATA:CAPTURE</pv_name>
<actions>
<action type="write_pv">
<pv_name>$(pv_name)</pv_name>
Expand All @@ -201,7 +201,7 @@
</widget>
<widget type="action_button" version="3.0.0">
<name>WritePV</name>
<pv_name>TEST_PREFIX:DATA:Capture</pv_name>
<pv_name>TEST_PREFIX:DATA:CAPTURE</pv_name>
<actions>
<action type="write_pv">
<pv_name>$(pv_name)</pv_name>
Expand All @@ -218,23 +218,23 @@
</widget>
<widget type="led" version="2.0.0">
<name>LED</name>
<pv_name>TEST_PREFIX:DATA:Capture</pv_name>
<pv_name>TEST_PREFIX:DATA:CAPTURE</pv_name>
<x>417</x>
<y>100</y>
<width>20</width>
<height>20</height>
</widget>
<widget type="label" version="2.0.0">
<name>Label</name>
<text>Capturemode</text>
<text>Capture Mode</text>
<x>0</x>
<y>125</y>
<width>250</width>
<height>20</height>
</widget>
<widget type="combo" version="2.0.0">
<name>ComboBox</name>
<pv_name>TEST_PREFIX:DATA:CaptureMode</pv_name>
<pv_name>TEST_PREFIX:DATA:CAPTURE_MODE</pv_name>
<x>255</x>
<y>125</y>
<width>205</width>
Expand Down Expand Up @@ -282,7 +282,7 @@
</widget>
<widget type="textupdate" version="2.0.0">
<name>TextUpdate</name>
<pv_name>TEST_PREFIX:DATA:Status</pv_name>
<pv_name>TEST_PREFIX:DATA:STATUS</pv_name>
<x>255</x>
<y>0</y>
<width>205</width>
Expand Down
2 changes: 1 addition & 1 deletion tests/test_hdf_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ async def test_hdf5_ioc(hdf5_subprocess_ioc):
assert val == ""

# Mix and match between CamelCase and UPPERCASE to check aliases work
val = await caget(hdf5_test_prefix + ":HDFFILENAME", datatype=DBR_CHAR_STR)
val = await caget(hdf5_test_prefix + ":HDF_FILE_NAME", datatype=DBR_CHAR_STR)
assert val == ""

val = await caget(hdf5_test_prefix + ":NumCapture")
Expand Down

0 comments on commit 6ea2e84

Please sign in to comment.