def plot(self): super(MatterPowerPlot, self).plot() done_any = False if self.power_files_exist("matter_power_lin"): self.plot_section("matter_power_lin", "Linear") done_any = True if self.power_files_exist("matter_power_nl"): self.plot_section("matter_power_nl", "Non-Linear") done_any = True if self.power_files_exist("matter_power_gal"): self.plot_section("matter_power_gal", "Galaxy") done_any = True if self.power_files_exist("matter_power_no_bao"): self.plot_section("matter_power_no_bao", "No BAO") done_any = True if self.power_files_exist("intrinsic_alignment_parameters"): self.plot_section("intrinsic_alignment_parameters", "Intrinsic-intrinsic", p_name='p_ii') done_any = True if self.power_files_exist("intrinsic_alignment_parameters"): self.plot_section("intrinsic_alignment_parameters", "Shear-intrinsic", p_name='p_gi') done_any = True if not done_any: raise IOError("Not making plot: %s (no data in this sample)" % self.__class__.__name__[:-4]) pylab.xlabel("$k / (Mpc/h)$") pylab.ylabel("$P(k) / (h^1 Mpc)^3$") pylab.grid() pylab.legend()
def plot(self): super(DistancePlot, self).plot() z = self.load_file("distances", "z") d = self.load_file("distances", self.distance) pylab.plot(z, d * self.scaling) pylab.grid() pylab.xlabel("Redshift z") pylab.ylabel(self.name)
def plot(self): super(LuminositySlopePlot, self).plot() section = "galaxy_luminosity_function" z = self.load_file(section, "z") alpha = self.load_file(section, "alpha") pylab.plot(z, alpha) pylab.grid() pylab.xlabel("Redshift z") pylab.ylabel("Luminosity Function Slope $\\alpha$")
def plot(self): super(CMBSpectrumPlot, self).plot() ell = self.load_file("cmb_cl", "ell") c_ell = self.load_file("cmb_cl", self.name) pylab.plot(ell, c_ell) pylab.grid() pylab.xlabel("$\\ell$") pylab.ylabel("$\\ell(\\ell+1) C_\\ell/2\\pi \\mathrm{" + self.name.upper() + "} / uK^2$")
def plot(self): super(GrandPlot, self).plot() ell = self.load_file("cmb_cl", "ell") for name in ['tt', 'ee', 'te', 'bb']: c_ell = self.load_file("cmb_cl", name) pylab.loglog(ell, abs(c_ell), label=name.upper()) pylab.legend() pylab.grid() pylab.xlabel("$\\ell$") pylab.ylabel("$\\ell(\\ell+1) C_\\ell/2\\pi / uK^2$")
def plot(self): super(GrowthPlot, self).plot() section = "growth_parameters" z = self.load_file(section, "z") d_z = self.load_file(section, "d_z") f_z = self.load_file(section, "f_z") pylab.plot(z, d_z, label='$d(z)$') pylab.plot(z, f_z, label='$f(z)$') pylab.grid() pylab.xlabel("Redshift z") pylab.ylabel("Growth Functions") pylab.legend(loc='center right')
def plot(self): super(ShearCorrelationMinusPlot, self).plot() nbin = 0 for i in range(1, 100): filename = self.file_path("shear_xi_minus", "bin_{0}_{0}".format(i)) if os.path.exists(filename): nbin += 1 else: break if nbin == 0: IOError("No data for plot: %s" % self.__class__.__name__[:-4]) theta = self.load_file("shear_xi_minus", "theta") sz = 1.0 / (nbin + 2) for i in range(1, nbin + 1): for j in range(1, i + 1): rect = (i * sz, j * sz, sz, sz) self.figure.add_axes(rect) #pylab.ploy() #pylab.subplot(nbin, nbin, (nbin*nbin)-nbin*(j-1)+i) xi = self.load_file("shear_xi_minus", "bin_{0}_{1}".format(i, j)) pylab.loglog(theta, xi) pylab.xlim(1e-4, 1e-1) pylab.ylim(2e-7, 1e-3) if i == 1 and j == 1: pylab.xlabel("$\\theta$") pylab.ylabel("$\\xi_+(\\theta)$") else: pylab.gca().xaxis.set_ticklabels([]) pylab.gca().yaxis.set_ticklabels([]) pylab.gca().tick_params(length=0.0, which='minor') pylab.gca().tick_params(length=3.0, which='major') pylab.gca().tick_params(labelsize=10) pylab.text(1.5e-3, 1.8e-4, "(%d,%d)" % (i, j), fontsize=8, color='red') pylab.grid()
def plot_section(self, section): nbin = 0 for i in range(1, 100): filename = self.file_path(section, "bin_{0}_{0}".format(i)) if os.path.exists(filename): nbin += 1 else: break if nbin == 0: IOError("No data for plot: %s" % self.__class__.__name__[:-4]) ell = self.load_file(section, "ell") sz = 1.0 / (nbin + 2) for i in range(1, nbin + 1): for j in range(1, i + 1): rect = (i * sz, j * sz, sz, sz) self.figure.add_axes(rect) #pylab.ploy() #pylab.subplot(nbin, nbin, (nbin*nbin)-nbin*(j-1)+i) cl = self.load_file(section, "bin_{0}_{1}".format(i, j)) if all(cl <= 0): cl *= -1 pylab.loglog(ell, ell * (ell + 1.) * cl / 2 / np.pi) pylab.ylim(*self.ylim) if i == 1 and j == 1: pylab.xlabel("$\\ell$") pylab.ylabel("$\\ell (\\ell+1) C_\\ell / 2 \\pi$") else: pylab.gca().xaxis.set_ticklabels([]) pylab.gca().yaxis.set_ticklabels([]) pylab.gca().tick_params(length=0.0, which='minor') pylab.gca().tick_params(length=3.0, which='major') pylab.gca().tick_params(labelsize=10) if section == "shear_cl": pylab.text(1.5 * ell.min(), 1.8e-4, "(%d,%d)" % (i, j), fontsize=8, color='red') pylab.grid()