-
Notifications
You must be signed in to change notification settings - Fork 0
Add snapshots plan #41
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
Merged
+81
−1
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a36ab5b
Newest ophyd-async
jacob720 63c0bbe
Add snapshots plan
jacob720 583b8e2
Small fixes
jacob720 8da2f68
Merge branch 'main' into 20_add_snapshots_plan
jacob720 457030c
Merge branch 'main' into 20_add_snapshots_plan
jacob720 fe10654
Fix
jacob720 d6bfb25
Fix
jacob720 29c41cb
Pin dodal to branch
jacob720 c2dd086
Merge branch 'main' into 20_add_snapshots_plan
DominicOram 84f00f7
Merge branch 'main' into 20_add_snapshots_plan
jacob720 fe60754
Pin ophyd-async
jacob720 0e14dd5
Add test
jacob720 2374dc2
Remove test
jacob720 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import bluesky.plan_stubs as bps | ||
| import bluesky.preprocessors as bpp | ||
| from bluesky.utils import MsgGenerator | ||
| from ophyd_async.core import TriggerInfo | ||
| from ophyd_async.epics.adcore import ContAcqDetector | ||
|
|
||
|
|
||
| @bpp.run_decorator() | ||
| def take_snapshot(camera: ContAcqDetector) -> MsgGenerator: | ||
| yield from bps.stage(camera) | ||
| yield from bps.prepare(camera, TriggerInfo(number_of_events=1), wait=True) | ||
| yield from bps.trigger_and_read([camera]) | ||
| yield from bps.unstage(camera) |
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,7 @@ | ||
| import pytest | ||
| from bluesky import RunEngine | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def run_engine(): | ||
| return RunEngine() |
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,28 @@ | ||
| import pytest | ||
| from bluesky import RunEngine | ||
| from dodal.beamlines.i15_1 import cam_1 | ||
| from dodal.common.visit import DataCollectionIdentifier, StaticVisitPathProvider | ||
| from ophyd_async.core import init_devices | ||
| from ophyd_async.epics.adcore import ADImageMode, ContAcqDetector | ||
|
|
||
| from crystallography_bluesky.i15_1.plans.snapshots import take_snapshot | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| async def camera(tmp_path) -> ContAcqDetector: | ||
| assert tmp_path.exists() | ||
| path_provider = StaticVisitPathProvider("i15_1", tmp_path) | ||
| path_provider._filename_provider.collectionId = DataCollectionIdentifier( | ||
| collectionNumber=0 | ||
| ) | ||
| async with init_devices(mock=True): | ||
| camera = cam_1(path_provider) | ||
|
|
||
| await camera.driver.image_mode.set(ADImageMode.CONTINUOUS) | ||
| await camera.driver.acquire.set(True) | ||
|
|
||
| return camera | ||
|
|
||
|
|
||
| def test_take_snapshot_plan(run_engine: RunEngine, camera: ContAcqDetector): | ||
| run_engine(take_snapshot(camera)) | ||
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.
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.
Should: Can you assert something here? Or maybe also have a test that runs with the sim run engine?