Added randomization of the galaxies direction
This commit is contained in:
parent
d58c617e63
commit
857b5dc95d
@ -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,do_random=False):
|
||||
import progressbar as pbar
|
||||
|
||||
cat = np.load("2m++.npy")
|
||||
@ -55,8 +55,11 @@ def generate_from_catalog(dmin,dmax,Nside):
|
||||
ksz_mask = np.ones(Npix, dtype=np.uint8)
|
||||
|
||||
for i in pbar.ProgressBar(maxval = cat.size, widgets=[pbar.Bar(), pbar.ETA()])(cat):
|
||||
if do_random:
|
||||
l = np.random.rand()*360
|
||||
b = np.arcsin(2*np.random.rand()-1)*90/np.pi
|
||||
else:
|
||||
l,b=i['gal_long'],i['gal_lat']
|
||||
ra,dec=i['ra'],i['dec']
|
||||
|
||||
l=ne.evaluate('l*deg2rad')
|
||||
b=ne.evaluate('b*deg2rad')
|
||||
@ -100,6 +103,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('--random', type=bool, default=False)
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
@ -112,7 +116,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,do_random=args.random)
|
||||
|
||||
if args.degrade > 0:
|
||||
proj *= mask
|
||||
|
Loading…
Reference in New Issue
Block a user