From 9df37cdbce90e223d2c60ff4c0bea0d2241b21d3 Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Wed, 31 Jul 2024 17:23:46 -0500 Subject: [PATCH] simpler, per @tacaswell --- ophyd/utils/epics_pvs.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ophyd/utils/epics_pvs.py b/ophyd/utils/epics_pvs.py index 1e5d116a6..9858e7ad5 100644 --- a/ophyd/utils/epics_pvs.py +++ b/ophyd/utils/epics_pvs.py @@ -267,11 +267,10 @@ def _wait_for_value(signal, val, poll_time=0.01, timeout=10, rtol=None, atol=Non TimeoutError if timeout is exceeded """ expiration_time = ttime.time() + timeout if timeout is not None else None - is_array = isinstance(val, (list, np.ndarray, tuple)) - if is_array: - current_value = signal.get(count=len(val)) - else: - current_value = signal.get() + get_kwargs = {} + if isinstance(val, (list, np.ndarray, tuple)): + get_kwargs["count"] = len(val) + current_value = signal.get(**get_kwargs) if atol is None and hasattr(signal, "tolerance"): atol = signal.tolerance @@ -309,10 +308,7 @@ def _wait_for_value(signal, val, poll_time=0.01, timeout=10, rtol=None, atol=Non ttime.sleep(poll_time) if poll_time < 0.1: poll_time *= 2 # logarithmic back-off - if is_array: - current_value = signal.get(count=len(val)) - else: - current_value = signal.get() + current_value = signal.get(**get_kwargs) if expiration_time is not None and ttime.time() > expiration_time: raise TimeoutError( "Attempted to set %r to value %r and timed "