forked from labscript-suite/labscript-devices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPythonCamera.py
51 lines (42 loc) · 2.23 KB
/
PythonCamera.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#####################################################################
# #
# /labscript_devices/PythonCamera.py #
# #
# Copyright 2013, Monash University #
# #
# This file is part of labscript_devices, in the labscript suite #
# (see http://labscriptsuite.org), and is licensed under the #
# Simplified BSD License. See the license.txt file in the root of #
# the project for the full license. #
# #
#####################################################################
from __future__ import print_function, unicode_literals, absolute_import, division
try:
from labscript_utils import check_version
except ImportError:
raise ImportError('Require labscript_utils > 2.1.0')
check_version('labscript', '2.0.1', '3')
from labscript_devices import BLACS_tab
from labscript_devices.Camera import Camera, CameraTab
from labscript import set_passed_properties
class PythonCamera(Camera):
"""A class for new features not compatible with the legacy Camera class"""
description = 'Python camera'
@set_passed_properties(
property_names = {
"device_properties": ["acquisition_ROI"]}
)
def __init__(self, *args, **kwargs):
self.acquisition_ROI = kwargs.pop('acquisition_ROI', None)
Camera.__init__(self, *args, **kwargs)
def set_acquisition_ROI(self, acquisition_ROI):
# acq_ROI is a tuple of form (width, height, offset_X, offset_Y) This
# method can be used in a script to overwrite a camera's acquisition_ROI
# after instantiation, so that BlACS does not detect a connection table
# change on disk when the same file is being imported by experiment scripts
# and used as the lab connection table.
self.set_property('acquisition_ROI', acquisition_ROI,
location='device_properties', overwrite=True)
@BLACS_tab
class PythonCameraTab(CameraTab):
pass