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

Eiger exts logic #54

Merged
merged 33 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3811a5f
Merge eiger changes from tickit/Exts-Logic
abbiemery Jun 15, 2023
3029c7b
Add test to flag missing __init__.py files in tickit directory
abbiemery Jun 16, 2023
5fe979d
Adapt to WIP Http Adapter PR
callumforrester Jul 3, 2023
c870cfb
Fix tests
callumforrester Jul 3, 2023
c67db3e
Begin removing private calls from tests
callumforrester Jul 3, 2023
0a8402e
Remove unused test
callumforrester Jul 3, 2023
f4ad5fd
Add logging to eiger trigger
callumforrester Jul 4, 2023
4a5dd9e
Add eiger launch config
callumforrester Jul 5, 2023
495ff65
Fix eiger adapter logging
callumforrester Jul 5, 2023
df7982b
Ensure interrupts in correct place
callumforrester Jul 5, 2023
b9b2e0b
Rationalise stream messages into a schema
callumforrester Jul 6, 2023
b8925fc
Move serailization logic out of stream and into adapter
callumforrester Jul 7, 2023
5238996
Complete eiger tests
callumforrester Jul 7, 2023
3453611
Restructure to remove multiple inheritance
callumforrester Jul 7, 2023
04cb9ed
Add multi series tests
callumforrester Jul 7, 2023
2de99c3
Add exts mode support
callumforrester Jul 7, 2023
353b006
Enable system tests
callumforrester Jul 7, 2023
ce40080
Remove inspector class
callumforrester Jul 7, 2023
e186dc4
Tidy up eiger system test
callumforrester Jul 13, 2023
ac4ea9a
Tidy eiger docstrings
callumforrester Jul 13, 2023
19a6bff
Add timeouts to eiger system tests
callumforrester Jul 13, 2023
ab2f095
Move rest logic out of eiger device
callumforrester Jul 13, 2023
298fea0
Fix imports and formatting
callumforrester Jul 13, 2023
0617352
Fix mock stream mypy errors
callumforrester Jul 13, 2023
e24721c
Depend on latest tickit again
callumforrester Jul 14, 2023
65f7cec
Fix synchrotron making IOC with args in the wrong order
callumforrester Jul 14, 2023
339b315
Delete package structure test
callumforrester Jul 14, 2023
dcd9c04
Add docstrings to eiger schema docs
callumforrester Jul 14, 2023
0556f65
Add docstrings to stream
callumforrester Jul 14, 2023
d42ea93
Require pydantic v2
callumforrester Jul 21, 2023
32d06b4
Delete commented out types
callumforrester Jul 21, 2023
e2dd2e8
Include apischema dependency
callumforrester Jul 24, 2023
dcde894
Pin tickit version
callumforrester Jul 24, 2023
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
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Eiger",
"type": "python",
"request": "launch",
"module": "tickit",
"justMyCode": false,
"console": "integratedTerminal",
"args": [
"all",
"examples/configs/eiger/eiger.yaml"
]
},
{
"name": "Debug Unit Test",
"type": "python",
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ classifiers = [
]
description = "Devices for tickit, an event-based device simulation framework"
dependencies = [
"tickit<0.2.3",
"tickit==0.2.3",
"typing_extensions",
"softioc",
"pydantic>1",
"apischema"
]
dynamic = ["version"]
license.file = "LICENSE"
Expand Down
2 changes: 1 addition & 1 deletion src/tickit_devices/eiger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ def __call__(self) -> Component: # noqa: D102
device=EigerDevice(),
adapters=[
EigerRESTAdapter(host=self.host, port=self.port),
EigerZMQAdapter(zmq_host=self.zmq_host, zmq_port=self.zmq_port),
EigerZMQAdapter(host=self.zmq_host, port=self.zmq_port),
],
)
11 changes: 5 additions & 6 deletions src/tickit_devices/eiger/data/dummy_image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dataclasses import dataclass
from pathlib import Path
from typing import List
from typing import List, Tuple


@dataclass
Expand All @@ -12,9 +11,10 @@ class Image:
dtype: str
data: bytes
encoding: str
shape: Tuple[int, int]

@classmethod
def create_dummy_image(cls, index: int) -> "Image":
def create_dummy_image(cls, index: int, shape: Tuple[int, int]) -> "Image":
"""Returns an Image object wrapping the dummy blob using the metadata provided.

Args:
Expand All @@ -27,7 +27,7 @@ def create_dummy_image(cls, index: int) -> "Image":
hsh = str(hash(data))
dtype = "uint16"
encoding = "bs16-lz4<"
return Image(index, hsh, dtype, data, encoding)
return Image(index, hsh, dtype, data, encoding, shape)


_DUMMY_IMAGE_BLOBS: List[bytes] = []
Expand All @@ -44,8 +44,7 @@ def dummy_image_blob() -> bytes:
"""
if not _DUMMY_IMAGE_BLOBS:
with open(
Path(Path(__file__).parent.parent, "resources", "frame_sample"),
"rb",
"src/tickit_devices/eiger/resources/frame_sample", "rb"
) as frame_file:
_DUMMY_IMAGE_BLOBS.append(frame_file.read())
return _DUMMY_IMAGE_BLOBS[0]
73 changes: 73 additions & 0 deletions src/tickit_devices/eiger/data/schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
from typing import Any, Dict, Iterable, Tuple, Union

from pydantic.v1 import BaseModel
from zmq import Frame

Json = Dict[str, Any]
Sendable = Union[bytes, Frame, memoryview]
MultipartMessage = Iterable[Sendable]

DEFAULT_HEADER_TYPE = "dheader-1.0"


class AcquisitionSeriesHeader(BaseModel):
"""Sent before a series of images (and associated headers)."""

header_detail: str
series: int
htype: str = DEFAULT_HEADER_TYPE


class AcquisitionSeriesFooter(BaseModel):
"""Sent at the end of a series of images (and associated headers)."""

series: int
htype: str = "dseries_end-1.0"


class AcquisitionDetailsHeader(BaseModel):
"""Describes an additional dataset sent at the beginning of a series.

Used when header_detail is set to all in AcquisitionSeriesHeader.
"""

htype: str = DEFAULT_HEADER_TYPE
shape: Tuple[int, int]
type: str


class ImageHeader(BaseModel):
"""Sent before a detector image blob.

Metadata about the acquisition operation.
"""

frame: int
hash: str
series: int
htype: str = "dimage-1.0"


class ImageCharacteristicsHeader(BaseModel):
"""Sent before a detector image blob.

Metadata about the image.
"""

encoding: str
shape: Tuple[int, int]
size: int
type: str
htype: str = "dimage_d-1.0"


class ImageConfigHeader(BaseModel):
"""Sent before a detector image blob.

Describes the metrics on the image acquisition.
"""

real_time: float
start_time: float
stop_time: float
htype: str = "dconfig-1.0"
Loading