Exemple #1
0
def resource_list_with_prefix(layout_manager, prefix, res_class, num_ress):
    def name_from_line(line):
        field = LayoutManager.layline_objid(line)
        if field:
            return field
        return LayoutManager.layline_first_field(line)
    layline_test = lambda line: LayoutManager.field_starts_with(name_from_line(line), prefix)
    res_type = ResourceType(res_class, layline_test, name_from_line)
    res_list = [layout_manager.assign_unused_resource(res_type) for _ in range(num_ress)]
    res_list.sort(key=lambda r: r.layout_name())
    return res_list
Exemple #2
0
import os
from pyhamilton import (HamiltonInterface, LayoutManager, ResourceType, Tip96,
                        INITIALIZE, PICKUP, NoTipError, HardwareError)

layfile = os.path.abspath(os.path.join('.', 'minimal_error_example.lay'))
lmgr = LayoutManager(layfile)

tip_name_from_line = lambda line: LayoutManager.layline_first_field(line)
tip_name_condition = lambda line: LayoutManager.field_starts_with(
    tip_name_from_line(line), 'HTF_L_')
tips_type = ResourceType(Tip96, tip_name_condition, tip_name_from_line)
tips = lmgr.assign_unused_resource(tips_type)

if __name__ == '__main__':
    with HamiltonInterface() as hammy:
        print('INITIALIZED!!',
              hammy.wait_on_response(hammy.send_command(INITIALIZE)))
        try:
            id = hammy.send_command(PICKUP,
                                    labwarePositions=str(tips.layout_name()) +
                                    ', 1;')
            print(hammy.wait_on_response(id, raise_first_exception=True))
        except NoTipError:
            print('\n' * 10 + 'THERE WAS NO TIP THERE' + '\n' * 10)
        except HardwareError:
            print('\n' * 10 + 'Did I just crash into something?' + '\n' * 10)
Exemple #3
0
#!python3

import os
import sys
sys.path.append("..\\")

from pyhamilton import (HamiltonInterface, LayoutManager, ResourceType, Tip96,
                        Plate96, INITIALIZE, PICKUP, EJECT, ASPIRATE, DISPENSE,
                        HamiltonError)

layfile = os.path.abspath(os.path.join('.', 'single_ch_aspirate_dispense.lay'))
lmgr = LayoutManager(layfile)
plate_type = ResourceType(Plate96, 'Cos_96_Rd_0001')
plate = lmgr.assign_unused_resource(plate_type)

tip_name_from_line = lambda line: LayoutManager.layline_first_field(line)
print(tip_name_from_line)
tip_name_condition = lambda line: LayoutManager.field_starts_with(
    tip_name_from_line(line), 'HTF_L_')
print(tip_name_condition)
tips_type = ResourceType(Tip96, tip_name_condition, tip_name_from_line)
print(tips_type)
tips = lmgr.assign_unused_resource(tips_type)
print(tips)
print(tips.layout_name())
print(tips.position_id(88))

if __name__ == '__main__':
    tip_no = 88  # top right corner
    well_no = 7  # bottom left corner
    tip_labware_pos = tips.layout_name() + ', ' + tips.position_id(
import os
from pyhamilton import (HamiltonInterface, LayoutManager, ResourceType,
                        Plate96, INITIALIZE, ISWAP_GET, ISWAP_PLACE,
                        HamiltonError)

layfile = os.path.abspath(os.path.join('.', 'grip_move_plate.lay'))
lmgr = LayoutManager(layfile)

plate_type = ResourceType(Plate96, 'Cos_96_Rd_0001')
plate = lmgr.assign_unused_resource(plate_type)

target_site_type = ResourceType(Plate96, 'Cos_96_Rd_0002')
target_site = lmgr.assign_unused_resource(target_site_type)

if __name__ == '__main__':
    plate_pos = plate.layout_name() + ', ' + plate.position_id(0)
    target_pos = target_site.layout_name() + ', ' + target_site.position_id(0)
    with HamiltonInterface() as hammy:
        hammy.wait_on_response(hammy.send_command(INITIALIZE))
        for id in (hammy.send_command(ISWAP_GET,
                                      plateLabwarePositions=plate_pos),
                   hammy.send_command(ISWAP_PLACE,
                                      plateLabwarePositions=target_pos)):
            print(hammy.wait_on_response(id, raise_first_exception=True))
        for id in (hammy.send_command(ISWAP_GET,
                                      plateLabwarePositions=target_pos),
                   hammy.send_command(ISWAP_PLACE,
                                      plateLabwarePositions=plate_pos)):
            print(hammy.wait_on_response(id, raise_first_exception=True))
Exemple #5
0
            '#'*width]

log_dir = os.path.join(this_file_dir, 'log')
if not os.path.exists(log_dir):
    os.mkdir(log_dir)
main_logfile = os.path.join(log_dir, 'main.log')
total_move_vol = 250.0 # uL
well_vol = 300.0 # uL

layfile = os.path.join(this_file_dir, 'population_dynamics.lay')
lmgr = LayoutManager(layfile)

sys_state = lambda:None # simple namespace

plates = resource_list_with_prefix(lmgr, 'site_top_left_', Plate96, 10)
main_tips = lmgr.assign_unused_resource(ResourceType(Tip96, 'main_tips'))
wet_tips = lmgr.assign_unused_resource(ResourceType(Tip96, 'cross_tips'))
water_trough = lmgr.assign_unused_resource(ResourceType(Plate96, 'water_trough'))

def next_tips_tups():
    for column in range(11): # use prime number of columns to avoid sharing factors with other periodic activities
        yield [(main_tips, t) for t in range(8*column, 8*(column+1))]
tips_tups_gen = next_tips_tups()
tips_tups = None

wet_prep_plates = len(sys.argv) > 1 and sys.argv[1] == '--wet'

def system_initialize():
    ham_int, *_ = sys_state.instruments
    logging.basicConfig(filename=main_logfile, level=logging.DEBUG, format='[%(asctime)s] %(name)s %(levelname)s %(message)s')
    for banner_line in log_banner('Begin execution of ' + __file__):