def test_create_arc(robot, instruments): from opentrons.legacy_api.robot.robot import (TIP_CLEARANCE_DECK, TIP_CLEARANCE_LABWARE) p300 = instruments.P300_Single(mount='left') plate = containers_load(robot, '96-flat', '1') plate2 = containers_load(robot, '96-flat', '2') new_labware_height = 10 robot.poses = p300._move(robot.poses, x=10, y=10, z=new_labware_height) robot.calibrate_container_with_instrument(plate, p300, save=False) trash_height = robot.max_placeable_height_on_deck(robot.fixed_trash) assert robot.max_deck_height() == trash_height res = robot._create_arc(p300, (0, 0, 0), plate[0]) arc_top = robot.max_deck_height() + TIP_CLEARANCE_DECK expected = [{'z': arc_top}, {'x': 0, 'y': 0}, {'z': 0}] assert res == expected res = robot._create_arc(p300, (0, 0, 0), plate[1]) arc_top = robot.max_placeable_height_on_deck(plate) + TIP_CLEARANCE_LABWARE expected = [{'z': arc_top}, {'x': 0, 'y': 0}, {'z': 0}] assert res == expected new_labware_height = 200 robot.poses = p300._move(robot.poses, x=10, y=10, z=new_labware_height) robot.calibrate_container_with_instrument(plate2, p300, save=False) assert robot.max_deck_height() == new_labware_height res = robot._create_arc(p300, (0, 0, 0), plate2[0]) arc_top = p300._max_deck_height() expected = [{'z': arc_top}, {'x': 0, 'y': 0}, {'z': 0}] assert res == expected
def test_use_filter_tips(instruments, robot): # test tips with lower working volume than max volume of pipette used to # ensure that the pipette never over-aspirates with a smaller pipette tip tipracks = [ 'opentrons_96_filtertiprack_10ul', 'opentrons_96_filtertiprack_200ul', 'opentrons_96_filtertiprack_1000ul' ] for t in tipracks: robot.reset() tip_rack = containers_load(robot, t, '3') plate = containers_load(robot, '96-flat', '1') p300 = instruments.P300_Single(mount='left', tip_racks=[tip_rack]) p300.pick_up_tip() p300.aspirate(plate[0]) # working volume should be the lesser of the pipette max volume # and the tip max volume assert p300.current_volume == p300._working_volume assert p300.current_volume == min(tip_rack[0].max_volume(), p300.max_volume) # working volume should revert back to pipette max volume if no tip # is attached p300.return_tip() assert p300._working_volume == p300.max_volume
def test_dispense_move_to(old_aspiration): # TODO: same as for aspirate robot.reset() tip_rack = containers_load(robot, 'tiprack-200ul', '3') p300 = instruments.P300_Single( mount='left', tip_racks=[tip_rack]) x, y, z = (161.0, 116.7, 0.0) plate = containers_load(robot, '96-flat', '1') well = plate[0] pos = well.from_center(x=0, y=0, z=-1, reference=plate) location = (plate, pos) robot.poses = p300._move(robot.poses, x=x, y=y, z=z) robot.calibrate_container_with_instrument(plate, p300, False) p300.pick_up_tip() p300.aspirate(100, location) p300.dispense(100, location) current_pos = pose_tracker.absolute( robot.poses, p300.instrument_actuator) assert (current_pos == (1.5, 0.0, 0.0)).all() current_pos = pose_tracker.absolute(robot.poses, p300) assert isclose(current_pos, (161, 116.7, 10.5)).all()
def test_aspirate_move_to(old_aspiration, robot, instruments): # TODO: it seems like this test is checking that the aspirate point is # TODO: *fully* at the bottom of the well, which isn't the expected # TODO: behavior of aspirate when a location is not specified. This should # TODO: be split into two tests--one for this behavior (specifying a place) # TODO: and another one for the default robot.reset() tip_rack = containers_load(robot, 'tiprack-200ul', '3') p300 = instruments.P300_Single(mount='left', tip_racks=[tip_rack]) p300.pick_up_tip() x, y, z = (161.0, 116.7, 0.0) plate = containers_load(robot, '96-flat', '1') well = plate[0] pos = well.from_center(x=0, y=0, z=-1, reference=plate) location = (plate, pos) robot.poses = p300._move(robot.poses, x=x, y=y, z=z) robot.calibrate_container_with_instrument(plate, p300, False) p300.aspirate(100, location) current_pos = pose_tracker.absolute(robot.poses, p300.instrument_actuator) assert isclose(current_pos, (6.9, 0.0, 0.0)).all() current_pos = pose_tracker.absolute(robot.poses, p300) assert isclose(current_pos, (161, 116.7, 10.5)).all()
def protocol(self): self.robot.get_serial_ports_list() self.robot.home() tiprack = containers_load( self.robot, 'tiprack-200ul', # container type 'A1', # slot 'tiprack' # user-defined name ) plate = containers_load( self.robot, '96-flat', 'B1', 'plate' ) trash = containers_load( self.robot, 'point', 'C2', 'trash' ) trough = containers_load( self.robot, 'trough-12row', 'B2', 'trough' ) p200 = pipette.Pipette( self.robot, name="p200", trash_container=trash, tip_racks=[tiprack], max_volume=200, min_volume=0.5, axis="b", channels=1 ) self.robot.clear_commands() # distribute p200.pick_up_tip(tiprack[0]) p200.aspirate(96 * 2, trough[0]) for i in range(96): p200.dispense(2, plate[i]).touch_tip() p200.drop_tip(tiprack[0]) p200.pick_up_tip(tiprack[1]) for i in range(96): p200.aspirate(2, plate[95 - i]) p200.dispense(trough[0]) p200.drop_tip(tiprack[1])
def test_protocol_container_setup(robot): plate = containers_load(robot, '96-flat', '1', 'myPlate') tiprack = containers_load(robot, 'tiprack-10ul', '5') containers_list = robot.get_containers() assert len(containers_list) == 3 assert robot._deck['1']['myPlate'] == plate assert robot._deck['5']['tiprack-10ul'] == tiprack assert plate in containers_list assert tiprack in containers_list
def test_trough_move_to(robot, instruments): # TODO: new labware system should center multichannel pipettes within wells # TODO: (correct single-channel position currently corresponds to back- # TODO: most tip of multi-channel), so calculate against that robot.reset() tip_rack = containers_load(robot, 'tiprack-200ul', '3') p300 = instruments.P300_Single(mount='left', tip_racks=[tip_rack]) trough = containers_load(robot, 'trough-12row', '1') p300.pick_up_tip() p300.move_to(trough) current_pos = pose_tracker.absolute(robot.poses, p300) assert isclose(current_pos, (0, 0, 38)).all()
def test_container_from_container_load(robot): robot.reset() plate = containers_load(robot, '96-flat', '1') actual = plate._coordinates expected = Vector(14.34, 11.24, 10.50) assert plate.get_type() == '96-flat' assert actual == expected
def test_shake_during_pick_up(monkeypatch, robot, instruments): robot.reset() pip = instruments._create_pipette_from_config( config=pipette_config.load('p1000_single_v2.0'), mount='left', name='p1000_single_v2.0') tiprack = containers_load(robot, 'opentrons_96_tiprack_1000ul', '1') shake_tips_pick_up = mock.Mock(side_effect=pip._shake_off_tips_pick_up) monkeypatch.setattr(pip, '_shake_off_tips_pick_up', shake_tips_pick_up) # Test double shake for after pick up tips pip.pick_up_tip(tiprack[0]) assert shake_tips_pick_up.call_count == 2 actual_calls = [] def mock_jog(pose_tree, axis, distance): actual_calls.append((axis, distance)) monkeypatch.setattr(pip, '_jog', mock_jog) # Test shake in both x and y shake_tips_pick_up() expected_calls = [('x', -0.3), ('x', 0.6), ('x', -0.3), ('y', -0.3), ('y', 0.6), ('y', -0.3), ('z', 20)] assert actual_calls == expected_calls pip.tip_attached = False
def test_shake_during_drop(monkeypatch): robot.reset() pip = instruments._create_pipette_from_config( config=pipette_config.load('p1000_single_v2.0'), mount='left', name='p1000_single_v2.0') tiprack = containers_load(robot, 'opentrons_96_tiprack_1000ul', '1') shake_tips_drop = mock.Mock( side_effect=pip._shake_off_tips_drop) monkeypatch.setattr(pip, '_shake_off_tips_drop', shake_tips_drop) # Test single shake for after pick up tips pip.tip_attached = True pip.drop_tip(tiprack.wells(0)) assert shake_tips_drop.call_count == 1 actual_calls = [] def jog_side_effect(pose_tree, axis, distance): actual_calls.append((axis, distance)) jog = mock.Mock(side_effect=jog_side_effect) monkeypatch.setattr(pip, '_jog', jog) # Test shake only in x, with no location passed, shake distance is 2.25 shake_tips_drop() expected_calls = [('x', -2.25), ('x', 4.5), ('x', -2.25), ('z', 20)] assert actual_calls == expected_calls # Test drop tip shake at a well with diameter above upper limit (2.25 mm) tiprack.wells(0).properties['width'] = 2.3*4 actual_calls.clear() shake_tips_drop(tiprack.wells(0)) expected_calls = [('x', -2.25), ('x', 4.5), ('x', -2.25), ('z', 20)] assert actual_calls == expected_calls # Test drop tip shake at a well with diameter between upper limit # and lower limit (1.00 - 2.25 mm) tiprack.wells(0).properties['width'] = 2*4 actual_calls.clear() shake_tips_drop(tiprack.wells(0)) expected_calls = [('x', -2), ('x', 4), ('x', -2), ('z', 20)] assert actual_calls == expected_calls # Test drop tip shake at a well with diameter below lower limit (1.00 mm) tiprack.wells(0).properties['width'] = 0.9*4 actual_calls.clear() shake_tips_drop(tiprack.wells(0)) expected_calls = [('x', -1), ('x', 2), ('x', -1), ('z', 20)] assert actual_calls == expected_calls pip.tip_attached = False
def test_protocol_head(robot): trash = containers_load(robot, 'point', '1', 'myTrash') tiprack = containers_load(robot, 'tiprack-10ul', '5') p200 = pipette.Pipette( robot, name='myPipette', trash_container=trash, tip_racks=[tiprack], max_volume=200, min_volume=10, # These are variable ul_per_mm=18.0, mount='left', channels=1) instruments_list = robot.get_instruments() assert instruments_list[0] == ('left', p200) instruments_list = robot.get_instruments('myPipette') assert instruments_list[0] == ('left', p200)
def test_pos_tracker_persistance(robot, instruments): p300 = instruments.P300_Single(mount='left') plate = containers_load(robot, 'trough-12row', '5') assert robot.max_placeable_height_on_deck(plate) == \ plate[0].coordinates()[2] robot.poses = p300._move(robot.poses, x=10, y=10, z=10) robot.calibrate_container_with_instrument(plate, p300, save=False) assert robot.max_placeable_height_on_deck(plate) == 10.0
def test_well_from_container_load(robot): robot.reset() plate = containers_load(robot, '96-flat', '1') assert plate[3].top()[1] == Vector(3.20, 3.20, 10.50) assert plate[3].properties == { 'depth': 10.5, 'total-liquid-volume': 400, 'diameter': 6.4, 'height': 10.5, 'width': 6.4, 'length': 6.4 }
def test_deck_setup(robot): deck = robot.deck pip = pipette.Pipette(robot, mount='left', max_volume=300, ul_per_mm=18.0) # Check that the fixed trash has loaded on to the pipette trash = pip.trash_container tiprack = containers_load(robot, 'tiprack-10ul', '5') assert isinstance(tiprack, Container) assert isinstance(deck, Deck) # Check that well location is the same on the robot as the pipette assert robot._deck['12']['tall-fixed-trash'][0] == trash assert deck.has_container(tiprack)
def test_drop_tip_default_trash(robot, instruments): tiprack = containers_load(robot, 'tiprack-200ul', '1') pip = instruments.P300_Single(mount='right', tip_racks=[tiprack]) trash_loc = vector.Vector([80.00, 80.00, 80.00]) pip.pick_up_tip() with mock.patch.object(robot, 'move_to') as move_to: # NOQA pip.drop_tip() move_to.assert_called_with((robot.fixed_trash[0], trash_loc), instrument=pip, strategy='arc')
def local_test_pipette(robot): trash = containers_load(robot, 'point', '1') tiprack1 = containers_load(robot, 'tiprack-10ul', '5') tiprack2 = containers_load(robot, 'tiprack-10ul', '8') plate = containers_load(robot, '96-flat', '4') p200 = Pipette( robot, ul_per_mm=18.5, trash_container=trash, tip_racks=[tiprack1, tiprack2], max_volume=200, min_volume=10, # These are variable mount='left', channels=1, name='other-pipette-for-transfer-tests') p200.reset() p200.calibrate_plunger(top=0, bottom=10, blow_out=12, drop_tip=13) robot.home() return trash, tiprack1, tiprack2, plate, p200
def test_load_tip_length_calibration_v1(robot): lw = containers_load(robot, 'opentrons_96_tiprack_10ul', '1') hash = lw.properties['labware_hash'] tip_length_data = {'tipLength': 19.99, 'lastModified': utc_now()} tip_length_cal = {hash: tip_length_data} pip_id = 'fake_id' modify.save_tip_length_calibration(pip_id=pip_id, tip_length_cal=tip_length_cal) result = load_tip_length_calibration(pip_id, lw.wells('A1')) assert result == tip_length_data delete.clear_tip_length_calibration() # clean up
def test_retract(robot, instruments): robot.reset() plate = containers_load(robot, '96-flat', '1') p300 = instruments.P300_Single(mount='left') from opentrons.drivers.smoothie_drivers.driver_3_0 import HOMED_POSITION p300.move_to(plate[0].top()) assert p300.previous_placeable == plate[0] current_pos = pose_tracker.absolute(robot.poses, p300) assert current_pos[2] == plate[0].coordinates()[2] p300.retract() assert p300.previous_placeable is None current_pos = pose_tracker.absolute(robot.poses, p300.instrument_mover) assert current_pos[2] == HOMED_POSITION['A']
def test_new_containers(robot, instruments): robot.reset() trash_box = containers_load(robot, 'trash-box', '1') tip_rack = containers_load(robot, 'tiprack-200ul', '3') wheaton_vial_rack = containers_load(robot, 'wheaton_vial_rack', '4') tube_rack_80well = containers_load(robot, 'tube-rack-80well', '7') T75_flask = containers_load(robot, 'T75-flask', '2') T25_flask = containers_load(robot, 'T25-flask', '5') p300 = instruments.P300_Single(mount='right', tip_racks=[tip_rack]) p300.pick_up_tip() p300.aspirate(100, wheaton_vial_rack[0]).dispense(trash_box) p300.aspirate(100, tube_rack_80well[0]).dispense(trash_box) p300.aspirate(100, T75_flask[0]).dispense(trash_box) p300.aspirate(100, T25_flask[0]).dispense(trash_box)
def test_slot_name(slot_name, expected_name): robot.reset() p = containers_load(robot, '96-flat', slot_name) slot_name = p.get_parent().get_name() assert slot_name == expected_name
def test_load_same_slot_force(robot): container_name = '96-flat' slot = '1' containers_load(robot, container_name, slot) # 2018-1-30 Incremented number of containers based on fixed trash assert len(robot.get_containers()) == 2 with pytest.raises(RuntimeWarning): containers_load(robot, container_name, slot) with pytest.raises(RuntimeWarning): containers_load(robot, container_name, slot) with pytest.raises(RuntimeWarning): containers_load(robot, container_name, slot) with pytest.raises(RuntimeWarning): containers_load(robot, container_name, slot) with pytest.raises(RuntimeWarning): containers_load(robot, container_name, slot) containers_load(robot, container_name, slot, 'custom-name', share=True) assert len(robot.get_containers()) == 3 containers_load(robot, 'trough-12row', slot, share=True) assert len(robot.get_containers()) == 4
def test_container_parse(robot): robot.reset() plate = containers_load(robot, '96-flat', '1') expected = {'x': 14.34, 'y': 11.24, 'z': 10.50} assert database._parse_container_obj(plate) == expected