ax4 = [plt.subplot( gs[-1,i] , sharex=ax1[i]) for i in range(Nzs)] else: fig = plt.figure() gs = gridspec.GridSpec(1,Nzs) gs.update(hspace=0.0, wspace=0.2) ax1 = [plt.subplot( gs[:,i]) for i in range(Nzs)] fig2 = plt.figure() gs = gridspec.GridSpec(1,Nzs) gs.update(hspace=0.0, wspace=0.2) ax3 = [plt.subplot( gs[:,i]) for i in range(Nzs)] noise_freqs, noise_ks, noises = py21cm.load_noise_files( glob.glob(opts.noisefiles),polyfit_deg=3 ) POBER_NOISE = py21cm.noise_interp2d(noise_freqs,noise_ks,noises,interp_kind='linear') for key in data: z,ks,k3pk,k3err = capo.eor_results.get_k3pk_from_npz( data[key] ) _,kpls,pk,pkerr = capo.eor_results.get_pk_from_npz( data[key] ) fqs = capo.pspec.z2f(z)*1e3 ##put freqs in Mhz for i, redshift in enumerate(z): ax1[i].plot(ks[i], np.abs(k3pk[i]) + k3err[i], '--', color=colors[key],label=key) ax1[i].plot(ks[i], 2*POBER_NOISE(fqs[i],ks[i]), 'k-') ax1[i].set_yscale('log') if i > 0: ax1[i].get_shared_y_axes().join(ax1[0],ax1[i])
else: fig = plt.figure() gs = gridspec.GridSpec(1, Nzs) gs.update(hspace=0.0, wspace=0.2) ax1 = [plt.subplot(gs[:, i]) for i in range(Nzs)] fig2 = plt.figure() gs = gridspec.GridSpec(1, Nzs) gs.update(hspace=0.0, wspace=0.2) ax3 = [plt.subplot(gs[:, i]) for i in range(Nzs)] noise_freqs, noise_ks, noises = py21cm.load_noise_files(glob.glob( opts.noisefiles), polyfit_deg=3) POBER_NOISE = py21cm.noise_interp2d(noise_freqs, noise_ks, noises, interp_kind='linear') for key in data: z, ks, k3pk, k3err = capo.eor_results.get_k3pk_from_npz(data[key]) _, kpls, pk, pkerr = capo.eor_results.get_pk_from_npz(data[key]) fqs = capo.pspec.z2f(z) * 1e3 ##put freqs in Mhz for i, redshift in enumerate(z): ax1[i].plot(ks[i], np.abs(k3pk[i]) + k3err[i], '--', color=colors[key], label=key) ax1[i].plot(ks[i], 2 * POBER_NOISE(fqs[i], ks[i]), 'k-')
print 'frequency not found in boots. Searching in pspec.npz' f_name = ('/home/mkolopanis/psa64/sigloss_verification/' 'Jul6_noise_3Jy_inttime_44/95_115/I/' 'pspec_Jul6_noise_3Jy_inttime_44_95_115_I.npz') npz = n.load(f_name) # matt's data freq = npz['freq'] z_bin = f2z(freq) # load 21cmSense Noise models used to compute Beta # Beta = (P_noise + P_inj)/P_out noise_files = ('/home/mkolopanis/psa64/' '21cmsense_noise/dish_size_1/*drift_mod*.npz') n_fqs, n_ks, noise = py21cm.load_noise_files(glob.glob(noise_files)) noise_interp = py21cm.noise_interp2d(n_fqs, n_ks, noise) kpls_pos = n.concatenate(n.array_split(kpls, [10, 11])[1:]) umag = 30 / (3e8 / (freq * 1e9)) kpr = dk_du(z_bin) * umag n_k = n.array(n.sqrt(kpls_pos**2 + kpr**2)) d2_n = noise_interp(freq * 1e3, n_k) pk_n = 2 * n.pi**2 / (n_k**3) * d2_n # * 3887./2022 p_n = n.median(pk_n) # p_n = n.max( pk_n ) print 'This script does not Bootstrap' # take the median over k's # Now has shape (inj, boots*times) pIs = n.ma.median(pIs, 1)
except: print 'frequency not found in boots. Searching in pspec.npz' npz = n.load('/home/mkolopanis/psa64/sigloss_verification/' 'Jul6_noise_3Jy_inttime_44/95_115/I/' 'pspec_Jul6_noise_3Jy_inttime_44_95_115_I.npz') # matt's data freq = npz['freq'] z_bin = f2z(freq) # load 21cmSense Noise models used to compute Beta # Beta = (P_noise + P_inj)/P_out n_fqs, n_ks, noise = py21cm.load_noise_files( glob.glob('/home/mkolopanis/psa64/21cmsense_noise/' 'dish_size_1/*drift_mod*.npz')) noise_interp = py21cm.noise_interp2d(n_fqs, n_ks, noise) kpls_pos = n.concatenate(n.array_split(kpls, [10, 11])[1:]) umag = 30/(3e8/(freq*1e9)) kpr = dk_du(z_bin) * umag n_k = n.array(n.sqrt(kpls_pos**2 + kpr**2)) d2_n = noise_interp(freq*1e3, n_k) pk_n = 2*n.pi**2/(n_k**3) * d2_n # * 3887./2022 p_n = n.median(pk_n) # p_n = n.max( pk_n ) pIvs_boot = [] pCvs_boot = [] pCs_boot = [] pIs_boot = []