@@ -68,7 +68,7 @@ def evo_get_selection(rows: int, cols: int, selected: np.ndarray) -> str:
6868 Code string for well selection of pipetting actions in EvoWare scripts (.esc)
6969 """
7070 # apply bit mask with 7 bits, adapted from function detailed in EvoWare manual
71- selection = f"0 { to_hex (cols )} { rows :02d } "
71+ selection = f"{ to_hex (cols ):0>2 } { to_hex ( rows ):0>2 } "
7272 bit_counter = 0
7373 bit_mask = 0
7474 for x in range (cols ):
@@ -83,16 +83,6 @@ def evo_get_selection(rows: int, cols: int, selected: np.ndarray) -> str:
8383 if bit_counter > 0 :
8484 selection += chr (bit_mask + 48 )
8585
86- # check if wells from more than one column are selected and raise Exception if so
87- check = 0
88- for column in selected .transpose ():
89- if sum (column ) >= 1 :
90- check += 1
91- if check >= 2 :
92- raise ValueError (
93- "Wells from more than one column are selected.\n Select only wells from one column per pipetting action."
94- )
95-
9686 return selection
9787
9888
@@ -212,6 +202,16 @@ def prepare_evo_aspirate_dispense_parameters(
212202 return wells_list , labware_position , volume_list , liquid_class , tecan_tips
213203
214204
205+ def require_single_column_selection (selection : np .ndarray ):
206+ """Raises an error if wells from more than one column are selected."""
207+ ncols = np .any (selection > 0 , axis = 0 ).sum ()
208+ if ncols >= 2 :
209+ raise ValueError (
210+ "Wells from more than one column are selected.\n Select only wells from one column per pipetting action."
211+ )
212+ return
213+
214+
215215def evo_aspirate (
216216 * ,
217217 n_rows : int ,
@@ -283,6 +283,7 @@ def evo_aspirate(
283283
284284 # convert selection from list of well ids to numpy array with same dimensions as target labware (1: well is selected, 0: well is not selected)
285285 selected = evo_make_selection_array (n_rows , n_columns , wells )
286+ require_single_column_selection (selected )
286287 # create code string containing information about target well(s)
287288 code_string = evo_get_selection (n_rows , n_columns , selected )
288289 return f'B;Aspirate({ tip_selection } ,"{ liquid_class } ",{ tip_volumes } 0,0,0,0,{ labware_position [0 ]} ,{ labware_position [1 ]} ,1,"{ code_string } ",0,{ arm } );'
@@ -359,6 +360,7 @@ def evo_dispense(
359360
360361 # convert selection from list of well ids to numpy array with same dimensions as target labware (1: well is selected, 0: well is not selected)
361362 selected = evo_make_selection_array (n_rows , n_columns , wells )
363+ require_single_column_selection (selected )
362364 # create code string containing information about target well(s)
363365 code_string = evo_get_selection (n_rows , n_columns , selected )
364366 return f'B;Dispense({ tip_selection } ,"{ liquid_class } ",{ tip_volumes } 0,0,0,0,{ labware_position [0 ]} ,{ labware_position [1 ]} ,1,"{ code_string } ",0,{ arm } );'
0 commit comments