This repository has been archived by the owner on Oct 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
nominal.py
267 lines (247 loc) · 13.6 KB
/
nominal.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
from __future__ import absolute_import
from .common import read_map, loadtxt
import numpy as np
from healpy import nside2npix
import os
data_dir = os.path.join(os.path.dirname(__file__), 'template')
template = lambda x: os.path.join(data_dir, x)
def models(key, nside, pixel_indices=None, mpi_comm=None):
model = eval(key)(nside, pixel_indices=pixel_indices, mpi_comm=mpi_comm)
for m in model:
m['pixel_indices'] = pixel_indices # include pixel indices in the model dictionary
m['nside'] = nside
return model
def d0(nside, pixel_indices=None, mpi_comm=None):
A_I = read_map(template('dust_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm)
return [{
'model': 'modified_black_body',
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': A_I,
'A_Q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': np.ones(len(A_I)) * 1.54,
'temp': np.ones(len(A_I)) * 20.,
'add_decorrelation': False,
}]
def d1(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'modified_black_body',
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('dust_beta.fits'), nside=nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'temp': read_map(template('dust_temp.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation': False,
}]
def d2(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'modified_black_body',
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('beta_mean1p59_std0p2.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'temp': read_map(template('dust_temp.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation': False,
}]
def d3(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'modified_black_body',
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('beta_mean1p59_std0p3.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'temp': read_map(template('dust_temp.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation': False,
}]
def d4(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'modified_black_body',
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust2comp_I1_ns512_545.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust2comp_Q1_ns512_353.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust2comp_U1_ns512_353.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('dust2comp_beta1_ns512.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'temp': read_map(template('dust2comp_temp1_ns512.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation': False,
}, {
'model': 'modified_black_body',
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust2comp_I2_ns512_545.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust2comp_Q2_ns512_353.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust2comp_U2_ns512_353.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('dust2comp_beta2_ns512.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'temp': read_map(template('dust2comp_temp2_ns512.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation': False,
}]
def d5(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'hensley_draine_2017',
'draw_uval': True,
'draw_uval_seed': 4632,
'fcar': 1.,
'f_fe': 0.,
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation': False,
}]
def d6(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'modified_black_body',
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('dust_beta.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'temp': read_map(template('dust_temp.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation': True,
'corr_len': 5.0
}]
def d7(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'hensley_draine_2017',
'draw_uval': True,
'draw_uval_seed': 4632,
'fcar': 1.,
'f_fe': 0.44,
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation' : False,
}]
def d8(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'hensley_draine_2017',
'draw_uval': False,
'uval': 0.2,
'draw_uval_seed': 4632,
'fcar': 1.,
'f_fe': 0.44,
'nu_0_I': 545.,
'nu_0_P': 353.,
'A_I': read_map(template('dust_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'add_decorrelation': False,
}]
def s0(nside, pixel_indices=None, mpi_comm=None):
A_I = read_map(template('synch_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm)
return [{
'model': 'power_law',
'nu_0_I': 0.408,
'nu_0_P': 23.,
'A_I': A_I,
'A_Q': read_map(template('synch_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('synch_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': np.ones(len(A_I)) * -3,
}]
def s1(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'power_law',
'nu_0_I': 0.408,
'nu_0_P': 23.,
'A_I': read_map(template('synch_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('synch_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('synch_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('synch_beta.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
}]
def s2(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'power_law',
'nu_0_I': 0.408,
'nu_0_P': 23.,
'A_I': read_map(template('synch_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('synch_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('synch_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('beta_latvar.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
}]
def s3(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'curved_power_law',
'nu_0_I': 0.408,
'nu_0_P': 23.,
'A_I': read_map(template('synch_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('synch_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('synch_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': read_map(template('synch_beta.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_curvature': -0.052,
'nu_curve': 23.,
}]
def f1(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'power_law',
'nu_0_I': 30.,
'A_I': read_map(template('ff_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'spectral_index': -2.14,
}]
def c1(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'taylens',
'cmb_specs': loadtxt(template('camb_lenspotentialCls.dat'), mpi_comm=mpi_comm, unpack=True),
'delens': False,
'delensing_ells': loadtxt(template('delens_ells.txt'), mpi_comm=mpi_comm),
'nside': nside,
'cmb_seed': 1111
}]
def c2(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'pre_computed',
'A_I': read_map(template('lensed_cmb.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_Q': read_map(template('lensed_cmb.fits'), nside, field=1, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'A_U': read_map(template('lensed_cmb.fits'), nside, field=2, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'nside': nside
}]
def a1(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'spdust',
'nu_0_I': 22.8,
'nu_0_P': 22.8,
'A_I': read_map(template('ame_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'nu_peak_0': 30.,
'emissivity': loadtxt(template('emissivity.txt'), mpi_comm=mpi_comm, unpack=True),
'nu_peak': read_map(template('ame_nu_peak_0.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
}, {
'model': 'spdust',
'nu_0_I': 41.0,
'nu_0_P': 41.0,
'A_I': read_map(template('ame2_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'nu_peak_0': 30.,
'emissivity': loadtxt(template('emissivity.txt'), mpi_comm=mpi_comm, unpack=True),
'nu_peak': 33.35
}]
def a2(nside, pixel_indices=None, mpi_comm=None):
return [{
'model': 'spdust_pol',
'nu_0_I': 22.8,
'A_I': read_map(template('ame_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'nu_peak_0': 30.,
'emissivity': loadtxt(template('emissivity.txt'), mpi_comm=mpi_comm, unpack=True),
'nu_peak': read_map(template('ame_nu_peak_0.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'pol_frac': 0.02,
'angle_q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'angle_u': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm)
}, {
'model': 'spdust_pol',
'nu_0_I': 41.0,
'A_I': read_map(template('ame2_t_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'nu_peak_0': 30.,
'emissivity': loadtxt(template('emissivity.txt'), mpi_comm=mpi_comm, unpack=True),
'nu_peak': 33.35,
'pol_frac': 0.02,
'angle_q': read_map(template('dust_q_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm),
'angle_u': read_map(template('dust_u_new.fits'), nside, field=0, pixel_indices=pixel_indices, mpi_comm=mpi_comm)
}]