From 7fe6dc60ea3a0b6a318ec525fe43055f4266bdf5 Mon Sep 17 00:00:00 2001 From: CaseyBatten Date: Wed, 21 Feb 2024 09:59:49 -0500 Subject: [PATCH] iteration logic cleanup --- .../opentrons/protocol_engine/state/tips.py | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/api/src/opentrons/protocol_engine/state/tips.py b/api/src/opentrons/protocol_engine/state/tips.py index 16c75e40a4a..62697e52123 100644 --- a/api/src/opentrons/protocol_engine/state/tips.py +++ b/api/src/opentrons/protocol_engine/state/tips.py @@ -248,13 +248,11 @@ def _validate_tip_cluster(tip_cluster: List[str]) -> Optional[str]: # Move on to the row above or column to the left if critical_row - num_nozzle_rows > 0: critical_row = critical_row - num_nozzle_rows - elif critical_column - num_nozzle_cols > 0: + else: critical_column = critical_column - 1 critical_row = ( len(columns[critical_column]) - num_nozzle_rows ) - else: - critical_column = -1 return None elif self._state.nozzle_map.starting_nozzle == "A12": @@ -262,7 +260,7 @@ def _validate_tip_cluster(tip_cluster: List[str]) -> Optional[str]: critical_column = num_nozzle_cols - 1 critical_row = len(columns[critical_column]) - num_nozzle_rows - while critical_column <= 12: + while critical_column <= len(columns): # change to max size of labware tip_cluster = _identify_tip_cluster(critical_column, critical_row) result = _validate_tip_cluster(tip_cluster) if isinstance(result, str): @@ -272,13 +270,11 @@ def _validate_tip_cluster(tip_cluster: List[str]) -> Optional[str]: # Move on to the row above or column to the right if critical_row - num_nozzle_rows > 0: critical_row = critical_row - num_nozzle_rows - elif critical_column + num_nozzle_cols < 12: + else: critical_column = critical_column + 1 critical_row = ( len(columns[critical_column]) - num_nozzle_rows ) - else: - critical_column = 13 return None elif self._state.nozzle_map.starting_nozzle == "H1": @@ -294,13 +290,11 @@ def _validate_tip_cluster(tip_cluster: List[str]) -> Optional[str]: return result elif result is None: # Move on to the row above or column to the right - if critical_row + num_nozzle_rows < 8: + if critical_row + num_nozzle_rows < len(columns[0]): critical_row = critical_row + num_nozzle_rows - elif critical_column - num_nozzle_cols > 0: + else: critical_column = critical_column - 1 critical_row = num_nozzle_rows - 1 - else: - critical_column = -1 return None elif self._state.nozzle_map.starting_nozzle == "H12": @@ -308,7 +302,7 @@ def _validate_tip_cluster(tip_cluster: List[str]) -> Optional[str]: critical_column = num_nozzle_cols - 1 critical_row = num_nozzle_rows - 1 - while critical_column <= 12: + while critical_column <= len(columns): tip_cluster = _identify_tip_cluster(critical_column, critical_row) result = _validate_tip_cluster(tip_cluster) if isinstance(result, str): @@ -316,13 +310,11 @@ def _validate_tip_cluster(tip_cluster: List[str]) -> Optional[str]: return result elif result is None: # Move on to the row above or column to the right - if critical_row + num_nozzle_rows < 8: + if critical_row + num_nozzle_rows < len(columns[0]): critical_row = critical_row + num_nozzle_rows - elif critical_column + num_nozzle_cols < 12: + else: critical_column = critical_column + 1 critical_row = num_nozzle_rows - 1 - else: - critical_column = 13 return None else: