@@ -988,37 +988,66 @@ def squid_acquire_from_fridge(args: SmallProtocolArgs) -> Program:
988
988
raise ValueError ('Specify some RT time. Example: "1800" for 30 minutes' )
989
989
if not plates :
990
990
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
+ ''' )
991
1002
checks : list [Command ] = []
1003
+ chunks : dict [tuple [str , int ], list [Command ]] = {}
992
1004
for i , plate in enumerate (plates , start = 1 ):
993
1005
protocol_path , project , barcode , name = plate .split (':' )
994
1006
assert_valid_project_name (project )
995
1007
checks += [SquidStageCmd ('check_protocol_exists' , protocol_path ).fork_and_wait ()]
996
1008
plus_secs = dict (enumerate (RT_time_secs , start = 1 )).get (i , RT_time_secs [- 1 ])
997
- cmds + = [
1009
+ chunks [ 'fridge -> H13' , i ] = [
998
1010
FridgeEject (plate = barcode , project = project , check_barcode = False ).fork_and_wait (),
999
1011
Checkpoint (f'RT { i } ' ),
1000
1012
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' ),
1002
1019
PFCmd (f'H11-to-squid' ),
1003
-
1004
1020
Seq (
1005
1021
SquidStageCmd ('leave_loading' ),
1006
1022
SquidStageCmd ('goto_loading' ), # go back and forth a few times
1007
1023
SquidStageCmd ('leave_loading' ), # go back and forth a few times
1008
1024
WaitForCheckpoint (f'RT { i } ' , plus_secs = plus_secs , assume = 'nothing' ),
1025
+ WaitForCheckpoint (f'Ok to start { i } ' , assume = 'nothing' ),
1009
1026
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' ),
1012
1033
SquidStageCmd ('goto_loading' ).fork_and_wait (),
1013
1034
PFCmd (f'squid-to-H11' ),
1014
- SquidStageCmd ('leave_loading' ).fork_and_wait (),
1035
+ SquidStageCmd ('leave_loading' ).fork (),
1015
1036
BarcodeClear (),
1016
1037
PFCmd (f'H11-to-fridge' ),
1017
1038
FridgeInsert (
1018
1039
project ,
1019
1040
assume_barcode = barcode ,
1020
- ).fork_and_wait (),
1041
+ ).fork (),
1021
1042
]
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 ]
1022
1051
cmd = Seq (* checks , * cmds )
1023
1052
return Program (cmd )
1024
1053
0 commit comments