示例#1
0
def eb_modes(cmd_args):

    #Plot setup
    fig, ax = plt.subplots()

    #Load in the shear map, compute E and B modes power spectrum
    shear = ShearMap.load(
        os.path.join(dataExtern(), "WLshear_z2.00_0001r.fits"))
    l_edges = np.linspace(200., 50000., 50)
    l, ee, bb, eb = shear.decompose(l_edges)

    #Plot the power spectra and prediction from NICAEA
    ax.plot(l, l * (l + 1) * ee / (2. * np.pi), label=r"$P^{EE}$", color="red")
    cosmo = Nicaea(Om0=0.26, Ode0=0.74, w0=-1, sigma8=0.8)
    ax.plot(l,
            l * (l + 1) * cosmo.convergencePowerSpectrum(l, z=2.0) /
            (2. * np.pi),
            label=r"$P^{\kappa\kappa}{\rm (NICAEA)}$",
            linestyle="--",
            color="red")
    ax.plot(l,
            l * (l + 1) * bb / (2. * np.pi),
            label=r"$P^{BB}$",
            color="blue")

    #Labels
    ax.set_xscale("log")
    ax.set_yscale("log")
    ax.set_xlabel(r"$\ell$", fontsize=22)
    ax.set_ylabel(r"$\ell(\ell+1)P_\ell/2\pi$", fontsize=22)
    ax.legend(loc="upper left")

    #Save
    fig.savefig("eb_modes." + cmd_args.type)
示例#2
0
    shear_file_1 = fits.open(filename1)
    angle = shear_file_1[0].header["ANGLE"]
    gamma = shear_file_1[0].data.astype(np.float)
    shear_file_1.close()

    shear_file_2 = fits.open(filename2)
    assert shear_file_2[0].header["ANGLE"] == angle
    gamma = np.array((gamma, shear_file_2[0].data.astype(np.float)))
    shear_file_2.close()

    return angle * deg, gamma


test_map = ShearMap.load("Data/shear1.fit",
                         filename2="Data/shear2.fit",
                         format=two_file_loader)
test_map_conv = ConvergenceMap.load("Data/conv.fit")

l_edges = np.arange(200.0, 50000.0, 200.0)


def test_visualize1():

    assert hasattr(test_map, "data")
    assert hasattr(test_map, "side_angle")
    assert test_map.data.shape[0] == 2

    test_map.setAngularUnits(arcsec)
    test_map.visualize(colorbar=True)
    test_map.fig.tight_layout()
示例#3
0
	shear_file_1 = fits.open(filename1)
	angle = shear_file_1[0].header["ANGLE"]
	gamma = shear_file_1[0].data.astype(np.float)
	shear_file_1.close()

	shear_file_2 = fits.open(filename2)
	assert shear_file_2[0].header["ANGLE"] == angle
	gamma = np.array((gamma,shear_file_2[0].data.astype(np.float)))
	shear_file_2.close()

	return angle*deg,gamma




test_map = ShearMap.load("Data/shear1.fit",filename2="Data/shear2.fit",format=two_file_loader)

l_edges = np.arange(200.0,50000.0,200.0)

l,EE,BB,EB = test_map.decompose(l_edges,keep_fourier=True)

assert l.shape == EE.shape == BB.shape == EB.shape

fig,ax = plt.subplots()
ax.plot(l,l*(l+1)*EE/(2.0*np.pi),label=r"$P_{EE}$")
ax.plot(l,l*(l+1)*BB/(2.0*np.pi),label=r"$P_{BB}$")
ax.plot(l,l*(l+1)*np.abs(EB)/(2.0*np.pi),label=r"$\vert P_{EB}\vert$")

ax.set_xscale("log")
ax.set_yscale("log")
ax.set_xlabel(r"$l$")