def plot(self, ax, ax_err, colormap="jet"):
"""
Plot the calculated 2D power spectrum.
"""
x = self.k_perp
y = self.k_los
if self.meanstd:
title = "2D Power Spectrum (mean)"
title_err = "Error (standard deviation)"
else:
title = "2D Power Spectrum (median)"
title_err = "Error (1.4826*MAD)"
# median/mean
mappable = ax.pcolormesh(x[1:], y[1:],
np.log10(self.ps2d[0, 1:, 1:]),
cmap=colormap)
vmin, vmax = mappable.get_clim()
ax.set(xscale="log", yscale="log",
xlim=(x[1], x[-1]), ylim=(y[1], y[-1]),
xlabel=r"$k_{\perp}$ [Mpc$^{-1}$]",
ylabel=r"$k_{||}$ [Mpc$^{-1}$]",
title=title)
cb = ax.figure.colorbar(mappable, ax=ax, pad=0.01, aspect=30)
cb.ax.set_xlabel(r"[%s$^2$ Mpc$^3$]" % self.unit)
# error
mappable = ax_err.pcolormesh(x[1:], y[1:],
np.log10(self.ps2d[1, 1:, 1:]),
cmap=colormap)
mappable.set_clim(vmin, vmax)
ax_err.set(xscale="log", yscale="log",
xlim=(x[1], x[-1]), ylim=(y[1], y[-1]),
xlabel=r"$k_{\perp}$ [Mpc$^{-1}$]",
ylabel=r"$k_{||}$ [Mpc$^{-1}$]",
title=title_err)
cb = ax_err.figure.colorbar(mappable, ax=ax_err, pad=0.01, aspect=30)
cb.ax.set_xlabel(r"[%s$^2$ Mpc$^3$]" % self.unit)
return (ax, ax_err)
评论列表
文章目录