Merge branch 'master' of bitbucket.org:glavaux/cosmotool
This commit is contained in:
commit
fbb8d57335
@ -38,7 +38,7 @@ def build_unit_vectors(N):
|
|||||||
|
|
||||||
return ux,uy,uz
|
return ux,uy,uz
|
||||||
|
|
||||||
def generate_from_catalog(dmin,dmax,Nside,do_random=False):
|
def generate_from_catalog(dmin,dmax,Nside,y=0.0,do_random=False):
|
||||||
import progressbar as pbar
|
import progressbar as pbar
|
||||||
|
|
||||||
cat = np.load("2m++.npy")
|
cat = np.load("2m++.npy")
|
||||||
@ -71,7 +71,7 @@ def generate_from_catalog(dmin,dmax,Nside,do_random=False):
|
|||||||
DA =i['distance']/100
|
DA =i['distance']/100
|
||||||
Lgal = DA**2*10**(0.4*(tmpp_cat['Msun']-i['K2MRS']+25))
|
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)
|
idx0 = hp.query_disc(Nside, (x0,y0,z0), 3*profiler.rGalaxy/DA)
|
||||||
|
|
||||||
@ -103,6 +103,7 @@ def get_args():
|
|||||||
parser.add_argument('--base_fig', type=str, default="kszfig.png")
|
parser.add_argument('--base_fig', type=str, default="kszfig.png")
|
||||||
parser.add_argument('--build_dipole', type=bool, default=False)
|
parser.add_argument('--build_dipole', type=bool, default=False)
|
||||||
parser.add_argument('--degrade', type=int, default=-1)
|
parser.add_argument('--degrade', type=int, default=-1)
|
||||||
|
parser.add_argument('--y',type=float,default=0.0)
|
||||||
parser.add_argument('--random', type=bool, default=False)
|
parser.add_argument('--random', type=bool, default=False)
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ def main():
|
|||||||
|
|
||||||
print("Generating map...")
|
print("Generating map...")
|
||||||
|
|
||||||
proj,mask = generate_from_catalog(args.depth_min,args.depth_max,args.Nside,do_random=args.random)
|
proj,mask = generate_from_catalog(args.depth_min,args.depth_max,args.Nside,args.y,do_random=args.random)
|
||||||
|
|
||||||
if args.degrade > 0:
|
if args.degrade > 0:
|
||||||
proj *= mask
|
proj *= mask
|
||||||
|
@ -46,7 +46,7 @@ class KSZ_Profile(object):
|
|||||||
|
|
||||||
class KSZ_Isothermal(KSZ_Profile):
|
class KSZ_Isothermal(KSZ_Profile):
|
||||||
sigma_FP=160e3 #m/s
|
sigma_FP=160e3 #m/s
|
||||||
R_innergal = 0.226
|
R_innergal = 0.030
|
||||||
|
|
||||||
def __init__(self, Lgal, x, y=0.0):
|
def __init__(self, Lgal, x, y=0.0):
|
||||||
"Support for Isothermal profile"
|
"Support for Isothermal profile"
|
||||||
@ -71,15 +71,15 @@ class KSZ_Isothermal(KSZ_Profile):
|
|||||||
|
|
||||||
Q = np.zeros(r.size)
|
Q = np.zeros(r.size)
|
||||||
|
|
||||||
cond = r <= rInner
|
cond = (r>=0)*(r <= rInner)
|
||||||
D['r'] = r[cond]
|
D['r'] = r[cond]
|
||||||
ne.evaluate('rho0*2/(Mpc*r) * arctan(sqrt( (rGalaxy/r)**2 -1 ) - arctan(sqrt( (rInner/r)**2 - 1 ))',
|
Q[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])
|
local_dict=D)
|
||||||
|
|
||||||
cond = (r > rInner)*(r <= rGalaxy)
|
cond = (r > rInner)*(r <= rGalaxy)
|
||||||
D['r'] = r[cond]
|
D['r'] = r[cond]
|
||||||
ne.evaluate('rho0*2/(Mpc*r) * arctan(sqrt( (rGalaxy/r)**2 -1 ))',
|
Q[cond] = ne.evaluate('rho0*2/(Mpc*r) * arctan(sqrt( (rGalaxy/r)**2 -1 ))',
|
||||||
local_dict=D, out=Q[cond])
|
local_dict=D)
|
||||||
|
|
||||||
return Q,np.where(r<rInner)[0]
|
return Q,np.where(r<rInner)[0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user