Skip to content

Commit

Permalink
Refactor and create ophyd-async FGS devices (#422)
Browse files Browse the repository at this point in the history
* Convert FGS device to ophyd async

* Combine panda and zebra FGS devices and params

* Param positions now a function instead of attribute


---------

Co-authored-by: Dominic Oram <dominic.oram@diamond.ac.uk>
  • Loading branch information
olliesilvester and DominicOram authored Jun 11, 2024
1 parent 06ddca6 commit 44bdecc
Show file tree
Hide file tree
Showing 7 changed files with 378 additions and 667 deletions.
17 changes: 8 additions & 9 deletions src/dodal/beamlines/i03.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
from dodal.devices.detector import DetectorParams
from dodal.devices.detector.detector_motion import DetectorMotion
from dodal.devices.eiger import EigerDetector
from dodal.devices.fast_grid_scan import FastGridScan
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.oav.oav_detector import OAV, OAVConfigParams
from dodal.devices.oav.pin_image_recognition import PinTipDetection
from dodal.devices.panda_fast_grid_scan import PandAFastGridScan
from dodal.devices.qbpm1 import QBPM1
from dodal.devices.robot import BartRobot
from dodal.devices.s4_slit_gaps import S4SlitGaps
Expand Down Expand Up @@ -200,16 +199,16 @@ def set_params(eiger: EigerDetector):
)


def fast_grid_scan(
def zebra_fast_grid_scan(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> FastGridScan:
"""Get the i03 fast_grid_scan device, instantiate it if it hasn't already been.
) -> ZebraFastGridScan:
"""Get the i03 zebra_fast_grid_scan device, instantiate it if it hasn't already been.
If this is called when already instantiated in i03, it will return the existing object.
"""
return device_instantiation(
device_factory=FastGridScan,
name="fast_grid_scan",
prefix="-MO-SGON-01:",
device_factory=ZebraFastGridScan,
name="zebra_fast_grid_scan",
prefix="-MO-SGON-01:FGS:",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)
Expand All @@ -220,7 +219,7 @@ def panda_fast_grid_scan(
) -> PandAFastGridScan:
"""Get the i03 panda_fast_grid_scan device, instantiate it if it hasn't already been.
If this is called when already instantiated in i03, it will return the existing object.
This is used instead of the fast_grid_scan device when using the PandA.
This is used instead of the zebra_fast_grid_scan device when using the PandA.
"""
return device_instantiation(
device_factory=PandAFastGridScan,
Expand Down
12 changes: 6 additions & 6 deletions src/dodal/beamlines/i04.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dodal.devices.detector import DetectorParams
from dodal.devices.detector.detector_motion import DetectorMotion
from dodal.devices.eiger import EigerDetector
from dodal.devices.fast_grid_scan import FastGridScan
from dodal.devices.fast_grid_scan import ZebraFastGridScan
from dodal.devices.flux import Flux
from dodal.devices.i04.transfocator import Transfocator
from dodal.devices.ipin import IPin
Expand Down Expand Up @@ -260,15 +260,15 @@ def set_params(eiger: EigerDetector):
)


def fast_grid_scan(
def zebra_fast_grid_scan(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> FastGridScan:
"""Get the i04 fast_grid_scan device, instantiate it if it hasn't already been.
) -> ZebraFastGridScan:
"""Get the i04 zebra_fast_grid_scan device, instantiate it if it hasn't already been.
If this is called when already instantiated in i04, it will return the existing object.
"""
return device_instantiation(
device_factory=FastGridScan,
name="fast_grid_scan",
device_factory=ZebraFastGridScan,
name="zebra_fast_grid_scan",
prefix="-MO-SGON-01:",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
Expand Down
Loading

0 comments on commit 44bdecc

Please sign in to comment.