gs.update(hspace=0.0, wspace=0.2) ax3 = [plt.subplot( gs[:-1,i]) for i in range(Nzs)] 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')
gs.update(hspace=0.0, wspace=0.2) ax3 = [plt.subplot(gs[:-1, i]) for i in range(Nzs)] ax4 = [plt.subplot(gs[-1, i], sharex=ax1[gs_ind]) 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) freqs = capo.pspec.z2f(z_ref) * 1e3 noise_ind = np.array( [np.argmin(abs(np.array(noise_freqs) - fq)) for fq in freqs]) noise_freqs = np.take(noise_freqs, noise_ind).tolist() noise_ks = np.take(noise_ks, noise_ind, axis=0).tolist() noises = np.take(noises, noise_ind, axis=0).tolist() # POBER_NOISE = py21cm.noise_interp2d( # noise_freqs,noise_ks,noises,interp_kind='linear') if opts.psa32_noise: noise_freqs_32, noise_ks_32, noises_32 = py21cm.load_noise_files( glob.glob(opts.psa32_noise), polyfit_deg=3)
z_bin = f2z(freq) except: 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
gs.update(hspace=0.0, wspace=0.2) ax3 = [plt.subplot( gs[:-1,i]) for i in range(Nzs)] 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') if opts.psa32_noise: noise_freqs_32, noise_ks_32, noises_32 = py21cm.load_noise_files( glob.glob(opts.psa32_noise),polyfit_deg=3 ) # POBER_NOISE_32 = py21cm.noise_interp2d(noise_freqs_32,noise_ks_32,noises_32,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):
gs.update(hspace=0.0, wspace=0.2) ax3 = [plt.subplot(gs[:-1, i]) for i in range(Nzs)] 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], '--',
try: z_bin = f2z(freq) 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 = []
try: z_bin = f2z(freq) 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 = []
# Create figure and prep subplot sizes for P(k) Noise fig5 = plt.figure(figsize=figsize) gs = gridspec.GridSpec(1, Nzs) gs.update(hspace=0.0, wspace=0.2) ax5 = [plt.subplot(gs[:, i]) for i in range(Nzs)] plt.subplots_adjust(left=0.2) # Create figure and prep subplot sizes for P(k) Noise fig6 = plt.figure(figsize=figsize) gs = gridspec.GridSpec(1, Nzs) gs.update(hspace=0.0, wspace=0.2) ax6 = [plt.subplot(gs[:, i]) for i in range(Nzs)] plt.subplots_adjust(left=0.2) if args.noisefiles: noise_freqs, noise_ks, noises = py21cm.load_noise_files( args.noisefiles, polyfit_deg=3) freqs = capo.pspec.z2f(zs) * 1e3 noise_ind = np.array([np.argmin(abs(np.array(noise_freqs) - fq)) for fq in freqs]) noise_freqs = np.take(noise_freqs, noise_ind).tolist() noise_ks = np.take(noise_ks, noise_ind, axis=0).tolist() noises = np.take(noises, noise_ind, axis=0).tolist() # Plot the Noise files on the plot for gs_ind in xrange(Nzs): ax1[gs_ind].plot(noise_ks[gs_ind], noises[gs_ind], 'c-', label='21cmSense') d2_n = noises[gs_ind] pk_n = 2*np.pi**2/(np.array(noise_ks[gs_ind])**3)*d2_n
z_bin = f2z(freq) except: 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