Skip to content

Commit

Permalink
XimeaCamera._fetch_data (fixup 9fe1030)
Browse files Browse the repository at this point in the history
Fix two issues introduced when removing code duplication:

1. When doing software trigger return None if we are acquiring but
have not triggered yet otherwise it falls through to the error about
unknown trigger type.  This partially fixes issue python-microscope#131.

2. return the acquire data when doing non-software trigger (fix
indentation level of the return data statement)
  • Loading branch information
carandraug committed Jan 7, 2020
1 parent d936aa9 commit 9738638
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions microscope/cameras/ximea.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ def _fetch_data(self):
return

trigger_type = self._handle.get_trigger_source()
if trigger_type == 'XI_TRG_SOFTWARE' and not self._triggered:
return
if trigger_type == 'XI_TRG_SOFTWARE':
if not self._triggered:
return
# else, continue to fetch an image
elif trigger_type != 'XI_TRG_EDGE_RISING':
raise Exception('unhandled trigger type %s' % trigger_type)

Expand All @@ -57,7 +59,7 @@ def _fetch_data(self):
_logger.info('Sending image')
if trigger_type == 'XI_TRG_SOFTWARE':
self._triggered = False
return self.img.get_image_data_numpy()
return self.img.get_image_data_numpy()
except Exception as err:
if getattr(err, 'status', None) == 10:
# This is a Timeout error
Expand Down

0 comments on commit 9738638

Please sign in to comment.