Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"bluesky": ("https://blueskyproject.io/bluesky/main/", None),
"ophyd_async": ("https://blueskyproject.io/ophyd-async/v0.14.0/", None),
"ophyd_async": ("https://blueskyproject.io/ophyd-async/v0.15/", None),
"event_model": ("https://blueskyproject.io/event-model/main/", None),
"scipp": ("https://scipp.github.io/", None),
"scippneutron": ("https://scipp.github.io/scippneutron/", None),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ classifiers = [
dependencies = [
"bluesky", # Bluesky framework
"confluent-kafka", # Kafka producer
"ophyd-async[ca] == 0.14.2", # Device abstraction. When changing, also change in doc/conf.py
"ophyd-async[ca] == 0.15.0", # Device abstraction. When changing, also change in doc/conf.py
"lmfit", # Fitting
"matplotlib", # Plotting
"msgpack-numpy", # Encoding kafka messages
Expand Down
12 changes: 6 additions & 6 deletions src/ibex_bluesky_core/devices/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,15 @@ def plan():
be set to empty string to read and write to exactly the same PV.

"""
self._write_config: BlockWriteConfig[T] = write_config or BlockWriteConfig()

self.setpoint: SignalRW[T] = epics_signal_rw(
datatype, f"{prefix}CS:SB:{block_name}{sp_suffix}"
datatype,
f"{prefix}CS:SB:{block_name}{sp_suffix}",
wait=self._write_config.use_completion_callback,
)
"""The setpoint for this block."""

self._write_config: BlockWriteConfig[T] = write_config or BlockWriteConfig()

if self._write_config.use_global_moving_flag:
# Misleading PV name... says it's a str but it's really a bi record.
# Only link to this if we need to (i.e. if use_global_moving_flag was requested)
Expand Down Expand Up @@ -283,9 +285,7 @@ def my_plan():

async def do_set(setpoint: T) -> None:
logger.info("Setting Block %s to %s", self.name, setpoint)
await self.setpoint.set(
setpoint, wait=self._write_config.use_completion_callback, timeout=None
)
await self.setpoint.set(setpoint, timeout=None)
logger.info("Got completion callback from setting block %s to %s", self.name, setpoint)

if self._write_config.use_global_moving_flag:
Expand Down
4 changes: 2 additions & 2 deletions src/ibex_bluesky_core/devices/dae/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def set(self, value: T) -> None:
OSError: If the signal failed to be set to the specified value.

"""
await self.signal.set(value, wait=True, timeout=None)
await self.signal.set(value, timeout=None)
actual_value = await self.signal.get_value()
if value != actual_value:
raise OSError(
Expand Down Expand Up @@ -252,7 +252,7 @@ async def _trigger_and_get_raw_specdata(self) -> npt.NDArray[np.int32]:
time channels (including the "junk" time-channel 0).
"""
await self.controls.update_run.trigger()
await self.raw_spec_data_proc.set(1, wait=True)
await self.raw_spec_data_proc.set(1)
(raw_data, nord) = await asyncio.gather(
self.raw_spec_data.get_value(),
self.raw_spec_data_nord.get_value(),
Expand Down
2 changes: 1 addition & 1 deletion src/ibex_bluesky_core/devices/dae/_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ async def set(self, value: BeginRunExBits) -> None:

"""
logger.info("starting run with options %s", value)
await self._raw_begin_run_ex.set(value, wait=True, timeout=None)
await self._raw_begin_run_ex.set(value, timeout=None)
logger.info("start run complete")
2 changes: 1 addition & 1 deletion src/ibex_bluesky_core/devices/dae/_period_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ async def set(self, value: DaePeriodSettingsData) -> None:
current_xml = await self._raw_period_settings.get_value()
to_write = _convert_period_settings_to_xml(current_xml, value)
logger.info("set period settings: %s", to_write)
await self._raw_period_settings.set(to_write, wait=True, timeout=None)
await self._raw_period_settings.set(to_write, timeout=None)
2 changes: 1 addition & 1 deletion src/ibex_bluesky_core/devices/dae/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,4 @@ async def set(self, value: DaeSettingsData) -> None:
current_xml = await self._raw_dae_settings.get_value()
to_write = _convert_dae_settings_to_xml(current_xml, value)
logger.info("set dae settings: %s", to_write)
await self._raw_dae_settings.set(to_write, wait=True, timeout=None)
await self._raw_dae_settings.set(to_write, timeout=None)
2 changes: 1 addition & 1 deletion src/ibex_bluesky_core/devices/dae/_tcb_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@ async def set(self, value: DaeTCBSettingsData) -> None:
xml = _convert_tcb_settings_to_xml(current_xml_dehexed, value)
the_value_to_write = compress_and_hex(xml).decode()
logger.info("set tcb settings: %s", the_value_to_write)
await self._raw_tcb_settings.set(the_value_to_write, wait=True, timeout=None)
await self._raw_tcb_settings.set(the_value_to_write, timeout=None)
4 changes: 2 additions & 2 deletions src/ibex_bluesky_core/devices/reflectometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async def set(self, value: float) -> None:
indicate it has finished.
"""
logger.info("setting %s to %s", self.setpoint.source, value)
await self.setpoint.set(value, wait=True, timeout=None)
await self.setpoint.set(value, timeout=None)
await asyncio.sleep(0.1)
logger.info("waiting for %s", self.changing.source)
async for chg in observe_value(self.changing, done_timeout=self.changing_timeout):
Expand Down Expand Up @@ -118,7 +118,7 @@ async def set(self, value: float) -> None:
if in_manager_mode != NoYesChoice.YES:
raise ValueError(f"Cannot redefine {self.define_pos_sp.source} as not in manager mode.")
logger.info("setting %s to %s", self.define_pos_sp.source, value)
await self.define_pos_sp.set(value, wait=True, timeout=None)
await self.define_pos_sp.set(value, timeout=None)
logger.info("waiting for 1s for redefine to finish")
# The Reflectometry server has a CHANGED PV for a redefine, but it doesn't actually
# give a monitor update, so just wait an arbitrary length of time for it to be done.
Expand Down
12 changes: 6 additions & 6 deletions src/ibex_bluesky_core/devices/simpledae/_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
async def _end_or_abort_run(dae: Dae, save: bool) -> None:
if save:
logger.info("ending run")
await dae.controls.end_run.trigger(wait=True, timeout=None)
await dae.controls.end_run.trigger(timeout=None)
logger.info("run ended")
else:
logger.info("aborting run")
await dae.controls.abort_run.trigger(wait=True, timeout=None)
await dae.controls.abort_run.trigger(timeout=None)
logger.info("run aborted")


Expand Down Expand Up @@ -65,7 +65,7 @@ async def start_counting(self, dae: Dae) -> None:
"""
logger.info("start counting")
self._current_period += 1
await dae.period_num.set(self._current_period, wait=True, timeout=None)
await dae.period_num.set(self._current_period, timeout=None)

# Error if the period change didn't work (e.g. we have exceeded max periods)
await wait_for_value(
Expand All @@ -80,7 +80,7 @@ async def start_counting(self, dae: Dae) -> None:
await wait_for_value(dae.period.raw_frames, 0, timeout=10)

logger.info("resuming run")
await dae.controls.resume_run.trigger(wait=True, timeout=None)
await dae.controls.resume_run.trigger(timeout=None)
await wait_for_value(
dae.run_state,
lambda v: v in {RunstateEnum.RUNNING, RunstateEnum.WAITING, RunstateEnum.VETOING},
Expand All @@ -90,7 +90,7 @@ async def start_counting(self, dae: Dae) -> None:
async def stop_counting(self, dae: Dae) -> None:
"""Stop counting a scan point, by pausing the run."""
logger.info("stop counting")
await dae.controls.pause_run.trigger(wait=True, timeout=None)
await dae.controls.pause_run.trigger(timeout=None)
await wait_for_value(dae.run_state, RunstateEnum.PAUSED, timeout=10)

async def teardown(self, dae: Dae) -> None:
Expand Down Expand Up @@ -133,7 +133,7 @@ def __init__(self, save_run: bool) -> None:
async def start_counting(self, dae: Dae) -> None:
"""Start counting a scan point, by starting a DAE run."""
logger.info("start counting")
await dae.controls.begin_run.trigger(wait=True, timeout=None)
await dae.controls.begin_run.trigger(timeout=None)
await wait_for_value(
dae.run_state,
lambda v: v in {RunstateEnum.RUNNING, RunstateEnum.WAITING, RunstateEnum.VETOING},
Expand Down
16 changes: 8 additions & 8 deletions tests/devices/simpledae/test_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,43 +43,43 @@ async def test_period_per_point_controller_begins_run_in_setup_and_ends_in_teard
set_mock_value(simpledae.run_state, RunstateEnum.PAUSED)
await period_per_point_controller.setup(simpledae)
get_mock_put(simpledae.controls.begin_run_ex._raw_begin_run_ex).assert_called_once_with(
BeginRunExBits.BEGIN_PAUSED, wait=True
BeginRunExBits.BEGIN_PAUSED
)
set_mock_value(simpledae.run_state, RunstateEnum.SETUP)
await period_per_point_controller.teardown(simpledae)
get_mock_put(simpledae.controls.end_run).assert_called_once_with(None, wait=True)
get_mock_put(simpledae.controls.end_run).assert_called_once_with(None)


async def test_aborting_period_per_point_controller_aborts_in_teardown(
simpledae: SimpleDae, aborting_period_per_point_controller: PeriodPerPointController
):
set_mock_value(simpledae.run_state, RunstateEnum.SETUP)
await aborting_period_per_point_controller.teardown(simpledae)
get_mock_put(simpledae.controls.abort_run).assert_called_once_with(None, wait=True)
get_mock_put(simpledae.controls.abort_run).assert_called_once_with(None)


async def test_period_per_point_controller_changes_periods_and_counts(
simpledae: SimpleDae, period_per_point_controller: PeriodPerPointController
):
set_mock_value(simpledae.run_state, RunstateEnum.RUNNING)
await period_per_point_controller.start_counting(simpledae)
get_mock_put(simpledae.controls.resume_run).assert_called_once_with(None, wait=True)
get_mock_put(simpledae.period_num).assert_called_once_with(1, wait=True)
get_mock_put(simpledae.controls.resume_run).assert_called_once_with(None)
get_mock_put(simpledae.period_num).assert_called_once_with(1)

set_mock_value(simpledae.run_state, RunstateEnum.PAUSED)
await period_per_point_controller.stop_counting(simpledae)
get_mock_put(simpledae.controls.pause_run).assert_called_once_with(None, wait=True)
get_mock_put(simpledae.controls.pause_run).assert_called_once_with(None)


async def test_run_per_point_controller_starts_and_ends_runs(
simpledae: SimpleDae, run_per_point_controller: RunPerPointController
):
set_mock_value(simpledae.run_state, RunstateEnum.RUNNING)
await run_per_point_controller.start_counting(simpledae)
get_mock_put(simpledae.controls.begin_run).assert_called_once_with(None, wait=True)
get_mock_put(simpledae.controls.begin_run).assert_called_once_with(None)

await run_per_point_controller.stop_counting(simpledae)
get_mock_put(simpledae.controls.end_run).assert_called_once_with(None, wait=True)
get_mock_put(simpledae.controls.end_run).assert_called_once_with(None)


def test_run_per_point_controller_publishes_run(
Expand Down
2 changes: 1 addition & 1 deletion tests/devices/simpledae/test_reducers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ async def test_period_spec_integrals_reducer(

await reducer.reduce_data(simpledae)

get_mock_put(simpledae.raw_spec_data_proc).assert_called_with(1, wait=True)
get_mock_put(simpledae.raw_spec_data_proc).assert_called_with(1)

np.testing.assert_equal(await reducer.mon_integrals.get_value(), mon_integrals)
np.testing.assert_equal(await reducer.det_integrals.get_value(), det_integrals)
Expand Down
8 changes: 4 additions & 4 deletions tests/devices/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ async def test_read_and_describe_configuration(readable_block):
async def test_block_set(writable_block):
set_mock_value(writable_block.setpoint, 10)
await writable_block.set(20)
get_mock_put(writable_block.setpoint).assert_called_once_with(20, wait=True)
get_mock_put(writable_block.setpoint).assert_called_once_with(20)


async def test_block_set_without_epics_completion_callback():
block = await _block_with_write_config(BlockWriteConfig(use_completion_callback=False))
await block.set(20)
get_mock_put(block.setpoint).assert_called_once_with(20, wait=False)
get_mock_put(block.setpoint).assert_called_once_with(20)


async def test_block_set_with_arbitrary_completion_function():
Expand Down Expand Up @@ -333,7 +333,7 @@ def test_plan_trigger_block(RE, readable_block):
def test_plan_mv_block(RE, writable_block):
set_mock_value(writable_block.setpoint, 123.0)
RE(bps.mv(writable_block, 456.0))
get_mock_put(writable_block.setpoint).assert_called_once_with(456.0, wait=True)
get_mock_put(writable_block.setpoint).assert_called_once_with(456.0)


def test_block_reprs():
Expand All @@ -349,7 +349,7 @@ async def test_block_mot_set_within_limits(mot_block):
set_mock_value(mot_block.high_limit_travel, 1000)
set_mock_value(mot_block.low_limit_travel, -1000)
await mot_block.set(20)
get_mock_put(mot_block.user_setpoint).assert_called_once_with(20, wait=True)
get_mock_put(mot_block.user_setpoint).assert_called_once_with(20)


async def test_block_mot_set_outside_limits(mot_block):
Expand Down
2 changes: 1 addition & 1 deletion tests/devices/test_reflectometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_set_waits_for_changing_on_reflectometry_parameter(RE):
callback_on_mock_put(param.setpoint, lambda *a, **k: set_mock_value(param.changing, False))
new_value = 456.0
RE(bps.mv(param, new_value))
get_mock_put(param.setpoint).assert_called_once_with(new_value, wait=True)
get_mock_put(param.setpoint).assert_called_once_with(new_value)


async def test_times_out_if_changing_never_finishes_on_reflectometry_parameter(RE):
Expand Down
2 changes: 1 addition & 1 deletion tests/plans/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def test_adaptive_scan_with_periods_sets_max_periods(RE, dae, block):
model=Gaussian().fit(),
)
)
get_mock_put(dae.number_of_periods.signal).assert_called_with(expected, wait=True)
get_mock_put(dae.number_of_periods.signal).assert_called_with(expected)


def test_adaptive_scan_does_normal_scan_when_relative_false(RE, dae, block):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_plan_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ def plan():
RE(plan())

get_mock_put(motor.set_use_switch).assert_has_calls(
[call(UseSetMode.SET, wait=True), call(UseSetMode.USE, wait=True)]
[call(UseSetMode.SET), call(UseSetMode.USE)]
)

get_mock_put(motor.user_setpoint).assert_called_once_with(42.0, wait=True)
get_mock_put(motor.user_setpoint).assert_called_once_with(42.0)


async def test_redefine_refl_parameter(RE):
Expand All @@ -172,7 +172,7 @@ async def test_redefine_refl_parameter(RE):

RE(redefine_refl_parameter(param, 42.0))

get_mock_put(param.redefine.define_pos_sp).assert_called_once_with(42.0, wait=True) # pyright: ignore [reportOptionalMemberAccess]
get_mock_put(param.redefine.define_pos_sp).assert_called_once_with(42.0) # pyright: ignore [reportOptionalMemberAccess]


async def test_raises_when_attempting_to_redefine_refl_parameter_with_no_redefine(RE):
Expand Down