@@ -68,7 +68,7 @@ def evo_get_selection(rows: int, cols: int, selected: np.ndarray) -> str:
68
68
Code string for well selection of pipetting actions in EvoWare scripts (.esc)
69
69
"""
70
70
# 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 } "
72
72
bit_counter = 0
73
73
bit_mask = 0
74
74
for x in range (cols ):
@@ -83,16 +83,6 @@ def evo_get_selection(rows: int, cols: int, selected: np.ndarray) -> str:
83
83
if bit_counter > 0 :
84
84
selection += chr (bit_mask + 48 )
85
85
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
-
96
86
return selection
97
87
98
88
@@ -212,6 +202,16 @@ def prepare_evo_aspirate_dispense_parameters(
212
202
return wells_list , labware_position , volume_list , liquid_class , tecan_tips
213
203
214
204
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
+
215
215
def evo_aspirate (
216
216
* ,
217
217
n_rows : int ,
@@ -283,6 +283,7 @@ def evo_aspirate(
283
283
284
284
# 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)
285
285
selected = evo_make_selection_array (n_rows , n_columns , wells )
286
+ require_single_column_selection (selected )
286
287
# create code string containing information about target well(s)
287
288
code_string = evo_get_selection (n_rows , n_columns , selected )
288
289
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(
359
360
360
361
# 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)
361
362
selected = evo_make_selection_array (n_rows , n_columns , wells )
363
+ require_single_column_selection (selected )
362
364
# create code string containing information about target well(s)
363
365
code_string = evo_get_selection (n_rows , n_columns , selected )
364
366
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