Skip to content

Commit ade4337

Browse files
committed
Interleave squid acquire from fridge
1 parent 1c2a00b commit ade4337

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

cellpainter/cellpainter/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def main():
111111
def cmdline_to_log(cmdline: str):
112112
cmdname = 'cellpainter'
113113
print(cmdline, shlex.split(cmdline))
114-
args, _ = arg.parse_args(Args, args=[cmdname, *shlex.split(cmdline)], exit_on_error=False)
114+
args, _ = arg.parse_args(Args, args=[*shlex.split(cmdline)], exit_on_error=False)
115115
pbutils.pr(args)
116116
if args.log_file_for_visualize:
117117
return Log.connect(args.log_file_for_visualize)

cellpainter/cellpainter/gui/start_form.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def from_config(config: RuntimeConfig):
151151
'1x5': {'project': '', 'plate': ''},
152152
'1x3': {'project': 'sim', 'plate': 'S02'},
153153
},
154-
# **{f'3x{i}': {'project': 'sim', 'plate': f'T{i:03}'} for i in range(100)}
154+
**{f'3x{i}': {'project': 'sim', 'plate': f'T{i:03}'} for i in range(100)}
155155
},
156156
last_barcode = f'PT{random.randint(0, 999999):06}',
157157
squid_protocols = '''

cellpainter/cellpainter/small_protocols.py

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -988,37 +988,66 @@ def squid_acquire_from_fridge(args: SmallProtocolArgs) -> Program:
988988
raise ValueError('Specify some RT time. Example: "1800" for 30 minutes')
989989
if not plates:
990990
raise ValueError('Select some plates.')
991+
ilv = Interleaving.init('''
992+
fridge -> H13
993+
H13 -> squid
994+
fridge -> H13
995+
squid -> fridge
996+
H13 -> squid
997+
fridge -> H13
998+
squid -> fridge
999+
H13 -> squid
1000+
squid -> fridge
1001+
''')
9911002
checks: list[Command] = []
1003+
chunks: dict[tuple[str, int], list[Command]] = {}
9921004
for i, plate in enumerate(plates, start=1):
9931005
protocol_path, project, barcode, name = plate.split(':')
9941006
assert_valid_project_name(project)
9951007
checks += [SquidStageCmd('check_protocol_exists', protocol_path).fork_and_wait()]
9961008
plus_secs = dict(enumerate(RT_time_secs, start=1)).get(i, RT_time_secs[-1])
997-
cmds += [
1009+
chunks['fridge -> H13', i] = [
9981010
FridgeEject(plate=barcode, project=project, check_barcode=False).fork_and_wait(),
9991011
Checkpoint(f'RT {i}'),
10001012
PFCmd(f'fridge-to-H11'),
1001-
SquidStageCmd('goto_loading').fork_and_wait(),
1013+
PFCmd(f'H11-to-H13') if i > 1 else Noop(),
1014+
]
1015+
chunks['H13 -> squid', i] = [
1016+
SquidStageCmd('goto_loading').fork(),
1017+
PFCmd(f'H13-to-H11') if i > 1 else Noop(),
1018+
WaitForResource('squid'),
10021019
PFCmd(f'H11-to-squid'),
1003-
10041020
Seq(
10051021
SquidStageCmd('leave_loading'),
10061022
SquidStageCmd('goto_loading'), # go back and forth a few times
10071023
SquidStageCmd('leave_loading'), # go back and forth a few times
10081024
WaitForCheckpoint(f'RT {i}', plus_secs=plus_secs, assume='nothing'),
1025+
WaitForCheckpoint(f'Ok to start {i}', assume='nothing'),
10091026
SquidAcquire(protocol_path, project=project, plate=name),
1010-
).fork_and_wait(),
1011-
1027+
Checkpoint(f'Done {i}'),
1028+
).fork(),
1029+
]
1030+
chunks['squid -> fridge', i] = [
1031+
Checkpoint(f'Ok to start {i}'),
1032+
WaitForCheckpoint(f'Done {i}', assume='nothing'),
10121033
SquidStageCmd('goto_loading').fork_and_wait(),
10131034
PFCmd(f'squid-to-H11'),
1014-
SquidStageCmd('leave_loading').fork_and_wait(),
1035+
SquidStageCmd('leave_loading').fork(),
10151036
BarcodeClear(),
10161037
PFCmd(f'H11-to-fridge'),
10171038
FridgeInsert(
10181039
project,
10191040
assume_barcode=barcode,
1020-
).fork_and_wait(),
1041+
).fork(),
10211042
]
1043+
for i, substep in ilv.inst(list([i for i, _ in enumerate(plates, start=1)])):
1044+
chunk = Seq(*chunks[substep, i])
1045+
chunk = chunk.transform(lambda cmd: cmd.add(Metadata(plate_id=str(i))) if isinstance(cmd, SquidAcquire) else cmd)
1046+
if substep == 'squid -> fridge':
1047+
t = 10 * (i // 10)
1048+
name = f'({1 + t}-{10 + t})'
1049+
chunk = chunk.add(Metadata(section=name))
1050+
cmds += [chunk]
10221051
cmd = Seq(*checks, *cmds)
10231052
return Program(cmd)
10241053

0 commit comments

Comments
 (0)