def __init__(self, espia_dev_nb, use_events=False, print_time=1, sleep_time=0, all_frames=False): self.m_edev = Espia.Dev(espia_dev_nb) self.m_acq = Espia.Acq(self.m_edev) self.m_buffer_cb_mgr = Espia.BufferMgr(self.m_acq) self.m_eserline = Espia.SerialLine(self.m_edev) self.m_cam = Frelon.Camera(self.m_eserline) self.m_buffer_mgr = Core.BufferCtrlMgr(self.m_buffer_cb_mgr) self.m_hw_inter = Frelon.Interface(self.m_acq, self.m_buffer_mgr, self.m_cam) self.m_acq_state = Core.AcqState() self.m_ct = Core.CtControl(self.m_hw_inter) self.m_ct_acq = self.m_ct.acquisition() self.m_ct_saving = self.m_ct.saving() self.m_ct_image = self.m_ct.image() self.m_ct_buffer = self.m_ct.buffer() self.m_ct_display = self.m_ct.display() self.m_use_events = use_events self.m_print_time = print_time self.m_sleep_time = sleep_time if self.m_use_events: cb = ImageStatusCallback(self.m_ct, self.m_acq_state, print_time, sleep_time, all_frames) self.m_img_status_cb = cb self.m_ct.registerImageStatusCallback(self.m_img_status_cb) self.m_ct_display.setNames('_ccd_ds_', 'frelon_live') self.m_ct_display.setActive(True)
def __init__(self, dev_name, dev_class=None, cmd_list=None): TacoCcdAcq.__init__(self, dev_name, dev_class, cmd_list) res_pars = self.getResources(self.DefaultResources) espia_dev_nb = int(res_pars['espia_dev_nb']) self.m_acq = Frelon.FrelonAcq(espia_dev_nb) self.m_get_acq_frames = False
def __init__(self, **kws): self.__dict__.update(kws) self.acq = Frelon.FrelonAcq(self.espia_dev_nb) self.ct = self.acq.getGlobalControl() self.ct_acq = self.ct.acquisition() self.ct_saving = self.ct.saving() self.setupAcq() self.setupSaving()
def __init__(self, edev_nr=0): self.edev = Espia.Dev(edev_nr) self.eser_line = Espia.SerialLine(self.edev) self.frelon = Frelon.Camera(self.eser_line) self.fser_line = self.frelon.getSerialLine() self.finish_cond = Core.Cond() self.finish_req = False self.log_cond = Core.Cond()
def main(): edev_nr = 0 enable_debug = False if len(sys.argv) > 1: edev_nr = int(sys.argv[1]) if enable_debug: Core.DebParams.enableModuleFlags(Core.DebParams.AllFlags) Core.DebParams.enableTypeFlags(Core.DebParams.AllFlags) else: Core.DebParams.disableModuleFlags(Core.DebParams.AllFlags) edev = Espia.Dev(edev_nr) eserline = Espia.SerialLine(edev) cam = Frelon.Camera(eserline) dt_cb = DeadTimeChangedCallback(cam) cam.registerDeadTimeChangedCallback(dt_cb) cam.setFrameTransferMode(Frelon.FTM) cam.setFrameTransferMode(Frelon.FFM)
def DevCcdSetHwPar(self, hw_par_str): hw_par = map(int, string.split(hw_par_str)) deb.Param('Setting hw par: %s' % hw_par) kin_win_size, kin_line_beg, kin_stripes = self.getKinPars() flip_mode, kin_line_beg, kin_stripes, d0, roi_mode_int = hw_par flip = Core.Flip(flip_mode >> 1, flip_mode & 1) _FrelonAcq.setFlip(flip) roi_mode = FrelonAcq.RoiMode(roi_mode_int) _FrelonAcq.setRoiMode(roi_mode) if roi_mode == FrelonAcq.Kinetic: max_frame_dim = _FrelonAcq.getFrameDim(max_dim=True) frame_height = max_frame_dim.getSize().getHeight() if kin_line_beg + kin_win_size > frame_height: kin_win_size = frame_height - kin_line_beg bin_y = _FrelonAcq.getBin().getY() kin_win_size = (kin_win_size / bin_y) * bin_y deb.Trace('Re-adjusting kin_win_size to %d to fit chip' % kin_win_size) self.setKinPars(kin_win_size, kin_line_beg, kin_stripes) else: deb.Warning('Ingoring Kinetic parameters')
def test_frelon_acc(enable_debug, espia_dev_nb, vert_bin, exp_time, acc_max_exp_time, nb_frames, acc_time_mode): if enable_debug: Core.DebParams.enableModuleFlags(Core.DebParams.AllFlags) Core.DebParams.enableTypeFlags(Core.DebParams.AllFlags) else: Core.DebParams.disableModuleFlags(Core.DebParams.AllFlags) deb.Always("Creating FrelonAcq") acq = Frelon.FrelonAcq(espia_dev_nb) deb.Trace("Done!") cam = acq.getFrelonCamera() ct = acq.getGlobalControl() ct_image = ct.image() ct_acq = ct.acquisition() acq_state = Core.AcqState() status_cb = ImageStatusCallback(ct, acq_state) ct.registerImageStatusCallback(status_cb) deb.Always("Setting Full Frame Mode - Speed - Chan 3&4") cam.setSPB2Config(Frelon.SPB2Speed) cam.setFrameTransferMode(Frelon.FFM) cam.setInputChan(Frelon.Chan34) deb.Trace("Done!") frame_dim = acq.getFrameDim(max_dim=True) bin = Core.Bin(1, vert_bin) deb.Always("Setting binning %s" % bin) ct_image.setBin(bin) deb.Trace("Done!") image_size = frame_dim.getSize() nb_cols = image_size.getWidth() nb_lines = image_size.getHeight() / vert_bin roi = Core.Roi(Core.Point(0, nb_lines - 2), Core.Size(nb_cols, 1)) deb.Always("Setting RoI %s" % roi) ct_image.setRoi(roi) deb.Trace("Done!") deb.Always("Setting Kinetic RoI mode") cam.setRoiMode(Frelon.Kinetic) deb.Trace("Done!") deb.Always("Setting Acc. mode") ct_acq.setAcqMode(Core.Accumulation) deb.Trace("Done!") deb.Always("Setting %s Acc. Time mode" % acc_time_mode) acc_mode = Core.CtAcquisition.Live \ if acc_time_mode == 'Live' \ else Core.CtAcquisition.Real ct_acq.setAccTimeMode(acc_mode) deb.Trace("Done!") deb.Always("Setting Acc. max. exp. time %s" % acc_max_exp_time) ct_acq.setAccMaxExpoTime(acc_max_exp_time) deb.Trace("Done!") deb.Always("Setting exp. time %s" % exp_time) ct_acq.setAcqExpoTime(exp_time) deb.Trace("Done!") deb.Always("Setting nb. frames %s" % nb_frames) ct_acq.setAcqNbFrames(nb_frames) deb.Trace("Done!") acc_nb_frames = ct_acq.getAccNbFrames() acc_dead_time = ct_acq.getAccDeadTime() acc_live_time = ct_acq.getAccLiveTime() deb.Always("AccNbFrames: %d, AccDeadTime: %.6f, AccLiveTime: %.6f" % (acc_nb_frames, acc_dead_time, acc_live_time)) deb.Always("Preparing acq.") ct.prepareAcq() deb.Trace("Done!") deb.Always("Starting acq.") status_cb.start() ct.startAcq() deb.Trace("Done!") state_mask = Core.AcqState.Acquiring acq_state.waitNot(state_mask) deb.Always("Finished!") dead_time = cam.getDeadTime() read_time = cam.getReadoutTime() xfer_time = cam.getTransferTime() deb.Always("Dead Time: %.6f, Readout Time: %.6f, Transfer Time: %.6f" % (dead_time, read_time, xfer_time))
def get_control(espia_dev_nb=0, **keys): global _FrelonAcq if _FrelonAcq is None: _FrelonAcq = FrelonAcq.FrelonAcq(int(espia_dev_nb)) return _FrelonAcq.getGlobalControl()
def main(argv): deb.Always("Creating Espia.Dev") edev = Espia.Dev(0) deb.Always("Creating Espia.Acq") acq = Espia.Acq(edev) acqstat = acq.getStatus() deb.Always("Whether the Acquisition is running : %s" % acqstat.running) deb.Always("Creating Espia.BufferMgr") buffer_cb_mgr = Espia.BufferMgr(acq) deb.Always("Creating BufferCtrlMgr") buffer_mgr = Core.BufferCtrlMgr(buffer_cb_mgr) deb.Always("Creating Espia.SerialLine") eser_line = Espia.SerialLine(edev) deb.Always("Creating Frelon.Camera") cam = Frelon.Camera(eser_line) deb.Always("Creating the Hw Interface ... ") hw_inter = Frelon.Interface(acq, buffer_mgr, cam) deb.Always("Creating HW BufferSave") buffer_save = Core.HwBufferSave(Core.HwBufferSave.EDF, "img", 0, ".edf", True, 1) deb.Always("Getting HW detector info") hw_det_info = hw_inter.getHwCtrlObj(Core.HwCap.DetInfo) deb.Always("Getting HW buffer") hw_buffer = hw_inter.getHwCtrlObj(Core.HwCap.Buffer) deb.Always("Getting HW Sync") hw_sync = hw_inter.getHwCtrlObj(Core.HwCap.Sync) deb.Always("Getting HW Bin") hw_bin = hw_inter.getHwCtrlObj(Core.HwCap.Bin) deb.Always("Getting HW RoI") hw_roi = hw_inter.getHwCtrlObj(Core.HwCap.Roi) mis_cb = MaxImageSizeCallback() hw_det_info.registerMaxImageSizeCallback(mis_cb) deb.Always("Setting FTM") cam.setFrameTransferMode(Frelon.FTM) deb.Always("Setting FFM") cam.setFrameTransferMode(Frelon.FFM) soft_roi = Core.Roi() acq_state = Core.AcqState() deb.Always("Creating a TestFrameCallback") cb = TestFrameCallback(hw_inter, soft_roi, buffer_save, acq_state) do_reset = False if do_reset: deb.Always("Reseting hardware ...") hw_inter.reset(HwInterface.HardReset) deb.Always(" Done!") size = hw_det_info.getMaxImageSize() image_type = hw_det_info.getCurrImageType() frame_dim = Core.FrameDim(size, image_type) bin = Core.Bin(Core.Point(1)) hw_bin.setBin(bin) #Roi set_roi, real_roi; #set_hw_roi(hw_roi, set_roi, real_roi, soft_roi); effect_frame_dim = Core.FrameDim(frame_dim) # was (frame_dim / bin) hw_buffer.setFrameDim(effect_frame_dim) hw_buffer.setNbBuffers(10) hw_buffer.registerFrameCallback(cb) hw_sync.setExpTime(2) hw_sync.setNbFrames(3) deb.Always("Starting Acquisition") acq_state.set(Core.AcqState.Acquiring) hw_inter.startAcq() deb.Always("Waiting acq finished...") acq_state.waitNot(Core.AcqState.Acquiring) deb.Always("Acq finished!!") deb.Always("Stopping Acquisition") hw_inter.stopAcq() deb.Always("This is the End...")
import time import signal from Lima import Core, GLDisplay, Frelon acq = Frelon.FrelonAcq(0) ct_control = acq.getGlobalControl() class FrelonCleanup(GLDisplay.GLForkCallback): def execInForked(self): global acq del acq frelon_cleanup = FrelonCleanup() gldisplay = GLDisplay.CtSPSGLDisplay(ct_control, []) gldisplay.addForkCallback(frelon_cleanup) gldisplay.setSpecArray('GLDisplayTest', 'Frelon') gldisplay.createWindow() signal.signal(signal.SIGCHLD, signal.SIG_IGN) ct_acq = ct_control.acquisition() ct_acq.setAcqNbFrames(10) ct_acq.setAcqExpoTime(0.1) gldisplay.setNorm(0, 200, 0) ct_control.prepareAcq() ct_control.startAcq() ct_status = ct_control.getStatus while ct_status().AcquisitionStatus == Core.AcqRunning: