From 646c479c5f7b59654c5d1f2ed3b33cbcb77acd59 Mon Sep 17 00:00:00 2001 From: Man-Yat Chu Date: Tue, 5 Sep 2017 17:45:22 -0700 Subject: [PATCH 1/3] Support transfer function without neutrinos. --- fastpm/multi.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fastpm/multi.py b/fastpm/multi.py index 07fd599..becc5b1 100644 --- a/fastpm/multi.py +++ b/fastpm/multi.py @@ -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 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 - +correspondencecorrespondence From a3d09d6e8f6f91a2d9186cfd1cbe759a9607ba19 Mon Sep 17 00:00:00 2001 From: Man-Yat Chu Date: Tue, 5 Sep 2017 17:59:08 -0700 Subject: [PATCH 2/3] Fixing stupid bug and return d_tot. --- fastpm/multi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastpm/multi.py b/fastpm/multi.py index becc5b1..0da62b9 100644 --- a/fastpm/multi.py +++ b/fastpm/multi.py @@ -194,6 +194,7 @@ def get_species_transfer_function_from_class(cosmology, z): d['d_b'] = tf['d_b'] * -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 @@ -214,4 +215,3 @@ def get_species_transfer_function_from_class(cosmology, z): 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 -correspondencecorrespondence From e29bbe42806d9c7d1cc993d5c67b598755259163 Mon Sep 17 00:00:00 2001 From: Man-Yat Chu Date: Wed, 27 Sep 2017 16:32:07 -0700 Subject: [PATCH 3/3] add growth factor on DX1 --- fastpm/multi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastpm/multi.py b/fastpm/multi.py index 0da62b9..754397e 100644 --- a/fastpm/multi.py +++ b/fastpm/multi.py @@ -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):