Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the horizontal mirror voltages #834

Merged
merged 5 commits into from
Oct 21, 2024
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
10 changes: 5 additions & 5 deletions src/dodal/beamlines/i03.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from dodal.devices.eiger import EigerDetector
from dodal.devices.fast_grid_scan import PandAFastGridScan, ZebraFastGridScan
from dodal.devices.flux import Flux
from dodal.devices.focusing_mirror import FocusingMirrorWithStripes, VFMMirrorVoltages
from dodal.devices.focusing_mirror import FocusingMirrorWithStripes, MirrorVoltages
from dodal.devices.motors import XYZPositioner
from dodal.devices.oav.oav_detector import OAV, OAVConfigParams
from dodal.devices.oav.pin_image_recognition import PinTipDetection
Expand Down Expand Up @@ -123,12 +123,12 @@ def vfm(


@skip_device(lambda: BL == "s03")
def vfm_mirror_voltages(
def mirror_voltages(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> VFMMirrorVoltages:
) -> MirrorVoltages:
return device_instantiation(
device_factory=VFMMirrorVoltages,
name="vfm_mirror_voltages",
device_factory=MirrorVoltages,
name="mirror_voltages",
prefix="-MO-PSU-01:",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
Expand Down
22 changes: 14 additions & 8 deletions src/dodal/devices/focusing_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MirrorVoltageDemand(str, Enum):
SLEW = "SLEW"


class MirrorVoltageDevice(Device):
class SingleMirrorVoltage(Device):
"""Abstract the bimorph mirror voltage PVs into a single device that can be set asynchronously and returns when
the demanded voltage setpoint is accepted, without blocking the caller as this process can take significant time.
"""
Expand Down Expand Up @@ -105,22 +105,28 @@ async def set(self, value, *args, **kwargs):
await set_status


class VFMMirrorVoltages(StandardReadable):
class MirrorVoltages(StandardReadable):
def __init__(
self, name: str, prefix: str, *args, daq_configuration_path: str, **kwargs
):
self.voltage_lookup_table_path = (
daq_configuration_path + "/json/mirrorFocus.json"
)

with self.add_children_as_readables():
self.voltage_channels = DeviceVector(
{
i - 14: MirrorVoltageDevice(prefix=f"{prefix}BM:V{i}")
for i in range(14, 22)
}
)
self.horizontal_voltages = self._channels_in_range(prefix, 0, 14)
self.vertical_voltages = self._channels_in_range(prefix, 14, 22)

super().__init__(*args, name=name, **kwargs)

def _channels_in_range(self, prefix, start_idx, end_idx):
return DeviceVector(
{
i - start_idx: SingleMirrorVoltage(prefix=f"{prefix}BM:V{i}")
for i in range(start_idx, end_idx)
}
)


class FocusingMirror(StandardReadable):
"""Focusing Mirror"""
Expand Down
9 changes: 0 additions & 9 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
PathProvider,
)

from dodal.beamlines import i03
from dodal.common.beamlines import beamline_utils
from dodal.common.visit import (
DirectoryServiceClient,
Expand Down Expand Up @@ -92,14 +91,6 @@ def pytest_runtest_teardown():
sys.modules["dodal.beamlines.beamline_utils"].clear_devices()


@pytest.fixture
def vfm_mirror_voltages(RE: RunEngine):
voltages = i03.vfm_mirror_voltages(fake_with_ophyd_sim=True)
voltages.voltage_lookup_table_path = "tests/test_data/test_mirror_focus.json"
yield voltages
beamline_utils.clear_devices()


s03_epics_server_port = getenv("S03_EPICS_CA_SERVER_PORT")
s03_epics_repeater_port = getenv("S03_EPICS_CA_REPEATER_PORT")

Expand Down
Loading
Loading