Use more numexpr and pyfftw
This commit is contained in:
parent
025cdba6a9
commit
7c346fa1b2
2 changed files with 32 additions and 21 deletions
|
@ -6,7 +6,7 @@ from .constants import *
|
|||
# -----------------------------------------------------------------------------
|
||||
|
||||
class KSZ_Profile(object):
|
||||
R_star= 0.050 # 15 kpc/h
|
||||
R_star= 0.015 # 15 kpc/h
|
||||
L_gal0 = 10**(0.4*(tmpp_cat['Msun']-tmpp_cat['Mstar']))
|
||||
|
||||
def __init__(self):
|
||||
|
@ -17,23 +17,24 @@ class KSZ_Profile(object):
|
|||
|
||||
def projected_profile(self, cos_theta,angularDistance):
|
||||
|
||||
idx = np.where(cos_theta > 0)[0]
|
||||
idx_base = idx = np.where(cos_theta > 0)[0]
|
||||
tan_theta_2 = 1/(cos_theta[idx]**2) - 1
|
||||
tan_theta_2_max = (self.rGalaxy/angularDistance)**2
|
||||
tan_theta_2_min = (self.R_star/angularDistance)**2
|
||||
|
||||
idx0 = np.where((tan_theta_2 < tan_theta_2_max))
|
||||
idx = idx[idx0]
|
||||
idx = idx_base[idx0]
|
||||
tan_theta_2 = tan_theta_2[idx0]
|
||||
tan_theta = np.sqrt(tan_theta_2)
|
||||
|
||||
r = (tan_theta*angularDistance)
|
||||
|
||||
m,idx_mask = self.evaluate_profile(r)
|
||||
idx_mask = idx[idx_mask]
|
||||
|
||||
idx_mask = np.append(idx_mask,np.where(tan_theta_2<tan_theta_2_min)[0])
|
||||
idx_mask = np.append(idx_mask,idx[np.where(tan_theta_2<tan_theta_2_min)[0]])
|
||||
if tan_theta_2.size > 0:
|
||||
idx_mask = np.append(idx_mask,[tan_theta_2.argmin()])
|
||||
idx_mask = np.append(idx_mask,idx[tan_theta_2.argmin()])
|
||||
|
||||
return idx,idx_mask,m
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue