-
Notifications
You must be signed in to change notification settings - Fork 12
Add i21 shutter with lateral motor #2005
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
Open
oliwenmandiamond
wants to merge
6
commits into
main
Choose a base branch
from
add_i21_shutter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
678855f
Add i21 shutter with lateral motor
oliwenmandiamond 4e2ee29
Add tests
oliwenmandiamond f2d4e99
Add doc string
oliwenmandiamond 80431d7
Improve doc string
oliwenmandiamond 49bd441
Merge branch 'main' into add_i21_shutter
Relm-Arrowny fac8e28
Update src/dodal/devices/beamlines/i21/fast_shutter.py
oliwenmandiamond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| from typing import Generic | ||
|
|
||
| from ophyd_async.epics.motor import Motor | ||
|
|
||
| from dodal.devices.fast_shutter import EnumTypesT, FastShutter | ||
|
|
||
|
|
||
| class FastShutterWithLateralMotor(FastShutter[EnumTypesT], Generic[EnumTypesT]): | ||
| """Implementation of fast shutter that connects to an epics enum pv. This controls | ||
| the open and close state of the shutter. This also has the lateral motor x. | ||
|
|
||
| Args: | ||
| pv (str): The pv to connect to the shutter device. | ||
| open_state (EnumTypesT): The enum value that corresponds with opening the | ||
| shutter. | ||
| close_state (EnumTypesT): The enum value that corresponds with closing the | ||
| shutter. | ||
| shutter_suffix (str, optional): Shutter suffix state. Defaults to CON. | ||
| lateral_suffix (str, optional): Lateral motor suffix. Defaults to LAT. | ||
| name (str, optional): The name of the shutter. | ||
| """ | ||
|
|
||
| def __init__( | ||
| self, | ||
| prefix: str, | ||
| open_state: EnumTypesT, | ||
| close_state: EnumTypesT, | ||
| shutter_suffix: str = "CON", | ||
| lateral_suffix: str = "LAT", | ||
| name: str = "", | ||
| ): | ||
| with self.add_children_as_readables(): | ||
| self.x = Motor(prefix + lateral_suffix) | ||
| super().__init__(prefix + shutter_suffix, open_state, close_state, name) | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import pytest | ||
| from ophyd_async.core import init_devices | ||
| from ophyd_async.testing import assert_reading, partial_reading | ||
|
|
||
| from dodal.common.enums import OpenClosed | ||
| from dodal.devices.beamlines.i21 import FastShutterWithLateralMotor | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def fs_with_lateral_motor() -> FastShutterWithLateralMotor: | ||
| with init_devices(mock=True): | ||
| fs_with_lateral_motor = FastShutterWithLateralMotor[OpenClosed]( | ||
| "TESt", open_state=OpenClosed.OPEN, close_state=OpenClosed.CLOSED | ||
| ) | ||
| return fs_with_lateral_motor | ||
|
|
||
|
|
||
| async def test_fs_with_lateral_motor_read( | ||
| fs_with_lateral_motor: FastShutterWithLateralMotor, | ||
| ) -> None: | ||
| await assert_reading( | ||
| fs_with_lateral_motor, | ||
| { | ||
| "fs_with_lateral_motor-shutter_state": partial_reading(OpenClosed.OPEN), | ||
| "fs_with_lateral_motor-x": partial_reading(0), | ||
| }, | ||
| ) |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to ask @fajinyuan how this fast shutter actually should behave, looking at it as an outsider, it look to me this is a externally triggered fast shutter. Couple of things concern me: