Skip to content

Commit

Permalink
andorEmccd: correct image orientation when EM gain disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbe authored and LabOne committed Nov 12, 2018
1 parent bd48cbe commit 3e54266
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion andorEmccd/andorEmccd.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def __init__(self, leave_camera_warm=True, framebuffer_len=100):
self._get_vertical_shift_speeds()
self._get_horizontal_shift_speeds()

# Sensible non-EM parameters
self.set_horizontal_shift_parameters(
3, em_gain=False, adc_bit_depth=16)

horiz = ctypes.c_int()
vert = ctypes.c_int()
self.dll.GetDetector(ctypes.byref(horiz), ctypes.byref(vert))
Expand Down Expand Up @@ -237,6 +241,8 @@ def set_horizontal_shift_parameters(self, horizontal_shift_speed,
if ret != DRV_SUCCESS:
raise Exception()

self._em_gain_enabled = em_gain

def set_trigger_mode(self, trig_mode):
"""Set the trigger mode between internal and external"""
ret = self.dll.SetTriggerMode(int(trig_mode))
Expand Down Expand Up @@ -377,6 +383,9 @@ def _get_all_images(self):
im = raw[(im_size*i):(im_size*(i+1))]
im = im.reshape(self.roiHeight, self.roiWidth)
im = np.transpose(im)
if not self._em_gain_enabled:
# Ensure image orientation is the same as for the EM amplifier
im = np.flipud(im)
im_array.append(im.copy(order="C"))
return im_array

Expand All @@ -391,7 +400,7 @@ def deregister_callback(self, f):

def _acquisition_thread(self):
while True:
# The GIL is released in the cytes library call, so we get true
# The GIL is released in the ctypes library call, so we get true
# multithreading until wait_for_acquisition() returns
self.wait_for_acquisition()
ims = self._get_all_images()
Expand Down

0 comments on commit 3e54266

Please sign in to comment.