-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMSTAparser.py
94 lines (73 loc) · 1.76 KB
/
MSTAparser.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
import numpy as np
class MSTA():
def __init__(self,val):
assert(type(val)==int)
assert(val>0)
self.val = val
self.MSTA = {
'DIRECTION':1,
'DONE':2,
'PLUS_LS':3,
'HOMELS':4,
'Unused':5,
'POSITION':6,
'SLIP_STALL':7,
'HOME':8,
'PRESENT':9,
'PROBLEM':10,
'MOVING':11,
'GAIN_SUPPORT':12,
'COMM_ERR':13,
'MINUS_LS':14,
'HOMED':15}
def check(self,PV):
key = self.MSTA[PV]
bitkey = len(self.MSTA) - key
string = np.binary_repr(self.val)
bit = int(string[bitkey])
return bit
@property
def direction(self):
return self.check('DIRECTION')
@property
def done(self):
return self.check('DONE')
@property
def plus_ls(self):
return self.check('PLUS_LS')
@property
def homels(self):
return self.check('HOMELS')
@property
def unused(self):
return self.check('Unused')
@property
def position(self):
return self.check('POSITION')
@property
def slip_stall(self):
return self.check('SLIP_STALL')
@property
def home(self):
return self.check('HOME')
@property
def present(self):
return self.check('PRESENT')
@property
def problem(self):
return self.check('PROBLEM')
@property
def moving(self):
return self.check('MOVING')
@property
def gain_support(self):
return self.check('GAIN_SUPPORT')
@property
def comm_err(self):
return self.check('COMM_ERR')
@property
def minus_ls(self):
return self.check('MINUS_LS')
@property
def homed(self):
return self.check('HOMED')