@@ -93,22 +93,24 @@ class Locations:
93
93
B : list [str ] = [f'B{ i } ' for i in HB ]
94
94
95
95
Lid : list [str ] = ['B19' , 'B17' ]
96
- Incu : list [str ] = [f'L{ i } ' for i in I ] + [f'R{ i } ' for i in I ]
97
96
RT : list [str ] = A [:21 ]
97
+
98
+ L : list [str ] = [f'L{ i } ' for i in I ]
99
+ R : list [str ] = [f'R{ i } ' for i in I ]
100
+ Incu : list [str ] = [* L , * R ]
101
+
102
+ IncuPerBatch : dict [str , list [str ]] = {
103
+ '1 of 1' : L ,
104
+ '1 of 2' : L ,
105
+ '2 of 2' : R ,
106
+ }
107
+
98
108
Out : dict [str , list [str ]] = {
99
109
'1 of 1' : A [:21 ],
100
- '2 of 2' : A [: 17 ], # up to 17 plates, last batch goes to A
101
- '1 of 2' : B [ 4 :][:: - 1 ] + A [ 17 :][:: - 1 ], # first batch goes to B then starts to fill A from below
110
+ '1 of 2' : B [ 4 :] + A [ 18 : ], # 1st batch goes to B then starts to fill remaining locations in A (with one gap)
111
+ '2 of 2' : A [: 17 ], # 2nd batch goes to A (up to 17 plates)
102
112
}
103
113
104
- '''
105
- 8,8: 4.5s
106
- 10,10: 8.9s
107
- 14,14: 114s
108
- 16,16: 130s
109
- 16: 10s
110
- '''
111
-
112
114
def initial_world (plates : list [Plate ], p : ProtocolConfig ) -> World :
113
115
if p .steps and p .steps [0 ].name in ['Mito' , 'PFA' ]:
114
116
return World ({p .incu_loc : p .id for p in plates })
@@ -123,18 +125,22 @@ def define_plates(batch_sizes: list[int]) -> list[list[Plate]]:
123
125
for batch_index , batch_size in enumerate (batch_sizes ):
124
126
assert batch_size > 0
125
127
126
- out_key = f'{ batch_index + 1 } of { len (batch_sizes )} '
127
- Out = Locations . Out . get ( out_key )
128
- # print(out_key, len( Out), Out )
128
+ batch_key = f'{ batch_index + 1 } of { len (batch_sizes )} '
129
+
130
+ Out = Locations . Out . get ( batch_key )
129
131
if not Out :
130
- raise ValueError (f'This configuration of batches, { out_key } , not defined. Try one of { ", " .join (Locations .Out .keys ())} .' )
132
+ raise ValueError (f'The batch { batch_key } is not defined for output locations. Try one of { ", " .join (Locations .Out .keys ())} .' )
133
+
134
+ Incu = Locations .IncuPerBatch .get (batch_key )
135
+ if not Incu :
136
+ raise ValueError (f'The batch { batch_key } is not defined for incubator locations. Try one of { ", " .join (Locations .IncuPerBatch .keys ())} .' )
131
137
132
138
batch : list [Plate ] = []
133
139
rt = Locations .RT
134
140
for index_in_batch in range (batch_size ):
135
141
batch += [Plate (
136
142
id = f'{ index + 1 } ' ,
137
- incu_loc = Locations . Incu [index ],
143
+ incu_loc = Incu [index_in_batch ],
138
144
rt_loc = rt [index_in_batch ],
139
145
# lid_loc=Locations.Lid[index_in_batch],
140
146
lid_loc = Locations .Lid [index_in_batch % 2 ],
0 commit comments