diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2016-07-12 11:07:06 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2016-07-12 11:07:06 +0200 |
commit | 6e4d24ed15b50411a7b1541ea078756fc455f4ac (patch) | |
tree | 3a4f09cc6a725ab569a2fb40f032f4a419f0ee02 | |
parent | 199edb1bbf35da2b0d0624a6f3d2860b8be7a6e3 (diff) | |
download | uca-ufo-6e4d24ed15b50411a7b1541ea078756fc455f4ac.tar.gz uca-ufo-6e4d24ed15b50411a7b1541ea078756fc455f4ac.tar.bz2 uca-ufo-6e4d24ed15b50411a7b1541ea078756fc455f4ac.tar.xz uca-ufo-6e4d24ed15b50411a7b1541ea078756fc455f4ac.zip |
Add some TANGO tests
-rw-r--r-- | tests/roi.py | 35 | ||||
-rw-r--r-- | tests/timeout.py | 42 |
2 files changed, 77 insertions, 0 deletions
diff --git a/tests/roi.py b/tests/roi.py new file mode 100644 index 0000000..f429740 --- /dev/null +++ b/tests/roi.py @@ -0,0 +1,35 @@ +import argparse +import PyTango +import tifffile + + +def grab(camera, height=3840, offset=0): + if height < 3840: + camera.roi_y0 = offset + camera.roi_height = height + else: + camera.roi_height = height + camera.roi_y0 = offset + + try: + camera.Start() + except: + camera.Stop() + camera.Start() + + frame = camera.image + tifffile.imsave('frame-{}-{}.tif'.format(offset, height), frame) + camera.Stop() + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--device', '-d', type=str, help="TANGO device path") + + args = parser.parse_args() + + camera = PyTango.DeviceProxy(args.device) + + grab(camera) + grab(camera, height=3640) + grab(camera, height=3640, offset=200) diff --git a/tests/timeout.py b/tests/timeout.py new file mode 100644 index 0000000..3b0d150 --- /dev/null +++ b/tests/timeout.py @@ -0,0 +1,42 @@ +import time +import argparse +import PyTango + + +def grab(camera, timeout, do_trigger): + camera.timeout = timeout + camera.trigger_source = 1 + + try: + camera.Start() + except: + camera.Stop() + camera.Start() + + start = time.time() + + try: + if do_trigger: + camera.Trigger() + + frame = camera.image + end = time.time() + print("Success after {} s".format(end -start)) + except PyTango.DevFailed: + end = time.time() + print("Timeout after {} s".format(end - start)) + + camera.Stop() + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--device', '-d', type=str, help="TANGO device path") + + args = parser.parse_args() + + camera = PyTango.DeviceProxy(args.device) + grab(camera, 100000, False) + grab(camera, 100000, True) + grab(camera, 300000, False) + grab(camera, 300000, True) |