2014-06-03 18:50:04 +02:00
|
|
|
import numpy as np
|
|
|
|
import cosmotool as ct
|
|
|
|
import borgicgen as bic
|
2014-06-04 13:57:17 +02:00
|
|
|
import cosmogrowth as cg
|
2014-06-04 09:13:34 +02:00
|
|
|
import sys
|
2014-06-03 18:50:04 +02:00
|
|
|
|
|
|
|
cosmo={'omega_M_0':0.3175, 'h':0.6711}
|
|
|
|
cosmo['omega_lambda_0']=1-cosmo['omega_M_0']
|
|
|
|
cosmo['omega_k_0'] = 0
|
|
|
|
cosmo['omega_B_0']=0.049
|
|
|
|
cosmo['SIGMA8']=0.8344
|
2014-06-04 13:57:17 +02:00
|
|
|
cosmo['ns']=0.9624
|
2014-06-12 11:23:17 +02:00
|
|
|
N0=256
|
2014-06-04 13:57:17 +02:00
|
|
|
|
|
|
|
doSimulation=True
|
2014-06-12 11:23:17 +02:00
|
|
|
simShift=True
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-04 09:13:34 +02:00
|
|
|
snap_id=int(sys.argv[1])
|
2014-06-04 13:57:17 +02:00
|
|
|
astart=1/100.
|
|
|
|
|
|
|
|
if doSimulation:
|
2014-06-12 17:16:59 +02:00
|
|
|
s = ct.loadRamsesAll("/nethome/lavaux/remote2/borgsim3/", snap_id, doublePrecision=True)
|
2014-06-04 13:57:17 +02:00
|
|
|
astart=s.getTime()
|
|
|
|
L = s.getBoxsize()
|
|
|
|
|
2014-06-12 11:23:17 +02:00
|
|
|
p = s.getPositions()
|
|
|
|
Nsim = int( np.round( p[0].size**(1./3)) )
|
|
|
|
print("Nsim = %d" % Nsim)
|
|
|
|
|
|
|
|
if simShift:
|
|
|
|
p = [(q-0.5*L/Nsim)%L for q in p]
|
|
|
|
|
|
|
|
dsim = ct.cicParticles(p[::-1], L, N0)
|
2014-06-04 13:57:17 +02:00
|
|
|
dsim /= np.average(np.average(np.average(dsim, axis=0), axis=0), axis=0)
|
|
|
|
dsim -= 1
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-04 13:57:17 +02:00
|
|
|
dsim_hat = np.fft.rfftn(dsim)*(L/N0)**3
|
|
|
|
Psim, bsim = bic.bin_power(np.abs(dsim_hat)**2/L**3, L, range=(0,1.), bins=150)
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-12 11:23:17 +02:00
|
|
|
pos,_,density,N,L,_,_ = bic.run_generation("initial_density_2588.dat", 0.001, astart, cosmo, supersample=2, do_lpt2=True)
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-04 09:13:34 +02:00
|
|
|
dcic = ct.cicParticles(pos, L, N0)
|
2014-06-03 18:50:04 +02:00
|
|
|
dcic /= np.average(np.average(np.average(dcic, axis=0), axis=0), axis=0)
|
|
|
|
dcic -= 1
|
|
|
|
|
2014-06-04 13:57:17 +02:00
|
|
|
dcic_hat = np.fft.rfftn(dcic)*(L/N0)**3
|
|
|
|
dens_hat = np.fft.rfftn(density)*(L/N0)**3
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-04 13:57:17 +02:00
|
|
|
Pcic, bcic = bic.bin_power(np.abs(dcic_hat)**2/L**3, L, range=(0,1.), bins=150)
|
|
|
|
Pdens, bdens = bic.bin_power(np.abs(dens_hat)**2/L**3, L, range=(0,1.), bins=150)
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-04 13:57:17 +02:00
|
|
|
cgrowth = cg.CosmoGrowth(**cosmo)
|
|
|
|
D1 = cgrowth.D(astart)
|
|
|
|
D1_0 = D1/cgrowth.D(1)#0.001)
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-04 13:57:17 +02:00
|
|
|
Pref, bref = bic.compute_ref_power(L, N0, cosmo, range=(0,1.), bins=150)
|
|
|
|
|
|
|
|
Pcic /= D1_0**2
|
|
|
|
Pdens /= D1_0**2
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-12 11:23:17 +02:00
|
|
|
#borg_evolved = ct.read_borg_vol("final_density_1380.dat")
|
|
|
|
#dborg_hat = np.fft.rfftn(borg_evolved.density)*L**3/borg_evolved.density.size
|
2014-06-03 18:50:04 +02:00
|
|
|
|
2014-06-12 11:23:17 +02:00
|
|
|
#Pborg, bborg = bic.bin_power(np.abs(dborg_hat)**2/L**3, L, range=(0,1.),bins=150)
|