-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 1032-apertures
- Loading branch information
Showing
41 changed files
with
736 additions
and
154 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 |
---|---|---|
|
@@ -92,7 +92,7 @@ jobs: | |
pipx run build | ||
- name: Upload sdist and wheel as artifacts | ||
uses: actions/upload-artifact@v4.1.0 | ||
uses: actions/upload-artifact@v4.3.1 | ||
with: | ||
name: ${{ env.DIST_WHEEL_PATH }} | ||
path: dist | ||
|
@@ -136,7 +136,7 @@ jobs: | |
echo "DIST_LOCKFILE_PATH=lockfiles-${{ env.CONTAINER_PYTHON }}-dist-${{ github.sha }}" >> $GITHUB_ENV | ||
- name: Download wheel and lockfiles | ||
uses: actions/[email protected].1 | ||
uses: actions/[email protected].2 | ||
with: | ||
path: artifacts/ | ||
pattern: "*dist*" | ||
|
@@ -216,7 +216,7 @@ jobs: | |
|
||
steps: | ||
- name: Download wheel and lockfiles | ||
uses: actions/[email protected].1 | ||
uses: actions/[email protected].2 | ||
with: | ||
pattern: "*dist*" | ||
|
||
|
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,67 @@ | ||
Creating a new beamline | ||
----------------------- | ||
|
||
A beamline is a collection of devices that can be used together to run experiments, they may be read-only or capable of being set. | ||
They include motors in the experiment hutch, optical components in the optics hutch, the synchrotron "machine" and more. | ||
|
||
The following example creates a fictitious beamline ``w41``, with a simulated twin ``s41``. | ||
``w41`` needs to monitor the status of the Synchrotron and has an AdAravisDetector. | ||
``s41`` has a simulated clone of the AdAravisDetector, but not of the Synchrotron machine. | ||
|
||
.. code-block:: python | ||
from dodal.beamlines.beamline_utils import device_instantiation | ||
from dodal.beamlines.beamline_utils import set_beamline as set_utils_beamline | ||
from dodal.devices.areadetector.adaravis import AdAravisDetector | ||
from dodal.devices.synchrotron import Synchrotron | ||
from dodal.log import set_beamline as set_log_beamline | ||
from dodal.utils import get_beamline_name, skip_device | ||
BL = get_beamline_name("s41") # Default used when not on a live beamline | ||
set_log_beamline(BL) # Configure logging and util functions | ||
set_utils_beamline(BL) | ||
""" | ||
Define device factory functions below this point. | ||
A device factory function is any function that has a return type which conforms | ||
to one or more Bluesky Protocols. | ||
""" | ||
""" | ||
A valid factory function which is: | ||
- instantiated only on the live beamline | ||
- a maximum of once | ||
- can optionally be faked with ophyd simulated axes | ||
- can optionally be connected concurrently by not waiting for connect to complete | ||
- if constructor took a prefix, could optionally exclude the BLIXX prefix | ||
"""" | ||
@skip_device(lambda: BL == "s41") # Conditionally do not instantiate this device | ||
def synchrotron( | ||
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False | ||
) -> Synchrotron: | ||
"""Calls the Synchrotron class's constructor with name="synchrotron", prefix="" | ||
If this is called when already instantiated, it will return the existing object. | ||
""" | ||
return device_instantiation( | ||
Synchrotron, | ||
"synchrotron", | ||
"", | ||
wait_for_connection, | ||
fake_with_ophyd_sim, | ||
bl_prefix=False, | ||
) | ||
def d11(name: str = "D11") -> AdAravisDetector: | ||
""" | ||
Also a valid Device factory function, but as multiple calls would instantiate | ||
multiple copies of a device, discouraged. | ||
""" | ||
return AdAravisDetector(name=name, prefix=f"{BL}-DI-DCAM-01:") | ||
``w41`` should also be added to the list of ``ALL_BEAMLINES`` in ``tests/beamlines/test_device_instantiation``. | ||
This test checks that the function returns a type that conforms to Bluesky protocols, | ||
that it always returns the same instance of the device and that the arguments passed | ||
into the Device class constructor are valid. | ||
|
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ side-bar. | |
:maxdepth: 1 | ||
|
||
how-to/run-container | ||
how-to/create-beamline.rst | ||
|
||
+++ | ||
|
||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
from dodal.beamlines.beamline_utils import device_instantiation | ||
from dodal.beamlines.beamline_utils import set_beamline as set_utils_beamline | ||
from dodal.devices.areadetector import AdAravisDetector | ||
from dodal.utils import BeamlinePrefix | ||
from dodal.log import set_beamline as set_log_beamline | ||
from dodal.utils import get_beamline_name | ||
|
||
PREFIX: str = BeamlinePrefix("p38").beamline_prefix | ||
BL = get_beamline_name("p38") | ||
set_log_beamline(BL) | ||
set_utils_beamline(BL) | ||
|
||
|
||
def d11(name: str = "D11") -> AdAravisDetector: | ||
return AdAravisDetector(name=name, prefix=f"{PREFIX}-DI-DCAM-03:") | ||
def d11( | ||
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False | ||
) -> AdAravisDetector: | ||
return device_instantiation( | ||
AdAravisDetector, | ||
"D11", | ||
"-DI-DCAM-03:", | ||
wait_for_connection, | ||
fake_with_ophyd_sim, | ||
) | ||
|
||
|
||
def d12(name: str = "D12") -> AdAravisDetector: | ||
return AdAravisDetector(name=name, prefix=f"{PREFIX}-DI-DCAM-04:") | ||
def d12( | ||
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False | ||
) -> AdAravisDetector: | ||
return device_instantiation( | ||
AdAravisDetector, | ||
"D12", | ||
"-DI-DCAM-04:", | ||
wait_for_connection, | ||
fake_with_ophyd_sim, | ||
) |
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,21 +1,58 @@ | ||
from dodal.beamlines.beamline_utils import device_instantiation | ||
from dodal.beamlines.beamline_utils import set_beamline as set_utils_beamline | ||
from dodal.devices.areadetector import AdAravisDetector | ||
from dodal.devices.p45 import Choppers, TomoStageWithStretchAndSkew | ||
from dodal.utils import BeamlinePrefix | ||
|
||
PREFIX: str = BeamlinePrefix("p45").beamline_prefix | ||
|
||
|
||
def sample(name: str = "sample_stage") -> TomoStageWithStretchAndSkew: | ||
return TomoStageWithStretchAndSkew(name=name, prefix=f"{PREFIX}-MO-STAGE-01:") | ||
|
||
|
||
def choppers(name: str = "chopper") -> Choppers: | ||
return Choppers(name=name, prefix=f"{PREFIX}-MO-CHOP-01:") | ||
|
||
|
||
def det(name: str = "det") -> AdAravisDetector: | ||
return AdAravisDetector(name=name, prefix=f"{PREFIX}-EA-MAP-01:") | ||
|
||
|
||
def diff(name: str = "diff") -> AdAravisDetector: | ||
return AdAravisDetector(name=name, prefix=f"{PREFIX}-EA-DIFF-01:") | ||
from dodal.log import set_beamline as set_log_beamline | ||
from dodal.utils import get_beamline_name | ||
|
||
BL = get_beamline_name("p45") | ||
set_log_beamline(BL) | ||
set_utils_beamline(BL) | ||
|
||
|
||
def sample( | ||
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False | ||
) -> TomoStageWithStretchAndSkew: | ||
return device_instantiation( | ||
TomoStageWithStretchAndSkew, | ||
"sample_stage", | ||
"-MO-STAGE-01:", | ||
wait_for_connection, | ||
fake_with_ophyd_sim, | ||
) | ||
|
||
|
||
def choppers( | ||
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False | ||
) -> Choppers: | ||
return device_instantiation( | ||
Choppers, | ||
"chopper", | ||
"-MO-CHOP-01:", | ||
wait_for_connection, | ||
fake_with_ophyd_sim, | ||
) | ||
|
||
|
||
def det( | ||
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False | ||
) -> AdAravisDetector: | ||
return device_instantiation( | ||
AdAravisDetector, | ||
"det", | ||
"-EA-MAP-01:", | ||
wait_for_connection, | ||
fake_with_ophyd_sim, | ||
) | ||
|
||
|
||
def diff( | ||
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False | ||
) -> AdAravisDetector: | ||
return device_instantiation( | ||
AdAravisDetector, | ||
"diff", | ||
"-EA-DIFF-01:", | ||
wait_for_connection, | ||
fake_with_ophyd_sim, | ||
) |
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
Oops, something went wrong.