def send(data): config = cfg.read_cfg('config.json') subject = str(config['ptopic']) server = str(config['server']) note = str(data) xmt(server=server, topic=subject, note=note)
def __init__(self, input_dir, cfg_file, source_dir, target_dir, task_name,\ source_transform = None, target_transform = None): self.input_dir = input_dir self.cfg_file = cfg_file self.source_dir = source_dir self.target_dir = target_dir self.task_name = task_name self.source_transform = source_transform self.target_transform = target_transform self.cfg = cfg.read_cfg(input_dir, cfg_file) for j in self.cfg.keys(): for k in self.cfg[j].keys(): self.cfg[j][k].update({'context_vector':'%08d.pth' % (int(j)),\ 'rendering':'out-%04d-%04d.png'\ % (int(j), int(k)),\ 'i': j, 'j' : k}) self.flat_cfg = [self.cfg[j][k] for j in self.cfg.keys() \ for k in self.cfg[j].keys()]
def __init__(self, input_dir, cfg_file, image_dir, target_dir, task_name,\ transform = None, target_transform = None): self.input_dir = input_dir self.cfg_file = cfg_file self.image_dir = image_dir self.target_dir = target_dir self.task_name = task_name self.transform = transform self.target_transform = target_transform self.cfg = cfg.read_cfg(input_dir, cfg_file) for j in self.cfg.keys(): for k in self.cfg[j].keys(): self.cfg[j][k].update({'normals':'normal_%04d.png' % (int(j)),\ 'rendering':'out-%04d-%04d.png'\ % (int(j), int(k)),\ 'i': j, 'j' : k}) self.flat_cfg = [self.cfg[j][k] for j in self.cfg.keys() \ for k in self.cfg[j].keys()] self.last = None
def main(): c = cfg.read_cfg() pin = int(c['pin']) motion = setup_sensor(pin) wait_detection(c, motion)
import sys sys.dont_write_bytecode = True sys.path.append('../scripts') import cfg import glob import os import time if len(sys.argv) < 2: print 'Usage: ' + sys.argv[0] + ' <cfg_file>' print 'no cfg_file provided, using default "cfg/bmp51_len12.cfg"' sys.argv.append('cfg/bmp51_len12.cfg') cfgdict = cfg.read_cfg(sys.argv[1]) score_folder = cfgdict['score_folder'] odds_folder = cfgdict['odds_folder'] test_folder = cfgdict['test_folder'] if '110030080' in score_folder: execprog = './exec/new_pred_reg_search_l1o_ecparam110030080.out' execprog = './exec/new_pred_reg_bestweight_ecparam110030080.out' execprog = './exec/new_pred_reg_bestscore_ecparam110030080.out' elif '110020070' in score_folder: execprog = './exec/new_pred_reg_search_l1o_ecparam110020070.out' execprog = './exec/new_pred_reg_bestweight_ecparam110020070.out' execprog = './exec/new_pred_reg_bestscore_ecparam110020070.out' elif '110010080' in score_folder: execprog = './exec/new_pred_reg_search_l1o_ecparam110010080.out'