Skip to content

Commit a026e74

Browse files
committed
XimeaCamera._fetch_data: limit scope of try/except block.
There is only handling of a timeout exception which only happens during xiapi.Camera.get_image, so limit the try/except block to that statement.
1 parent 877c7b5 commit a026e74

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

microscope/cameras/ximea.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,21 @@ def _fetch_data(self):
5353

5454
try:
5555
self._handle.get_image(self.img)
56-
data = self.img.get_image_data_numpy()
57-
_logger.info("Fetched imaged with dims %s and size %s.",
58-
data.shape, data.size)
59-
_logger.info('Sending image')
60-
if trigger_type == 'XI_TRG_SOFTWARE':
61-
self._triggered = False
62-
return data
6356
except Exception as err:
6457
if getattr(err, 'status', None) == 10:
6558
# This is a Timeout error
6659
return
6760
else:
6861
raise err
6962

63+
data = self.img.get_image_data_numpy()
64+
_logger.info("Fetched imaged with dims %s and size %s.",
65+
data.shape, data.size)
66+
_logger.info('Sending image')
67+
if trigger_type == 'XI_TRG_SOFTWARE':
68+
self._triggered = False
69+
return data
70+
7071
def abort(self):
7172
_logger.info('Disabling acquisition.')
7273
if self._acquiring:

0 commit comments

Comments
 (0)