sandyyuan commited on
Commit
4435fbf
·
verified ·
1 Parent(s): 6e52989

Upload 3 files

Browse files
examply_code_loadingTNG.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # illustrative script on how to use the GRIZY color data file. and loading TNG data. The links do not work.
2
+
3
+ import illustris_python as il
4
+ import numpy as np
5
+
6
+ # loading TNG catalog data
7
+ basePath = "./TNG300-1/output"
8
+ subhalos = il.groupcat.loadSubhalos(basePath, 55)
9
+ halos = il.groupcat.loadHalos(basePath, 55)
10
+
11
+ dmoPath = "./TNG300-1-Dark/output"
12
+ halos_dmo = il.groupcat.loadHalos(dmoPath, 55)
13
+ subhalos_dmo = il.groupcat.loadSubhalos(dmoPath, 55)
14
+ fp_matching = np.load("./halo_matching_055_addtree.npz")['indices_fp']
15
+ dmo_matching = np.load("./halo_matching_055_addtree.npz")['indices_dmo']
16
+
17
+ # loading the GRIZY photometry data that we generated following section 2.2
18
+ f = asdf.open("./photometry/photo_bands_55_DESI.asdf")
19
+ borydata = f['data']
20
+ grizy = borydata['grizy']
21
+ sh_index = borydata['SubhaloIndex']
22
+ mstar = borydata['SubhaloMstar']
23
+
24
+ # generating DESI like LRGs using the colors and the TNG halo and subhalo catalogs
25
+ def desi_lrg(grizy, sh_index, mag_shift = -0.4):
26
+ cg, cr, ci, cz, cy = grizy.T
27
+ masks = (cr - cz > (cz + mag_shift - 16.83) * 0.45) & (cr - cz > (cz + mag_shift - 13.80) * 0.19)
28
+ print("total number of subhalos", len(sh_index), "number of desi lrgs", len(sh_index[masks]))
29
+ return sh_index[masks]
30
+
31
+ # getting LRG indices in the catalog
32
+ magshift = -0.4
33
+ desi_lrg_indices_doubleslide = desi_lrg(grizy, sh_index, magshift) # these are subhalo indices in fp
34
+
35
+ # getting central and satellite indices
36
+ subhalo_grnr = subhalos['SubhaloGrNr']
37
+ _, central_inds = np.unique(subhalo_grnr, return_index=True)
38
+ lrg_indices_central_doubleslide = np.intersect1d(central_inds, desi_lrg_indices_doubleslide)
39
+ lrg_indices_satellites_doubleslide \
40
+ = desi_lrg_indices_doubleslide[~np.in1d(desi_lrg_indices_doubleslide, lrg_indices_central_doubleslide)]
41
+
42
+
43
+
44
+ # similarly to select ELG indices in the subhalo catalog we provide the following script
45
+ def desi_elg(grizy, sh_index, mag_shift = 0.0):
46
+
47
+ # add noise
48
+ maglimits = np.array([24, 23.4, 22.5])
49
+ cg = get_scatter(grizy[:,0], maglimits[0])+mag_shift
50
+ cr = get_scatter(grizy[:,1], maglimits[1])+mag_shift
51
+ ci = grizy[:,2]+mag_shift
52
+ cz = get_scatter(grizy[:,3], maglimits[2])+mag_shift
53
+ cy = grizy[:,4]+mag_shift
54
+
55
+ masks = (cg < 23.6) & (cg > 20) & (cr - cz > 0.3) & (cr - cz < 1.6) \
56
+ * (cg - cr < 1.15*(cr - cz) - 0.15) & (cg - cr < -1.2*(cr - cz) + 1.6) \
57
+ * (cg < maglimits[0]) & (cr < maglimits[1]) & (cz < maglimits[2])
58
+ print("total number of subhalos", len(sh_index), "number of desi elgs", len(sh_index[masks]))
59
+ return sh_index[masks]
60
+
61
+ magshift = 0.6
62
+ desi_elg_indices = desi_elg(grizy, sh_index, magshift)
halo_matching_055.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f35d8134256e579260a7b9e9f84c7cb36ce7cf51b2349701105a7c2051ba485d
3
+ size 3733568
halo_matching_055_addtree.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2d01f2cc5995830383d066a3ea3f1479d5b7ef2bddad6dc6496fef99ebd38b7
3
+ size 3733568