This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #855 from DiamondLightSource/834_separate_setup_fr…
…om_rotation_scan 834 separate setup from rotation scan
- Loading branch information
Showing
10 changed files
with
266 additions
and
137 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,63 @@ | ||
from __future__ import annotations | ||
|
||
import bluesky.plan_stubs as bps | ||
from dodal.devices.attenuator import Attenuator | ||
from dodal.devices.backlight import Backlight | ||
from dodal.devices.detector_motion import DetectorMotion | ||
from dodal.devices.smargon import Smargon | ||
|
||
from artemis.log import LOGGER | ||
|
||
LOWER_DETECTOR_SHUTTER_AFTER_SCAN = True | ||
|
||
|
||
def setup_sample_environment( | ||
detector_motion: DetectorMotion, | ||
backlight: Backlight, | ||
attenuator: Attenuator, | ||
transmission_fraction: float, | ||
detector_distance: float, | ||
group="setup_senv", | ||
): | ||
"""Move out the backlight, retract the detector shutter, and set the attenuator to | ||
transmission.""" | ||
|
||
yield from bps.abs_set(detector_motion.shutter, 1, group=group) | ||
yield from bps.abs_set(detector_motion.z, detector_distance, group=group) | ||
yield from bps.abs_set(backlight.pos, backlight.OUT, group=group) | ||
yield from bps.abs_set(attenuator, transmission_fraction, group=group) | ||
|
||
|
||
def cleanup_sample_environment( | ||
detector_motion: DetectorMotion, | ||
group="cleanup_senv", | ||
): | ||
"""Put the detector shutter back down""" | ||
|
||
yield from bps.abs_set( | ||
detector_motion.shutter, | ||
int(not LOWER_DETECTOR_SHUTTER_AFTER_SCAN), | ||
group=group, | ||
) | ||
|
||
|
||
def move_x_y_z( | ||
smargon: Smargon, | ||
x: float | None = None, | ||
y: float | None = None, | ||
z: float | None = None, | ||
wait=False, | ||
group="move_x_y_z", | ||
): | ||
"""Move the x, y, and z axes of the given smargon to the specified position. All | ||
axes are optional.""" | ||
|
||
LOGGER.info(f"Moving smargon to x, y, z: {(x,y,z)}") | ||
if x: | ||
yield from bps.abs_set(smargon.x, x, group=group) | ||
if y: | ||
yield from bps.abs_set(smargon.y, y, group=group) | ||
if z: | ||
yield from bps.abs_set(smargon.z, z, group=group) | ||
if wait: | ||
yield from bps.wait(group) |
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
Oops, something went wrong.