From 8003d5e15f64e4a25a198ee426589f5054b73a4c Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Fri, 10 Oct 2014 12:05:45 +0200 Subject: [PATCH] Added 3d hole generation support --- python_sample/build_dipole_ksz_from_galaxies.py | 7 ++++--- python_sample/ksz/gal_prof.py | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/python_sample/build_dipole_ksz_from_galaxies.py b/python_sample/build_dipole_ksz_from_galaxies.py index 271584e..2870c12 100644 --- a/python_sample/build_dipole_ksz_from_galaxies.py +++ b/python_sample/build_dipole_ksz_from_galaxies.py @@ -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 diff --git a/python_sample/ksz/gal_prof.py b/python_sample/ksz/gal_prof.py index eb44610..92d9622 100644 --- a/python_sample/ksz/gal_prof.py +++ b/python_sample/ksz/gal_prof.py @@ -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