Commit df8d04cc authored by Alejandro Homs Puron's avatar Alejandro Homs Puron

* Test ImageStatusCallback.setRatePolicy(RateAllRates) in test_frelon_control

parent 4818a6d2
......@@ -31,7 +31,8 @@ class ImageStatusCallback(Core.CtControl.ImageStatusCallback):
Core.DEB_CLASS(Core.DebModTest, "ImageStatusCallback")
@Core.DEB_MEMBER_FUNCT
def __init__(self, ct, acq_state, print_time=1, sleep_time=0):
def __init__(self, ct, acq_state, print_time=1, sleep_time=0,
all_frames=False):
Core.CtControl.ImageStatusCallback.__init__(self)
self.m_ct = ct
......@@ -41,6 +42,11 @@ class ImageStatusCallback(Core.CtControl.ImageStatusCallback):
self.m_last_print_ts = 0
self.m_print_time = print_time
self.m_sleep_time = sleep_time
if all_frames:
rate_policy = self.RateAllFrames
else:
rate_policy = self.RateAsFastAsPossible
self.setRatePolicy(rate_policy)
@Core.DEB_MEMBER_FUNCT
def imageStatusChanged(self, img_status):
......@@ -96,7 +102,7 @@ class FrelonAcq:
@Core.DEB_MEMBER_FUNCT
def __init__(self, espia_dev_nb, use_events=False, print_time=1,
sleep_time=0):
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)
......@@ -120,7 +126,7 @@ class FrelonAcq:
if self.m_use_events:
cb = ImageStatusCallback(self.m_ct, self.m_acq_state, print_time,
sleep_time)
sleep_time, all_frames)
self.m_img_status_cb = cb
self.m_ct.registerImageStatusCallback(self.m_img_status_cb)
......@@ -225,7 +231,8 @@ class FrelonAcq:
@Core.DEB_GLOBAL_FUNCT
def test_frelon_control(enable_debug, use_events, print_time, sleep_time):
def test_frelon_control(enable_debug, use_events, print_time, sleep_time,
all_frames):
if enable_debug:
Core.DebParams.enableModuleFlags(Core.DebParams.AllFlags)
......@@ -235,7 +242,8 @@ def test_frelon_control(enable_debug, use_events, print_time, sleep_time):
deb.Always("Creating FrelonAcq")
espia_dev_nb = 0
acq = FrelonAcq(espia_dev_nb, use_events, print_time, sleep_time)
acq = FrelonAcq(espia_dev_nb, use_events, print_time, sleep_time,
all_frames)
deb.Always("Done!")
acq.initSaving("data", "img", ".edf", 0, Core.CtSaving.EDF,
......@@ -293,8 +301,9 @@ def main(argv):
use_events = False
print_time = 1
sleep_time = 0
all_frames = False
opts, args = getopt.getopt(argv[1:], 'dep:s:')
opts, args = getopt.getopt(argv[1:], 'dep:s:a')
for opt, val in opts:
if opt == '-d':
enable_debug = True
......@@ -304,8 +313,11 @@ def main(argv):
print_time = float(val)
if opt == '-s':
sleep_time = float(val)
if opt == '-a':
all_frames = True
test_frelon_control(enable_debug, use_events, print_time, sleep_time)
test_frelon_control(enable_debug, use_events, print_time, sleep_time,
all_frames)
......
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