-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove ophyd references from motion devices (#985)
* Change p45 to phyd async * Use standard readable instead of device * Instantiate p45 devices correctly * Add prefix to device pvs * Convert i03 and i04 devices to ophyd_async --------- Co-authored-by: Shihab Suliman <[email protected]>
- Loading branch information
1 parent
317698f
commit 157afd6
Showing
3 changed files
with
49 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
from ophyd import Component, Device, EpicsSignalRO, Kind | ||
from ophyd_async.core import ( | ||
StandardReadable, | ||
StandardReadableFormat, | ||
) | ||
from ophyd_async.epics.core import epics_signal_r | ||
|
||
|
||
class Flux(Device): | ||
class Flux(StandardReadable): | ||
"""Simple device to get the flux reading""" | ||
|
||
flux_reading = Component(EpicsSignalRO, "SAMP", kind=Kind.hinted) | ||
def __init__(self, prefix: str, name="") -> None: | ||
with self.add_children_as_readables(StandardReadableFormat.HINTED_SIGNAL): | ||
self.flux_reading = epics_signal_r(float, prefix + "SAMP") | ||
super().__init__(name=name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,55 @@ | ||
from ophyd import Component as Cpt | ||
from ophyd import EpicsMotor, MotorBundle | ||
from ophyd.areadetector.base import ADComponent as Cpt | ||
from ophyd_async.core import StandardReadable | ||
from ophyd_async.epics.motor import Motor | ||
|
||
|
||
class SampleY(MotorBundle): | ||
class SampleY(StandardReadable): | ||
""" | ||
Motors for controlling the sample's y position and stretch in the y axis. | ||
""" | ||
|
||
base = Cpt(EpicsMotor, "CS:Y") | ||
stretch = Cpt(EpicsMotor, "CS:Y:STRETCH") | ||
top = Cpt(EpicsMotor, "Y:TOP") | ||
bottom = Cpt(EpicsMotor, "Y:BOT") | ||
def __init__(self, prefix: str, name="") -> None: | ||
with self.add_children_as_readables(): | ||
self.base = Motor(prefix + "CS:Y") | ||
self.stretch = Motor(prefix + "CS:Y:STRETCH") | ||
self.top = Motor(prefix + "Y:TOP") | ||
self.bottom = Motor(prefix + "Y:BOT") | ||
super().__init__(name=name) | ||
|
||
|
||
class SampleTheta(MotorBundle): | ||
class SampleTheta(StandardReadable): | ||
""" | ||
Motors for controlling the sample's theta position and skew | ||
""" | ||
|
||
base = Cpt(EpicsMotor, "THETA:POS") | ||
skew = Cpt(EpicsMotor, "THETA:SKEW") | ||
top = Cpt(EpicsMotor, "THETA:TOP") | ||
bottom = Cpt(EpicsMotor, "THETA:BOT") | ||
def __init__(self, prefix: str, name="") -> None: | ||
with self.add_children_as_readables(): | ||
self.base = Motor(prefix + "THETA:POS") | ||
self.skew = Motor(prefix + "THETA:SKEW") | ||
self.top = Motor(prefix + "THETA:TOP") | ||
self.bottom = Motor(prefix + "THETA:BOT") | ||
super().__init__(name=name) | ||
|
||
|
||
class TomoStageWithStretchAndSkew(MotorBundle): | ||
class TomoStageWithStretchAndSkew(StandardReadable): | ||
""" | ||
Grouping of motors for the P45 tomography stage | ||
""" | ||
|
||
x = Cpt(EpicsMotor, "X") | ||
y = Cpt(SampleY, "") | ||
theta = Cpt(SampleTheta, "") | ||
def __init__(self, prefix: str, name="") -> None: | ||
with self.add_children_as_readables(): | ||
self.x = Motor(prefix + "X") | ||
self.y = SampleY(prefix) | ||
self.theta = SampleTheta(prefix) | ||
super().__init__(name=name) | ||
|
||
|
||
class Choppers(MotorBundle): | ||
class Choppers(StandardReadable): | ||
""" | ||
Grouping for the P45 chopper motors | ||
""" | ||
|
||
x = Cpt(EpicsMotor, "ENDAT") | ||
y = Cpt(EpicsMotor, "BISS") | ||
def __init__(self, prefix: str, name="") -> None: | ||
with self.add_children_as_readables(): | ||
self.x = Motor(prefix + "ENDAT") | ||
self.y = Motor(prefix + "BISS") | ||
super().__init__(name=name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
from ophyd import Component, Device, EpicsMotor | ||
from ophyd_async.core import StandardReadable | ||
from ophyd_async.epics.motor import Motor | ||
|
||
|
||
class S4SlitGaps(Device): | ||
class S4SlitGaps(StandardReadable): | ||
"""Note that the S4 slits have a different PV fromat to other beamline slits""" | ||
|
||
xgap = Component(EpicsMotor, "XGAP") | ||
ygap = Component(EpicsMotor, "YGAP") | ||
def __init__(self, prefix: str, name="") -> None: | ||
with self.add_children_as_readables(): | ||
self.xgap = Motor(prefix + "XGAP") | ||
self.ygap = Motor(prefix + "YGAP") | ||
super().__init__(name=name) |