-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweights.py
More file actions
executable file
·42 lines (37 loc) · 1.24 KB
/
weights.py
File metadata and controls
executable file
·42 lines (37 loc) · 1.24 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
38
39
40
41
42
"""
Compute and save the weights used in the photo-z
calibration of the 2MPZ and WIxSC bins.
"""
from DIR import xref, weights
# global
fname_mask = "data/maps/mask_v3.fits.gz"
## 2MPZ ##
fname_data = "data/cats/2MPZ_FULL_wspec_coma_complete.fits.gz"
colors = ["JCORR", "HCORR", "KCORR", "W1MCORR",
"W2MCORR", "BCALCORR", "RCALCORR", "ICALCORR"]
print("2MPZ")
# sample selection
q = xref(fname_data)
q.remove_galplane(fname_mask, "L", "B")
q.cutoff("ZPHOTO", [-1.00, 0.10])
cat = q.cat_fid # photo-z sample
q.cutoff("ZSPEC", -999)
xcat = q.cat_fid # spec-z sample
print(len(xcat) / len(cat))
# spectroscopic sample weights
weights(xcat, cat, colors, verbose=True, save="out/weights_2mpz")
## WIxSC ##
fname_data = "data/cats/wiseScosPhotoz160708.csv"
colors = ["w1mCorr", "w2mCorr", "bCalCorr", "rCalCorr"]
for i in range(1, 6):
print("WIxSC bin %d" % i)
# sample selection
fname = fname_data.split(".")[0] + "_bin%d.csv" % i
q = xref(fname)
q.remove_galplane(fname_mask, "l", "b")
cat = q.cat_fid # photo-z sample
q.cutoff("Zspec", -999)
xcat = q.cat_fid # spec-z sample
print(len(xcat) / len(cat))
# spectroscopic sample weights
weights(xcat, cat, colors, verbose=True, save="out/weights_wisc%d" % i)