Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support transfer function without neutrinos. #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions fastpm/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def apply_density(k, v):
source1[...] += sp.Omega(a) * source
Omega_tot += sp.Omega(a)

DX1 = lpt1(source, Q)
DX1 = lpt1(source, Q)*pt.D1(a)
sp.S[...] = DX1

def apply_velocity(k, v):
Expand Down Expand Up @@ -192,23 +192,26 @@ def get_species_transfer_function_from_class(cosmology, z):
# flip the sign to meet preserve the phase of the
d['d_cdm'] = tf['d_cdm'] * -1
d['d_b'] = tf['d_b'] * -1
d['d_ncdm[0]'] = tf['d_ncdm[0]'] * -1
if getattr(tf, 'd_ncdm[0]', None) is not None:
d['d_ncdm[0]'] = tf['d_ncdm[0]'] * -1
d['d_tot'] = tf['d_tot'] * -1
if cosmology.gauge == 'newtonian':
# dtau to da, the negative sign in the 3 fluid equation of motion
# eliminated due to the flip in d
fac = 1.0 / (cosmology.hubble_function(z) * (1. + z) ** -2)
d['dd_cdm'] = tf['t_cdm'] * fac
d['dd_b'] = tf['t_b'] * fac
d['dd_ncdm[0]'] = tf['t_ncdm[0]'] * fac
if getattr(tf, 't_ncdm[0]', None) is not None:
d['dd_ncdm[0]'] = tf['t_ncdm[0]'] * fac
elif cosmology.gauge == 'synchronous':
fac = 1.0 / (cosmology.hubble_function(z) * (1. + z) ** -2)
d['dd_cdm'] = 0.5 * tf['h_prime'] * fac
d['dd_b'] = (0.5 * tf['h_prime'] + tf['t_b']) * fac
d['dd_ncdm[0]'] = (0.5 * tf['h_prime'] + tf['t_ncdm[0]']) * fac
if getattr(tf, 't_ncdm[0]', None) is not None:
d['dd_ncdm[0]'] = (0.5 * tf['h_prime'] + tf['t_ncdm[0]']) * fac

k = tf['k'].copy()
e = {}
for name in d:
e[name] = lambda k, x=tf['k'], y=d[name]: numpy.interp(k, x, y, left=0, right=0)
return e