def test_no_new_tip(_instr_labware): _instr_labware['ctx'].home() lw1 = _instr_labware['lw1'] lw2 = _instr_labware['lw2'] options = tx.TransferOptions() options = options._replace(transfer=options.transfer._replace( new_tip=TransferTipPolicy.NEVER)) # ========== Transfer ========== xfer_plan = tx.TransferPlan( 100, lw1.columns()[0], lw2.columns()[0], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) for step in xfer_plan: assert step['method'] != 'pick_up_tip' assert step['method'] != 'drop_tip' # ========== Distribute =========== dist_plan = tx.TransferPlan( 30, lw1.columns()[0][0], lw2.columns()[0], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) for step in dist_plan: assert step['method'] != 'pick_up_tip' assert step['method'] != 'drop_tip' # ========== Consolidate =========== consd_plan = tx.TransferPlan( 40, lw1.columns()[0], lw2.rows()[0][1], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) for step in consd_plan: assert step['method'] != 'pick_up_tip' assert step['method'] != 'drop_tip'
def test_touchtip_mix(_instr_labware): _instr_labware['ctx'].home() lw1 = _instr_labware['lw1'] lw2 = _instr_labware['lw2'] options = tx.TransferOptions() options = options._replace(transfer=options.transfer._replace( new_tip=TransferTipPolicy.NEVER, touch_tip_strategy=tx.TouchTipStrategy.ALWAYS, mix_strategy=tx.MixStrategy.AFTER)) # ========== Transfer ========== xfer_plan = tx.TransferPlan( 100, lw1.columns()[0][1:5], lw2.rows()[0][1:5], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) xfer_plan_list = [] for step in xfer_plan: xfer_plan_list.append(step) exp1 = [{ 'method': 'aspirate', 'args': [100, lw1.columns()[0][1], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][1], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'location': lw2.rows()[0][1] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][2], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][2], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'location': lw2.rows()[0][2] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][3], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][3], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'location': lw2.rows()[0][3] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][4], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][4], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'location': lw2.rows()[0][4] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }] assert xfer_plan_list == exp1 # ========== Distribute ========== dist_plan = tx.TransferPlan( 60, lw1.columns()[1][0], lw2.rows()[1][1:6], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) dist_plan_list = [] for step in dist_plan: dist_plan_list.append(step) exp2 = [{ 'method': 'aspirate', 'args': [300, lw1.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [60, lw2.rows()[1][1], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [60, lw2.rows()[1][2], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [60, lw2.rows()[1][3], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [60, lw2.rows()[1][4], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [60, lw2.rows()[1][5], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'location': lw2.rows()[1][5] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }] assert dist_plan_list == exp2 # ========== Consolidate ========== consd_plan = tx.TransferPlan( 60, lw1.columns()[1], lw2.rows()[1][1], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) consd_plan_list = [] for step in consd_plan: consd_plan_list.append(step) exp3 = [{ 'method': 'aspirate', 'args': [60, lw1.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][1], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][2], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][3], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][4], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [300, lw2.rows()[1][1], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'location': lw2.rows()[1][1] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][5], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][6], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][7], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [180, lw2.rows()[1][1], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'location': lw2.rows()[1][1] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }] assert consd_plan_list == exp3
def test_transfer_w_airgap_blowout(_instr_labware): _instr_labware['ctx'].home() lw1 = _instr_labware['lw1'] lw2 = _instr_labware['lw2'] options = tx.TransferOptions() options = options._replace(transfer=options.transfer._replace( air_gap=10, blow_out_strategy=tx.BlowOutStrategy.DEST_IF_EMPTY, new_tip=TransferTipPolicy.NEVER)) # ========== Transfer ========== xfer_plan = tx.TransferPlan( 100, lw1.columns()[0][1:5], lw2.rows()[0][1:5], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) xfer_plan_list = [] for step in xfer_plan: xfer_plan_list.append(step) exp1 = [{ 'method': 'aspirate', 'args': [100, lw1.columns()[0][1], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [110, lw2.rows()[0][1], 1.0], 'kwargs': {} }, { 'method': 'blow_out', 'args': [lw2.rows()[0][1]], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][2], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [110, lw2.rows()[0][2], 1.0], 'kwargs': {} }, { 'method': 'blow_out', 'args': [lw2.rows()[0][2]], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][3], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [110, lw2.rows()[0][3], 1.0], 'kwargs': {} }, { 'method': 'blow_out', 'args': [lw2.rows()[0][3]], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][4], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [110, lw2.rows()[0][4], 1.0], 'kwargs': {} }, { 'method': 'blow_out', 'args': [lw2.rows()[0][4]], 'kwargs': {} }] assert xfer_plan_list == exp1 # ========== Distribute ========== dist_plan = tx.TransferPlan( 60, lw1.columns()[1][0], lw2.rows()[1][1:6], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) dist_plan_list = [] for step in dist_plan: dist_plan_list.append(step) exp2 = [{ 'method': 'aspirate', 'args': [240, lw1.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [70, lw2.rows()[1][1], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [70, lw2.rows()[1][2], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [70, lw2.rows()[1][3], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [70, lw2.rows()[1][4], 1.0], 'kwargs': {} }, { 'method': 'blow_out', 'args': [lw2.rows()[1][4]], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [70, lw2.rows()[1][5], 1.0], 'kwargs': {} }, { 'method': 'blow_out', 'args': [lw2.rows()[1][5]], 'kwargs': {} }] assert dist_plan_list == exp2 # ========== Consolidate ========== consd_plan = tx.TransferPlan( 60, lw1.columns()[1], lw2.rows()[1][1], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) consd_plan_list = [] for step in consd_plan: consd_plan_list.append(step) exp3 = [{ 'method': 'aspirate', 'args': [60, lw1.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][1], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][2], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][3], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [280, lw2.rows()[1][1], 1.0], 'kwargs': {} }, { 'method': 'blow_out', 'args': [lw2.rows()[1][1]], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][4], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][5], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][6], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'aspirate', 'args': [60, lw1.columns()[1][7], 1.0], 'kwargs': {} }, { 'method': 'air_gap', 'args': [10], 'kwargs': {} }, { 'method': 'dispense', 'args': [280, lw2.rows()[1][1], 1.0], 'kwargs': {} }, { 'method': 'blow_out', 'args': [lw2.rows()[1][1]], 'kwargs': {} }] assert consd_plan_list == exp3
def test_transfer_w_touchtip_blowout(_instr_labware): _instr_labware['ctx'].home() lw1 = _instr_labware['lw1'] lw2 = _instr_labware['lw2'] # ========== Transfer ========== options = tx.TransferOptions() options = options._replace(transfer=options.transfer._replace( touch_tip_strategy=tx.TouchTipStrategy.ALWAYS, blow_out_strategy=tx.BlowOutStrategy.TRASH, new_tip=TransferTipPolicy.NEVER)) xfer_plan = tx.TransferPlan( 100, lw1.columns()[0][:3], lw2.rows()[0][:3], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) xfer_plan_list = [] for step in xfer_plan: xfer_plan_list.append(step) exp1 = [{ 'method': 'aspirate', 'args': [100, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][0], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'blow_out', 'args': [_instr_labware['instr'].trash_container.wells()[0]], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][1], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][1], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'blow_out', 'args': [_instr_labware['instr'].trash_container.wells()[0]], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][2], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][2], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'blow_out', 'args': [_instr_labware['instr'].trash_container.wells()[0]], 'kwargs': {} }] assert xfer_plan_list == exp1 # ========== Distribute ========== options = tx.TransferOptions() options = options._replace(transfer=options.transfer._replace( disposal_volume=_instr_labware['instr'].min_volume, touch_tip_strategy=tx.TouchTipStrategy.ALWAYS, new_tip=TransferTipPolicy.NEVER)) dist_plan = tx.TransferPlan( 30, lw1.columns()[0][0], lw2.rows()[0][:3], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) dist_plan_list = [] for step in dist_plan: dist_plan_list.append(step) exp2 = [{ 'method': 'aspirate', 'args': [120, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [30, lw2.rows()[0][0], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [30, lw2.rows()[0][1], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'dispense', 'args': [30, lw2.rows()[0][2], 1.0], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': {} }, { 'method': 'blow_out', 'args': [_instr_labware['instr'].trash_container.wells()[0]], 'kwargs': {} }] assert dist_plan_list == exp2
def test_new_tip_always(_instr_labware, monkeypatch): _instr_labware['ctx'].home() lw1 = _instr_labware['lw1'] lw2 = _instr_labware['lw2'] tiprack = _instr_labware['tiprack'] i_ctx = _instr_labware['instr'] options = tx.TransferOptions() options = options._replace(transfer=options.transfer._replace( new_tip=TransferTipPolicy.ALWAYS, drop_tip_strategy=tx.DropTipStrategy.TRASH)) xfer_plan = tx.TransferPlan( 100, lw1.columns()[0][1:5], lw2.columns()[0][1:5], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) xfer_plan_list = [] for step in xfer_plan: xfer_plan_list.append(step) exp1 = [{ 'method': 'pick_up_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][1], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[0][1], 1.0], 'kwargs': {} }, { 'method': 'drop_tip', 'args': [], 'kwargs': {} }, { 'method': 'pick_up_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][2], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[0][2], 1.0], 'kwargs': {} }, { 'method': 'drop_tip', 'args': [], 'kwargs': {} }, { 'method': 'pick_up_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][3], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[0][3], 1.0], 'kwargs': {} }, { 'method': 'drop_tip', 'args': [], 'kwargs': {} }, { 'method': 'pick_up_tip', 'args': [], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][4], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[0][4], 1.0], 'kwargs': {} }, { 'method': 'drop_tip', 'args': [], 'kwargs': {} }] assert xfer_plan_list == exp1 for cmd in xfer_plan_list: getattr(i_ctx, cmd['method'])(*cmd['args'], **cmd['kwargs']) assert tiprack.next_tip() == tiprack.columns()[0][4]
def test_uneven_transfers(_instr_labware): _instr_labware['ctx'].home() lw1 = _instr_labware['lw1'] lw2 = _instr_labware['lw2'] options = tx.TransferOptions() options = options._replace(transfer=options.transfer._replace( new_tip=TransferTipPolicy.NEVER)) # ========== One-to-Many ========== xfer_plan = tx.TransferPlan( 100, lw1.columns()[0][0], lw2.columns()[1][:4], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, mode='transfer', options=options) one_to_many_plan_list = [] for step in xfer_plan: one_to_many_plan_list.append(step) exp1 = [{ 'method': 'aspirate', 'args': [100, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[1][1], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[1][2], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[1][3], 1.0], 'kwargs': {} }] assert one_to_many_plan_list == exp1 # ========== Few-to-Many ========== xfer_plan = tx.TransferPlan( [100, 90, 80, 70], lw1.columns()[0][:2], lw2.columns()[1][:4], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, mode='transfer', options=options) few_to_many_plan_list = [] for step in xfer_plan: few_to_many_plan_list.append(step) exp2 = [{ 'method': 'aspirate', 'args': [100, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [90, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [90, lw2.columns()[1][1], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [80, lw1.columns()[0][1], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [80, lw2.columns()[1][2], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [70, lw1.columns()[0][1], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [70, lw2.columns()[1][3], 1.0], 'kwargs': {} }] assert few_to_many_plan_list == exp2 # ========== Many-to-One ========== xfer_plan = tx.TransferPlan( [100, 90, 80, 70], lw1.columns()[0][:4], lw2.columns()[1][0], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, mode='transfer', options=options) many_to_one_plan_list = [] for step in xfer_plan: many_to_one_plan_list.append(step) exp3 = [{ 'method': 'aspirate', 'args': [100, lw1.columns()[0][0], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [100, lw2.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [90, lw1.columns()[0][1], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [90, lw2.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [80, lw1.columns()[0][2], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [80, lw2.columns()[1][0], 1.0], 'kwargs': {} }, { 'method': 'aspirate', 'args': [70, lw1.columns()[0][3], 1.0], 'kwargs': {} }, { 'method': 'dispense', 'args': [70, lw2.columns()[1][0], 1.0], 'kwargs': {} }] assert many_to_one_plan_list == exp3
def test_all_options(_instr_labware): _instr_labware['ctx'].home() lw1 = _instr_labware['lw1'] lw2 = _instr_labware['lw2'] options = tx.TransferOptions() options = options._replace( transfer=options.transfer._replace( new_tip=TransferTipPolicy.ONCE, drop_tip_strategy=tx.DropTipStrategy.RETURN, touch_tip_strategy=tx.TouchTipStrategy.ALWAYS, mix_strategy=tx.MixStrategy.AFTER), pick_up_tip=options.pick_up_tip._replace(presses=4, increment=2), touch_tip=options.touch_tip._replace(speed=1.6), mix=options.mix._replace(mix_after=options.mix.mix_after._replace( repetitions=2)), blow_out=options.blow_out._replace(location=lw2.columns()[10][0]), aspirate=options.aspirate._replace(rate=1.5)) xfer_plan = tx.TransferPlan( 100, lw1.columns()[0][1:4], lw2.rows()[0][1:4], _instr_labware['instr'], max_volume=_instr_labware['instr'].hw_pipette['working_volume'], api_version=_instr_labware['ctx'].api_version, options=options) xfer_plan_list = [] for step in xfer_plan: xfer_plan_list.append(step) exp1 = [{ 'method': 'pick_up_tip', 'args': [], 'kwargs': { 'presses': 4, 'increment': 2 } }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][1], 1.5], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': { 'speed': 1.6 } }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][1], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'repetitions': 2, 'location': lw2.rows()[0][1] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': { 'speed': 1.6 } }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][2], 1.5], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': { 'speed': 1.6 } }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][2], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'repetitions': 2, 'location': lw2.rows()[0][2] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': { 'speed': 1.6 } }, { 'method': 'aspirate', 'args': [100, lw1.columns()[0][3], 1.5], 'kwargs': {} }, { 'method': 'touch_tip', 'args': [], 'kwargs': { 'speed': 1.6 } }, { 'method': 'dispense', 'args': [100, lw2.rows()[0][3], 1.0], 'kwargs': {} }, { 'method': 'mix', 'args': [], 'kwargs': { 'repetitions': 2, 'location': lw2.rows()[0][3] } }, { 'method': 'touch_tip', 'args': [], 'kwargs': { 'speed': 1.6 } }, { 'method': 'return_tip', 'args': [], 'kwargs': {} }] assert xfer_plan_list == exp1
def test_transfer_options(loop, monkeypatch): ctx = papi.ProtocolContext(loop) lw1 = ctx.load_labware('biorad_96_wellplate_200ul_pcr', 1) lw2 = ctx.load_labware('corning_96_wellplate_360ul_flat', 2) tiprack = ctx.load_labware('opentrons_96_tiprack_300ul', 3) instr = ctx.load_instrument('p300_single', Mount.RIGHT, tip_racks=[tiprack]) ctx.home() transfer_options = None def fake_execute_transfer(xfer_plan): nonlocal transfer_options transfer_options = xfer_plan._options monkeypatch.setattr(instr, '_execute_transfer', fake_execute_transfer) instr.transfer(10, lw1.columns()[0], lw2.columns()[0], new_tip='always', mix_before=(2, 10), mix_after=(3, 20), blow_out=True) expected_xfer_options1 = tf.TransferOptions( transfer=tf.Transfer( new_tip=TransferTipPolicy.ALWAYS, air_gap=0, carryover=True, gradient_function=None, disposal_volume=0, mix_strategy=tf.MixStrategy.BOTH, drop_tip_strategy=tf.DropTipStrategy.TRASH, blow_out_strategy=tf.BlowOutStrategy.TRASH, touch_tip_strategy=tf.TouchTipStrategy.NEVER, ), pick_up_tip=tf.PickUpTipOpts(), mix=tf.Mix(mix_before=tf.MixOpts(repetitions=2, volume=10, rate=None), mix_after=tf.MixOpts(repetitions=3, volume=20, rate=None)), blow_out=tf.BlowOutOpts(), touch_tip=tf.TouchTipOpts(), aspirate=tf.AspirateOpts(), dispense=tf.DispenseOpts()) assert transfer_options == expected_xfer_options1 instr.pick_up_tip() instr.distribute(50, lw1.rows()[0][0], lw2.columns()[0], new_tip='never', touch_tip=True, trash=False, disposal_volume=10, mix_before=(2, 30), mix_after=(3, 20)) instr.drop_tip() expected_xfer_options2 = tf.TransferOptions( transfer=tf.Transfer(new_tip=TransferTipPolicy.NEVER, air_gap=0, carryover=True, gradient_function=None, disposal_volume=10, mix_strategy=tf.MixStrategy.BEFORE, drop_tip_strategy=tf.DropTipStrategy.RETURN, blow_out_strategy=tf.BlowOutStrategy.NONE, touch_tip_strategy=tf.TouchTipStrategy.ALWAYS), pick_up_tip=tf.PickUpTipOpts(), mix=tf.Mix(mix_before=tf.MixOpts(repetitions=2, volume=30, rate=None), mix_after=tf.MixOpts()), blow_out=tf.BlowOutOpts(), touch_tip=tf.TouchTipOpts(), aspirate=tf.AspirateOpts(), dispense=tf.DispenseOpts()) assert transfer_options == expected_xfer_options2 with pytest.raises(ValueError, match='air_gap.*'): instr.transfer(300, lw1['A1'], lw2['A1'], air_gap=300) with pytest.raises(ValueError, match='air_gap.*'): instr.transfer(300, lw1['A1'], lw2['A1'], air_gap=10000)