-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecation warning to inject (#854)
* Add deprecation warning to inject * Handle inject deprecation in tests * Docs page about including devices in plans
- Loading branch information
1 parent
ecc1a20
commit 0f8989e
Showing
3 changed files
with
73 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Include Devices in Plans | ||
|
||
There are two main ways to include dodal devices in plans | ||
|
||
## 1. Pass as Argument | ||
|
||
```python | ||
import bluesky.plans as bp | ||
|
||
from bluesky.protocols import Readable | ||
from bluesky.utils import MsgGenerator | ||
from dodal.beamlines import i22 | ||
|
||
def my_plan(detector: Readable) -> MsgGenerator: | ||
yield from bp.count([detector]) | ||
|
||
RE(my_plan(i22.saxs())) | ||
``` | ||
|
||
This is useful for generic plans that can run on a variety of devices and are not designed with any specific device in mind. | ||
|
||
## 2. Pass as Default Argument | ||
|
||
```python | ||
import bluesky.plans as bp | ||
|
||
from bluesky.protocols import Readable | ||
from bluesky.utils import MsgGenerator | ||
from dodal.beamlines import i22 | ||
|
||
def my_plan(detector: Readable = i22.saxs(connect_immediately=False)) -> MsgGenerator: | ||
yield from bp.count([detector]) | ||
|
||
RE(my_plan())) | ||
``` | ||
|
||
This is useful for plans that will usually, but not exclusively, use the same device or that are designed to only ever work with a specific device. |
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
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