Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions labscript_devices/AndorSolis/blacs_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self):
from .andor_sdk.andor_utils import AndorCam
self.camera = AndorCam()
self.attributes = self.camera.default_acquisition_attrs
self.exception_on_failed_shot = True

def set_attributes(self, attr_dict):
self.attributes.update(attr_dict)
Expand Down
3 changes: 2 additions & 1 deletion labscript_devices/FlyCapture2Camera/blacs_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def __init__(self, serial_number):
self.pixel_formats = IntEnum('pixel_formats',fmts)

self._abort_acquisition = False

self.exception_on_failed_shot = True

# check if GigE camera. If so, ensure max packet size is used
cam_info = self.camera.getCameraInfo()
if cam_info.interfaceType == PyCapture2.INTERFACE_TYPE.GIGE:
Expand Down
16 changes: 14 additions & 2 deletions labscript_devices/IMAQdxCamera/blacs_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class MockCamera(object):
def __init__(self):
print("Starting device worker as a mock device")
self.attributes = {}
self.exception_on_failed_shot = True

def set_attributes(self, attributes):
self.attributes.update(attributes)
Expand Down Expand Up @@ -139,6 +140,7 @@ def __init__(self, serial_number):
)
# Keep an img attribute so we don't have to create it every time
self.img = nv.imaqCreateImage(nv.IMAQ_IMAGE_U16)
self.exception_on_failed_shot = True
self._abort_acquisition = False

def set_attributes(self, attr_dict):
Expand Down Expand Up @@ -173,7 +175,7 @@ def get_attribute_names(self, visibility_level, writeable_only=True):
if not a.Readable:
continue
attributes.append(a.Name.decode('utf8'))
return sorted(attributes)
return attributes

def get_attribute(self, name):
"""Return current value of attribute of the given name"""
Expand Down Expand Up @@ -219,7 +221,16 @@ def grab_multiple(self, n_images, images, waitForNextBuffer=True):
if e.code == nv.IMAQdxErrorTimeout.value:
print('.', end='')
continue
raise

if self.exception_on_failed_shot:
raise
else:
# stop acquisition
print(e, file=sys.stderr)
break



print(f"Got {len(images)} of {n_images} images.")

def stop_acquisition(self):
Expand Down Expand Up @@ -385,6 +396,7 @@ def transition_to_buffered(self, device_name, h5_filepath, initial_values, fresh
self.stop_acquisition_timeout = properties['stop_acquisition_timeout']
self.exception_on_failed_shot = properties['exception_on_failed_shot']
saved_attr_level = properties['saved_attribute_visibility_level']
self.camera.exception_on_failed_shot = self.exception_on_failed_shot
# Only reprogram attributes that differ from those last programmed in, or all of
# them if a fresh reprogramming was requested:
if fresh:
Expand Down
2 changes: 2 additions & 0 deletions labscript_devices/PylonCamera/blacs_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(self, serial_number):
# Keep a nodeMap reference so we don't have to re-create a lot
self.nodeMap = self.camera.GetNodeMap()
self._abort_acquisition = False
self.exception_on_failed_shot = True


def set_attributes(self, attributes_dict):
"""Sets all attribues in attr_dict.
Expand Down
1 change: 1 addition & 0 deletions labscript_devices/SpinnakerCamera/blacs_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(self, serial_number):

# Set the abort acquisition thingy:
self._abort_acquisition = False
self.exception_on_failed_shot = True

def get_attribute_names(self, visibility):
names = []
Expand Down