LPT

lpt(nc, boxsize, a, ps, seed)

Generate a 2LPT displacement with $nc^3$ particles in a box of boxsize on a size at scale factor a, using a random Gaussian field with a power spectrum ps at $a=1$, and random seed seed.


In [3]:
%matplotlib inline
import matplotlib.pyplot as plt
import fs

omega_m = 0.308
nc = 64
boxsize = 64
a = 0.1
seed = 1

fs.msg.set_loglevel(3)
fs.cosmology.init(omega_m)
ps = fs.PowerSpectrum('../data/planck_matterpower.dat')

# Set 2LPT displacements at scale factor a
particles = fs.lpt.init(nc, boxsize, a, ps, seed)

In [4]:
p = particles.slice(2/nc) # particles in a slice 0 <= x[2] < 2/nc*boxsize

fig = plt.figure(figsize=(6,6))
ax = fig.add_subplot(111, aspect='equal')
ax.set_xlim(0, boxsize)
ax.set_ylim(0, boxsize)
plt.plot(p[:,0], p[:,1], 'r,');



In [ ]: