More debugging. Temporarily disabled phase shifting
This commit is contained in:
parent
7662ea98d4
commit
8f582707da
4 changed files with 51 additions and 17 deletions
|
@ -50,7 +50,7 @@ def compute_ref_power(L, N, cosmo, bins=10, range=(0,1), func='HU_WIGGLES'):
|
|||
|
||||
return bin_power(p.compute(k)*cosmo['h']**3, L, bins=bins, range=range)
|
||||
|
||||
def run_generation(input_borg, a_borg, a_ic, **cosmo):
|
||||
def run_generation(input_borg, a_borg, a_ic, cosmo, supersample=1, do_lpt2=True):
|
||||
""" Generate particles and velocities from a BORG snapshot. Returns a tuple of
|
||||
(positions,velocities,N,BoxSize,scale_factor)."""
|
||||
|
||||
|
@ -61,10 +61,10 @@ def run_generation(input_borg, a_borg, a_ic, **cosmo):
|
|||
|
||||
density_hat, L = ba.half_pixel_shift(borg_vol)
|
||||
|
||||
lpt = LagrangianPerturbation(density_hat, L, fourier=True)
|
||||
lpt = LagrangianPerturbation(density_hat, L, fourier=True, supersample=supersample)
|
||||
|
||||
# Generate grid
|
||||
posq = gen_posgrid(N, L)
|
||||
posq = gen_posgrid(N*supersample, L)
|
||||
vel= []
|
||||
posx = []
|
||||
|
||||
|
@ -73,11 +73,15 @@ def run_generation(input_borg, a_borg, a_ic, **cosmo):
|
|||
D1_0 = D1/cgrowth.D(a_borg)
|
||||
velmul = cgrowth.compute_velmul(a_ic)*D1_0
|
||||
|
||||
D2 = 3./7 * D1**2
|
||||
D2 = -3./7 * D1_0**2
|
||||
|
||||
for j in xrange(3):
|
||||
# Generate psi_j (displacement along j)
|
||||
print("LPT1 axis=%d" % j)
|
||||
psi = D1_0*lpt.lpt1(j).flatten()
|
||||
if do_lpt2:
|
||||
print("LPT2 axis=%d" % j)
|
||||
psi += D2 * lpt.lpt2(j).flatten()
|
||||
# Generate posx
|
||||
posx.append(((posq[j] + psi)%L).astype(np.float32))
|
||||
# Generate vel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue