def __init__(self, app, ini=None, base_dir=None): """ Initialize of GUI components. """ super(MainWindow, self).__init__() if base_dir is None: base_dir = batchJob.getCodeRootPath() os.chdir(base_dir) self.updating = False self.app = app self.base_dir = base_dir # GUI setup self.createWidgets() self.createActions() self.createMenus() self.createStatusBar() self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowTitle("GetDist GUI") # Allow to shutdown the GUI with Ctrl+C signal.signal(signal.SIGINT, signal.SIG_DFL) # Path for .ini file self.iniFile = ini or MCSamples.default_getdist_settings # Path of root directory self.rootdirname = None self.plot_module = 'GetDistPlots' self._resetGridData() self._resetPlotData() lastDir = self.getSettings().value('lastSearchDirectory') if lastDir: self.openDirectory(lastDir)
def BAOdensity(prob_file): d = loadtxt(prob_file) ix = 0 prob = np.zeros((alpha_npoints, alpha_npoints)) alpha_perp = np.zeros(alpha_npoints) alpha_pl = np.zeros(alpha_npoints) for i in range(alpha_npoints): for j in range(alpha_npoints): alpha_perp[i] = d[ix, 0] alpha_pl[j] = d[ix, 1] prob[j, i] = d[ix, 2] ix += 1 prob = prob / np.max(prob) return alpha_perp, alpha_pl, prob alpha_perp, alpha_pl, prob = BAOdensity(batchJob.getCodeRootPath() + 'data/sdss_DR11CMASS_consensus.dat') densityG = BAOdensityG() perp = alpha_perp * DA_fid para = H_fid / alpha_pl density = GetDistPlots.Density2D() density.pts = prob density.x1 = perp density.x2 = para density.contours = exp(-np.array([1.509, 2.4477]) ** 2 / 2) root = 'base_plikHM_TT_lowTEB_lensing'
FAP, f8 = np.meshgrid(FAP, f8) like = (FAP - FAPbar) ** 2 * invcov[0, 0] + 2 * (FAP - FAPbar) * (f8 - f8bar) * invcov[0, 1] + (f8 - f8bar) ** 2 * invcov[1, 1] density = GetDistPlots.Density2D() density.pts = exp(-like / 2) density.x1 = FAP density.x2 = f8 density.contours = exp(-np.array([1.509, 2.4477]) ** 2 / 2) return density FAPbar = 0.6725 f8bar = 0.4412 density = RSDdensity(FAPbar, f8bar, batchJob.getCodeRootPath() + 'data/sdss_DR11CMASS_RSD_bao_invcov_Samushia.txt') g.add_2d_contours(roots[0], 'FAP057', 'fsigma8z057', filled=True, density=density) # CS = contourf(FAP, f8, like, origin='lower', levels=[2.279, 5.991], colors='r') FAPbar = .683 f8bar = 0.422 density = RSDdensity(FAPbar, f8bar, batchJob.getCodeRootPath() + 'data/sdss_DR11CMASS_RSD_bao_invcov_Beutler.txt') g.add_2d_contours(roots[0], 'FAP057', 'fsigma8z057', filled=False, density=density, ls=':', alpha=0.5) g.add_2d_contours(roots[0], 'FAP057', 'fsigma8z057', filled=True, plotno=3) g.add_legend(['BOSS CMASS (Samushia et al.)', 'BOSS CMASS (Beutler et al.)', s.defplanck + '+lensing'], legend_loc='upper left')
d = loadtxt(prob_file) ix = 0 prob = np.zeros((alpha_npoints, alpha_npoints)) alpha_perp = np.zeros(alpha_npoints) alpha_pl = np.zeros(alpha_npoints) for i in range(alpha_npoints): for j in range(alpha_npoints): alpha_perp[i] = d[ix, 0] alpha_pl[j] = d[ix, 1] prob[j, i] = d[ix, 2] ix += 1 prob = prob / np.max(prob) return alpha_perp, alpha_pl, prob alpha_perp, alpha_pl, prob = BAOdensity(batchJob.getCodeRootPath() + 'data/sdss_DR11CMASS_consensus.dat') densityG = BAOdensityG() perp = alpha_perp * DA_fid para = H_fid / alpha_pl density = GetDistPlots.Density2D() density.pts = prob density.x1 = perp density.x2 = para density.contours = exp(-np.array([1.509, 2.4477])**2 / 2) root = 'base_plikHM_TT_lowTEB_lensing'
s = GetDistPlots.defaultSettings s.legend_frame = False s.figure_legend_frame = False s.prob_label = r'$P/P_{\rm max}$' s.norm_prob_label = 'Probability density' s.prob_y_ticks = True s.param_names_for_labels = 'clik_units.paramnames' s.alpha_filled_add = 0.85 s.solid_contour_palefactor = 0.6 s.solid_colors = [('#8CD3F5', '#006FED'), ('#F7BAA6', '#E03424'), ('#D1D1D1', '#A1A1A1'), 'g', 'cadetblue', 'indianred'] s.axis_marker_lw = 0.6 s.lw_contour = 1 use_plot_data = MCSamples.use_plot_data rootdir = MCSamples.default_grid_root or os.path.join(batchJob.getCodeRootPath(), 'main') output_base_dir = MCSamples.output_base_dir or batchJob.getCodeRootPath() H0_gpe = [70.6, 3.3] # various Omegam sigma8 constraints for plots def planck_lensing(omm, sigma): # g60_full return (0.591 + 0.021 * sigma) * omm ** (-0.25) def plotBounds(omm, data, c='gray'): pylab.fill_between(omm, data(omm, -2), data(omm, 2), facecolor=c, alpha=0.15, edgecolor=c, lw=0) pylab.fill_between(omm, data(omm, -1), data(omm, 1), facecolor=c, alpha=0.25, edgecolor=c, lw=0)