-
Notifications
You must be signed in to change notification settings - Fork 1
/
GreateyesTangoTwoDController.py
92 lines (74 loc) · 3.17 KB
/
GreateyesTangoTwoDController.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from tango import DeviceProxy
from sardana.pool.controller import TwoDController, Referable, Type, Description, DefaultValue, FGet, FSet
class GreateyesTangoTwoDController(TwoDController, Referable):
"""The most basic controller intended from demonstration purposes only.
This is the absolute minimum you have to implement to set a proper counter
controller able to get a counter value, get a counter state and do an
acquisition.
This example is so basic that it is not even directly described in the
documentation"""
ctrl_properties = {'tangoFQDN': {Type: str,
Description: 'The FQDN of the greateyes tango DS',
DefaultValue: 'greateyes.hhg.lab'},
}
axis_attributes = {
"SavingEnabled": {
Type: bool,
FGet: "isSavingEnabled",
FSet: "setSavingEnabled",
Description: ("Enable/disable saving of images in HDF5 files."
" Use with care in high demanding (fast)"
" acquisitions. Trying to save at high rate may"
" hang the acquisition process."),
}
}
def AddDevice(self, axis):
self._axes[axis] = {}
def DeleteDevice(self, axis):
self._axes.pop(axis)
def __init__(self, inst, props, *args, **kwargs):
"""Constructor"""
TwoDController.__init__(self,inst,props, *args, **kwargs)
print ('GreatEyes Tango Initialization ...')
self.proxy = DeviceProxy(self.tangoFQDN)
print ('SUCCESS')
self._axes = {}
def ReadOne(self, axis):
"""Get the specified counter value"""
#print(self._SavingEnabled)
#print('Image saved to: {:s}'.format(self.proxy.LastSavedImage))
return self.proxy.image
def RefOne(self, axis):
return self.proxy.LastSavedImage
def SetAxisPar(self, axis, parameter, value):
# if parameter == "value_ref_pattern":
# print('value_ref_pattern ' + str(value))
# elif parameter == "value_ref_enabled":
# print('value_ref_enabled ' + str(value))
# self.setSavingEnabled(axis, value)
pass
def StateOne(self, axis):
"""Get the specified counter state"""
#
return self.proxy.State(), "Counter is acquiring or not"
def PrepareOne(self, axis, value, repetitions, latency, nb_starts):
# set exporsure time of GE cam
self.proxy.ExposureTime = float(value)
def LoadOne(self, axis, value, repetitions, latency):
pass
def StartOne(self, axis, value=None):
"""acquire the specified counter"""
self.proxy.StartAcq()
return
def StopOne(self, axis):
"""Stop the specified counter"""
pass
#self.proxy.StopAcq()
def AbortOne(self, axis):
"""Abort the specified counter"""
pass
#self.proxy.StopAcq()
def isSavingEnabled(self, axis):
return bool(self.proxy.SaveImageFiles)
def setSavingEnabled(self, axis, value):
self.proxy.SaveImageFiles = bool(value)