forked from mxcube/HardwareObjects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSampleChangerMockup.py
134 lines (101 loc) · 3.66 KB
/
SampleChangerMockup.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
from sample_changer.GenericSampleChanger import *
"""
class Pin(Sample):
STD_HOLDERLENGTH = 22.0
def __init__(self,basket,basket_no,sample_no):
super(Pin, self).__init__(basket, Pin.getSampleAddress(basket_no,sample_no), False)
self._setHolderLength(Pin.STD_HOLDERLENGTH)
def getBasketNo(self):
return self.getContainer().getIndex()+1
def getVialNo(self):
return self.getIndex()+1
@staticmethod
def getSampleAddress(basket_number, sample_number):
return str(basket_number) + ":" + "%02d" % (sample_number)
class Basket(Container):
__TYPE__ = "Puck"
NO_OF_SAMPLES_PER_PUCK = 10
def __init__(self,container,number):
super(Basket, self).__init__(self.__TYPE__,container,Basket.getBasketAddress(number),True)
for i in range(Basket.NO_OF_SAMPLES_PER_PUCK):
slot = Pin(self,number,i+1)
self._addComponent(slot)
@staticmethod
def getBasketAddress(basket_number):
return str(basket_number)
def clearInfo(self):
self.getContainer()._triggerInfoChangedEvent()
"""
class SampleChangerMockup(SampleChanger):
__TYPE__ = "SC3"
NO_OF_BASKETS = 17
def __init__(self, *args, **kwargs):
super(SampleChangerMockup, self).__init__(self.__TYPE__,False, *args, **kwargs)
def init(self):
self._selected_sample = 1
self._selected_basket = 1
self._scIsCharging = None
for i in range(5):
basket = Basket(self,i+1)
self._addComponent(basket)
self._initSCContents()
SampleChanger.init(self)
def load_sample(self, holder_length, sample_location, wait):
return
def load(self, sample, wait):
self._setState(SampleChangerState.Ready)
return sample
def unload(self, sample_slot, wait):
return
def getBasketList(self):
basket_list = []
for basket in self.components:
if isinstance(basket, Basket):
basket_list.append(basket)
return basket_list
def _doAbort(self):
return
def _doChangeMode(self):
return
def _doUpdateInfo(self):
return
def _doChangeMode(self,mode):
return
def _doSelect(self,component):
return
def _doScan(self,component,recursive):
return
def _doLoad(self,sample=None):
return
def _doUnload(self,sample_slot=None):
return
def _doAbort(self):
return
def _doReset(self):
return
def _initSCContents(self):
"""
Initializes the sample changer content with default values.
:returns: None
:rtype: None
"""
basket_list= [('', 4)] * 5
for basket_index in range(5):
basket=self.getComponents()[basket_index]
datamatrix = None
present = scanned = False
basket._setInfo(present, datamatrix, scanned)
sample_list=[]
for basket_index in range(5):
for sample_index in range(10):
sample_list.append(("", basket_index+1, sample_index+1, 1, Pin.STD_HOLDERLENGTH))
for spl in sample_list:
sample = self.getComponentByAddress(Pin.getSampleAddress(spl[1], spl[2]))
datamatrix = "matr%d_%d" %(spl[1], spl[2])
present = scanned = loaded = has_been_loaded = False
sample._setInfo(present, datamatrix, scanned)
sample._setLoaded(loaded, has_been_loaded)
sample._setHolderLength(spl[4])
mounted_sample = self.getComponentByAddress(Pin.getSampleAddress(1,1))
mounted_sample._setLoaded(True, False)
self._setState(SampleChangerState.Ready)