Skip to content

Commit

Permalink
added doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
Relm-Arrowny committed Jan 22, 2025
1 parent e5ef133 commit b1f5686
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters",
"charliermarsh.ruff",
"ms-azuretools.vscode-docker"
"ms-azuretools.vscode-docker",
"streetsidesoftware.code-spell-checker"
]
}
},
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The devcontainer should use the developer target and run as root with podman
# or docker with user namespaces.
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION} as developer
FROM python:${PYTHON_VERSION} AS developer

# Add any system dependencies for the developer/build environment here
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -13,13 +13,13 @@ RUN python -m venv /venv
ENV PATH=/venv/bin:$PATH

# The build stage installs the context into the venv
FROM developer as build
FROM developer AS build
COPY . /context
WORKDIR /context
RUN touch dev-requirements.txt && pip install -c dev-requirements.txt .

# The runtime stage copies the built venv into a slim runtime container
FROM python:${PYTHON_VERSION}-slim as runtime
FROM python:${PYTHON_VERSION}-slim AS runtime
# Add apt-get system dependecies for runtime here if needed
COPY --from=build /venv/ /venv/
ENV PATH=/venv/bin:$PATH
Expand Down
18 changes: 12 additions & 6 deletions src/i10_bluesky/plans/centre_direct_beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
def centre_tth(
det: StandardReadable = RASOR_DEFAULT_DET,
det_name: str = RASOR_DEFAULT_DET_NAME_EXTENSION,
start=-1,
end=1,
num=21,
start: float = -1,
end: float = 1,
num: int = 21,
):
"""Centre two theta using Rasor dector."""

yield from step_scan_and_move_cen(
det=det,
motor=diffractometer().tth,
Expand All @@ -37,10 +39,11 @@ def centre_tth(
def centre_alpha(
det: StandardReadable = RASOR_DEFAULT_DET,
det_name: str = RASOR_DEFAULT_DET_NAME_EXTENSION,
start=-0.8,
end=0.8,
num=21,
start: float = -0.8,
end: float = 0.8,
num: int = 21,
):
"""Centre rasor alpha using Rasor dector."""
yield from step_scan_and_move_cen(
det=det,
motor=diffractometer().alpha,
Expand All @@ -57,11 +60,14 @@ def centre_det_angles(
det: StandardReadable = RASOR_DEFAULT_DET,
det_name: str = RASOR_DEFAULT_DET_NAME_EXTENSION,
):
"""Centre both two theta and alpha angle on Rasor"""
yield from centre_tth(det, det_name)
yield from centre_alpha(det, det_name)


def move_pin_origin(wait: bool = True, group: Hashable | None = None) -> MsgGenerator:
"""Move the point to the centre of rotation."""

if wait and group is None:
group = "move_pin_origin"
yield from bps.abs_set(simple_stage().x, 0, wait=False, group=group)
Expand Down
4 changes: 4 additions & 0 deletions src/i10_bluesky/plans/configuration/default_setting.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Storing i10 default value for verious devices.
"""

from dodal.beamlines.i10 import rasor_femto_pa_scaler_det

RASOR_DEFAULT_DET = rasor_femto_pa_scaler_det()
Expand Down
57 changes: 57 additions & 0 deletions src/i10_bluesky/plans/open_beam_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
def open_s5s6(
size: float = S5S6_OPENING_SIZE, wait: bool = True, group: Hashable | None = None
) -> MsgGenerator:
"""Open up clean up slits s5 and s6.
Parameters
----------
size: float
The size of their opening both x and y will set to the same value.
wait: bool
If this is true it will set both slits to move and wait until it get to position
.
group: Hashable
If given this will be the group name that pass along to bluesky, which
can be use at a later time.
"""

if wait and group is None:
group = f"{slits().name}__wait"
yield from set_slit_size(slits().s5, size, wait=False, group=group)
Expand All @@ -30,6 +44,18 @@ def open_dsd_dsu(
wait: bool = True,
group: Hashable | None = None,
) -> MsgGenerator:
"""Remove both detector slits
Parameters
----------
open_position: float
The position of the opening.
wait: bool
If this is true it will wait until all motions are done.
group: Hashable
If given this will be the group name that pass along to bluesky, which
can be use at a later time.
"""

if wait and group is None:
group = f"{det_slits().name}_wait"
LOGGER.info("Opening Dsd and dsu, very slow motor may take minutes.")
Expand All @@ -45,6 +71,17 @@ def remove_pin_hole(
wait: bool = True,
group: Hashable | None = None,
) -> MsgGenerator:
"""Move pin hole out of the way of the pin
Parameters
----------
open_position: float
The position of the opening.
wait: bool
If this is true it will wait until all motions are done.
group: Hashable
If given this will be the group name that pass along to bluesky, which
can be use at a later time.
"""
if wait and group is None:
group = f"{pin_hole().name}_wait"
LOGGER.info("Removing pin hole.")
Expand All @@ -55,6 +92,16 @@ def remove_pin_hole(


def direct_beam_polan(wait: bool = True, group: Hashable | None = None) -> MsgGenerator:
"""
Move polarization analyzer out of the way of the beam.
Parameters
----------
wait: bool
If this is true it will wait until all motions are done.
group: Hashable
If given this will be the group name that pass along to bluesky, which
can be use at a later time.
"""
if wait and group is None:
group = f"{pa_stage().name}_wait"
LOGGER.info(f"Removing {pa_stage().name}.")
Expand All @@ -68,6 +115,16 @@ def direct_beam_polan(wait: bool = True, group: Hashable | None = None) -> MsgGe


def clear_beam_path(wait: bool = True, group: Hashable | None = None) -> MsgGenerator:
"""Move everything out of the way of the direct beam
Parameters
----------
wait: bool
If this is true it will wait until all motions are done.
group: Hashable
If given this will be the group name that pass along to bluesky, which
can be use at a later time.
"""
if group is None:
group = "clear_beam_path"
yield from open_s5s6(wait=False, group=group)
Expand Down
17 changes: 17 additions & 0 deletions src/i10_bluesky/plans/utils/motions.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ def set_slit_size(
wait: bool = True,
group: Hashable | None = None,
) -> MsgGenerator:
"""Set opening of an x-y slit.
Parameters
----------
xy_slit: Slits
A slits device.
x_size: float
The x opening size.
y_size: float
The y opening size.
wait: bool
If this is true it will wait for all motions to finish.
group: Hashable
If given this will be the group name that pass along to bluesky, which
can be use at a later time.
"""

if wait and group is None:
group = f"{xy_slit.name}_wait"
if y_size is None:
Expand Down

0 comments on commit b1f5686

Please sign in to comment.