예제 #1
0
def test_highest_z():
    deck = Deck()
    fixed_trash = deck.get_fixed_trash()
    assert deck.highest_z == fixed_trash.highest_z
    tall_lw = labware.load(tall_lw_name, deck.position_for(1))
    deck[1] = tall_lw
    assert deck.highest_z == pytest.approx(tall_lw.wells()[0].top().point.z)
    del deck[1]
    assert deck.highest_z == fixed_trash.highest_z
    mod = module_geometry.load_module(
        module_geometry.TemperatureModuleModel.TEMPERATURE_V1,
        deck.position_for(8))
    deck[8] = mod
    assert deck.highest_z == mod.highest_z
    lw = labware.load(labware_name, mod.location)
    mod.add_labware(lw)
    deck.recalculate_high_z()
    assert deck.highest_z == mod.highest_z
예제 #2
0
def test_instr_max_height():
    deck = Deck()
    fixed_trash = deck.get_fixed_trash()
    trough = labware.load(trough_name, deck.position_for(1))
    trough2 = labware.load(trough_name, deck.position_for(2))
    deck[1] = trough
    deck[2] = trough2

    # if the highest deck height is between 1 mm and 10 mm below
    # the max instrument achievable height, we use the max instrument
    # height as the safe height
    instr_max_height = fixed_trash.wells()[0].top().point.z + 1
    height = safe_height(from_loc=trough.wells()[0].top(),
                         to_loc=trough2.wells()[0].top(),
                         deck=deck,
                         instr_max_height=round(instr_max_height, 2),
                         well_z_margin=7.0,
                         lw_z_margin=15.0)
    assert height == round(instr_max_height, 2)

    # if the highest deck height is > 10 mm below the max instrument
    # height, we use the lw_z_margin instead
    instr_max_height = fixed_trash.wells()[0].top().point.z + 30
    height2 = safe_height(from_loc=trough.wells()[0].top(),
                          to_loc=trough2.wells()[0].top(),
                          deck=deck,
                          instr_max_height=round(instr_max_height, 2),
                          well_z_margin=7.0,
                          lw_z_margin=15.0)
    assert height2 ==\
        round(fixed_trash.wells()[0].top().point.z, 2) + 15.0

    # it fails if the highest deck height is less than 1 mm below
    # the max instr achievable height
    instr_max_height = fixed_trash.wells()[0].top().point.z
    with pytest.raises(Exception):
        safe_height(from_loc=trough.wells()[0].top(),
                    to_loc=trough2.wells()[0].top(),
                    deck=deck,
                    instr_max_height=round(instr_max_height, 2),
                    well_z_margin=7.0,
                    lw_z_margin=15.0)