Added 3d hole generation support

This commit is contained in:
Guilhem Lavaux 2014-10-10 12:05:45 +02:00
parent d58c617e63
commit 8003d5e15f
2 changed files with 10 additions and 9 deletions

View File

@ -38,7 +38,7 @@ def build_unit_vectors(N):
return ux,uy,uz
def generate_from_catalog(dmin,dmax,Nside):
def generate_from_catalog(dmin,dmax,Nside,y=0.0):
import progressbar as pbar
cat = np.load("2m++.npy")
@ -68,7 +68,7 @@ def generate_from_catalog(dmin,dmax,Nside):
DA =i['distance']/100
Lgal = DA**2*10**(0.4*(tmpp_cat['Msun']-i['K2MRS']+25))
profiler = ksz.KSZ_Isothermal(Lgal, 2.37)
profiler = ksz.KSZ_Isothermal(Lgal, 2.37, y=y)
idx0 = hp.query_disc(Nside, (x0,y0,z0), 3*profiler.rGalaxy/DA)
@ -100,6 +100,7 @@ def get_args():
parser.add_argument('--base_fig', type=str, default="kszfig.png")
parser.add_argument('--build_dipole', type=bool, default=False)
parser.add_argument('--degrade', type=int, default=-1)
parser.add_argument('--y',type=float,default=0.0)
return parser.parse_args()
def main():
@ -112,7 +113,7 @@ def main():
print("Generating map...")
proj,mask = generate_from_catalog(args.depth_min,args.depth_max,args.Nside)
proj,mask = generate_from_catalog(args.depth_min,args.depth_max,args.Nside,args.y)
if args.degrade > 0:
proj *= mask

View File

@ -46,7 +46,7 @@ class KSZ_Profile(object):
class KSZ_Isothermal(KSZ_Profile):
sigma_FP=160e3 #m/s
R_innergal = 0.226
R_innergal = 0.030
def __init__(self, Lgal, x, y=0.0):
"Support for Isothermal profile"
@ -71,15 +71,15 @@ class KSZ_Isothermal(KSZ_Profile):
Q = np.zeros(r.size)
cond = r <= rInner
cond = (r>=0)*(r <= rInner)
D['r'] = r[cond]
ne.evaluate('rho0*2/(Mpc*r) * arctan(sqrt( (rGalaxy/r)**2 -1 ) - arctan(sqrt( (rInner/r)**2 - 1 ))',
local_dict=D, out=Q[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]
ne.evaluate('rho0*2/(Mpc*r) * arctan(sqrt( (rGalaxy/r)**2 -1 ))',
local_dict=D, out=Q[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]