Commit 17ed9d1d authored by Martin Drechsler's avatar Martin Drechsler
Browse files

now measures dont freeze. A trigger is shot at the end to unlock the acq thread

parent 69c03a31
Loading
Loading
Loading
Loading
+4 −5
Changes for drivers/andorzyla.py: 4 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ def create_aligned_array(shape, dtype=np.typeDict['singlecomplex'], boundary=16)

class Helper_messager(QtCore.QObject):
    imageAquiredSignal = QtCore.pyqtSignal(int)

    timeoutSignal = QtCore.pyqtSignal()

class AndorBase(SDK3Camera):
    
@@ -752,17 +752,16 @@ class AndorBase(SDK3Camera):
        if self.TriggerMode.getString()=='Internal':
            timeout = self.ExposureTime.getValue() * 5000
        if self.TriggerMode.getString()=='Software':
            timeout = 1000000
            timeout = 10000
        
        while getattr(t, "do_run", True):
            try:
                a_s, px_encoding, xs, ys, bufs = self._live_acq_auxs
            except AttributeError:
                print('AndorZyla object has no attribute _live_acq_auxs')
            try:
            
            pData, lData = SDK3.WaitBuffer(self.handle, int(timeout))
            except:
                raise Exception('Timeout in the camera')
            
            img = create_aligned_array(xs*ys, 'uint16')
            SDK3.ConvertBuffer(bufs[self.acq_index_i%len(bufs)].ctypes.data_as(ctypes.POINTER(ctypes.c_uint8)), 
                               img.ctypes.data_as(ctypes.POINTER(ctypes.c_uint8)), 
+8 −6
Changes for zylaCameraWorker.py: 8 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ class CameraWorker(QtCore.QObject):
                
        # internal connections
        self.cam.helper.imageAquiredSignal.connect(self.new_image_acquired)

        #self.cam.helper.timeoutSignal.connect()
    def __del__(self):
        print("adios camera worker")

@@ -151,16 +151,17 @@ class CameraWorker(QtCore.QObject):
                target=self.cam.live_acquisition_loop
            )
        self.acq_thread.start()
        with self._lock:
        #with self._lock:
        self.simple_scan_measurement_step()
        
            
    def simple_scan_measurement_end(self):
    
        print('entering scan ending in worker')    
        self.measurementEndingSignal.emit()  
        self.cam.trigger()
        self._stop_acquisition_loop()
        self.cam.TriggerMode.setString('Internal')
        self.ao_to_scan.go_softly_to_value(self.measure_params['end'])     
        self.measurementEndingSignal.emit()  
        self.cam.TriggerMode.setString('Internal')
        print('exiting scan ending in worker')
        
    def simple_scan_measurement_step(self):
@@ -175,6 +176,8 @@ class CameraWorker(QtCore.QObject):
            print('trigger')
        except StopIteration:
            self.simple_scan_measurement_end()
        except:
            raise
       
    def get_scan_signal(self, ao_name):
        return [ao for ao in anal_control_signal._registry if ao.name == ao_name][0]
@@ -188,7 +191,6 @@ class CameraWorker(QtCore.QObject):
    
    def abort_measurement(self):
        self.scan_array_gen.close()
        self.simple_scan_measurement_end()
        print('Measurement aborted')
    
    @QtCore.pyqtSlot(str)