Skip to content

Commit 363effa

Browse files
authored
update STAR to STARBackend in STARBackend (#668)
1 parent cbefde8 commit 363effa

File tree

1 file changed

+49
-48
lines changed

1 file changed

+49
-48
lines changed

pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ def trace_information_to_string(module_identifier: str, trace_information: int)
989989
86: "Gripper drive: Auto adjustment of DMS digital potentiometer not possible",
990990
89: "Gripper drive movement error: drive locked or incremental sensor fault during gripping",
991991
90: "Gripper drive initialized failed",
992-
91: "iSWAP not initialized. Call star.initialize_iswap().",
992+
91: "iSWAP not initialized. Call STARBackend.initialize_iswap().",
993993
92: "Gripper drive movement error: drive locked or incremental sensor fault during release",
994994
93: "Gripper drive movement error: position counter over/underflow",
995995
94: "Plate not found",
@@ -1117,7 +1117,7 @@ def _dispensing_mode_for_op(empty: bool, jet: bool, blow_out: bool) -> int:
11171117

11181118

11191119
class STARBackend(HamiltonLiquidHandler, HamiltonHeaterShakerInterface):
1120-
"""Interface for the Hamilton STAR."""
1120+
"""Interface for the Hamilton STARBackend."""
11211121

11221122
def __init__(
11231123
self,
@@ -1130,9 +1130,9 @@ def __init__(
11301130
"""Create a new STAR interface.
11311131
11321132
Args:
1133-
device_address: the USB device address of the Hamilton STAR. Only useful if using more than
1133+
device_address: the USB device address of the Hamilton STARBackend. Only useful if using more than
11341134
one Hamilton machine over USB.
1135-
serial_number: the serial number of the Hamilton STAR. Only useful if using more than one
1135+
serial_number: the serial number of the Hamilton STARBackend. Only useful if using more than one
11361136
Hamilton machine over USB.
11371137
packet_read_timeout: timeout in seconds for reading a single packet.
11381138
read_timeout: timeout in seconds for reading a full response.
@@ -1242,7 +1242,8 @@ async def get_iswap_version(self) -> str:
12421242

12431243
async def request_pip_channel_version(self, channel: int) -> str:
12441244
return cast(
1245-
str, (await self.send_command(STAR.channel_id(channel), "RF", fmt="rf" + "&" * 17))["rf"]
1245+
str,
1246+
(await self.send_command(STARBackend.channel_id(channel), "RF", fmt="rf" + "&" * 17))["rf"],
12461247
)
12471248

12481249
def get_id_from_fw_response(self, resp: str) -> Optional[int]:
@@ -1690,7 +1691,7 @@ async def aspirate(
16901691
min_z_endpos: The minimum height to move to, this is the end of aspiration.
16911692
16921693
hamilton_liquid_classes: Override the default liquid classes. See
1693-
pylabrobot/liquid_handling/liquid_classes/hamilton/star.py
1694+
pylabrobot/liquid_handling/liquid_classes/hamilton/STARBackend.py
16941695
liquid_surface_no_lld: Liquid surface at function without LLD [mm]. Must be between 0
16951696
and 360. Defaults to well bottom + liquid height. Should use absolute z.
16961697
"""
@@ -1978,7 +1979,7 @@ async def dispense(
19781979
side_touch_off_distance: The distance to move to the side from the well for a dispense.
19791980
19801981
hamilton_liquid_classes: Override the default liquid classes. See
1981-
pylabrobot/liquid_handling/liquid_classes/hamilton/star.py
1982+
pylabrobot/liquid_handling/liquid_classes/hamilton/STARBackend.py
19821983
19831984
jet: Whether to use jetting for each dispense. Defaults to `False` for all. Used for
19841985
determining the dispense mode. True for dispense mode 0 or 1.
@@ -3139,7 +3140,7 @@ async def core_check_resource_exists_at_location_center(
31393140
"""Check existence of resource with CoRe gripper tool
31403141
a "Get plate using CO-RE gripper" + error handling
31413142
Which channels are used for resource check is dependent on which channels have been used for
3142-
`STAR.get_core(p1: int, p2: int)` which is a prerequisite for this check function.
3143+
`STARBackend.get_core(p1: int, p2: int)` which is a prerequisite for this check function.
31433144
31443145
Args:
31453146
location: Location to check for resource
@@ -3363,9 +3364,9 @@ async def request_electronic_board_type(self):
33633364

33643365
resp = await self.send_command(module="C0", command="QB")
33653366
try:
3366-
return STAR.BoardType(resp["qb"])
3367+
return STARBackend.BoardType(resp["qb"])
33673368
except ValueError:
3368-
return STAR.BoardType.UNKNOWN
3369+
return STARBackend.BoardType.UNKNOWN
33693370

33703371
# TODO: parse response.
33713372
async def request_supply_voltage(self):
@@ -5842,7 +5843,7 @@ async def move_core_96_head_to_defined_position(
58425843
342.5. Default 342.5.
58435844
"""
58445845

5845-
# TODO: these are values for a STAR. Find them for a STARlet.
5846+
# TODO: these are values for a STARBackend. Find them for a STARlet.
58465847
self._check_96_position_legal(Coordinate(x, y, z))
58475848
assert (
58485849
0 <= minimum_height_at_beginning_of_a_command <= 342.5
@@ -7258,19 +7259,19 @@ async def request_cover_open(self) -> bool:
72587259

72597260
@staticmethod
72607261
def mm_to_y_drive_increment(value_mm: float) -> int:
7261-
return round(value_mm / STAR.y_drive_mm_per_increment)
7262+
return round(value_mm / STARBackend.y_drive_mm_per_increment)
72627263

72637264
@staticmethod
72647265
def y_drive_increment_to_mm(value_mm: int) -> float:
7265-
return round(value_mm * STAR.y_drive_mm_per_increment, 2)
7266+
return round(value_mm * STARBackend.y_drive_mm_per_increment, 2)
72667267

72677268
@staticmethod
72687269
def mm_to_z_drive_increment(value_mm: float) -> int:
7269-
return round(value_mm / STAR.z_drive_mm_per_increment)
7270+
return round(value_mm / STARBackend.z_drive_mm_per_increment)
72707271

72717272
@staticmethod
72727273
def z_drive_increment_to_mm(value_increments: int) -> float:
7273-
return round(value_increments * STAR.z_drive_mm_per_increment, 2)
7274+
return round(value_increments * STARBackend.z_drive_mm_per_increment, 2)
72747275

72757276
async def clld_probe_z_height_using_channel(
72767277
self,
@@ -7307,29 +7308,29 @@ async def clld_probe_z_height_using_channel(
73077308
The detected Z-height in mm.
73087309
"""
73097310

7310-
lowest_immers_pos_increments = STAR.mm_to_z_drive_increment(lowest_immers_pos)
7311-
start_pos_search_increments = STAR.mm_to_z_drive_increment(start_pos_search)
7312-
channel_speed_increments = STAR.mm_to_z_drive_increment(channel_speed)
7313-
channel_acceleration_thousand_increments = STAR.mm_to_z_drive_increment(
7311+
lowest_immers_pos_increments = STARBackend.mm_to_z_drive_increment(lowest_immers_pos)
7312+
start_pos_search_increments = STARBackend.mm_to_z_drive_increment(start_pos_search)
7313+
channel_speed_increments = STARBackend.mm_to_z_drive_increment(channel_speed)
7314+
channel_acceleration_thousand_increments = STARBackend.mm_to_z_drive_increment(
73147315
channel_acceleration / 1000
73157316
)
7316-
post_detection_dist_increments = STAR.mm_to_z_drive_increment(post_detection_dist)
7317+
post_detection_dist_increments = STARBackend.mm_to_z_drive_increment(post_detection_dist)
73177318

73187319
assert 9_320 <= lowest_immers_pos_increments <= 31_200, (
7319-
f"Lowest immersion position must be between \n{STAR.z_drive_increment_to_mm(9_320)}"
7320-
+ f" and {STAR.z_drive_increment_to_mm(31_200)} mm, is {lowest_immers_pos} mm"
7320+
f"Lowest immersion position must be between \n{STARBackend.z_drive_increment_to_mm(9_320)}"
7321+
+ f" and {STARBackend.z_drive_increment_to_mm(31_200)} mm, is {lowest_immers_pos} mm"
73217322
)
73227323
assert 9_320 <= start_pos_search_increments <= 31_200, (
7323-
f"Start position of LLD search must be between \n{STAR.z_drive_increment_to_mm(9_320)}"
7324-
+ f" and {STAR.z_drive_increment_to_mm(31_200)} mm, is {start_pos_search} mm"
7324+
f"Start position of LLD search must be between \n{STARBackend.z_drive_increment_to_mm(9_320)}"
7325+
+ f" and {STARBackend.z_drive_increment_to_mm(31_200)} mm, is {start_pos_search} mm"
73257326
)
73267327
assert 20 <= channel_speed_increments <= 15_000, (
7327-
f"LLD search speed must be between \n{STAR.z_drive_increment_to_mm(20)}"
7328-
+ f"and {STAR.z_drive_increment_to_mm(15_000)} mm/sec, is {channel_speed} mm/sec"
7328+
f"LLD search speed must be between \n{STARBackend.z_drive_increment_to_mm(20)}"
7329+
+ f"and {STARBackend.z_drive_increment_to_mm(15_000)} mm/sec, is {channel_speed} mm/sec"
73297330
)
73307331
assert 5 <= channel_acceleration_thousand_increments <= 150, (
7331-
f"Channel acceleration must be between \n{STAR.z_drive_increment_to_mm(5*1_000)} "
7332-
+ f" and {STAR.z_drive_increment_to_mm(150*1_000)} mm/sec**2, is {channel_acceleration} mm/sec**2"
7332+
f"Channel acceleration must be between \n{STARBackend.z_drive_increment_to_mm(5*1_000)} "
7333+
+ f" and {STARBackend.z_drive_increment_to_mm(150*1_000)} mm/sec**2, is {channel_acceleration} mm/sec**2"
73337334
)
73347335
assert (
73357336
0 <= detection_edge <= 1_023
@@ -7339,7 +7340,7 @@ async def clld_probe_z_height_using_channel(
73397340
), "Offset after capacitive LLD edge detection must be between 0 and 1023"
73407341
assert 0 <= post_detection_dist_increments <= 9_999, (
73417342
"Post cLLD-detection movement distance must be between \n0"
7342-
+ f" and {STAR.z_drive_increment_to_mm(9_999)} mm, is {post_detection_dist} mm"
7343+
+ f" and {STARBackend.z_drive_increment_to_mm(9_999)} mm, is {post_detection_dist} mm"
73437344
)
73447345

73457346
lowest_immers_pos_str = f"{lowest_immers_pos_increments:05}"
@@ -7352,7 +7353,7 @@ async def clld_probe_z_height_using_channel(
73527353

73537354
try:
73547355
await self.send_command(
7355-
module=STAR.channel_id(channel_idx),
7356+
module=STARBackend.channel_id(channel_idx),
73567357
command="ZL",
73577358
zh=lowest_immers_pos_str, # Lowest immersion position [increment]
73587359
zc=start_pos_search_str, # Start position of LLD search [increment]
@@ -7483,22 +7484,22 @@ async def ztouch_probe_z_height_using_channel(
74837484
if start_pos_search is None:
74847485
start_pos_search = 334.7 - tip_len + fitting_depth
74857486

7486-
tip_len_used_in_increments = (tip_len - fitting_depth) / STAR.z_drive_mm_per_increment
7487+
tip_len_used_in_increments = (tip_len - fitting_depth) / STARBackend.z_drive_mm_per_increment
74877488
channel_head_start_pos = (
74887489
start_pos_search + tip_len - fitting_depth
74897490
) # start_pos of the head itself!
74907491
safe_head_bottom_z_pos = (
74917492
99.98 + tip_len - fitting_depth
7492-
) # 99.98 == STAR.z_drive_increment_to_mm(9_320)
7493-
safe_head_top_z_pos = 334.7 # 334.7 == STAR.z_drive_increment_to_mm(31_200)
7493+
) # 99.98 == STARBackend.z_drive_increment_to_mm(9_320)
7494+
safe_head_top_z_pos = 334.7 # 334.7 == STARBackend.z_drive_increment_to_mm(31_200)
74947495

7495-
lowest_immers_pos_increments = STAR.mm_to_z_drive_increment(lowest_immers_pos)
7496-
start_pos_search_increments = STAR.mm_to_z_drive_increment(channel_head_start_pos)
7497-
channel_speed_increments = STAR.mm_to_z_drive_increment(channel_speed)
7498-
channel_acceleration_thousand_increments = STAR.mm_to_z_drive_increment(
7496+
lowest_immers_pos_increments = STARBackend.mm_to_z_drive_increment(lowest_immers_pos)
7497+
start_pos_search_increments = STARBackend.mm_to_z_drive_increment(channel_head_start_pos)
7498+
channel_speed_increments = STARBackend.mm_to_z_drive_increment(channel_speed)
7499+
channel_acceleration_thousand_increments = STARBackend.mm_to_z_drive_increment(
74997500
channel_acceleration / 1000
75007501
)
7501-
channel_speed_upwards_increments = STAR.mm_to_z_drive_increment(channel_speed_upwards)
7502+
channel_speed_upwards_increments = STARBackend.mm_to_z_drive_increment(channel_speed_upwards)
75027503

75037504
assert 0 <= channel_idx <= 15, f"channel_idx must be between 0 and 15, is {channel_idx}"
75047505
assert 20 <= tip_len <= 120, "Total tip length must be between 20 and 120"
@@ -7512,16 +7513,16 @@ async def ztouch_probe_z_height_using_channel(
75127513
+ f" and {safe_head_top_z_pos} mm, is {channel_head_start_pos} mm"
75137514
)
75147515
assert 20 <= channel_speed_increments <= 15_000, (
7515-
f"Z-touch search speed must be between \n{STAR.z_drive_increment_to_mm(20)}"
7516-
+ f" and {STAR.z_drive_increment_to_mm(15_000)} mm/sec, is {channel_speed} mm/sec"
7516+
f"Z-touch search speed must be between \n{STARBackend.z_drive_increment_to_mm(20)}"
7517+
+ f" and {STARBackend.z_drive_increment_to_mm(15_000)} mm/sec, is {channel_speed} mm/sec"
75177518
)
75187519
assert 5 <= channel_acceleration_thousand_increments <= 150, (
7519-
f"Channel acceleration must be between \n{STAR.z_drive_increment_to_mm(5*1_000)}"
7520-
+ f" and {STAR.z_drive_increment_to_mm(150*1_000)} mm/sec**2, is {channel_speed} mm/sec**2"
7520+
f"Channel acceleration must be between \n{STARBackend.z_drive_increment_to_mm(5*1_000)}"
7521+
+ f" and {STARBackend.z_drive_increment_to_mm(150*1_000)} mm/sec**2, is {channel_speed} mm/sec**2"
75217522
)
75227523
assert 20 <= channel_speed_upwards_increments <= 15_000, (
7523-
f"Channel retraction speed must be between \n{STAR.z_drive_increment_to_mm(20)}"
7524-
+ f" and {STAR.z_drive_increment_to_mm(15_000)} mm/sec, is {channel_speed_upwards} mm/sec"
7524+
f"Channel retraction speed must be between \n{STARBackend.z_drive_increment_to_mm(20)}"
7525+
+ f" and {STARBackend.z_drive_increment_to_mm(15_000)} mm/sec, is {channel_speed_upwards} mm/sec"
75257526
)
75267527
assert (
75277528
0 <= detection_limiter_in_PWM <= 125
@@ -7540,7 +7541,7 @@ async def ztouch_probe_z_height_using_channel(
75407541
push_down_force_in_PWM_str = f"{push_down_force_in_PWM:03}"
75417542

75427543
ztouch_probed_z_height = await self.send_command(
7543-
module=STAR.channel_id(channel_idx),
7544+
module=STARBackend.channel_id(channel_idx),
75447545
command="ZH",
75457546
zb=start_pos_search_str, # begin of searching range [increment]
75467547
za=lowest_immers_pos_str, # end of searching range [increment]
@@ -7552,7 +7553,7 @@ async def ztouch_probe_z_height_using_channel(
75527553
fmt="rz#####",
75537554
)
75547555
# Subtract tip_length from measurement in increment, and convert to mm
7555-
result_in_mm = STAR.z_drive_increment_to_mm(
7556+
result_in_mm = STARBackend.z_drive_increment_to_mm(
75567557
ztouch_probed_z_height["rz"] - tip_len_used_in_increments
75577558
)
75587559
if post_detection_dist != 0: # Safety first
@@ -7876,7 +7877,7 @@ async def step_off_foil(
78767877
await self.move_all_channels_in_z_safety()
78777878

78787879
async def request_volume_in_tip(self, channel: int) -> float:
7879-
resp = await self.send_command(STAR.channel_id(channel), "QC", fmt="qc##### (n)")
7880+
resp = await self.send_command(STARBackend.channel_id(channel), "QC", fmt="qc##### (n)")
78807881
_, current_volume = resp["qc"] # first is max volume
78817882
return float(current_volume) / 10
78827883

@@ -8180,7 +8181,7 @@ async def violently_shoot_down_tip(self, channel_idx: int):
81808181
81818182
Consider this method an easter egg. Not for serious use.
81828183
"""
8183-
await self.star.send_command(module=STAR.channel_id(channel_idx), command="SI")
8184+
await self.star.send_command(module=STARBackend.channel_id(channel_idx), command="SI")
81848185

81858186

81868187
# Deprecated alias with warning # TODO: remove mid May 2025 (giving people 1 month to update)

0 commit comments

Comments
 (0)