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
def new_tips(num=num_phage_dilutions, ttype='agar'): ham_int, *_ = sys_state.instruments while True: try: if ttype == 'agar': tip_batch = [next(agar_tips_gen) for _ in range(num)] elif ttype == 'culture': tip_batch = [next(culture_tips_gen) for _ in range(num)] else: raise ValueError() tip_pick_up(ham_int, tip_batch) break except pyhamilton.NoTipError: initialize(ham_int) # eject tips if present continue return tip_batch
def system_initialize(ham_int, reader_int): ham_int, *_ = sys_state.instruments ham_int.set_log_dir(os.path.join(local_log_dir, 'hamilton.log')) initialize(ham_int) hepa_on(ham_int, 30, simulate=int(simulation_on))
def system_initialize(): ham_int, *_ = sys_state.instruments ham_int.set_log_dir(os.path.join(local_log_dir, 'hamilton.log')) initialize(ham_int)
wash_vols = [wash_vol for _ in media_poss] bleach_poss = [(bleach_site, j) for j in array_idxs] aspirate(ham_int, bleach_poss, wash_vols, **liq_move_param) dispense(ham_int, bleach_poss, wash_vols, **liq_move_param) water_poss = [(water_site, j) for j in array_idxs] aspirate(ham_int, water_poss, wash_vols, **liq_move_param) dispense(ham_int, water_poss, wash_vols, **liq_move_param) tip_eject(ham_int, tip_poss) remember.replace_vols = None # make sure these transfers are only executed once with HamiltonInterface( simulate=simulation_on) as ham_int, ClarioStar() as reader_int: if no_reader or simulation_on: reader_int.disable() ham_int.set_log_dir(os.path.join(local_log_dir, 'hamilton.log')) initialize(ham_int) hepa_on(ham_int, 30, simulate=int(simulation_on)) std_class = 'StandardVolumeFilter_Water_DispenseSurface_Part_no_transport_vol' remember = SimpleNamespace() remember.od_readings = None def measure_plate(plate, reader_protocols, simultaneously_execute=lambda: None): reader_protocols = [ proto_name + '_fast' for proto_name in reader_protocols ] # use the speed optimized versions ham_int, reader_int, *_ = sys_state.instruments platedatas = read_plate(ham_int, reader_int, reader_tray,