From 46b7ce292bca170210b4823bd2bf7b0890c5274c Mon Sep 17 00:00:00 2001 From: Guangxin Zhang Date: Wed, 16 Jul 2025 23:28:46 +0800 Subject: [PATCH] Update for discard tips --- .../liquid_handler_abstract.py | 29 ++++++++------- .../devices/liquid_handling/prcxi/prcxi.py | 35 ++++++++++--------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/unilabos/devices/liquid_handling/liquid_handler_abstract.py b/unilabos/devices/liquid_handling/liquid_handler_abstract.py index cda5a90..3582c59 100644 --- a/unilabos/devices/liquid_handling/liquid_handler_abstract.py +++ b/unilabos/devices/liquid_handling/liquid_handler_abstract.py @@ -628,6 +628,10 @@ class LiquidHandlerAbstract(LiquidHandlerMiddleware): for i in range(0, len(sources), 8): # 取出8个任务 + tip = [] + for _ in range(len(use_channels)): + tip.extend(next(self.current_tip)) + await self.pick_up_tips(tip) current_targets = waste_liquid[i:i + 8] current_reagent_sources = sources[i:i + 8] current_asp_vols = vols[i:i + 8] @@ -666,7 +670,7 @@ class LiquidHandlerAbstract(LiquidHandlerMiddleware): if delays is not None: await self.custom_delay(seconds=delays[1]) await self.touch_tip(current_targets) - await self.discard_tips() + await self.discard_tips() except Exception as e: traceback.print_exc() @@ -751,10 +755,6 @@ class LiquidHandlerAbstract(LiquidHandlerMiddleware): await self.touch_tip(targets[_]) elif len(use_channels) == 8: - tip = [] - for _ in range(len(use_channels)): - tip.extend(next(self.current_tip)) - await self.pick_up_tips(tip) # 对于8个的情况,需要判断此时任务是不是能被8通道移液站来成功处理 if len(targets) % 8 != 0: @@ -763,7 +763,10 @@ class LiquidHandlerAbstract(LiquidHandlerMiddleware): # 8个8个来取任务序列 for i in range(0, len(targets), 8): - # 取出8个任务 + tip = [] + for _ in range(len(use_channels)): + tip.extend(next(self.current_tip)) + await self.pick_up_tips(tip) current_targets = targets[i:i + 8] current_reagent_sources = reagent_sources[i:i + 8] current_asp_vols = asp_vols[i:i + 8] @@ -813,7 +816,8 @@ class LiquidHandlerAbstract(LiquidHandlerMiddleware): if delays is not None: await self.custom_delay(seconds=delays[1]) await self.touch_tip(current_targets) - await self.discard_tips() + await self.discard_tips() + except Exception as e: traceback.print_exc() @@ -915,11 +919,6 @@ class LiquidHandlerAbstract(LiquidHandlerMiddleware): await self.discard_tips() elif len(use_channels) == 8: - tip = [] - for _ in range(len(use_channels)): - tip.extend(next(self.current_tip)) - await self.pick_up_tips(tip) - # 对于8个的情况,需要判断此时任务是不是能被8通道移液站来成功处理 if len(targets) % 8 != 0: raise ValueError(f"Length of `targets` {len(targets)} must be a multiple of 8 for 8-channel mode.") @@ -928,6 +927,10 @@ class LiquidHandlerAbstract(LiquidHandlerMiddleware): for i in range(0, len(targets), 8): # 取出8个任务 + tip = [] + for _ in range(len(use_channels)): + tip.extend(next(self.current_tip)) + await self.pick_up_tips(tip) current_targets = targets[i:i + 8] current_reagent_sources = sources[i:i + 8] current_asp_vols = asp_vols[i:i + 8] @@ -978,7 +981,7 @@ class LiquidHandlerAbstract(LiquidHandlerMiddleware): if delays is not None: await self.custom_delay(seconds=delays[1]) await self.touch_tip(current_targets) - await self.discard_tips() + await self.discard_tips() except Exception as e: traceback.print_exc() diff --git a/unilabos/devices/liquid_handling/prcxi/prcxi.py b/unilabos/devices/liquid_handling/prcxi/prcxi.py index c977ff5..b9a410f 100644 --- a/unilabos/devices/liquid_handling/prcxi/prcxi.py +++ b/unilabos/devices/liquid_handling/prcxi/prcxi.py @@ -1051,7 +1051,7 @@ if __name__ == "__main__": "uuid": "57b1e4711e9e4a32b529f3132fc5931f", } }) - plate6 = PRCXI9300Trash(name="trash", size_x=50, size_y=50, size_z=10, category="trash") + plate6 = PRCXI9300Trash(name="trash", size_x=50, size_y=500, size_z=10, category="trash") plate6.load_state({ "Material": { "uuid": "57b1e4711e9e4a32b529f3132fc5931f", @@ -1079,27 +1079,28 @@ if __name__ == "__main__": handler.set_tiprack([tip_rack]) # Set the tip rack for the handler asyncio.run(handler.setup()) # Initialize the handler and setup the connection asyncio.run(handler.create_protocol(protocol_name="Test Protocol")) # Initialize the backend and setup the connection - #asyncio.run(handler.pick_up_tips(tip_rack.children[:8],[0,1,2,3,4,5,6,7])) + asyncio.run(handler.pick_up_tips(tip_rack.children[:8],[0,1,2,3,4,5,6,7])) # asyncio.run(handler.aspirate(well_containers.children[:8],[50]*8, [0,1,2,3,4,5,6,7])) # asyncio.run(handler.dispense(well_containers.children[:8],[50]*8,[0,1,2,3,4,5,6,7])) #asyncio.run(handler.drop_tips(tip_rack.children[8:16],[0,1,2,3,4,5,6,7])) + asyncio.run(handler.discard_tips()) # asyncio.run(handler.mix(well_containers.children[:8], mix_time=3, mix_vol=50, height_to_bottom=0.5, offsets=Coordinate(0, 0, 0), mix_rate=100)) #print(json.dumps(handler._unilabos_backend.steps_todo_list, indent=2)) # Print matrix info - asyncio.run(handler.add_liquid( - asp_vols=[100]*16, - dis_vols=[100]*16, - reagent_sources=well_containers.children[-16:], - targets=well_containers.children[:16], - use_channels=[0, 1, 2, 3, 4, 5, 6, 7], - flow_rates=[None] * 32, - offsets=[Coordinate(0, 0, 0)] * 32, - liquid_height=[None] * 16, - blow_out_air_volume=[None] * 16, - delays=None, - mix_time=3, - mix_vol=50, - spread="wide", - )) + # asyncio.run(handler.add_liquid( + # asp_vols=[100]*16, + # dis_vols=[100]*16, + # reagent_sources=well_containers.children[-16:], + # targets=well_containers.children[:16], + # use_channels=[0, 1, 2, 3, 4, 5, 6, 7], + # flow_rates=[None] * 32, + # offsets=[Coordinate(0, 0, 0)] * 32, + # liquid_height=[None] * 16, + # blow_out_air_volume=[None] * 16, + # delays=None, + # mix_time=3, + # mix_vol=50, + # spread="wide", + # )) # asyncio.run(handler.remove_liquid( # vols=[100]*16,