Skip to content

Commit 115f5d4

Browse files
committed
Start batch two from R incu
1 parent c893da5 commit 115f5d4

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

cellpainter/cellpainter/protocol.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,24 @@ class Locations:
9393
B: list[str] = [f'B{i}' for i in HB]
9494

9595
Lid: list[str] = ['B19', 'B17']
96-
Incu: list[str] = [f'L{i}' for i in I] + [f'R{i}' for i in I]
9796
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+
98108
Out: dict[str, list[str]] = {
99109
'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)
102112
}
103113

104-
'''
105-
8,8: 4.5s
106-
10,10: 8.9s
107-
14,14: 114s
108-
16,16: 130s
109-
16: 10s
110-
'''
111-
112114
def initial_world(plates: list[Plate], p: ProtocolConfig) -> World:
113115
if p.steps and p.steps[0].name in ['Mito', 'PFA']:
114116
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]]:
123125
for batch_index, batch_size in enumerate(batch_sizes):
124126
assert batch_size > 0
125127

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)
129131
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())}.')
131137

132138
batch: list[Plate] = []
133139
rt = Locations.RT
134140
for index_in_batch in range(batch_size):
135141
batch += [Plate(
136142
id=f'{index+1}',
137-
incu_loc=Locations.Incu[index],
143+
incu_loc=Incu[index_in_batch],
138144
rt_loc=rt[index_in_batch],
139145
# lid_loc=Locations.Lid[index_in_batch],
140146
lid_loc=Locations.Lid[index_in_batch % 2],

0 commit comments

Comments
 (0)