Exemplo n.º 1
0
def system_initialize():
    ham_int, reader_int, reader_int, shaker, *_ = sys_state.instruments
    if mid_run:
        print('CONTINUING A PREVIOUSLY INITIALIZED AND PAUSED RUN. WILL SKIP CLEANING. OK? 5 SECONDS TO CANCEL...')
        time.sleep(5)
    local_log_dir = os.path.join(method_local_dir, 'log')
    if not os.path.exists(local_log_dir):
        os.mkdir(local_log_dir)
    main_logfile = os.path.join(local_log_dir, 'main.log')
    logging.basicConfig(filename=main_logfile, level=logging.DEBUG, format='[%(asctime)s] %(name)s %(levelname)s %(message)s')
    add_robot_level_log()
    add_stderr_logging()
    for banner_line in log_banner('Begin execution of ' + __file__):
        logging.info(banner_line)
    if sys_state.disable_pumps or simulation_on:
        pump_int.disable()
    if simulation_on:
        reader_int.disable()
        shaker.disable()
    ham_int.set_log_dir(os.path.join(local_log_dir, 'hamilton.log'))
    if mid_run:
        prime_and_clean = None
    else:
        prime_and_clean = run_async(lambda: (#pump_int.prime(),             # important that the shaker is
            shaker.start(shake_speed), pump_int.bleach_clean(),
            shaker.stop())) # started and stopped at least once
    initialize(ham_int)
    hepa_on(ham_int, simulate=int(simulation_on))
    method_start_time = time.time()
    if not sys_state.disable_pumps:
        wash_empty_refill(ham_int, refillAfterEmpty=2, chamber2WashLiquid=0) # 2=chamber 1 only; 0=Liquid 1 (bleach)
    if prime_and_clean:
        prime_and_clean.join()
    shaker.start(shake_speed) # TODO: For asynchrony
Exemplo n.º 2
0
from pace_util import (
    pyhamilton, HamiltonInterface, LayoutManager,
    ResourceType, Plate24, Plate96, Tip96, LAYFILE,
    initialize, hepa_on, tip_pick_up, tip_eject, aspirate, dispense,
    resource_list_with_prefix, add_robot_level_log, add_stderr_logging,
    fileflag, clear_fileflag, log_banner)


local_log_dir = os.path.join(method_local_dir, 'log')
if not os.path.exists(local_log_dir):
    os.mkdir(local_log_dir)
main_logfile = os.path.join(local_log_dir, 'main.log')
logging.basicConfig(filename=main_logfile, level=logging.DEBUG, format='[%(asctime)s] %(name)s %(levelname)s %(message)s')
add_robot_level_log()
add_stderr_logging()
for banner_line in log_banner('Begin execution of ' + __file__):
    logging.info(banner_line)

debug = '--debug' in sys.argv
prep_hard_agar = '--prep' in sys.argv
simulation_on = debug or '--simulate' in sys.argv
num_phage_dilutions = 4
num_plates = 1 if '--plates' not in sys.argv else int(sys.argv[sys.argv.index('--plates') + 1])
assert num_plates <= 4
num_skips = 0 if '--skip' not in sys.argv else int(sys.argv[sys.argv.index('--skip') + 1])
culture_vol = 20 # uL
hard_agar_vol = 250 # uL
soft_agar_vol = 200 # uL
culture_stock_vol = 300 # uL
dipenses_per_prep_tip = 3 #int(1000/1.1)//int(hard_agar_vol)