This commit is contained in:
Guilhem Lavaux 2015-01-22 19:16:46 +01:00
parent 7a27dae025
commit f12c9a0c1a
5 changed files with 128 additions and 33 deletions

View file

@ -27,6 +27,7 @@ tmpp_cat={'Msun':3.29,
baryon_fraction = Omega_baryon / Omega_matter
ksz_normalization = -T_cmb*sigmaT*v_unit/(lightspeed*mu*mp) * baryon_fraction
assert ksz_normalization < 0
rho_mean_matter = Omega_matter * (3*(100e3/Mpc)**2/(8*np.pi*G))
Lbar = tmpp_cat['lbar'] / Mpc**3
M_over_L_galaxy = rho_mean_matter / Lbar

View file

@ -10,7 +10,14 @@ class KSZ_Profile(object):
R_star= 0.0 # 15 kpc/h
L_gal0 = 10**(0.4*(tmpp_cat['Msun']-tmpp_cat['Mstar']))
def __init__(self):
def __init__(self,sculpt):
"""Base class for KSZ profiles
Arguments:
sculpt (float): If negative, do not sculpt. If positive, there will be a 2d
suppression of the profile with a radius given by sculpt (in arcmins).
"""
self.sculpt = sculpt * np.pi/180/60.
self.rGalaxy = 1.0
def evaluate_profile(self, r):
@ -37,6 +44,11 @@ class KSZ_Profile(object):
if tan_theta_2.size > 0:
idx_mask = np.append(idx_mask,idx[tan_theta_2.argmin()])
if self.sculpt > 0:
theta = np.arctan(tan_theta)
cond = theta < self.sculpt
m[cond] *= (theta[cond]/self.sculpt)**2
return idx,idx_mask,m
@ -48,10 +60,20 @@ class KSZ_Isothermal(KSZ_Profile):
sigma_FP=160e3 #m/s
R_innergal = 0.030
def __init__(self, Lgal, x, y=0.0):
"Support for Isothermal profile"
def __init__(self, Lgal, x, y=0.0, sculpt=-1):
"""Support for Isothermal profile
Arguments:
Lgal (float): Galaxy luminosity in solar units
x (float): extent of halo in virial radius units
Keyword arguments:
y (float): Inner part where there is no halo
sculpt (float): If negative, do not sculpt. If positive, there will be a 2d
suppression of the profile with a radius given by sculpt (in arcmins).
"""
super(KSZ_Isothermal,self).__init__()
super(KSZ_Isothermal,self).__init__(sculpt)
self.R_gal = 0.226 * x
self.R_innergal *= y
@ -71,20 +93,20 @@ class KSZ_Isothermal(KSZ_Profile):
Q = np.zeros(r.size)
cond = (r<=0)
cond = (r<=1e-10)
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)
cond = (r > rInner)*(r <= rGalaxy)
D['r'] = r[cond]
Q[cond] = ne.evaluate('rho0*2/(Mpc*r) * arctan(sqrt( (rGalaxy/r)**2 -1 ))',
local_dict=D)
return Q,np.where(r<rInner)[0]
return Q,[] #np.where(r<rInner)[0]
# -----------------------------------------------------------------------------