Skip to content

Commit c5e26c1

Browse files
committed
[imager] [cytation] image is an np.array
1 parent c9bdf2f commit c5e26c1

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

pylabrobot/plate_reading/biotek_backend.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,14 +1194,11 @@ async def _acquire_image(
11941194
timeout = int(self.cam.ExposureTime.GetValue() / 1000 + 1000) # from example
11951195
image_result = self.cam.GetNextImage(timeout)
11961196
if not image_result.IsIncomplete():
1197-
t0 = time.time()
11981197
processor = PySpin.ImageProcessor()
11991198
processor.SetColorProcessing(color_processing_algorithm)
12001199
image_converted = processor.Convert(image_result, pixel_format)
12011200
image_result.Release()
1202-
logger.debug("[cytation5] acquired image in %d tries", num_tries + 1)
1203-
logger.debug("[cytation5] Convert took %.2f seconds for BS", time.time() - t0)
1204-
return image_converted.GetNDArray().tolist() # type: ignore
1201+
return image_converted.GetNDArray() # type: ignore
12051202
except SpinnakerException as e:
12061203
# the image is not ready yet, try again
12071204
logger.debug("Failed to get image: %s", e)

pylabrobot/plate_reading/imager.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ async def capture(
134134
gain: Gain = "machine-auto",
135135
**backend_kwargs,
136136
) -> ImagingResult:
137+
if not isinstance(exposure_time, (int, float, AutoExposure)):
138+
raise TypeError(f"Invalid exposure time: {exposure_time}")
139+
if not isinstance(focal_height, (int, float)) and focal_height != "machine-auto":
140+
raise TypeError(f"Invalid focal height: {focal_height}")
141+
137142
if isinstance(well, tuple):
138143
row, column = well
139144
else:

pylabrobot/plate_reading/standard.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
from dataclasses import dataclass
33
from typing import Awaitable, Callable, List, Literal, Union
44

5-
Image = List[List[float]]
5+
try:
6+
import numpy.typing as npt
7+
8+
Image = npt.NDArray
9+
except ImportError:
10+
Image = object # type: ignore
611

712

813
class Objective(enum.Enum):

0 commit comments

Comments
 (0)