-
Notifications
You must be signed in to change notification settings - Fork 12
Adds DCM in optics, and read-only DCM in i19_1, i19_2 #2066
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
Matt-Carre
wants to merge
13
commits into
main
Choose a base branch
from
2064_dcm_in_i19_optics
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
13 commits
Select commit
Hold shift + click to select a range
9ee2a37
Adds initial circular plans
Matt-Carre 2a7ae1c
Merge branch 'main' of github.com:DiamondLightSource/dodal
Matt-Carre c928479
Merge branch 'main' of github.com:DiamondLightSource/dodal
Matt-Carre 1be9005
initial commit - need to check the PV values but can't seem to ATM
Matt-Carre 044f38e
added DCM to i19-1/-2 which i think is the right approach
Matt-Carre 889c389
fixes it? Adds factories that are just standard readables in _1,_2, a…
Matt-Carre 2be5bd0
removes extra bit accidentally added before
Matt-Carre a6e8f2a
connects devices
Matt-Carre fc20afd
Merge branch 'main' into 2064_dcm_in_i19_optics
Matt-Carre da57d58
alters code based on comments
Matt-Carre ec5d61a
Merge branch '2064_dcm_in_i19_optics' of github.com:DiamondLightSourc…
Matt-Carre 55c53b7
updates test to use assert_reading
Matt-Carre 8920012
Merge branch 'main' into 2064_dcm_in_i19_optics
Matt-Carre 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
15 changes: 15 additions & 0 deletions
15
src/dodal/devices/beamlines/i19/access_controlled/read_only_dcm.py
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,15 @@ | ||
| from ophyd_async.core import StandardReadable | ||
| from ophyd_async.epics.core import epics_signal_r | ||
|
|
||
|
|
||
| class ReadOnlyDCM(StandardReadable): | ||
| def __init__( | ||
| self, | ||
| prefix: str, | ||
| name: str = "", | ||
| ) -> None: | ||
| with self.add_children_as_readables(): | ||
| self.energy_in_eV = epics_signal_r(float, f"{prefix}ENERGY") | ||
| self.wavelength_in_a = epics_signal_r(float, f"{prefix}WAVELENGTH") | ||
|
|
||
| super().__init__(prefix) | ||
27 changes: 27 additions & 0 deletions
27
tests/devices/beamlines/i19/access_controlled/test_read_only_dcm.py
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 bluesky.run_engine import RunEngine | ||
| from ophyd_async.core import set_mock_value | ||
| from ophyd_async.testing import assert_reading, partial_reading | ||
|
|
||
| from dodal.devices.beamlines.i19.access_controlled.read_only_dcm import ReadOnlyDCM | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| async def mock_dcm() -> ReadOnlyDCM: | ||
| mock_dcm = ReadOnlyDCM(prefix="FOO-MO") | ||
| await mock_dcm.connect(mock=True) | ||
| set_mock_value(mock_dcm.energy_in_eV, 1) | ||
| set_mock_value(mock_dcm.wavelength_in_a, 100) | ||
| return mock_dcm | ||
|
|
||
|
|
||
| async def test_reading(mock_dcm: ReadOnlyDCM, run_engine: RunEngine): | ||
| prefix = "FOO-MO" | ||
| await assert_reading( | ||
| mock_dcm, | ||
| { | ||
| f"{prefix}-energy_in_eV": partial_reading(1.0), | ||
| f"{prefix}-wavelength_in_a": partial_reading(100.0), | ||
| }, | ||
| False, | ||
| ) |
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.