Ejemplo n.º 1
0
def stat_analysis(cutouts, binsize, arcmax, cents, modRMaps):
    profiles = []
    for i in range(0, len(cutouts)):
        thetaRange = np.arange(0., arcmax, binsize)
        breali = bin2D(modRMaps[i] * 180. * 60. / np.pi, thetaRange)
        a = breali.bin(cutouts[i])[1]
        profiles.append(a)
    statistics = stats.getStats(profiles)
    mean = statistics['mean']
    error = statistics['errmean']
    covmat = statistics['cov']
    corrcoef = stats.cov2corr(covmat)
    io.quickPlot2d(corrcoef, 'corrcoef.png')
    pl = Plotter(labelX='Distance from Center (arcminutes)',
                 labelY='Temperature Fluctuation ($\mu K$)',
                 ftsize=10)
    pl.add(cents, mean)
    pl.addErr(cents, mean, yerr=error)
    pl._ax.axhline(y=0., ls="--", alpha=0.5)
    pl.done(out_dir + "error.png")
Ejemplo n.º 2
0
              marker="o",
              alpha=0.5,
              label="auto n0subbed")

    io.save_cols(save_dir + "autokk.txt",
                 (lcents, rstats['mean'], rstats['errmean']))

    pl.add(lcents, nlkk, ls="--", label="theory n0")
    pl.add(lcents, nstats['mean'], ls="--", label="superdumb n0")
    io.save_cols(save_dir + "sdn0.txt",
                 (lcents, nstats['mean'], nstats['errmean']))
    pl.add(ellrange, clkk, color="k")
    pl.legendOn(loc="lower left", labsize=9)
    pl.done(out_dir + "cpower.png")

    io.quickPlot2d(stats.cov2corr(astats['covmean']), out_dir + "corr.png")
    io.quickPlot2d(stats.cov2corr(rstats['covmean']), out_dir + "rcorr.png")

    pl = io.Plotter()
    ldiff = (cstats['mean'] - istats['mean']) / istats['mean']
    lerr = cstats['errmean'] / istats['mean']
    io.save_cols(save_dir + "rxikk.txt",
                 (lcents, cstats['mean'], cstats['errmean']))
    io.save_cols(save_dir + "ratkk.txt", (lcents, ldiff, lerr))
    pl.addErr(lcents, ldiff, yerr=lerr, marker="o", ls="-")
    pl._ax.axhline(y=0., ls="--", color="k")
    pl._ax.set_ylim(-0.2, 0.1)
    pl.done(out_dir + "powerdiff.png")

    iltt2d = theory.lCl("TT", parray_dat.modlmap)
    ccents, iltt = lbinner_dat.bin(iltt2d)
Ejemplo n.º 3
0
    rxr = mpibox.stats['rxr']
    sdn0 = mpibox.stats['superdumbs']


    area = S0.area()*(180./np.pi)**2.
    print(("area: ", area, " sq.deg."))
    fsky = area/41250.
    print(("fsky: ",fsky))
    diagraw = np.sqrt(np.diagonal(rxr_raw['cov'])*cents*np.diff(lbin_edges)*fsky)
    diagn0sub = np.sqrt(np.diagonal(rxr['cov'])*cents*np.diff(lbin_edges)*fsky)
    idiag = np.sqrt(np.diagonal(ixr['cov'])*cents*np.diff(lbin_edges)*fsky)
    cents,clkk1d = lbinner.bin(clkk2d)
    idiag_est = clkk1d+(3.*(idiag**2.-clkk1d**2.)/clkk1d)

    
    io.quickPlot2d(stats.cov2corr(rxr['covmean']),pout_dir+"rcorr.png")
    io.quickPlot2d(stats.cov2corr(rxr_raw['covmean']),pout_dir+"corr.png")

    # if paper and not(unlensed):
    #     np.save(pout_dir+"covmat_"+str(area)+"sqdeg.npy",rxr['cov'])
    #     np.save(pout_dir+"lbin_edges_"+str(area)+"sqdeg.npy",lbin_edges)
    #     import cPickle as pickle
    #     pickle.dump((cents,mpibox.stats['noisett']['mean']),open(pout_dir+"noise.pkl",'wb'))
    
    ellrange = np.arange(2,kellmax,1)
    clkk = theory.gCl('kk',ellrange)
    pl = io.Plotter(scaleY='log',labelX="$L$",labelY="$C^{\\kappa\\kappa}_L$")#,scaleX='log')
    pl.add(ellrange,clkk,color="k",lw=3)
    io.save_cols(pout_dir+"_plot_clkk_theory.txt",(ellrange,clkk))
    pl.addErr(cents-140,ixr['mean'],yerr=ixr['errmean'],ls="none",marker="o",label='Input x Reconstruction')
    io.save_cols(pout_dir+"_plot_inputXrecon.txt",(cents,ixr['mean'],ixr['errmean']))
