Catch timeout errors when closing camera stream
This commit is contained in:
parent
aa57331ce9
commit
ca051243a1
1 changed files with 12 additions and 6 deletions
|
|
@ -71,9 +71,15 @@ class Microscope:
|
||||||
"""Shut down the microscope hardware."""
|
"""Shut down the microscope hardware."""
|
||||||
logging.info("Closing {}".format(self))
|
logging.info("Closing {}".format(self))
|
||||||
if self.camera:
|
if self.camera:
|
||||||
self.camera.close()
|
try:
|
||||||
|
self.camera.close()
|
||||||
|
except TimeoutError as e:
|
||||||
|
logging.error(e)
|
||||||
if self.stage:
|
if self.stage:
|
||||||
self.stage.close()
|
try:
|
||||||
|
self.stage.close()
|
||||||
|
except TimeoutError as e:
|
||||||
|
logging.error(e)
|
||||||
self.captures.close()
|
self.captures.close()
|
||||||
logging.info("Closed {}".format(self))
|
logging.info("Closed {}".format(self))
|
||||||
|
|
||||||
|
|
@ -291,7 +297,7 @@ class Microscope:
|
||||||
fmt: str = "jpeg",
|
fmt: str = "jpeg",
|
||||||
annotations: dict = None,
|
annotations: dict = None,
|
||||||
tags: list = None,
|
tags: list = None,
|
||||||
metadata: dict = None
|
metadata: dict = None,
|
||||||
):
|
):
|
||||||
if not annotations:
|
if not annotations:
|
||||||
annotations = {}
|
annotations = {}
|
||||||
|
|
@ -299,7 +305,7 @@ class Microscope:
|
||||||
metadata = {}
|
metadata = {}
|
||||||
if not tags:
|
if not tags:
|
||||||
tags = []
|
tags = []
|
||||||
|
|
||||||
with self.camera.lock:
|
with self.camera.lock:
|
||||||
# Create output object
|
# Create output object
|
||||||
output = self.captures.new_image(
|
output = self.captures.new_image(
|
||||||
|
|
@ -312,7 +318,7 @@ class Microscope:
|
||||||
use_video_port=use_video_port,
|
use_video_port=use_video_port,
|
||||||
resize=resize,
|
resize=resize,
|
||||||
bayer=bayer,
|
bayer=bayer,
|
||||||
fmt=fmt
|
fmt=fmt,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Inject system metadata
|
# Inject system metadata
|
||||||
|
|
@ -324,4 +330,4 @@ class Microscope:
|
||||||
# Insert custom tags
|
# Insert custom tags
|
||||||
output.put_tags(tags)
|
output.put_tags(tags)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue