Example #1
0
def model(robot, hardware, loop, request):
    # Use with pytest.mark.parametrize(’labware’, [some-labware-name])
    # to have a different labware loaded as .container. If not passed,
    # defaults to the version-appropriate way to do 96 flat
    from opentrons.legacy_api.containers import load
    from opentrons.legacy_api.instruments.pipette import Pipette

    try:
        lw_name = request.getfixturevalue('labware')
    except Exception:
        lw_name = None

    if isinstance(hardware, hc.HardwareAPILike):
        ctx = ProtocolContext(loop=loop, hardware=hardware)
        pip = ctx.load_instrument('p300_single', 'right')
        loop.run_until_complete(
            hardware.cache_instruments({Mount.RIGHT: 'p300_single'}))
        instrument = models.Instrument(pip, context=ctx)
        plate = ctx.load_labware(lw_name or 'corning_96_wellplate_360ul_flat',
                                 1)
        rob = hardware
        container = models.Container(plate, context=ctx)
    else:
        print("hardware is {}".format(hardware))
        pipette = Pipette(robot, ul_per_mm=18.5, max_volume=300, mount='right')
        plate = load(robot, lw_name or '96-flat', '1')
        rob = robot
        instrument = models.Instrument(pipette)
        container = models.Container(plate)

    return namedtuple('model',
                      'robot instrument container')(robot=rob,
                                                    instrument=instrument,
                                                    container=container)
Example #2
0
def build_v1_model(r, lw_name):
    plate = load(r, lw_name or '96-flat', '1')
    tiprack = load(r, 'opentrons-tiprack-300ul', '2')
    pipette = Pipette(r,
                      ul_per_mm=18.5, max_volume=300, mount='right',
                      tip_racks=[tiprack])
    instrument = models.Instrument(pipette)
    container = models.Container(plate)
    return namedtuple('model', 'robot instrument container')(
        robot=r,
        instrument=instrument,
        container=container,
    )
Example #3
0
def model_with_trough(robot):
    from opentrons.legacy_api.containers import load
    from opentrons.legacy_api.instruments.pipette import Pipette

    pipette = Pipette(robot, ul_per_mm=18.5, max_volume=300, mount='right')
    plate = load(robot, 'trough-12row', '1')

    instrument = models.Instrument(pipette)
    container = models.Container(plate)

    return namedtuple('model',
                      'robot instrument container')(robot=robot,
                                                    instrument=instrument,
                                                    container=container)
Example #4
0
def build_v2_model(h, lw_name, loop):
    ctx = ProtocolContext(loop=loop, hardware=h)

    loop.run_until_complete(h.cache_instruments({Mount.RIGHT: 'p300_single'}))
    tiprack = ctx.load_labware('opentrons_96_tiprack_300ul', '2')
    pip = ctx.load_instrument('p300_single', 'right', tip_racks=[tiprack])
    instrument = models.Instrument(pip, context=ctx)
    plate = ctx.load_labware(lw_name or 'corning_96_wellplate_360ul_flat', 1)
    container = models.Container(plate, context=ctx)
    return namedtuple('model', 'robot instrument container')(
        robot=h,
        instrument=instrument,
        container=container,
    )