-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpseudoCounterAltOn.py
More file actions
26 lines (19 loc) · 882 Bytes
/
pseudoCounterAltOn.py
File metadata and controls
26 lines (19 loc) · 882 Bytes
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
from sardana.pool.controller import PseudoCounterController
import PyTango
class pseudoCounterAltOn(PseudoCounterController):
""" A simple pseudo counter which receives two counter values (I and I0)
and returns I/I0"""
counter_roles = ('I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', 'I8', )
pseudo_counter_roles = ('O1', 'O2', 'O3', 'O4', 'O5', 'O6', 'O7', 'O8',)
value = [0,0,0,0,0,0,0,0]
field = 0
def __init__(self, inst, props):
PseudoCounterController.__init__(self, inst, props)
self.magnet = PyTango.DeviceProxy("motor/caenfastpsctrl/0")
def Calc(self, axis, counters):
counter = counters[axis-1]
if axis == 1:
self.field = self.magnet.position
if self.field < 0:
self.value[axis-1] = counter
return self.value[axis-1]