-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Most merge conflicts were due to naming issues, i.e. ophyd-epics-devices vs ophyd-async, and file locations
- Loading branch information
Showing
30 changed files
with
2,418 additions
and
90 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 @@ | ||
# This file is for use as a devcontainer and a runtime container | ||
# | ||
# The devcontainer should use the build target and run as root with podman | ||
# or docker with user namespaces. | ||
# | ||
FROM python:3.8 as build | ||
|
||
ARG PIP_OPTIONS | ||
|
||
# Add any system dependencies for the developer/build environment here e.g. | ||
# RUN apt-get update && apt-get upgrade -y && \ | ||
# apt-get install -y --no-install-recommends \ | ||
# desired-packages \ | ||
# && rm -rf /var/lib/apt/lists/* | ||
|
||
# set up a virtual environment and put it in PATH | ||
RUN python -m venv /venv | ||
ENV PATH=/venv/bin:$PATH | ||
|
||
# Copy any required context for the pip install over | ||
COPY . /context | ||
WORKDIR /context | ||
|
||
# install python package into /venv | ||
RUN pip install ${PIP_OPTIONS} | ||
|
||
FROM python:3.8-slim as runtime | ||
|
||
# Add apt-get system dependecies for runtime here if needed | ||
|
||
# copy the virtual environment from the build stage and put it in PATH | ||
COPY --from=build /venv/ /venv/ | ||
ENV PATH=/venv/bin:$PATH | ||
|
||
# change this entrypoint if it is not the same as the repo | ||
ENTRYPOINT ["python", "-m", "ophyd_epics_devices"] | ||
CMD ["--version"] |
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,47 @@ | ||
// For format details, see https://containers.dev/implementors/json_reference/ | ||
{ | ||
"name": "Python 3 Developer Container", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"target": "build", | ||
// Only upgrade pip, we will install the project below | ||
"args": { | ||
"PIP_OPTIONS": "--upgrade pip" | ||
}, | ||
}, | ||
"remoteEnv": { | ||
"DISPLAY": "${localEnv:DISPLAY}" | ||
}, | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"python.defaultInterpreterPath": "/venv/bin/python" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-python.python", | ||
"tamasfe.even-better-toml", | ||
"redhat.vscode-yaml", | ||
"ryanluker.vscode-coverage-gutters" | ||
] | ||
} | ||
}, | ||
// Make sure the files we are mapping into the container exist on the host | ||
"initializeCommand": "bash -c 'for i in $HOME/.inputrc; do [ -f $i ] || touch $i; done'", | ||
"runArgs": [ | ||
"--net=host", | ||
"--security-opt=label=type:container_runtime_t" | ||
], | ||
"mounts": [ | ||
"source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind", | ||
"source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind", | ||
// map in home directory - not strictly necessary but useful | ||
"source=${localEnv:HOME},target=${localEnv:HOME},type=bind,consistency=cached" | ||
], | ||
// make the workspace folder the same inside and outside of the container | ||
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind", | ||
"workspaceFolder": "${localWorkspaceFolder}", | ||
// After the container is created, install the python project in editable form | ||
"postCreateCommand": "pip install -e .[dev] --config-settings editable_mode=compat" | ||
} |
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
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,45 @@ | ||
import bluesky.plan_stubs as bps | ||
import bluesky.plans as bp # noqa | ||
import bluesky.preprocessors as bpp | ||
|
||
# Import bluesky and ophyd | ||
import matplotlib.pyplot as plt | ||
from bluesky import RunEngine | ||
from bluesky.callbacks.best_effort import BestEffortCallback | ||
from bluesky.utils import ProgressBarManager, register_transform | ||
from ophyd.v2.core import DeviceCollector | ||
|
||
from ophyd_async.devices import areadetector | ||
|
||
# Create a run engine, with plotting, progressbar and transform | ||
RE = RunEngine({}, call_returns_result=True) | ||
bec = BestEffortCallback() | ||
RE.subscribe(bec) | ||
RE.waiting_hook = ProgressBarManager() | ||
plt.ion() | ||
register_transform("RE", prefix="<") | ||
|
||
# Start IOC with demo pvs in subprocess | ||
pv_prefix = "pc0105-AD-SIM-01:" | ||
|
||
|
||
# Create v2 devices | ||
with DeviceCollector(): | ||
det1 = areadetector.MySingleTriggerSim(pv_prefix) | ||
det2 = areadetector.MyHDFWritingSim(pv_prefix) | ||
det3 = areadetector.MyHDFFlyerSim(pv_prefix) | ||
|
||
|
||
# And a plan | ||
@bpp.run_decorator() | ||
@bpp.stage_decorator([det3]) | ||
def fly_det3(num: int): | ||
yield from bps.mov(det3.drv.num_images, num) | ||
yield from bps.kickoff(det3, wait=True) | ||
status = yield from bps.complete(det3, wait=False, group="complete") | ||
while status and not status.done: | ||
yield from bps.collect(det3, stream=True, return_payload=False) | ||
yield from bps.sleep(0.1) | ||
yield from bps.wait(group="complete") | ||
# One last one | ||
yield from bps.collect(det3, stream=True, return_payload=False) |
Oops, something went wrong.