Skip to content

Commit d71f3d0

Browse files
aliddellandy-sweet
andauthored
Capabilities interface (#113)
- Expose and test Capabilities interface in Python. - Remove a bunch of commented code in camera.rs. *Note*: Storage metadata is unqueryable unless you start the runtime (issue [here](acquire-project/acquire-video-runtime#119)). In the test `test_storage_capabilities`, it was necessary to start the runtime for the test to pass, but that's really pretty terrible and I wouldn't choose to do that. --------- Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
1 parent fd65deb commit d71f3d0

11 files changed

Lines changed: 1464 additions & 193 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ imgui.ini
44
Testing
55
*.zarr
66
*.tif
7+
*.bin
78
*.json
89
Cargo.lock
910

python/acquire/acquire.pyi

Lines changed: 117 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ class Camera:
2525
def __init__(self, *args: None, **kwargs: Any) -> None: ...
2626
def dict(self) -> Dict[str, Any]: ...
2727

28+
@final
29+
class CameraCapabilities:
30+
exposure_time_us: Property
31+
line_interval_us: Property
32+
readout_direction: Property
33+
binning: Property
34+
offset: OffsetShapeCapabilities
35+
shape: OffsetShapeCapabilities
36+
supported_pixel_types: List[SampleType]
37+
digital_lines: DigitalLineCapabilities
38+
triggers: TriggerCapabilities
39+
def dict(self) -> Dict[str, Any]: ...
40+
2841
@final
2942
class CameraProperties:
3043
exposure_time_us: float
@@ -39,6 +52,27 @@ class CameraProperties:
3952
def __init__(self, *args: None, **kwargs: Any) -> None: ...
4053
def dict(self) -> Dict[str, Any]: ...
4154

55+
@final
56+
class Capabilities:
57+
video: Tuple[VideoStreamCapabilities, VideoStreamCapabilities]
58+
def __init__(self, *args: None, **kwargs: Any) -> None: ...
59+
def dict(self) -> Dict[str, Any]: ...
60+
61+
@final
62+
class ChunkDims:
63+
width: int
64+
height: int
65+
planes: int
66+
def dict(self) -> Dict[str, Any]: ...
67+
68+
@final
69+
class ChunkingCapabilities:
70+
is_supported: bool
71+
width: Property
72+
height: Property
73+
planes: Property
74+
def dict(self) -> Dict[str, Any]: ...
75+
4276
@final
4377
class DeviceIdentifier:
4478
id: Tuple[int, int]
@@ -100,6 +134,12 @@ class DeviceState:
100134
def __lt__(self, other: object) -> bool: ...
101135
def __ne__(self, other: object) -> bool: ...
102136

137+
@final
138+
class DigitalLineCapabilities:
139+
line_count: int
140+
names: Tuple[str, str, str, str, str, str, str, str]
141+
def dict(self) -> Dict[str, Any]: ...
142+
103143
@final
104144
class Direction:
105145
Backward: ClassVar[Direction] = Direction.Backward
@@ -119,6 +159,17 @@ class InputTriggers:
119159
frame_start: Trigger
120160
def dict(self) -> Dict[str, Any]: ...
121161

162+
@final
163+
class MultiscaleCapabilities:
164+
is_supported: bool
165+
def dict(self) -> Dict[str, Any]: ...
166+
167+
@final
168+
class OffsetShapeCapabilities:
169+
x: Property
170+
y: Property
171+
def dict(self) -> Dict[str, Any]: ...
172+
122173
@final
123174
class OutputTriggers:
124175
exposure: Trigger
@@ -134,6 +185,29 @@ class PID:
134185
def __init__(self, *args: None, **kwargs: Any) -> None: ...
135186
def dict(self) -> Dict[str, Any]: ...
136187

188+
@final
189+
class Property:
190+
writable: bool
191+
low: float
192+
high: float
193+
kind: PropertyType
194+
def __init__(self, *args: None, **kwargs: Any) -> None: ...
195+
def dict(self) -> Dict[str, Any]: ...
196+
197+
@final
198+
class PropertyType:
199+
FixedPrecision: ClassVar[PropertyType] = PropertyType.FixedPrecision
200+
FloatingPrecision: ClassVar[PropertyType] = PropertyType.FloatingPrecision
201+
Enum: ClassVar[PropertyType] = PropertyType.Enum
202+
String: ClassVar[PropertyType] = PropertyType.String
203+
def __eq__(self, other: object) -> bool: ...
204+
def __ge__(self, other: object) -> bool: ...
205+
def __gt__(self, other: object) -> bool: ...
206+
def __int__(self) -> int: ...
207+
def __le__(self, other: object) -> bool: ...
208+
def __lt__(self, other: object) -> bool: ...
209+
def __ne__(self, other: object) -> bool: ...
210+
137211
@final
138212
class Properties:
139213
video: Tuple[VideoStream, VideoStream]
@@ -146,6 +220,7 @@ class Runtime:
146220
def device_manager(self) -> DeviceManager: ...
147221
def get_available_data(self, stream_id: int) -> AvailableData: ...
148222
def get_configuration(self) -> Properties: ...
223+
def get_capabilities(self) -> Capabilities: ...
149224
def get_state(self) -> DeviceState: ...
150225
def set_configuration(self, properties: Properties) -> Properties: ...
151226
def start(self) -> None: ...
@@ -178,6 +253,21 @@ class SampleType:
178253
def __lt__(self, other: object) -> bool: ...
179254
def __ne__(self, other: object) -> bool: ...
180255

256+
@final
257+
class ShardDims:
258+
width: int
259+
height: int
260+
planes: int
261+
def dict(self) -> Dict[str, Any]: ...
262+
263+
@final
264+
class ShardingCapabilities:
265+
is_supported: bool
266+
width: Property
267+
height: Property
268+
planes: Property
269+
def dict(self) -> Dict[str, Any]: ...
270+
181271
@final
182272
class SignalIOKind:
183273
Input: ClassVar[SignalIOKind] = SignalIOKind.Input
@@ -209,10 +299,10 @@ class Storage:
209299
def dict(self) -> Dict[str, Any]: ...
210300

211301
@final
212-
class ChunkingShardingDims:
213-
width: int
214-
height: int
215-
planes: int
302+
class StorageCapabilities:
303+
chunk_dims_px: ChunkingCapabilities
304+
shard_dims_chunks: ShardingCapabilities
305+
multiscale: MultiscaleCapabilities
216306
def dict(self) -> Dict[str, Any]: ...
217307

218308
@final
@@ -221,8 +311,8 @@ class StorageProperties:
221311
filename: Optional[str]
222312
first_frame_id: int
223313
pixel_scale_um: Tuple[float, float]
224-
chunk_dims_px: ChunkingShardingDims
225-
shard_dims_chunks: ChunkingShardingDims
314+
chunk_dims_px: ChunkDims
315+
shard_dims_chunks: ShardDims
226316
enable_multiscale: bool
227317
def dict(self) -> Dict[str, Any]: ...
228318

@@ -235,6 +325,13 @@ class Trigger:
235325
def __init__(self, *args: None, **kwargs: Any) -> None: ...
236326
def dict(self) -> Dict[str, Any]: ...
237327

328+
@final
329+
class TriggerCapabilities:
330+
acquisition_start: TriggerInputOutputCapabilities
331+
exposure: TriggerInputOutputCapabilities
332+
frame_start: TriggerInputOutputCapabilities
333+
def dict(self) -> Dict[str, Any]: ...
334+
238335
@final
239336
class TriggerEdge:
240337
Falling: ClassVar[TriggerEdge] = TriggerEdge.Falling
@@ -251,6 +348,12 @@ class TriggerEdge:
251348
def __lt__(self, other: object) -> bool: ...
252349
def __ne__(self, other: object) -> bool: ...
253350

351+
@final
352+
class TriggerInputOutputCapabilities:
353+
input: int
354+
output: int
355+
def dict(self) -> Dict[str, Any]: ...
356+
254357
@final
255358
class VideoFrame:
256359
def data(self) -> NDArray[Any]: ...
@@ -276,6 +379,14 @@ class VideoStream:
276379
frame_average_count: int
277380
def dict(self) -> Dict[str, Any]: ...
278381

382+
@final
383+
class VideoStreamCapabilities:
384+
camera: CameraCapabilities
385+
storage: StorageCapabilities
386+
max_frame_count: Property
387+
frame_average_count: Property
388+
def dict(self) -> Dict[str, Any]: ...
389+
279390
@final
280391
class VoltageRange:
281392
mn: float

0 commit comments

Comments
 (0)