def make_cfg(plot_params, name=default_name, geo='square', mut=.002, delta=.0005, dim=20): if not os.path.isdir(name): os.mkdir(name) import shutil flist = os.listdir(name) cfg_start = cfg.dataPath('avida_default_cfgfiles') for r, d, files in os.walk(cfg_start): for f in files: if f in flist: continue shutil.copyfile(os.path.join(r, f), os.path.join(name, f)) #default_file = open(os.path.join(name,'avida.cfg')) outfile = open(os.path.join(name, 'avida.cfg.auto'), 'w') outfile.write('#avida.cfg generated by python.') #lines = default_file.readlines() auto_dir = os.path.join(name, os.path.join('autogen')) if not os.path.isdir(auto_dir): os.mkdir(auto_dir) eve_fname = ca.make_eve(name, default_evename) org_fname = ca.make_org(name, default_orgname) ana_fname = ca.make_ana(name, default_ananame) env_fname = ca.make_env(name, default_envname) ins_fname = ca.make_ins(name, default_insname) computed = presets.differential_mut(name, mut=mut, geo_name=geo, delta=delta, dim=dim, eve_fname=eve_fname, org_fname=org_fname, ana_fname=ana_fname, env_fname=env_fname, ins_fname=ins_fname, gen_name=default_genname) for pp in plot_params: pp['computed'] = computed print print 'setting print params: ' print for p in plot_params: if p['type'] == 'ts': colstr = '' for col in p.get('command_params', []): colstr += col + ' ' printstr = p['update'] + ' ' + p['command'] + ' ' + p[ 'fname'] + ' ' + colstr ca.alter_eve(eve_fname, printstr) elif p['type'] == 'grid': printstr = p['update'] + ' ' + p['command'] + ' ' + p['fname'] ca.alter_eve(eve_fname, printstr) f = open(eve_fname).read() print f
def make_cfg(plot_params, name =default_name, geo = 'square', mut = .002, delta = .0005, dim = 20): if not os.path.isdir(name): os.mkdir(name) import shutil flist = os.listdir(name) cfg_start = cfg.dataPath('avida_default_cfgfiles') for r,d,files in os.walk(cfg_start): for f in files: if f in flist: continue shutil.copyfile(os.path.join(r,f), os.path.join(name, f)) #default_file = open(os.path.join(name,'avida.cfg')) outfile = open(os.path.join(name,'avida.cfg.auto'),'w') outfile.write('#avida.cfg generated by python.') #lines = default_file.readlines() auto_dir = os.path.join(name,os.path.join('autogen')) if not os.path.isdir(auto_dir): os.mkdir(auto_dir) eve_fname = ca.make_eve(name,default_evename) org_fname = ca.make_org(name,default_orgname) ana_fname = ca.make_ana(name,default_ananame) env_fname = ca.make_env(name,default_envname) ins_fname = ca.make_ins(name,default_insname) computed = presets.differential_mut(name, mut = mut, geo_name = geo, delta = delta, dim = dim, eve_fname = eve_fname, org_fname = org_fname, ana_fname = ana_fname, env_fname = env_fname, ins_fname = ins_fname, gen_name = default_genname) for pp in plot_params: pp['computed'] = computed print print 'setting print params: ' print for p in plot_params: if p['type'] == 'ts': colstr = '' for col in p.get('command_params',[]): colstr += col + ' ' printstr = p['update']+' '+p['command'] +' '+p['fname'] + ' '+colstr ca.alter_eve(eve_fname, printstr) elif p['type'] == 'grid': printstr = p['update'] + ' ' + p['command'] + ' ' + p['fname'] ca.alter_eve(eve_fname, printstr) f = open(eve_fname).read() print f