def main(): options,args = parser.parse_args(sys.argv[1:]) if len(args) < 3: parser.print_help() sys.exit(45) run=args[0] is2 = int(args[1]) ie_or_is2n = int(args[2]) conf=shapesim.read_config(run) simconf = shapesim.read_config(conf['sim']) pattern=shapesim.get_output_url(run, is2, ie_or_is2n, itrial='*', fs='hdfs') flist=awk(hadoop('fs','-ls',pattern), '{print $8}').split() nring = simconf['nring'] for i in xrange(nring): f=shapesim.get_output_url(run, is2, ie_or_is2n, itrial=i, fs='hdfs') f=f.replace('hdfs://','') if f not in flist: print f
def main(): options,args = parser.parse_args(sys.argv[1:]) if len(args) < 4: parser.print_help() sys.exit(45) run=args[0] s2n=float(args[1]) npairs=int(args[2]) output_file=args[3] print 'reading config files' run_conf = shapesim.read_config(run) sim_conf = shapesim.read_config(run_conf['sim']) print 'running sim' run_sim(sim_conf,run_conf,s2n,npairs,output_file)
s2min=s2min, skip1=skip1, skip2=skip2, yrange=yrng, docum=options.cum,show=show, use_rb=options.use_rb) elif 'set-nbias' in set: p=shapesim.plotting.MultiPlotterNoiseBias(set, title=title, yrange=yrng, show=show) else: raise ValueError("bad set name '%s'" % set) p.doplots() else: c=shapesim.read_config(run) runtype=c.get('runtype','byellip') p=shapesim.plotting.SimPlotter(run, maketitle=options.maketitle, s2min=s2min, skip1=skip1, skip2=skip2, noerr=options.noerr, docum=options.cum) if runtype == 'byellip': if options.etot: yrng2 = options.yrange2 if yrng2 is not None: yrng2 = yrng2.split(',') yrng2 = [float(yrng2[0]),float(yrng2[1])] p.plot_ediff_Rshear_vs_e(yrng=yrng, yrng2=yrng2, show=show, title=options.title) else:
def main(): options,args = parser.parse_args(sys.argv[1:]) if len(args) < 3: parser.print_help() sys.exit(45) itrial=None if len(args) > 3: itrial = int(args[3]) run=args[0] is2 = int(args[1]) ie_or_is2n = int(args[2]) if run[0:5] == 'deswl': sim=shapesim.deswl_sim.DESWLSim(run) elif run[0:8] == 'gmix-fit': sim=shapesim.gmix_fit_sim.GMixFitSim(run) elif run[0:4] == 'gmix': sim=shapesim.gmix_em_sim.GMixEMSim(run) elif 'bafit' in run: sim=shapesim.bafit_sim.BAFitSim(run) c = shapesim.read_config(run) cs = shapesim.read_config(c['sim']) elif 'mixmc' in run or 'bayes' in run or 'mca' in run: sim=shapesim.bayesfit_sim.BayesFitSim(run) c = shapesim.read_config(run) cs = shapesim.read_config(c['sim']) if cs['orient'] == 'random': if itrial is None: raise ValueError("expect itrial for bayes orient=random") sim.process_bruteforce_trial_by_s2n(is2, ie_or_is2n, itrial) return elif 'shd' in run: sim=shapesim.shd_sim.SHDirectSim(run) elif 'mcm-' in run: if itrial is None: raise ValueError("send itrial for mcm") sim=shapesim.mcm_sim.MCMSim(run) sim.process_trial(is2, ie_or_is2n, itrial) return elif 'stack-' in run: if itrial is None: raise ValueError("send itrial for stack") if 'admom' in run: sim=shapesim.stack_sim.AdmomSim(run, is2=is2, is2n=ie_or_is2n, itrial=itrial) sim.run() sim.write() else: sim=shapesim.stack_sim.StackSim(run, is2=is2, is2n=ie_or_is2n, itrial=itrial) sim.generate_stacks() sim.fit_stacks() sim.write() return else: raise ValueError("Don't know about run '%s'" % run) sim.process_trials(is2, ie_or_is2n, itrial=itrial)
def plot_run(plt, run, shear_true, symbol, color, linestyle, options, with_points=True, with_curve=True, method='BA13', with_lensfit=False): c = shapesim.read_config(run) label = c.get('label',c['run']) url=shapesim.get_averaged_url(run, 0) print url data=eu.io.read(url) s_name,scov_name=get_names(method) if s_name=='g_sum': shear=data['g_sum'][:,0]/data['nsum'] else: shear=data[s_name][:,0] err=sqrt(data[scov_name][:,0,0]) s2n_vals = data[options.s2n_field] if options.xrange is None: xrng=[0.75*s2n_vals[0], 1.25*s2n_vals[-1]] else: xrng=options.xrange.split(',') xrng=[float(xr) for xr in xrng] pts = biggles.Points(s2n_vals, shear/shear_true-1, type=symbol, size=2, color=color) ep = biggles.SymmetricErrorBarsY(s2n_vals, shear/shear_true-1, err/shear_true, width=2, color=color) crv = biggles.Curve(s2n_vals, shear/shear_true-1, type=linestyle, width=2, color=color) crv.label=label pts.label=label if with_points: plt.add(pts,ep) if with_curve and not with_lensfit: plt.add(crv) if with_lensfit and method != 'lensfit': crv_lensfit = biggles.Curve(s2n_vals, data['shear_lensfit'][:,0]/shear_true-1, type=linestyle, width=2, color=color) plt.add(crv_lensfit) return xrng, crv, pts
parser.add_option('--allow-missing',action='store_true', help="allow missing splits") options,args = parser.parse_args(sys.argv[1:]) if len(args) < 1: parser.print_help() sys.exit(1) run=args[0] if len(args) == 3: i1 = int(args[1]) i2 = int(args[2]) shapesim.shapesim.combine_trials(run, i1, i2, allow_missing=options.allow_missing) elif len(args) == 1: c = shapesim.read_config(run) cs = shapesim.read_config(c['sim']) runtype = c['runtype'] n1 = cs['nums2'] if runtype == 'byellip': n2 = cs['nume'] else: n2 = shapesim.get_nums2n(c) for i1 in xrange(n1): for i2 in xrange(n2): shapesim.shapesim.combine_trials(run, i1, i2, allow_missing=options.allow_missing)