Fixed cic. Fixed lpt1 evaluation in cosmogrowth

This commit is contained in:
Guilhem Lavaux 2014-06-03 10:48:54 +02:00
parent 4bc7bf47a7
commit 7662ea98d4
4 changed files with 28 additions and 16 deletions

View file

@ -34,6 +34,7 @@ def compute_power_from_borg(input_borg, a_borg, cosmo, bins=10, range=(0,1)):
cgrowth = CosmoGrowth(**cosmo)
D1 = cgrowth.D(1)
D1_0 = D1/cgrowth.D(a_borg)
print("D1_0=%lg" % D1_0)
density_hat, L = ba.half_pixel_shift(borg_vol)
@ -76,7 +77,7 @@ def run_generation(input_borg, a_borg, a_ic, **cosmo):
for j in xrange(3):
# Generate psi_j (displacement along j)
psi = D1_0*lpt.lpt1(j).flatten()*(N/L)**3
psi = D1_0*lpt.lpt1(j).flatten()
# Generate posx
posx.append(((posq[j] + psi)%L).astype(np.float32))
# Generate vel

View file

@ -57,7 +57,7 @@ class LagrangianPerturbation(object):
k2 = self._get_k2()
k2[0,0,0] = 1
return self._gradient(-self.dhat/k2, direction)
return self._gradient(self.dhat/k2, direction)
def new_shape(self,direction, q=3, half=False):
N0 = (self.N/2+1) if half else self.N

View file

@ -10,5 +10,9 @@ cosmo['SIGMA8']=0.8344
zstart=0
astart=1/(1.+zstart)
pos,_,density,N,L,_ = bic.run_generation("initial_condition_borg.dat", 0.001, astart, **cosmo)
dcic = ct.cicParticles(pos, L, N)
#if __name__=="__main__":
# bic.write_icfiles(*bic.run_generation("initial_condition_borg.dat", 0.001, astart, **cosmo), **cosmo)