-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmapcat.py
More file actions
37 lines (30 loc) · 1.02 KB
/
mapcat.py
File metadata and controls
37 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from __future__ import print_function
from orphics import maps,io,cosmology,stats,catalogs
from pixell import enmap,utils
import numpy as np
import os,sys
import utils as cutils
"""
Loads a catalog
Maps it
Smooths it
Thresholds it
Projects it onto ACT
This gives a mask of 1s and 0s from which a random catalog can be made
"""
paths = cutils.paths
#cat_type = "wise_panstarrs"
#cat_type = "madcows_photz"
cat_type = args.sys[1]
meanfield = False
# cat_type = "sdss_redmapper"
# meanfield = True
shape,wcs = enmap.fullsky_geometry(res=1 * utils.degree)
ras,decs,_ = cutils.catalog_interface(cat_type,is_meanfield=meanfield)
cmapper = catalogs.CatMapper(ras,decs,shape=shape,wcs=wcs)
cmap = maps.binary_mask(enmap.smooth_gauss(cmapper.counts,2 * utils.degree),1e-3)
io.hplot(cmap,'counts')
shape,wcs = enmap.read_map_geometry(paths.coadd_data + f"act_planck_s08_s18_cmb_f150_daynight_srcfree_map.fits")
omap = enmap.project(cmap,shape,wcs,order=0)
io.plot_img(omap,'pcounts')
enmap.write_map(f'{paths.scratch}{cat_type}_mask.fits',omap)