diff --git a/src/pandablocks_ioc/ioc.py b/src/pandablocks_ioc/ioc.py index f67d238e..4f4c5ff7 100644 --- a/src/pandablocks_ioc/ioc.py +++ b/src/pandablocks_ioc/ioc.py @@ -16,7 +16,6 @@ GetBlockInfo, GetChanges, GetFieldInfo, - GetLine, Put, ) from pandablocks.responses import ( @@ -62,7 +61,6 @@ ScalarRecordValue, check_num_labels, device_and_record_to_panda_name, - epics_to_panda_name, panda_to_epics_name, trim_description, trim_string_value, @@ -422,10 +420,7 @@ async def update(self, new_val): @dataclass class _TimeRecordUpdater(_RecordUpdater): - """Set the EGU and DRVL values on a record when the UNITS sub-record is updated. - - DRVL will only be updated if the `is_type_time` flag is True - fields with a subtype - of `time` do not have a `MIN` attribute.""" + """Set the EGU values on a record when the UNITS sub-record is updated.""" base_record: RecordWrapper is_type_time: bool @@ -440,9 +435,6 @@ async def update(self, new_val: Any): async def update_parent_record(self, new_val): self.update_egu(new_val) - if self.is_type_time: - await self.update_drvl() - def update_egu(self, new_val) -> None: assert self.labels @@ -463,31 +455,6 @@ def update_egu(self, new_val) -> None: 1, ) - async def update_drvl(self) -> None: - # The MIN attribute of a TIME type is automatically updated when the - # UNITS record is updated. Retrieve the new value and set it into DRVL. - - # Remove the EPICS name prefix - record_name = self.record_info.record.name.replace( - self.record_prefix + ":", "", 1 - ) - - # Trim off the last component to find the base record - base_record_name = record_name.rsplit(":", maxsplit=1)[0] - - panda_field_name = epics_to_panda_name(base_record_name) - - new_min = await self.client.send(GetLine(f"{panda_field_name}.MIN")) - - new_min_float = np.require(new_min, dtype=np.float64) - - db_put_field( - f"{self.base_record.name}.DRVL", - fields.DBF_DOUBLE, - new_min_float.ctypes.data, - 1, - ) - @dataclass class StringRecordLabelValidator: @@ -776,9 +743,6 @@ def _make_type_time( initial_value=values[record_name], ) - # MIN attribute is the DRVL field in EPICS - record_dict[record_name].record.DRVL = field_info.min_val - return record_dict def _make_subtype_time_param( diff --git a/tests/fixtures/mocked_panda.py b/tests/fixtures/mocked_panda.py index 6c66f791..f2ef5c60 100644 --- a/tests/fixtures/mocked_panda.py +++ b/tests/fixtures/mocked_panda.py @@ -24,7 +24,6 @@ GetBlockInfo, GetChanges, GetFieldInfo, - GetLine, Put, ) from pandablocks.connections import DataConnection @@ -510,7 +509,6 @@ def multiple_seq_responses(table_field_info, table_data_1, table_data_2): ], ) ): repeat(None), - # DRVL changing from 8e-06 ms to minutes command_to_key(GetFieldInfo(block="SEQ", extended_metadata=True)): repeat( {"TABLE": table_field_info} ), @@ -588,7 +586,6 @@ def no_numbered_suffix_to_metadata_responses(table_field_info, table_data_1): ], ) ): repeat(None), - # DRVL changing from 8e-06 ms to minutes command_to_key(GetFieldInfo(block="SEQ", extended_metadata=True)): repeat( {"TABLE": table_field_info} ), @@ -812,14 +809,9 @@ def standard_responses(table_field_info, table_data_1, table_data_2): units_labels=["min", "s", "ms", "ns"], subtype=None, description="EGU Desc", - min_val=8e-06, ) }, ), - # DRVL changing from 8e-06 ms to minutes - command_to_key(GetLine(field="PULSE.DELAY.MIN")): chain( - ["8e-09"], repeat("1.333333333e-10") - ), command_to_key(GetFieldInfo(block="SEQ", extended_metadata=True)): repeat( {"TABLE": table_field_info} ), @@ -843,7 +835,6 @@ def standard_responses(table_field_info, table_data_1, table_data_2): "*METADATA.LABEL_PCAP1": "PcapMetadataLabel", "PULSE.DELAY": "100", "PULSE.DELAY.UNITS": "ms", - "PULSE.DELAY.MIN": "8e-06", }, multiline_values={"SEQ.TABLE": table_data_1}, ), diff --git a/tests/test_connection.py b/tests/test_connection.py index 0e7a927f..c5598080 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -16,7 +16,6 @@ GetBlockInfo, GetChanges, GetFieldInfo, - GetLine, Put, TimeFieldInfo, ) @@ -79,14 +78,9 @@ def panda_disconnect_responses(table_field_info, table_data_1, table_data_2): units_labels=["min", "s", "ms", "ns"], subtype=None, description="EGU Desc", - min_val=8e-06, ) }, ), - # DRVL changing from 8e-06 ms to minutes - command_to_key(GetLine(field="PULSE.DELAY.MIN")): chain( - ["8e-09"], repeat("1.333333333e-10") - ), command_to_key(GetFieldInfo(block="SEQ", extended_metadata=True)): repeat( {"TABLE": table_field_info} ), @@ -110,7 +104,6 @@ def panda_disconnect_responses(table_field_info, table_data_1, table_data_2): "*METADATA.LABEL_PCAP1": "PcapMetadataLabel", "PULSE.DELAY": "100", "PULSE.DELAY.UNITS": "ms", - "PULSE.DELAY.MIN": "8e-06", }, multiline_values={"SEQ.TABLE": table_data_1}, ), diff --git a/tests/test_ioc.py b/tests/test_ioc.py index 1236a5db..ec3903bc 100644 --- a/tests/test_ioc.py +++ b/tests/test_ioc.py @@ -7,7 +7,7 @@ import pytest from mock.mock import MagicMock, call from pandablocks.asyncio import AsyncioClient -from pandablocks.commands import GetLine, Put +from pandablocks.commands import Put from pandablocks.responses import ( BitMuxFieldInfo, BitOutFieldInfo, @@ -135,7 +135,6 @@ def idfn(val): None, None, units_labels=["s", "ms", "min"], - min_val=8e-09, ), { f"{TEST_RECORD}": "0.1", @@ -659,29 +658,6 @@ async def test_time_record_updater_update_egu( assert isinstance(put_field_args[2], int) -@patch("pandablocks_ioc.ioc.db_put_field") -async def test_time_record_updater_update_drvl( - db_put_field: MagicMock, mocked_time_record_updater: Tuple[_TimeRecordUpdater, str] -): - """Test that _TimeRecordUpdater.update_drvl works correctly""" - - time_record_updater, test_prefix = mocked_time_record_updater - await time_record_updater.update_drvl() - - time_record_updater.client.send.assert_called_once_with(GetLine("TEST.MIN")) - - db_put_field.assert_called_once() - - # Check the expected arguments are passed to db_put_field. - # Note we don't check the value of `array.ctypes.data` parameter as it's a pointer - # to a memory address so will always vary - put_field_args = db_put_field.call_args.args - expected_args = [test_prefix + ":BASE:RECORD.DRVL", fields.DBF_DOUBLE, 1] - for arg in expected_args: - assert arg in put_field_args - assert isinstance(put_field_args[2], int) - - def test_uint_sets_record_attributes(ioc_record_factory: IocRecordFactory): """Test that creating a uint record correctly sets all the attributes""" diff --git a/tests/test_ioc_system.py b/tests/test_ioc_system.py index a2a316d4..dc3046c0 100644 --- a/tests/test_ioc_system.py +++ b/tests/test_ioc_system.py @@ -82,7 +82,6 @@ async def test_introspect_panda( "PCAP:LABEL": "PcapMetadataLabel", "PULSE:DELAY": "100", "PCAP:ARM": "0", - "PULSE:DELAY:MIN": "8e-06", "PULSE:DELAY:UNITS": "ms", "SEQ:TABLE": table_data_1, } @@ -225,23 +224,11 @@ async def test_create_softioc_time_panda_changes(mocked_panda_standard_responses test_prefix + ":PULSE:DELAY:UNITS", units_queue.put, datatype=str ) assert await asyncio.wait_for(units_queue.get(), TIMEOUT) == "ms" - - drvl_queue = asyncio.Queue() - m3 = camonitor( - test_prefix + ":PULSE:DELAY.DRVL", - drvl_queue.put, - ) - # The units value changes from ms to s in the test Client, which causes - # the DRVL value to change from 8e-06 to 8e-09, consistent to ms to s. - - assert await asyncio.wait_for(drvl_queue.get(), TIMEOUT) == 8e-06 assert await asyncio.wait_for(egu_queue.get(), TIMEOUT) == "s" assert await asyncio.wait_for(units_queue.get(), TIMEOUT) == "s" - assert await asyncio.wait_for(drvl_queue.get(), TIMEOUT) == 8e-09 finally: m1.close() m2.close() - m3.close() async def test_create_softioc_time_epics_changes( @@ -271,17 +258,8 @@ async def test_create_softioc_time_epics_changes( test_prefix + ":PULSE:DELAY:UNITS", units_queue.put, datatype=str ) assert await asyncio.wait_for(units_queue.get(), TIMEOUT) == "ms" - - drvl_queue = asyncio.Queue() - m3 = camonitor( - test_prefix + ":PULSE:DELAY.DRVL", - drvl_queue.put, - ) - assert await asyncio.wait_for(drvl_queue.get(), TIMEOUT) == 8e-06 - assert await asyncio.wait_for(egu_queue.get(), TIMEOUT) == "s" assert await asyncio.wait_for(units_queue.get(), TIMEOUT) == "s" - assert await asyncio.wait_for(drvl_queue.get(), TIMEOUT) == 8e-09 # Change the UNITS to "min" assert await caput( @@ -290,12 +268,10 @@ async def test_create_softioc_time_epics_changes( assert await asyncio.wait_for(egu_queue.get(), TIMEOUT) == "min" assert await asyncio.wait_for(units_queue.get(), TIMEOUT) == "min" - assert await asyncio.wait_for(drvl_queue.get(), TIMEOUT) == 1.333333333e-10 finally: m1.close() m2.close() - m3.close() async def test_softioc_records_block(mocked_panda_standard_responses):