@@ -192,23 +192,26 @@ def get_species_transfer_function_from_class(cosmology, z):
192
192
# flip the sign to meet preserve the phase of the
193
193
d ['d_cdm' ] = tf ['d_cdm' ] * - 1
194
194
d ['d_b' ] = tf ['d_b' ] * - 1
195
- d ['d_ncdm[0]' ] = tf ['d_ncdm[0]' ] * - 1
195
+ if getattr (tf , 'd_ncdm[0]' , None ) is not None :
196
+ d ['d_ncdm[0]' ] = tf ['d_ncdm[0]' ] * - 1
196
197
if cosmology .gauge == 'newtonian' :
197
198
# dtau to da, the negative sign in the 3 fluid equation of motion
198
199
# eliminated due to the flip in d
199
200
fac = 1.0 / (cosmology .hubble_function (z ) * (1. + z ) ** - 2 )
200
201
d ['dd_cdm' ] = tf ['t_cdm' ] * fac
201
202
d ['dd_b' ] = tf ['t_b' ] * fac
202
- d ['dd_ncdm[0]' ] = tf ['t_ncdm[0]' ] * fac
203
+ if getattr (tf , 't_ncdm[0]' , None ) is not None :
204
+ d ['dd_ncdm[0]' ] = tf ['t_ncdm[0]' ] * fac
203
205
elif cosmology .gauge == 'synchronous' :
204
206
fac = 1.0 / (cosmology .hubble_function (z ) * (1. + z ) ** - 2 )
205
207
d ['dd_cdm' ] = 0.5 * tf ['h_prime' ] * fac
206
208
d ['dd_b' ] = (0.5 * tf ['h_prime' ] + tf ['t_b' ]) * fac
207
- d ['dd_ncdm[0]' ] = (0.5 * tf ['h_prime' ] + tf ['t_ncdm[0]' ]) * fac
209
+ if getattr (tf , 't_ncdm[0]' , None ) is not None :
210
+ d ['dd_ncdm[0]' ] = (0.5 * tf ['h_prime' ] + tf ['t_ncdm[0]' ]) * fac
208
211
209
212
k = tf ['k' ].copy ()
210
213
e = {}
211
214
for name in d :
212
215
e [name ] = lambda k , x = tf ['k' ], y = d [name ]: numpy .interp (k , x , y , left = 0 , right = 0 )
213
216
return e
214
-
217
+ correspondencecorrespondence
0 commit comments