Skip to content

Commit

Permalink
Fix prioritization of wash to disp
Browse files Browse the repository at this point in the history
  • Loading branch information
danr committed Feb 20, 2024
1 parent 803b8fa commit 1aebf10
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
5 changes: 4 additions & 1 deletion cellpainter/cellpainter/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from typing import *
from dataclasses import *

import sys

from .symbolic import Symbolic
from .commands import *

Expand Down Expand Up @@ -46,7 +48,8 @@ def Opt(cmd: Command) -> Command:
opt = optimal_env(cmd_inst)
ends |= opt.expected_ends
subst |= opt.env
pbutils.pr(opt)
print('... ', end='', file=sys.stderr, flush=True)
# pbutils.pr(opt)
return cmd_inst.resolve(opt.env)
else:
return cmd
Expand Down
22 changes: 14 additions & 8 deletions cellpainter/cellpainter/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@
import pbutils

class OptPrio:
incubation = Min(priority=7, weight=1)
wash_to_disp = Min(priority=6, weight=1)
incu_slack = Min(priority=6, weight=1)
without_lid = Min(priority=4, weight=1)
total_time = Min(priority=3, weight=1)
squeeze_steps = Min(priority=2, weight=1)
inside_incu = Max(priority=1, weight=0)
incubation = Min(priority=8, weight=1)
wash_to_disp = Min(priority=7, weight=1)
total_time = Min(priority=6, weight=1)
without_lid = Min(priority=5, weight=1)
inside_incu = Max(priority=4, weight=1)
squeeze_steps = Min(priority=3, weight=1)

# incu_slack = Min(priority=6, weight=1)

@dataclass(frozen=True)
class Plate:
Expand Down Expand Up @@ -535,6 +536,7 @@ def paint_batch(batch: list[Plate], protocol_config: ProtocolConfig) -> Command:
]

post_cmds = [
Duration(f'batch {batch_index}', OptPrio.total_time),
]

chunks: dict[Desc, Iterable[Command]] = {}
Expand Down Expand Up @@ -759,7 +761,11 @@ def paint_batch(batch: list[Plate], protocol_config: ProtocolConfig) -> Command:
Fork(
Seq(
*(wash_delay if not step.wash and not step.blue else []),
Duration(f'{plate_desc} transfer {ix}', OptPrio.wash_to_disp),
*(
[Duration(f'{plate_desc} transfer {ix}', OptPrio.wash_to_disp)]
if step.wash or step.blue else
[]
),
DispCmd('RunValidated', step.disp),
Checkpoint(f'{plate_desc} incubation {ix}'),
)
Expand Down

0 comments on commit 1aebf10

Please sign in to comment.