Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

131 make a simulated detector that can write hdf files #144

Merged
merged 59 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
028ef5f
add the sim module
stan-dot Mar 6, 2024
0617b1c
day progress
stan-dot Mar 6, 2024
adf185c
more exploration
stan-dot Mar 7, 2024
9d91cad
day's work
stan-dot Mar 7, 2024
cd15eaa
incremental changes
stan-dot Mar 8, 2024
abe237d
an attempt to put features together
stan-dot Mar 11, 2024
380283c
incremental changes
stan-dot Mar 11, 2024
93ef7b4
try SimSample
stan-dot Mar 11, 2024
c905758
make pattern generator do sensible things
stan-dot Mar 11, 2024
dbb09dd
make lint happy
stan-dot Mar 11, 2024
ac07085
attempt at tests
stan-dot Mar 11, 2024
d2585cf
WIP setting up pytest with fake paths
stan-dot Mar 12, 2024
989f9d4
write more test outlines
stan-dot Mar 12, 2024
acb3cdd
work on tests
stan-dot Mar 12, 2024
c7afde5
WIP fix async tests
stan-dot Mar 14, 2024
f290b9f
WIP make the tests work better
stan-dot Mar 14, 2024
5aa3763
raw refactor
stan-dot Mar 14, 2024
fb732e5
refactoring proof of concept
stan-dot Mar 15, 2024
f99b247
delete refactoring attempts
stan-dot Mar 15, 2024
97cb5f9
tests improvement
stan-dot Mar 15, 2024
8968c7d
add basic streaming plan
stan-dot Mar 15, 2024
9cc68bf
rename to sim driver
stan-dot Mar 15, 2024
fbe0a4b
change into SimDriver
stan-dot Mar 15, 2024
3ff67c4
fix formatting
stan-dot Mar 15, 2024
9236d93
work on the tests
stan-dot Mar 19, 2024
85528c4
correct 19 out of 32 errors
stan-dot Mar 19, 2024
7ebb832
down to 10 errors
stan-dot Mar 19, 2024
fc2c05b
down to 4 errors, all due to observe_value decision and the NDfileHDF
stan-dot Mar 19, 2024
45d99b4
swmr error
stan-dot Mar 20, 2024
e1bbab0
fix lint
stan-dot Mar 20, 2024
ad47d46
setup for asyncio
stan-dot Mar 20, 2024
ab9efde
still error with async
stan-dot Mar 20, 2024
f8af0dd
closing writer and file handle issue
stan-dot Mar 22, 2024
bf89749
move back to pattern generator
stan-dot Mar 22, 2024
597e308
got to descriptor validation error
stan-dot Mar 22, 2024
aafb5f1
async setup for all IO failed
stan-dot Mar 22, 2024
6cba58b
fix writer descriptor test. also component not found async error
stan-dot Mar 22, 2024
f04a9b2
fix the test
stan-dot Mar 25, 2024
9b98f9c
pass all tests
stan-dot Mar 25, 2024
adc5158
ran black
stan-dot Mar 25, 2024
a436ad7
make lint happy
stan-dot Mar 25, 2024
2e2b11c
missed one
stan-dot Mar 25, 2024
ab93157
make mypy happy
stan-dot Mar 25, 2024
e6d63c7
fix black
stan-dot Mar 25, 2024
2bf84a0
add declare to the failing plan
stan-dot Apr 2, 2024
f1113fa
update pyproject for wrong pyside6
stan-dot Apr 3, 2024
727e47e
fix the flyer test
stan-dot Apr 3, 2024
0da67c8
delete mistaken test file
stan-dot Apr 3, 2024
67cf855
rollback some unintended changes
stan-dot Apr 3, 2024
713ce0b
make lint happy
stan-dot Apr 3, 2024
f396112
delete sim sample to lower the test lines
stan-dot Apr 3, 2024
686d0c6
delete empty test
stan-dot Apr 3, 2024
0a6a6b1
mistake double test
stan-dot Apr 3, 2024
8f35e38
day work (not done yet)
stan-dot Apr 4, 2024
c3d5beb
add snake case@
stan-dot Apr 4, 2024
d04c5dd
Merge branch 'main' into 131-make-a-simulated-detector-that-can-write…
stan-dot Apr 4, 2024
107a825
Merge branch 'main' into 131-make-a-simulated-detector-that-can-write…
stan-dot Apr 15, 2024
8ecc12c
lock pyside6 to 6.6.2 to fix the svg indent issue in upstream
stan-dot Apr 15, 2024
0958fab
pyproject syntax error fix
stan-dot Apr 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 41 additions & 44 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,44 @@
// 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"
"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}"
},
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
// "settings": {
// "python.defaultInterpreterPath": "/venv/bin/python"
// },
// 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"
}
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ dev = [
"pre-commit",
"pydata-sphinx-theme>=0.12",
"pyepics>=3.4.2",
"pyside6",
"pyside6-stubs",
"pyside6==6.6.2",
"pytest",
"pytest-asyncio",
"pytest-cov",
Expand Down
7 changes: 6 additions & 1 deletion src/ophyd_async/epics/areadetector/writers/hdf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,17 @@ async def collect_stream_docs(
await self.hdf.flush_now.set(True)
if indices_written:
if not self._file:
path = Path(await self.hdf.full_file_name.get_value())
self._file = _HDFFile(
self._directory_provider(),
# See https://github.com/bluesky/ophyd-async/issues/122
Path(await self.hdf.full_file_name.get_value()),
path,
self._datasets,
)
# stream resource says "here is a dataset",
# stream datum says "here are N frames in that stream resource",
# you get one stream resource and many stream datums per scan

for doc in self._file.stream_resources():
yield "stream_resource", doc
for doc in self._file.stream_data(indices_written):
Expand Down
11 changes: 11 additions & 0 deletions src/ophyd_async/sim/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from .pattern_generator import PatternGenerator
from .sim_pattern_detector_control import SimPatternDetectorControl
from .sim_pattern_detector_writer import SimPatternDetectorWriter
from .sim_pattern_generator import SimPatternDetector

__all__ = [
"PatternGenerator",
"SimPatternDetectorControl",
"SimPatternDetectorWriter",
"SimPatternDetector",
]
Loading
Loading