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, 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()
Exemple #3
0
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 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...")