Ensure the point at r=0 has correct value and not nan

This commit is contained in:
Guilhem Lavaux 2014-12-02 17:36:52 +01:00
parent 83324fdbd1
commit 00d8d619ef
2 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import ksz
from ksz.constants import *
from cosmotool import interp3d
import numpy as np
from scipy import ndimage
from scipy.special import sinc
@ -159,10 +160,10 @@ def generate_from_catalog(dmin,dmax,Nside,perturb=0.0,y=0.0,do_random=False,do_h
ksz_hubble_template[idx] += m*DA
ne.evaluate('ksz_template*ksz_normalization', out=ksz_template)
ne.evaluate('ksz_hubble_template*ksz_normalization', out=ksz_hubble_template)
result =ksz_template, ksz_mask
if do_hubble:
ne.evaluate('ksz_hubble_template*ksz_normalization', out=ksz_hubble_template)
return result + ( ksz_hubble_template,)
else:
return result

View File

@ -71,7 +71,10 @@ class KSZ_Isothermal(KSZ_Profile):
Q = np.zeros(r.size)
cond = (r>=0)*(r <= rInner)
cond = (r<=0)
Q[cond] = rho0*2/Mpc * (rGalaxy-rInner)/(rGalaxy*rInner)
cond = (r>0)*(r <= rInner)
D['r'] = r[cond]
Q[cond] = ne.evaluate('rho0*2/(Mpc*r) * (arctan(sqrt( (rGalaxy/r)**2 -1 )) - arctan(sqrt( (rInner/r)**2 - 1 )))',
local_dict=D)