1+ from os .path import join as opj
2+ from henry import Henry
3+ import hippometa as hm
4+
5+ client = Henry ()
6+ sim_dir = '/scratch/gpfs/SIMONSOBS/users/zatkins/projects/lat-iso/piso_old/tiger_deep56_sim/sim_factory/sims/maps'
7+
8+ # collection layers:
9+ # Mock LAT ISO-SV1 Sims
10+ # - Mock LAT ISO-SV1 (1000x) Sims
11+ # - Mock LAT ISO-SV1 (1000x) tube freq Sims
12+ # - Mock LAT Deep56 Signal Map (1000x) tube freq {(Tags)}
13+ # - Mock LAT Deep56 Noise Map (1000x) tube freq (Set y)
14+
15+ top_collection = client .new_collection (
16+ name = 'Mock LAT ISO-SV1 Sims' ,
17+ description = 'Mock simulations of the LAT-ISO SV1 data. Each simulation ' \
18+ 'includes the four MF tubes i1, i3, i4, and i6, and the two UHF tubes c1 ' \
19+ 'and i5. Each tube and frequency band includes variations of signal maps ' \
20+ '(with/without random systematics, with/without map-level lensing) and ' \
21+ 'four-way split noise maps.\n \n ' \
22+ 'See [this page](https://simonsobs.atlassian.net/wiki/spaces/PRO/pages/1452802049/LAT+ISO+Mock+Simulations) ' \
23+ 'for more technical information.' ,
24+ products = [],
25+ )
26+
27+ for sim_num in range (10 ):
28+ sim_collection = client .new_collection (
29+ name = f'Mock LAT ISO-SV1 (1000{ sim_num } ) Sims' ,
30+ description = 'Mock simulations of the LAT-ISO SV1 data for sim index ' \
31+ f'1000{ sim_num } . Each simulation includes the four MF tubes i1, i3, ' \
32+ 'i4, and i6, and the two UHF tubes c1 and i5. Each tube and frequency ' \
33+ 'band includes variations of signal maps (with/without random ' \
34+ 'systematics, with/without map-level lensing) and four-way split noise' \
35+ 'maps.\n \n ' \
36+ 'See [this page](https://simonsobs.atlassian.net/wiki/spaces/PRO/pages/1452802049/LAT+ISO+Mock+Simulations) ' \
37+ 'for more technical information.' ,
38+ products = [],
39+ )
40+
41+ for mapname in ['i1_f090' , 'i1_f150' , 'i3_f090' , 'i3_f150' , 'i4_f090' ,
42+ 'i4_f150' , 'i6_f090' , 'i6_f150' , 'c1_f220' , 'c1_f280' ,
43+ 'i5_f220' , 'i5_f280' ]:
44+ tube , freq = mapname .split ('_' )
45+ tube_freq_collection = client .new_collection (
46+ name = f'Mock LAT ISO-SV1 (1000{ sim_num } ) { tube } { freq } Sims' ,
47+ description = 'Mock simulations of the LAT-ISO SV1 data for sim index ' \
48+ f'1000{ sim_num } , { tube } { freq } only. Includes variations of signal ' \
49+ 'maps (with/without random systematics, with/without map-level ' \
50+ 'lensing) and four-way split noise maps.\n \n ' \
51+ 'See [this page](https://simonsobs.atlassian.net/wiki/spaces/PRO/pages/1452802049/LAT+ISO+Mock+Simulations) ' \
52+ 'for more technical information.' ,
53+ products = [],
54+ )
55+
56+ # signal maps
57+ for tag in ['_' , '_syst_' , '_lens_' , '_syst_lens_' ]:
58+ map_file = f'signal_sim_map{ tag } LAT_{ tube } _{ freq } _1000{ sim_num } .fits'
59+
60+ if map_file == 'signal_sim_map_syst_LAT_i1_f150_10009.fits' :
61+ signal_map_set = client .pull_product ('69387f74f22a066989fc54e3' , realize_sources = False )
62+ else :
63+ nametag = {'_' : '' ,
64+ '_syst_' : ' (Systematics)' ,
65+ '_lens_' : ' (Map-level Lensing)' ,
66+ '_syst_lens_' : ' (Systematics, Map-level Lensing)'
67+ }[tag ]
68+
69+ desctag = {'_' : '' ,
70+ '_syst_' : ' Includes a random systematics realization.' ,
71+ '_lens_' : ' Includes map-level lensing with lenspyx.' ,
72+ '_syst_lens_' : ' Includes a random systematics realization and map-level lensing with lenspyx.'
73+ }[tag ]
74+
75+ name = f'Mock LAT Deep56 Signal Map (1000{ sim_num } ) { tube } { freq } { nametag } '
76+ desc = f'Mock signal simulation of the LAT-ISO SV1 data, for ' \
77+ f'{ tube } { freq } . The index of this simulation is 1000{ sim_num } . ' \
78+ f'Same map for each of the four-way splits.{ desctag } See ' \
79+ '[this page](https://simonsobs.atlassian.net/wiki/spaces/PRO/pages/1452802049/LAT+ISO+Mock+Simulations) ' \
80+ 'for more technical information.'
81+
82+ signal_map_set = client .new_product (
83+ name = name ,
84+ description = desc ,
85+ metadata = hm .MapSet (telescope = 'lat' , instrument = tube ,
86+ frequency = freq , release = 'lat-iso-sv1' ,
87+ patch = 'deep56' ,
88+ polarization_convention = 'COSMO' ,
89+ pixelisation = 'cartesian' ),
90+ sources = {'map' : {'path' : opj (sim_dir , map_file ),
91+ 'description' : 'the simulated map' }}
92+ )
93+
94+ tube_freq_collection .append (signal_map_set )
95+
96+ # noise maps
97+ for k in range (4 ):
98+ map_file = f'noise_sim_map_LAT_{ tube } _{ freq } _set{ k } _1000{ sim_num } .fits'
99+
100+ if map_file == 'noise_sim_map_LAT_i1_f150_set0_10009.fits' :
101+ noise_map_set = client .pull_product ('69387ef3f22a066989fc54dd' , realize_sources = False )
102+ else :
103+ desctag = {0 : ' first' ,
104+ 1 : ' second' ,
105+ 2 : ' third' ,
106+ 3 : ' fourth'
107+ }[k ]
108+
109+ name = f'Mock LAT Deep56 Noise Map (1000{ sim_num } ) { tube } { freq } (Set { k } )'
110+ desc = f'Mock noise simulation of the LAT-ISO SV1 data, for ' \
111+ f'{ tube } { freq } ,{ desctag } split of the four-way split. The index ' \
112+ f'of this simulation is 1000{ sim_num } . See ' \
113+ '[this page](https://simonsobs.atlassian.net/wiki/spaces/PRO/pages/1452802049/LAT+ISO+Mock+Simulations) ' \
114+ 'for more technical information.'
115+
116+ noise_map_set = client .new_product (
117+ name = name ,
118+ description = desc ,
119+ metadata = hm .MapSet (telescope = 'lat' , instrument = tube ,
120+ frequency = freq , release = 'lat-iso-sv1' ,
121+ patch = 'deep56' ,
122+ polarization_convention = 'COSMO' ,
123+ pixelisation = 'cartesian' , split = k ),
124+ sources = {'map' : {'path' : opj (sim_dir , map_file ),
125+ 'description' : 'the simulated map' }}
126+ )
127+
128+ tube_freq_collection .append (noise_map_set )
129+
130+ sim_collection .append (tube_freq_collection )
131+
132+ top_collection .append (sim_collection )
133+
134+ client .push (top_collection )
0 commit comments