def StackExt(self, start, stop, step=0.2, verbose=True):
     init_loc = self.zst.getPosition()
     no = int((stop - start) / step) + 1
     pos = start
     xs = self.ccd.image_size[0]
     ys = self.ccd.image_size[1]
     self.data = N.zeros((no, xs, ys), N.uint16)
     self.ccd.SetShutterMode(1)
     q = self.ccd.Acquire()
     time.sleep(0.2)  # was 0.05
     for p in range(no):
         self.zst.setPositionf(pos)
         daq.CCDTrig_run(self.handleA, self.handleB)
         q = self.ccd.WaitForNewData()
         print(p, q)
         self.data[p] = self.ccd.images
         pos += step
         time.sleep(self.delay)
     self.ccd.AbortAcquisition()
     self.ccd.SetShutterMode(2)
     if verbose:
         T.imshow(self.data, vmin=self.data.min(), vmax=self.data.max())
     cur_pos = self.prior.getPosition()
     xx = cur_pos[0]
     yy = cur_pos[1]
     self.stackTags(xx,
                    yy,
                    start,
                    stop,
                    step,
                    function='Z-Stack Widefield',
                    ps=89)
     self.zst.setPositionf(init_loc)
     return True
 def singleSnapExt(self, verbose=True):
     pos = self.zst.getPosition()
     xs = self.ccd.image_size[0]
     ys = self.ccd.image_size[1]
     self.data = N.zeros((xs, ys), dtype=N.uint16)
     self.ccd.SetShutterMode(1)
     self.ccd.Acquire()
     time.sleep(0.2)  # was 0.05
     daq.CCDTrig_run(self.handleA, self.handleB)
     self.ccd.WaitForNewData()
     self.data[:, :] = self.ccd.images
     self.ccd.AbortAcquisition()
     self.ccd.SetShutterMode(2)
     if verbose:
         T.imshow(self.data, vmin=self.data.min(), vmax=self.data.max())
     cur_pos = self.prior.getPosition()
     xx = cur_pos[0]
     yy = cur_pos[1]
     self.stackTags(xx,
                    yy,
                    z1=pos,
                    z2=pos,
                    zs=0.,
                    function='Single snap',
                    ps=89)
     return True
 def TimeLapseExt(self, no=200, pol=0, verbose=True):
     pos = self.zst.getPosition()
     xs = self.ccd.image_size[0]
     ys = self.ccd.image_size[1]
     self.data = N.zeros((no, xs, ys), dtype=N.uint16)
     self.ccd.SetShutterMode(1)
     q = self.ccd.Acquire()
     time.sleep(0.01)
     self.zst.setPositionf(pos)
     self.pol.MoveAbs(pol)
     for p in range(no):
         self.zst.setPositionf(pos)
         time.sleep(0.01)
         daq.CCDTrig_run(self.handleA, self.handleB)
         q = self.ccd.WaitForNewData()
         print(p, q)
         self.data[p] = self.ccd.images
         time.sleep(0.01)
     self.ccd.AbortAcquisition()
     self.ccd.SetShutterMode(2)
     if verbose:
         T.imshow(self.data, vmin=self.data.min(), vmax=self.data.max())
     cur_pos = self.prior.getPosition()
     xx = cur_pos[0]
     yy = cur_pos[1]
     self.stackTags(xx,
                    yy,
                    pos,
                    pos,
                    zs=0.,
                    function='Time-Lapse widefield',
                    ps=89)
     return True
 def SHWFSExt(self):
     self.cam.record(number_of_images=self.number_of_images,
                     mode='ring buffer')
     daq.CCDTrig_run(self.handleA, self.handleB)
     ca = self.cam.rec.get_status()
     img, meta = self.cam.image(-1)
     self.cam.stop()
     return img
 def Stack_Patterns(self, start, stop, step=0.2, verbose=True):
     init_loc = self.zst.getPosition()
     rots = self.pol_array
     no = int((stop - start) / step) + 1
     pos = start
     xs = self.ccd.image_size[0]
     ys = self.ccd.image_size[1]
     psz = 15
     phs = int(psz / 3)
     self.data = N.zeros((psz * no, xs, ys), dtype=N.uint16)
     self.ccd.SetShutterMode(1)
     q = self.ccd.Acquire()
     time.sleep(0.05)  # was 0.2,  changed 20141114
     for p in range(no):
         self.zst.setPositionf(pos)
         for w in range(3):
             self.pol.MoveAbs(rots[w])
             time.sleep(0.4)
             for m in range(phs):
                 qx.selecteorder(15 * self.l + phs * w + m)
                 qx.activate()
                 time.sleep(0.02)
                 daq.CCDTrig_run(self.handleA, self.handleB)
                 q = self.ccd.WaitForNewData()
                 print(p, q)
                 self.data[psz * p + 5 * w + m] = self.ccd.images
                 qx.deactivate()
                 time.sleep(0.02)
         pos += step
     self.ccd.AbortAcquisition()
     self.ccd.SetShutterMode(2)
     if verbose:
         T.imshow(self.data, vmin=self.data.min(), vmax=self.data.max())
     cur_pos = self.prior.getPosition()
     self.zst.setPositionf(init_loc)
     xx = cur_pos[0]
     yy = cur_pos[1]
     self.stackTags(xx,
                    yy,
                    start,
                    stop,
                    step,
                    function='Z-Stack 3DSIM patterns',
                    ps=89)
     return True
 def Stack_Sectioning(self, start, stop, step=0.2, verbose=True):
     init_loc = self.zst.getPosition()
     no = int((stop - start) / step) + 1
     pos = start
     xs = self.ccd.image_size[0]
     ys = self.ccd.image_size[1]
     psz = 3
     self.data = N.zeros((psz * no, xs, ys), dtype=N.uint16)
     self.ccd.SetShutterMode(1)
     q = self.ccd.Acquire()
     self.pol.MoveAbs(0)
     time.sleep(0.3)
     for p in range(no):
         self.zst.setPositionf(pos)
         for m in range(psz):
             qx.selecteorder(30 + m)
             qx.activate()
             time.sleep(0.02)
             daq.CCDTrig_run(self.handleA, self.handleB)
             q = self.ccd.WaitForNewData()
             print(p, q)
             self.data[psz * p + m] = self.ccd.images
             qx.deactivate()
             time.sleep(0.02)
         pos += step
     self.ccd.AbortAcquisition()
     self.ccd.SetShutterMode(2)
     if verbose:
         T.imshow(self.data, vmin=self.data.min(), vmax=self.data.max())
     cur_pos = self.prior.getPosition()
     self.zst.setPositionf(init_loc)
     xx = cur_pos[0]
     yy = cur_pos[1]
     self.stackTags(xx,
                    yy,
                    start,
                    stop,
                    step,
                    function='Z-Stack OS patterns',
                    ps=89)
     return True
 def Image_Patterns(self, angle=0, no=200, pol=0, verbose=True):
     pos = self.zst.getPosition()
     xs = self.ccd.image_size[0]
     ys = self.ccd.image_size[1]
     psz = 5
     self.data = N.zeros((psz * no, xs, ys), dtype=N.uint16)
     self.ccd.SetShutterMode(1)
     q = self.ccd.Acquire()
     time.sleep(0.01)  # was 0.2,  changed 20141114
     self.zst.setPositionf(pos)
     for p in range(no):
         for m in range(angle * 5, psz + angle * 5):
             self.pol.MoveAbs(pol)
             qx.selecteorder(15 * self.l + m)
             qx.activate()
             daq.CCDTrig_run(self.handleA, self.handleB)
             q = self.ccd.WaitForNewData()
             print(p, q)
             self.data[psz * p + m % 5] = self.ccd.images
             qx.deactivate()
             time.sleep(self.delay)
     self.ccd.AbortAcquisition()
     self.ccd.SetShutterMode(2)
     if verbose:
         T.imshow(self.data, vmin=self.data.min(), vmax=self.data.max())
     cur_pos = self.prior.getPosition()
     xx = cur_pos[0]
     yy = cur_pos[1]
     self.stackTags(xx,
                    yy,
                    z1=pos,
                    z2=pos,
                    zs=0.,
                    function='Signle plane SIM patterns',
                    ps=89)
     return True
 def dont_get_img(self):
     daq.CCDTrig_run(self.handleA, self.handleB)
 def get_img(self):
     daq.CCDTrig_run(self.handleA, self.handleB)
     self.ccd.WaitForNewData()
     self.data[:, :] = self.ccd.images