Skip to content

Commit

Permalink
Capabilities interface (#113)
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
aliddell and andy-sweet authored Nov 28, 2023
1 parent fd65deb commit d71f3d0
Show file tree
Hide file tree
Showing 11 changed files with 1,464 additions and 193 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ imgui.ini
Testing
*.zarr
*.tif
*.bin
*.json
Cargo.lock

Expand Down
123 changes: 117 additions & 6 deletions python/acquire/acquire.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ class Camera:
def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

@final
class CameraCapabilities:
exposure_time_us: Property
line_interval_us: Property
readout_direction: Property
binning: Property
offset: OffsetShapeCapabilities
shape: OffsetShapeCapabilities
supported_pixel_types: List[SampleType]
digital_lines: DigitalLineCapabilities
triggers: TriggerCapabilities
def dict(self) -> Dict[str, Any]: ...

@final
class CameraProperties:
exposure_time_us: float
Expand All @@ -39,6 +52,27 @@ class CameraProperties:
def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

@final
class Capabilities:
video: Tuple[VideoStreamCapabilities, VideoStreamCapabilities]
def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

@final
class ChunkDims:
width: int
height: int
planes: int
def dict(self) -> Dict[str, Any]: ...

@final
class ChunkingCapabilities:
is_supported: bool
width: Property
height: Property
planes: Property
def dict(self) -> Dict[str, Any]: ...

@final
class DeviceIdentifier:
id: Tuple[int, int]
Expand Down Expand Up @@ -100,6 +134,12 @@ class DeviceState:
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

@final
class DigitalLineCapabilities:
line_count: int
names: Tuple[str, str, str, str, str, str, str, str]
def dict(self) -> Dict[str, Any]: ...

@final
class Direction:
Backward: ClassVar[Direction] = Direction.Backward
Expand All @@ -119,6 +159,17 @@ class InputTriggers:
frame_start: Trigger
def dict(self) -> Dict[str, Any]: ...

@final
class MultiscaleCapabilities:
is_supported: bool
def dict(self) -> Dict[str, Any]: ...

@final
class OffsetShapeCapabilities:
x: Property
y: Property
def dict(self) -> Dict[str, Any]: ...

@final
class OutputTriggers:
exposure: Trigger
Expand All @@ -134,6 +185,29 @@ class PID:
def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

@final
class Property:
writable: bool
low: float
high: float
kind: PropertyType
def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

@final
class PropertyType:
FixedPrecision: ClassVar[PropertyType] = PropertyType.FixedPrecision
FloatingPrecision: ClassVar[PropertyType] = PropertyType.FloatingPrecision
Enum: ClassVar[PropertyType] = PropertyType.Enum
String: ClassVar[PropertyType] = PropertyType.String
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __int__(self) -> int: ...
def __le__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

@final
class Properties:
video: Tuple[VideoStream, VideoStream]
Expand All @@ -146,6 +220,7 @@ class Runtime:
def device_manager(self) -> DeviceManager: ...
def get_available_data(self, stream_id: int) -> AvailableData: ...
def get_configuration(self) -> Properties: ...
def get_capabilities(self) -> Capabilities: ...
def get_state(self) -> DeviceState: ...
def set_configuration(self, properties: Properties) -> Properties: ...
def start(self) -> None: ...
Expand Down Expand Up @@ -178,6 +253,21 @@ class SampleType:
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

@final
class ShardDims:
width: int
height: int
planes: int
def dict(self) -> Dict[str, Any]: ...

@final
class ShardingCapabilities:
is_supported: bool
width: Property
height: Property
planes: Property
def dict(self) -> Dict[str, Any]: ...

@final
class SignalIOKind:
Input: ClassVar[SignalIOKind] = SignalIOKind.Input
Expand Down Expand Up @@ -209,10 +299,10 @@ class Storage:
def dict(self) -> Dict[str, Any]: ...

@final
class ChunkingShardingDims:
width: int
height: int
planes: int
class StorageCapabilities:
chunk_dims_px: ChunkingCapabilities
shard_dims_chunks: ShardingCapabilities
multiscale: MultiscaleCapabilities
def dict(self) -> Dict[str, Any]: ...

@final
Expand All @@ -221,8 +311,8 @@ class StorageProperties:
filename: Optional[str]
first_frame_id: int
pixel_scale_um: Tuple[float, float]
chunk_dims_px: ChunkingShardingDims
shard_dims_chunks: ChunkingShardingDims
chunk_dims_px: ChunkDims
shard_dims_chunks: ShardDims
enable_multiscale: bool
def dict(self) -> Dict[str, Any]: ...

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

@final
class TriggerCapabilities:
acquisition_start: TriggerInputOutputCapabilities
exposure: TriggerInputOutputCapabilities
frame_start: TriggerInputOutputCapabilities
def dict(self) -> Dict[str, Any]: ...

@final
class TriggerEdge:
Falling: ClassVar[TriggerEdge] = TriggerEdge.Falling
Expand All @@ -251,6 +348,12 @@ class TriggerEdge:
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

@final
class TriggerInputOutputCapabilities:
input: int
output: int
def dict(self) -> Dict[str, Any]: ...

@final
class VideoFrame:
def data(self) -> NDArray[Any]: ...
Expand All @@ -276,6 +379,14 @@ class VideoStream:
frame_average_count: int
def dict(self) -> Dict[str, Any]: ...

@final
class VideoStreamCapabilities:
camera: CameraCapabilities
storage: StorageCapabilities
max_frame_count: Property
frame_average_count: Property
def dict(self) -> Dict[str, Any]: ...

@final
class VoltageRange:
mn: float
Expand Down
Loading

0 comments on commit d71f3d0

Please sign in to comment.