def run(self): coords = self.opts.coords names = vars(self.opts).get('names', len(coords) * ['']) labels = [ n.lower().replace(' ', '_').replace('(', '').replace(')', '') for n in names ] for name, label, coord in zip(names, labels, coords): glon, glat = coord[0], coord[1] print('\t', name, '(%.2f,%.2f)' % (glon, glat)) fig, ax = plt.subplots(1, 1, figsize=(8, 8)) plotter = ugali.utils.plotting.BasePlotter(glon, glat, self.config, radius=0.5) plotter.image_kwargs.update(opt='GL', xsize=800) plotter.drawImage(ax, invert=False) fig.suptitle(label) outfile = '%s_sdss_image.png' % label plt.savefig(outfile, dpi=200) Pipeline.run = run pipeline = Pipeline(description, components) pipeline.parser.add_coords(radius=True, targets=True, required=True) pipeline.parse_args() pipeline.execute()
outfile = join(self.outdir, base) out = open(outfile, 'w') out.write(yaml.dump(output)) out.close() if 'scan' in self.opts.run: logger.info("Running 'scan'...") for config, name, label, coord in args: logdir = mkdir('plots/log') logfile = join(logdir, '%s_lnlscan.log') cmd = 'python lnlscan.py %s --name %s --xpar %s --xbins 45 --ypar %s --ybins 45' % ( self.opts.config, name, 'age', 'metallicity') self.batch.submit(cmd, logfile=logfile) cmd = 'python lnlscan.py %s --name %s --xpar %s --xbins 45 --ypar %s --ybins 45' % ( self.opts.config, name, 'metallicity', 'distance_modulus') self.batch.submit(cmd, logfile=logfile) cmd = 'python lnlscan.py %s --name %s --xpar %s --xbins 45 --ypar %s --ybins 45' % ( self.opts.config, name, 'age', 'distance_modulus') self.batch.submit(cmd, logfile=logfile) Pipeline.run = run pipeline = Pipeline(__doc__, components) pipeline.parser.add_coords(radius=True, targets=True) pipeline.parser.add_ncores() pipeline.parse_args() pipeline.execute()
#idx=np.random.randint(len(data['ts'])-1,size=400) #idx=slice(400) #ugali.utils.plotting.plotChernoff(data['ts'][idx]) #ugali.utils.plotting.plotChernoff(data['fit_ts']) plt.ion() """ try: fig = plt.figure() x = range(len(data)) y = data['fit_mass']/data['stellar_mass'] yclip,lo,hi = scipy.stats.sigmaclip(y) yerr = data['fit_mass_err']/data['stellar_mass'] plt.errorbar(x,y,yerr=yerr,fmt='o',c='k') plt.axhline(1,ls='--',c='gray',lw=2) plt.axhline(np.mean(yclip),ls='--',c='r',lw=2) plt.ylim(lo,hi) plt.ylabel("Best-Fit Mass Residual") plt.xlabel("Simulation Number") except: pass """ Pipeline.run = run pipeline = Pipeline(__doc__,components) pipeline.parser.add_argument('-n','--num',default=None,type=int) pipeline.parse_args() pipeline.execute() import pylab as plt