Merged
This commit is contained in:
commit
075147da7a
@ -38,7 +38,7 @@ def build_unit_vectors(N):
|
||||
|
||||
return ux,uy,uz
|
||||
|
||||
def generate_from_catalog(dmin,dmax,Nside,y=0.0):
|
||||
def generate_from_catalog(dmin,dmax,Nside,y=0.0,do_random=False):
|
||||
import progressbar as pbar
|
||||
|
||||
cat = np.load("2m++.npy")
|
||||
@ -55,8 +55,11 @@ def generate_from_catalog(dmin,dmax,Nside,y=0.0):
|
||||
ksz_mask = np.ones(Npix, dtype=np.uint8)
|
||||
|
||||
for i in pbar.ProgressBar(maxval = cat.size, widgets=[pbar.Bar(), pbar.ETA()])(cat):
|
||||
l,b=i['gal_long'],i['gal_lat']
|
||||
ra,dec=i['ra'],i['dec']
|
||||
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']
|
||||
|
||||
l=ne.evaluate('l*deg2rad')
|
||||
b=ne.evaluate('b*deg2rad')
|
||||
@ -101,6 +104,7 @@ def get_args():
|
||||
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)
|
||||
parser.add_argument('--random', type=bool, default=False)
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
@ -113,7 +117,7 @@ def main():
|
||||
|
||||
print("Generating map...")
|
||||
|
||||
proj,mask = generate_from_catalog(args.depth_min,args.depth_max,args.Nside,args.y)
|
||||
proj,mask = generate_from_catalog(args.depth_min,args.depth_max,args.Nside,args.y,do_random=args.random)
|
||||
|
||||
if args.degrade > 0:
|
||||
proj *= mask
|
||||
|
Loading…
Reference in New Issue
Block a user