Ejemplo n.º 4
0
                  ls="-")
        pl.addErr(cents,
                  sgn * kapparecon_stats['mean'],
                  yerr=kapparecon_stats['errmean'],
                  ls="--")
        pl.done(out_dir + "kappa1d.png")

        if not (random):
            filename = "/profiles_simcmb_" + str(
                simulated_cmb) + "_simkap_" + str(
                    simulated_kappa) + "_periodic_" + str(periodic) + ".txt"
            np.savetxt(save_dir+filename,np.vstack((cents,kappa_stats['mean'],kappa_stats['errmean'],sgn*kapparecon_stats['mean'], \
                                                    kapparecon_stats['errmean'])).transpose(), \
                       header="# bin centers (arc) , input_kappa, input_kappa_err, recon_kappa, recon_kappa_err")

        io.quickPlot2d(stats.cov2corr(kappa_stats['cov']),
                       out_dir + "kappa_corr.png")

    reconstack = mpibox.stacks["recon_kappa2d"]
    io.quickPlot2d(reconstack, out_dir + "reconstack.png")
    if not (sigurd):
        inpstack = mpibox.stacks["input_kappa2d"]
        io.quickPlot2d(inpstack, out_dir + "inpstack.png")
        inp = enmap.ndmap(
            inpstack if abs(pixratio - 1.) < 1.e-3 else resample.resample_fft(
                inpstack, shape_dat), wcs_dat)
        pdiff = np.nan_to_num((inp - reconstack) * 100. / inp)
        io.quickPlot2d(pdiff, out_dir + "pdiffstack.png", lim=20.)
    np.save(save_dir + "/reconstack", reconstack)

    if not (cluster):
Ejemplo n.º 5
0
    pl = io.Plotter()
    pl.add(bin_cents,hist)
    pl.done(out_dir+"histogram_first_bin.png")
    

    pl = io.Plotter(scaleX='log',scaleY='log')
    
    pl.addErr(cents,kappa_stats['mean'],yerr=kappa_stats['errmean'],ls="-")
    pl.addErr(cents,kapparecon_stats['mean'],yerr=kapparecon_stats['errmean'],ls="--")
    pl._ax.set_xlim(0.1,10.)
    pl._ax.set_ylim(0.001,0.63)
    pl.done(out_dir+"kappa1d.png")



    io.quickPlot2d(stats.cov2corr(kappa_stats['cov']),out_dir+"kappa_corr.png")

    reconstack = mpibox.stacks["recon_kappa2d"]
    io.quickPlot2d(reconstack,out_dir+"reconstack.png")
    reconstack = mpibox.stacks["drecon_kappa2d"]
    io.quickPlot2d(reconstack,out_dir+"dreconstack.png")
    ureconstack = mpibox.stacks["urecon_kappa2d"]
    io.quickPlot2d(ureconstack,out_dir+"ureconstack.png")
    io.quickPlot2d(ureconstack-reconstack,out_dir+"diff_ud_reconstack.png")
    inpstack = mpibox.stacks["input_kappa2d"]
    io.quickPlot2d(inpstack,out_dir+"inpstack.png")
    inp = enmap.ndmap(inpstack if abs(pixratio-1.)<1.e-3 else resample.resample_fft(inpstack,shape_dat),wcs_dat)
    pdiff = np.nan_to_num((inp-reconstack)*100./inp)
    io.quickPlot2d(pdiff,out_dir+"pdiffstack.png",lim=20.)

Ejemplo n.º 6
0
    pl.add(lcents,diag,label=str(i))
    i+=1

pl.legendOn()
pl.done("test.png")



cov3 = "/gpfs01/astro/www/msyriac/plots/experiment_0.3arc_0.5uk_2000_2.91260385523sqdeg_covmat_dl300.npy"
lbin3 = "/gpfs01/astro/www/msyriac/plots/experiment_0.3arc_0.5uk_2000_2.91260385523sqdeg_lbin_edges_dl300.npy"
fsky3 = 2.91260385523/41250.

cov4 = "/gpfs01/astro/www/msyriac/plots/experiment_0.3arc_0.5uk_2000_2.91260385523sqdeg_autocovmat_dl300.npy"
lbin4 = "/gpfs01/astro/www/msyriac/plots/experiment_0.3arc_0.5uk_2000_2.91260385523sqdeg_lbin_edges_dl300.npy"
fsky4 = 2.91260385523/41250.


import orphics.tools.stats as stats
i = 0
for cov,lbin,fsky in zip([cov3,cov4],[lbin3,lbin4],[fsky3,fsky4]):
    covmat = np.load(cov)
    lbin_edges = np.load(lbin)
    lcents = (lbin_edges[1:]+lbin_edges[:-1])/2.
    lmin = lcents[0]
    lmax = lcents[-1]
    corr = stats.cov2corr(covmat)
    io.quickPlot2d(np.rot90(corr),"corr"+str(i)+".pdf",extent=[lmin,lmax,lmin,lmax],ticksize=10,labsize=10,ftsize=10,lim=[0.,1.0])
    i+=1