Commit 399b1a9d authored by Alejandro Homs Puron's avatar Alejandro Homs Puron

* Added Frelon timing calibration (Tango) and GLDisplay test programs

* Updated and renamed existing Frelon test examples
parent 5fec36a5
testfrelon
testfreloncontrol
testfreloninterface
testfrelonspectroscopy
test_frelon
test_frelon_control
test_frelon_interface
test_frelon_spectroscopy
......@@ -21,8 +21,8 @@
############################################################################
include ../../../config.inc
SRCS = testfrelon.cpp testfreloninterface.cpp testfrelonspectroscopy.cpp \
testfreloncontrol.cpp
SRCS = test_frelon.cpp test_frelon_interface.cpp test_frelon_spectroscopy.cpp \
test_frelon_control.cpp
include ../../common/espia/include/espia.inc
......@@ -44,25 +44,25 @@ CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../third-party/Sps/Include \
-I$(ESPIA_DRV_INCL) -Wall -pthread -g
test-progs = testfrelon testfreloninterface testfrelonspectroscopy \
testfreloncontrol
test-progs = test_frelon test_frelon_interface test_frelon_spectroscopy \
test_frelon_control
all: $(test-progs)
testfrelon: testfrelon.o
test_frelon: test_frelon.o
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfreloninterface: testfreloninterface.o
test_frelon_interface: test_frelon_interface.o
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfrelonspectroscopy: testfrelonspectroscopy.o
test_frelon_spectroscopy: test_frelon_spectroscopy.o
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfreloncontrol: testfreloncontrol.o
test_frelon_control: test_frelon_control.o
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
clean:
rm -f *.o *.P testfrelon testfreloninterface testfrelonspectroscopy
rm -f *.o *.P test_frelon test_frelon_interface test_frelon_spectroscopy
%.o : %.cpp
$(COMPILE.cpp) -MD $(CXXFLAGS) -o $@ $<
......
......@@ -20,19 +20,18 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
import os, sys, string, gc, time
from lima import *
from Debug import *
from Lima import Core, Espia, Frelon
import processlib
DEB_GLOBAL(DebModTest)
Core.DEB_GLOBAL(Core.DebModTest)
class ImageStatusCallback(CtControl.ImageStatusCallback):
class ImageStatusCallback(Core.CtControl.ImageStatusCallback):
DEB_CLASS(DebModTest, "ImageStatusCallback")
Core.DEB_CLASS(Core.DebModTest, "ImageStatusCallback")
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def __init__(self, ct, acq_state, print_time=1):
CtControl.ImageStatusCallback.__init__(self)
Core.CtControl.ImageStatusCallback.__init__(self)
self.m_ct = ct
self.m_acq_state = acq_state
......@@ -41,7 +40,7 @@ class ImageStatusCallback(CtControl.ImageStatusCallback):
self.m_last_print_ts = 0
self.m_print_time = print_time
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def imageStatusChanged(self, img_status):
last_acq_frame_nb = img_status.LastImageAcquired;
last_saved_frame_nb = img_status.LastImageSaved;
......@@ -53,14 +52,14 @@ class ImageStatusCallback(CtControl.ImageStatusCallback):
acq_state_changed = False
msg = ''
if ((last_acq_frame_nb == self.m_nb_frames - 1) and
(self.m_acq_state.get() == AcqState.Acquiring)):
(self.m_acq_state.get() == Core.AcqState.Acquiring)):
msg = 'All frames acquired!'
self.m_acq_state.set(AcqState.Saving)
self.m_acq_state.set(Core.AcqState.Saving)
acq_state_changed = True
if last_saved_frame_nb == self.m_nb_frames - 1:
msg = 'All frames saved!'
self.m_acq_state.set(AcqState.Finished)
self.m_acq_state.set(Core.AcqState.Finished)
acq_state_changed = True
now = time.time()
......@@ -77,21 +76,21 @@ class ImageStatusCallback(CtControl.ImageStatusCallback):
class FrelonAcq:
DEB_CLASS(DebModTest, "FrelonAcq")
Core.DEB_CLASS(Core.DebModTest, "FrelonAcq")
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def __init__(self, espia_dev_nb, use_events=False, print_time=1):
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 = BufferCtrlMgr(self.m_buffer_cb_mgr)
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 = AcqState()
self.m_ct = CtControl(self.m_hw_inter)
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()
......@@ -112,7 +111,7 @@ class FrelonAcq:
self.m_ct_display.setActive(True)
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def __del__(self):
if self.m_use_events:
del self.m_img_status_cb; gc.collect()
......@@ -128,21 +127,21 @@ class FrelonAcq:
del self.m_acq; gc.collect()
del self.m_edev; gc.collect()
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def start(self):
self.m_ct.prepareAcq()
self.m_acq_state.set(AcqState.Acquiring)
self.m_acq_state.set(Core.AcqState.Acquiring)
self.m_ct.startAcq()
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def wait(self):
if self.m_use_events:
state_mask = AcqState.Acquiring | AcqState.Saving
state_mask = Core.AcqState.Acquiring | Core.AcqState.Saving
self.m_acq_state.waitNot(state_mask)
else:
nb_frames = self.m_ct_acq.getAcqNbFrames()
last_print_ts = 0
running_states = [AcqState.Acquiring, AcqState.Saving]
running_states = [Core.AcqState.Acquiring, Core.AcqState.Saving]
while self.m_acq_state.get() in running_states:
img_status = self.m_ct.getImageStatus()
last_acq_frame_nb = img_status.LastImageAcquired;
......@@ -151,14 +150,14 @@ class FrelonAcq:
acq_state_changed = False
msg = ''
if ((last_acq_frame_nb == nb_frames - 1) and
(self.m_acq_state.get() == AcqState.Acquiring)):
(self.m_acq_state.get() == Core.AcqState.Acquiring)):
msg = 'All frames acquired!'
self.m_acq_state.set(AcqState.Saving)
self.m_acq_state.set(Core.AcqState.Saving)
acq_state_changed = True
if last_saved_frame_nb == nb_frames - 1:
msg = 'All frames saved!'
self.m_acq_state.set(AcqState.Finished)
self.m_acq_state.set(Core.AcqState.Finished)
acq_state_changed = True
now = time.time()
......@@ -176,12 +175,12 @@ class FrelonAcq:
pool_thread_mgr = processlib.PoolThreadMgr.get()
pool_thread_mgr.wait()
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def run(self):
self.start()
self.wait()
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def initSaving(self, dir, prefix, suffix, idx, fmt, mode, frames_per_file):
self.m_ct_saving.setDirectory(dir)
self.m_ct_saving.setPrefix(prefix)
......@@ -191,28 +190,28 @@ class FrelonAcq:
self.m_ct_saving.setSavingMode(mode)
self.m_ct_saving.setFramesPerFile(frames_per_file)
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def setExpTime(self, exp_time):
self.m_ct_acq.setAcqExpoTime(exp_time)
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def setNbAcqFrames(self, nb_acq_frames):
self.m_ct_acq.setAcqNbFrames(nb_acq_frames)
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def setBin(self, bin):
self.m_ct_image.setBin(bin)
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def setRoi(self, roi):
self.m_ct_image.setRoi(roi)
@DEB_GLOBAL_FUNCT
@Core.DEB_GLOBAL_FUNCT
def test_frelon_control(enable_debug):
if not enable_debug:
DebParams.disableModuleFlags(DebParams.AllFlags)
Core.DebParams.disableModuleFlags(Core.DebParams.AllFlags)
deb.Always("Creating FrelonAcq")
espia_dev_nb = 0
......@@ -220,8 +219,8 @@ def test_frelon_control(enable_debug):
acq = FrelonAcq(espia_dev_nb, use_events)
deb.Always("Done!")
acq.initSaving("data", "img", ".edf", 0, CtSaving.EDF,
CtSaving.AutoFrame, 1);
acq.initSaving("data", "img", ".edf", 0, Core.CtSaving.EDF,
Core.CtSaving.AutoFrame, 1);
deb.Always("First run with default pars")
acq.run()
......@@ -237,7 +236,7 @@ def test_frelon_control(enable_debug):
acq.run()
deb.Always("Done!")
bin = Bin(2, 2)
bin = Core.Bin(2, 2)
acq.setBin(bin)
nb_acq_frames = 5
......@@ -248,7 +247,7 @@ def test_frelon_control(enable_debug):
acq.run()
deb.Always("Done!")
roi = Roi(Point(256, 256), Size(512, 512));
roi = Core.Roi(Core.Point(256, 256), Core.Size(512, 512));
acq.setRoi(roi);
roi_tl, roi_size = roi.getTopLeft(), roi.getSize()
......@@ -258,7 +257,7 @@ def test_frelon_control(enable_debug):
acq.run()
deb.Always("Done!")
roi = Roi(Point(267, 267), Size(501, 501));
roi = Core.Roi(Core.Point(267, 267), Core.Size(501, 501));
acq.setRoi(roi);
roi_tl, roi_size = roi.getTopLeft(), roi.getSize()
......
......@@ -20,9 +20,7 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
import sys
from lima import *
from Debug import *
import processlib
from Lima import Core, Espia, Frelon
import time
import numpy as N
......@@ -39,39 +37,39 @@ Data_FLOAT = 9
Data_DOUBLE = 10
DEB_GLOBAL(DebModTest)
Core.DEB_GLOBAL(Core.DebModTest)
class SoftRoiCallback( processlib.TaskEventCallback ):
class SoftRoiCallback( Core.Processlib.TaskEventCallback ):
DEB_CLASS(DebModTest, "SoftRoiCallback")
Core.DEB_CLASS(Core.DebModTest, "SoftRoiCallback")
DataType2ImageType = {
N.int8: Bpp8,
N.uint8: Bpp8,
N.int16: Bpp16,
N.uint16: Bpp16,
N.int32: Bpp32,
N.uint32: Bpp32
N.int8: Core.Bpp8,
N.uint8: Core.Bpp8,
N.int16: Core.Bpp16,
N.uint16: Core.Bpp16,
N.int32: Core.Bpp32,
N.uint32: Core.Bpp32
}
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def __init__(self, hw_inter, buffer_save, acq_state):
processlib.TaskEventCallback.__init__(self)
Core.Processlib.TaskEventCallback.__init__(self)
self.m_hw_inter = hw_inter
self.m_buffer_save = buffer_save
self.m_acq_state = acq_state
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def finished(self, data):
finfo, fdim = self.data2FrameInfo(data)
self.m_buffer_save.writeFrame(finfo)
hw_sync = self.m_hw_inter.getHwCtrlObj(HwCap.Sync)
hw_sync = self.m_hw_inter.getHwCtrlObj(Core.HwCap.Sync)
nb_frames = hw_sync.getNbFrames()
if finfo.acq_frame_nb == nb_frames - 1:
self.m_acq_state.set(AcqState.Finished)
self.m_acq_state.set(Core.AcqState.Finished)
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def data2FrameInfo(self, data):
arr = data.buffer
arr_type = arr.dtype.type
......@@ -79,51 +77,50 @@ class SoftRoiCallback( processlib.TaskEventCallback ):
image_type = self.DataType2ImageType[arr_type]
buffer_ctrl = self.m_hw_inter.getHwCtrlObj(HwCap.Buffer)
buffer_ctrl = self.m_hw_inter.getHwCtrlObj(Core.HwCap.Buffer)
start_ts = buffer_ctrl.getStartTimestamp()
fdim = FrameDim(arr_width, arr_height, image_type)
timestamp = Timestamp(data.timestamp)
valid_pixels = Point(fdim.getSize()).getArea()
fdim = Core.FrameDim(arr_width, arr_height, image_type)
timestamp = Core.Timestamp(data.timestamp)
valid_pixels = Core.Point(fdim.getSize()).getArea()
finfo = HwFrameInfoType(data.frameNumber, arr, fdim,
timestamp, valid_pixels)
ownership = Core.HwFrameInfoType.Managed
finfo = Core.HwFrameInfoType(data.frameNumber, arr, timestamp,
valid_pixels, ownership)
return finfo, fdim
class TestFrameCallback( HwFrameCallback ):
class TestFrameCallback( Core.HwFrameCallback ):
DEB_CLASS(DebModTest, "TestFrameCallback")
Core.DEB_CLASS(Core.DebModTest, "TestFrameCallback")
ImageType2DataType = {
Bpp8: Data_UINT8,
Bpp16: Data_UINT16,
Bpp32: Data_UINT32
Core.Bpp8: Data_UINT8,
Core.Bpp16: Data_UINT16,
Core.Bpp32: Data_UINT32
}
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def __init__(self, hw_inter, soft_roi, buffer_save, acq_state):
HwFrameCallback.__init__(self)
Core.HwFrameCallback.__init__(self)
self.m_hw_inter = hw_inter
self.m_soft_roi = soft_roi
self.m_acq_state = acq_state
self.m_roi_task = processlib.Tasks.SoftRoi()
self.m_roi_task = Core.Processlib.Tasks.SoftRoi()
self.m_roi_cb = SoftRoiCallback(hw_inter, buffer_save,
acq_state)
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def newFrameReady(self, frame_info):
msg = 'acq_frame_nb=%d, ' % frame_info.acq_frame_nb
fdim = frame_info.frame_dim
size = fdim.getSize()
data = self.frameInfo2Data(frame_info)
buffer = data.buffer
msg += 'frame_dim=%dx%dx%d, ' % \
(size.getWidth(), size.getHeight(), fdim.getDepth())
(buffer.shape[1], buffer.shape[0], buffer.dtype.itemsize)
msg += 'frame_timestamp=%.6f, ' % frame_info.frame_timestamp
msg += 'valid_pixels=%d' % frame_info.valid_pixels
deb.Always("newFrameReady: %s" % msg)
data = self.frameInfo2Data(frame_info)
if self.m_soft_roi.isActive():
pass
else:
......@@ -131,30 +128,30 @@ class TestFrameCallback( HwFrameCallback ):
return True
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def frameInfo2Data(self, frame_info):
data = processlib.Data()
data.buffer = frame_info.frame_ptr
data = Core.Processlib.Data()
data.buffer = frame_info.frame_data
data.frameNumber = frame_info.acq_frame_nb
data.timestamp = frame_info.frame_timestamp
return data
class MaxImageSizeCallback( HwMaxImageSizeCallback ):
class MaxImageSizeCallback( Core.HwMaxImageSizeCallback ):
DEB_CLASS(DebModTest, "MaxImageSizeCallback")
Core.DEB_CLASS(Core.DebModTest, "MaxImageSizeCallback")
@DEB_MEMBER_FUNCT
@Core.DEB_MEMBER_FUNCT
def maxImageSizeChanged(self, size, image_type):
fdim = FrameDim(size, image_type)
fdim = Core.FrameDim(size, image_type)
msg = "size=%sx%s, image_type=%s, depth=%d" % \
(size.getWidth(), size.getHeight(), image_type, \
fdim.getDepth())
deb.Always("MaxImageSizeChanged: %s" % msg)
@DEB_GLOBAL_FUNCT
@Core.DEB_GLOBAL_FUNCT
def main(argv):
deb.Always("Creating Espia.Dev")
......@@ -171,7 +168,7 @@ def main(argv):
buffer_cb_mgr = Espia.BufferMgr(acq)
deb.Always("Creating BufferCtrlMgr")
buffer_mgr = BufferCtrlMgr(buffer_cb_mgr)
buffer_mgr = Core.BufferCtrlMgr(buffer_cb_mgr)
deb.Always("Creating Espia.SerialLine")
eser_line = Espia.SerialLine(edev)
......@@ -182,23 +179,24 @@ def main(argv):
deb.Always("Creating the Hw Interface ... ")
hw_inter = Frelon.Interface(acq, buffer_mgr, cam)
deb.Always("Creating BufferSave")
buffer_save = BufferSave(BufferSave.EDF, "img", 0, ".edf", True, 1)
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(HwCap.DetInfo)
hw_det_info = hw_inter.getHwCtrlObj(Core.HwCap.DetInfo)
deb.Always("Getting HW buffer")
hw_buffer = hw_inter.getHwCtrlObj(HwCap.Buffer)
hw_buffer = hw_inter.getHwCtrlObj(Core.HwCap.Buffer)
deb.Always("Getting HW Sync")
hw_sync = hw_inter.getHwCtrlObj(HwCap.Sync)
hw_sync = hw_inter.getHwCtrlObj(Core.HwCap.Sync)
deb.Always("Getting HW Bin")
hw_bin = hw_inter.getHwCtrlObj(HwCap.Bin)
hw_bin = hw_inter.getHwCtrlObj(Core.HwCap.Bin)
deb.Always("Getting HW RoI")
hw_roi = hw_inter.getHwCtrlObj(HwCap.Roi)
hw_roi = hw_inter.getHwCtrlObj(Core.HwCap.Roi)
mis_cb = MaxImageSizeCallback()
hw_det_info.registerMaxImageSizeCallback(mis_cb)
......@@ -208,8 +206,8 @@ def main(argv):
deb.Always("Setting FFM")
cam.setFrameTransferMode(Frelon.FFM)
soft_roi = Roi()
acq_state = AcqState()
soft_roi = Core.Roi()
acq_state = Core.AcqState()
deb.Always("Creating a TestFrameCallback")
cb = TestFrameCallback(hw_inter, soft_roi, buffer_save, acq_state)
......@@ -221,15 +219,15 @@ def main(argv):
size = hw_det_info.getMaxImageSize()
image_type = hw_det_info.getCurrImageType()
frame_dim = FrameDim(size, image_type)
frame_dim = Core.FrameDim(size, image_type)
bin = Bin(Point(1))
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 = FrameDim(frame_dim) # was (frame_dim / bin)
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)
......@@ -238,11 +236,11 @@ def main(argv):
hw_sync.setNbFrames(3)
deb.Always("Starting Acquisition")
acq_state.set(AcqState.Acquiring)
acq_state.set(Core.AcqState.Acquiring)
hw_inter.startAcq()
deb.Always("Waiting acq finished...")
acq_state.waitNot(AcqState.Acquiring)
acq_state.waitNot(Core.AcqState.Acquiring)
deb.Always("Acq finished!!")
deb.Always("Stopping Acquisition")
......
import time
import signal
from Lima import Core, GLDisplay, Frelon
acq = Frelon.FrelonAcq(0)
ct_control = acq.getGlobalControl()
def frelon_cleanup():
global acq
del acq
gldisplay = GLDisplay.CtSPSGLDisplay(ct_control, [])
gldisplay.setForkCleanup(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:
time.sleep(0.2)
print 'Frame: %d' % ct_status().ImageCounters.LastImageReady
nframes = ct_status().ImageCounters.LastImageReady + 1
print 'Finished: %d' % nframes
print 'Press any key to quit'
raw_input()
......@@ -20,20 +20,20 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
import sys, os, thread, time, random
import lima
from Lima import Core, Espia, Frelon
class FrelonData:
def __init__(self, edev_nr=0):
self.edev = lima.Espia.Dev(edev_nr)
self.eser_line = lima.Espia.SerialLine(self.edev)
self.frelon = lima.Frelon.Camera(self.eser_line)
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 = lima.Cond()
self.finish_cond = Core.Cond()
self.finish_req = False
self.log_cond = lima.Cond()
self.log_cond = Core.Cond()
def getFrelonCamera(self):
return self.frelon
......
import PyTango
import time
import sys
ln = '//pulsar:20000/isg/limaccds/frelon1'
fn = '//pulsar:20000/isg/frelon/frelon1'
l = PyTango.DeviceProxy(ln)
f = PyTango.DeviceProxy(fn)
def execCmd(cmd):
a = f.execSerialCommand(cmd)
lines = a.split('\r\n')[:-1]
if len(lines) == 1:
a = lines[0][4:]
try:
return int(a)
except:
return a
return lines
def calibrate(nb_images = 10):
tango_retries = 10
t0 = time.time()
for i in range(tango_retries):
s = l.State()
t1 = time.time()
tango_time = (t1 - t0) / tango_retries
print 'tango_time = %.3f ms' % (tango_time * 1e3)
seq_status_retries = 10
t0 = time.time()
for i in range(seq_status_retries):
s = f.seq_status
t1 = time.time()
seq_status_time = (t1 - t0) / seq_status_retries
print 'seq_status_time = %.3f ms' % (seq_status_time * 1e3)
cmd = '>VER?\r\n'
t0 = time.time()
ans = f.execSerialCommand(cmd)
t1 = time.time()
ser_line_chr_time = (t1 - t0) / len(cmd + ans)
print 'ser_line_chr_time = %.3f ms' % (ser_line_chr_time * 1e3)
image_sizes = l.image_sizes
image_size = image_sizes[1] * image_sizes[2] * image_sizes[3]
espia_xfer_time = image_size / 200e6
print 'espia_xfer_time = %.3f ms' % (espia_xfer_time * 1e3)
l.acq_expo_time = 1.1e-6
l.acq_nb_frames = nb_images
l.acq_trigger_mode = 'INTERNAL_TRIGGER'
l.prepareAcq()
t0 = time.time()
l.startAcq()
waitAcq()
t1 = time.time()
start_time = len('>S\r\n') * ser_line_chr_time
readout_time = (t1 - t0 - start_time - espia_xfer_time - tango_time) / nb_images
print 'measured readout_time = %.3f ms' % (readout_time * 1e3)
print 'calculated readout_time = %.3f ms' % (float(execCmd('TRD?')) / 1e3)
return readout_time
def waitAcq(d=False):
while l.acq_status == 'Running':
if d:
sys.stdout.write('%d\r' % (l.last_image_acquired + 1))
sys.stdout.flush()
if d:
sys.stdout.write('%d\n' % (l.last_image_acquired + 1))
calibrate()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment