Skip to content

Commit 47e2d09

Browse files
committed
Use new get_bytes method to read full content
Add numpy and pillow to dependencies
1 parent f2a4b69 commit 47e2d09

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ classifiers = [
1212
]
1313
description = "Develop a FastCS application to introspect an Eiger detector and odin-data processes"
1414
dependencies = [
15-
"fastcs @ git+https://github.com/DiamondLightSource/FastCS.git@HTTP"
15+
"fastcs @ git+https://github.com/DiamondLightSource/FastCS.git@HTTP",
16+
"numpy",
17+
"pillow",
1618
] # Add project dependencies here, e.g. ["click", "numpy"]
1719
dynamic = ["version"]
1820
license.file = "LICENSE"

src/eiger_fastcs/eiger_controller.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from io import BytesIO
44
from typing import Any, Coroutine, Type
55

6+
import numpy as np
67
from attr import Attribute
78
from fastcs.attributes import AttrR, AttrRW, AttrW
89
from fastcs.connections import HTTPConnection, IPConnectionSettings
@@ -325,12 +326,14 @@ async def handle_monitor(self):
325326
Done until a no new images are available to be viewed.
326327
"""
327328
# collects images from the detector until there is no image.
328-
image_byte = await self.connection.get("monitor/api/1.8.0/images/next")
329-
if image_byte.status != 200:
329+
response, image_bytes = await self.connection.get_bytes(
330+
"monitor/api/1.8.0/images/next"
331+
)
332+
if response.status != 200:
330333
print("No Image")
331334
return
332335
else:
333-
image = Image.open(BytesIO(image_byte))
336+
image = Image.open(BytesIO(image_bytes))
334337

335338
# Extract basic metadata of image
336339
image_size = image.size
@@ -354,3 +357,5 @@ async def handle_monitor(self):
354357
"frames": frames_in_image,
355358
"depth": bit_depth,
356359
}
360+
361+
print(np.array(image))

0 commit comments

Comments
 (0)