summaryrefslogtreecommitdiffstats
path: root/tests/roi.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/roi.py')
-rw-r--r--tests/roi.py35
1 files changed, 35 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)