Skip to content

Commit

Permalink
fixed bugs from payload commit
Browse files Browse the repository at this point in the history
  • Loading branch information
abestroka committed Dec 18, 2024
1 parent 361a9de commit 50a84ed
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 27 deletions.
23 changes: 14 additions & 9 deletions ot2_driver/protopiler/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,17 @@ def check_list_lengths_match(self) -> "Transfer":
"multi_blow_out",
"multi_drop_tip",
]

for field in listable_fields:

if isinstance(getattr(self, field), str):
if "payload" in getattr(self, field) or ":" in getattr(self,field):
continue # skip this iteration and leave the value that contains a payload as is

else:
setattr(self, field, [getattr(self, field)])

# if not already handled in string block and is not a list
if not isinstance(getattr(self, field), str) and not isinstance(getattr(self, field), list):
# convert the value into a list of of the value
setattr(self, field, [getattr(self, field)])
# if not isinstance(getattr(self, field), str) and not isinstance(getattr(self, field), list):
# # convert the value into a list of of the value
# setattr(self, field, [getattr(self, field)])

if isinstance(getattr(self, field), list): # just look to see if you have user entered lists of different lengths
if iter_len == 0:
Expand All @@ -207,11 +204,19 @@ def check_list_lengths_match(self) -> "Transfer":
)
if iter_len > 0:
for field in listable_fields:
###TODO
#had to put changing things to list here, so that conditional doesn't catch on first validation
if not isinstance(getattr(self, field), str) and not isinstance(getattr(self, field), list):
setattr(self, field, [getattr(self, field)])
###
if "payload" in getattr(self, field) and isinstance(getattr(self, field), str):
pass
elif not isinstance(getattr(self, field), list):
setattr(self, field, [getattr(self, field)] * iter_len)

#TODO
# elif not isinstance(getattr(self, field), list):
#should be redundant because everything is now list
else:
setattr(self, field, getattr(self, field) * iter_len)
pass
return self


Expand Down
2 changes: 0 additions & 2 deletions ot2_driver/protopiler/protopiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,6 @@ def _create_commands(self, payload: Optional[Dict]) -> List[str]:
pipette_mount
]
new_src = copy.copy(src)

new_src = new_src.replace("'", "")
new_src = new_src.split(":")[-1]
new_src = new_src.strip("][").split(", ")
Expand Down Expand Up @@ -1340,7 +1339,6 @@ def _process_multi_instruction(

# Ensure that the command block is a properly validated Multi_Transfer
command_block = Multi_Transfer.model_validate(command_block)

for row in zip(
command_block.multi_volume,
command_block.multi_source,
Expand Down
74 changes: 58 additions & 16 deletions ot2_driver/protopiler/test_configs/flex_test.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,69 @@
# equipment:
# - name: nest_96_wellplate_2ml_deep
# location: "2"
# alias: plate
# offset: [0, 1.7, 3.9]
# - name: opentrons_flex_96_tiprack_200ul
# location: "11"
# offset: [0.5, 0.9, -0.3]
# # - name: flex_1channel_50
# # mount: left
# - name: flex_8channel_1000
# mount: right
# - name: trash
# location: "4"

# commands:
# # - name: test
# # command: transfer
# # source: 2:[A1, A2, A3]
# # aspirate_clearance: 2
# # destination: 2:[A4, A5, A6]
# # dispense_clearance: 2
# # volume: [10, 10, 10]
# # mix_cycles: 0
# # mix_volume: 0
# # drop_tip: [false, false, true]

# - name: test
# command: multi_transfer
# multi_source: 2:[[A1, B1, C1], [A2, B2, C2], [A3, B3, C3]]
# # multi_source: 2:[["A1", "B1", "C1"], ["A2", "B2", "C2"], ["A3", "B3", "C3"]]
# multi_aspirate_clearance: 1
# multi_destination: 2:[[A4, B4, C4], [A5, B5, C5], [A6, B6, C6]]
# # multi_destination: 2:[["A4", "B4", "C4"], ["A5", "B5", "C5"], ["A6", "B6", "C6"]]
# multi_dispense_clearance: 1
# multi_volume: 200

# metadata:
# protocolName: Flex test
# author: Abe [email protected]
# description: testing flex protocol generation
# apiLevel: "2.18"

# requirements:
# robotType: Flex


equipment:
- name: nest_96_wellplate_2ml_deep
location: "2"
location: "1"
alias: plate
offset: [0, 1.7, 3.9]
- name: opentrons_flex_96_tiprack_200ul
location: "11"
location: "9"
offset: [0.5, 0.9, -0.3]
# - name: flex_1channel_50
# mount: left
# - name: flex_1channel_1000
# mount: right
- name: flex_8channel_1000
mount: right
- name: trash
location: "4"

commands:
# - name: test
# command: transfer
# source: 2:[A1, A2, A3]
# source: 1:A1
# aspirate_clearance: 2
# destination: 2:[A4, A5, A6]
# destination: 1:A4
# dispense_clearance: 2
# volume: [10, 10, 10]
# mix_cycles: 0
Expand All @@ -27,20 +72,17 @@ commands:

- name: test
command: multi_transfer
multi_source: 2:[[A1, B1, C1], [A2, B2, C2], [A3, B3, C3]]
# multi_source: 2:[["A1", "B1", "C1"], ["A2", "B2", "C2"], ["A3", "B3", "C3"]]
multi_source: 1:[[A1, B1, C1], [A2, B2, C2], [A3, B3, C3]]
multi_aspirate_clearance: 1
multi_destination: 2:[[A4, B4, C4], [A5, B5, C5], [A6, B6, C6]]
# multi_destination: 2:[["A4", "B4", "C4"], ["A5", "B5", "C5"], ["A6", "B6", "C6"]]
multi_destination: 1:[[A4, B4, C4], [A5, B5, C5], [A6, B6, C6]]
multi_dispense_clearance: 1
multi_volume: 200
multi_volume: 10

metadata:
protocolName: Flex test
author: Abe [email protected]
description: testing flex protocol generation
apiLevel: "2.18"
apiLevel: "2.12"

requirements:
robotType: Flex

robotType: Flex

0 comments on commit 50a84ed

Please sign in to comment.