cmap=cm.coolwarm, title=pols[m], xlabel='Frequency (Mhz)', ylabel='Obs', cbar_label='Fraction', xticks=xticks, xminors=xminors, yminors=yminors, xticklabels=xticklabels, zero_mask=False, mask_color='black') pl.image_plot(fig_INS_s, ax_INS_s[m / 2][m % 2], INS_stack[:, 0, :, m], title=pols[m], cbar_label='Amplitude (UNCALIB)', xticks=xticks, aspect_ratio=0.1, xminors=xminors, xticklabels=xticklabels, zero_mask=False) pl.image_plot(fig_FD_s, ax_FD_s[m / 2][m % 2], FD_stack[:, 0, :, m], cmap=cm.coolwarm, title=pols[m], cbar_label='Fraction', aspect_ratio=0.1, xticks=xticks, xminors=xminors, xticklabels=xticklabels, zero_mask=False, mask_color='black') for m in range(2): pl.line_plot(fig_m, ax_m[m], [[INS_m[0, :, n] for n in range(4)], [frac_diff_m[0, :, n] for n in range(4)]][m], title=avg_title[m], xlabel='Frequency (Mhz)', ylabel=ylabels[m], labels=pols, xticks=xticks, xticklabels=xticklabels, xminors=xminors) pl.line_plot(fig_mp, ax_mp[m], [[INS_m[0].mean(axis=-1), ], [frac_diff_m[0].mean(axis=-1), ]][m], title=avg_title[m], xlabel='Frequency (Mhz)', ylabel=ylabels[m], xticks=xticks, xticklabels=xticklabels, xminors=xminors, legend=False) fig_INS.savefig('%sGolden_Set_INS.png' % (outpath)) fig_fd.savefig('%sGolden_Set_FD.png' % (outpath)) fig_m.savefig('%sGolden_Set_INS_FD_tavg.png' % (outpath)) fig_mp.savefig('%sGolden_Set_INS_FD_tpavg.png' % (outpath)) fig_INS_s.savefig('%sGolden_Set_INS_noavg.png' % (outpath)) fig_FD_s.savefig('%sGolden_Set_FD_noavg.png' % (outpath))
fig.savefig('%s%i/%s_match_filter_MS.png' % (outpath, sig_thresh, obs)) plt.close(fig) occ = occ_num / occ_den * 100 occ_freq = (occ_freq_num.transpose() / occ_freq_den).transpose() * 100 np.save('%sRFI_occupancy_sigma.npy' % (outpath), occ) np.save('%sRFI_occupancy_freq.npy' % (outpath), occ_freq) fig, ax = plt.subplots(figsize=(14, 8)) fig_f, ax_f = plt.subplots(figsize=(14, 8)) xticks = range(-5, 25, 5) xticklabels = [str(tick + 4) for tick in xticks] pl.line_plot(fig, ax, [ occ, ], title='RFI Occupancy at Different Thresholds', xlabel='Sigma', ylabel='Percent Occupancy', xticks=xticks, xticklabels=xticklabels, legend=False) xticks = [64 * k for k in range(6)] xminors = AutoMinorLocator(4) xticklabels = ['%.1f' % (freq_array[0, tick] * 10**(-6)) for tick in xticks] pl.line_plot(fig_f, ax_f, occ_freq, title='RFI Occupancy at Different Frequencies', xlabel='Frequency (Mhz)', ylabel='Percent Occupancy', xticks=xticks, xminors=xminors,
fig, ax = plt.subplots(figsize=(14, 8)) pl.error_plot(fig, ax, x, mu_sim, None, s_sim, label='Simulation', drawstyle='steps-mid') pl.error_plot(fig, ax, x, m, None, s, label='Theory', drawstyle='steps-mid') pl.error_plot(fig, ax, fx, mf, None, None, xlabel='$\sigma$', ylabel='Counts', label='Standard Normal PDF') fig.savefig('%s/Error_Plots.png' % (outpath)) plt.close(fig) fig, ax = plt.subplots(figsize=(14, 8)) pl.line_plot(fig, ax, [s, s_sim], title='Standard Deviation Comparison', labels=['Theory', 'Simulations'], xlabel='$\sigma$', ylabel='STD (Counts)') fig.savefig('%s/STD_Comp.png' % (outpath))
# anal_sigs = np.random.multivariate_normal([0, 0], cov, size=10**args.s[0]) s = np.random.normal(size=10**args.s[0]) n1 = np.random.normal(size=10**args.s[0]) n2 = np.random.normal(size=10**args.s[0]) anal_sig_1 = combo[0] * (a * s + b * n1) anal_sig_2 = combo[1] * (a * s + b * n2) dig_sig_1 = digital_signal(args.n[0], anal_sig_1, args.q[0]) dig_sig_2 = digital_signal(args.n[0], anal_sig_2, args.q[0]) corr[i] = np.mean(dig_sig_1.sig * dig_sig_2.sig) if not i: k = rhos[i] / corr[i] rho_quant[i] = k * corr[i] frac[i] = rho_quant[i] / rhos[i] - 1 data = [corr, rho_quant, frac] for axis, y, ylabel in zip(ax, data, ylabels): plot_args = (fig, axis, rhos, [ y, ]) plot_kwargs.update({'ylabel': ylabel}) pl.line_plot(*plot_args, **plot_kwargs) if not os.path.exists(args.outpath[0]): os.makedirs(args.outpath[0]) fig.savefig('%s/digital_correlation_sim_n%i_q%i_s%i.png' % (args.outpath[0], args.n[0], args.q[0], args.s[0])) print('Ended at %s' % (time.strftime('%H:%M:%S')))
plot_lib.image_plot(fig_ratio, ax_ratio[m / 2][m % 2], ratio[:, :, m], title=pol_titles[m], cbar_label='Excess/Average', xticks=xticks, xticklabels=xticklabels, xminors=xminors, zero_mask=False, cmap=cm.coolwarm) plot_lib.line_plot( fig_line, ax_line[m / 2][m % 2], [ mean[:, m], fit[:, m], fit[:, m] + fit_centers[:, m], fit[:, m] + fit_edges[:, m] ], title=pol_titles[m], xticks=xticks, xminors=xminors, xticklabels=xticklabels, zorder=[1, 2, 2, 2], labels=['Template', 'Fit', 'Center Teeth Fit', 'Edge Teeth Fit']) plot_lib.scatter_plot_2d(fig_scatter, ax_scatter[m / 2][m % 2], temps[:, m], mean[:, m], title=pol_titles[m], xlabel='Fit Width', ylabel='Template') fig_exc.savefig('%s%s_Vis_Avg_Excess.png' % (plot_dir, obslist[n])) fig_ratio.savefig('%s%s_Vis_Avg_Ratio.png' % (plot_dir, obslist[n]))