-
Notifications
You must be signed in to change notification settings - Fork 0
/
fastcc_old.py
339 lines (328 loc) · 19.1 KB
/
fastcc_old.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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Apply colour corrections to Planck LFI and WMAP data
# freq should be one of 30, 44, 70, K, Ka, Q, V or W, as a string.
# Actual frequencies are 28.4, 44.1 or 70.4 for LFI; 22.80 33.00 40.60 60.80 93.50 for WMAP
# detector (optional) should be between '18' and '28' inclusive for LFI, as a string; they should of the style 'K11', 'K12', 'K1' for WMAP. Only works for power laws.
# set 'debug' to see debug messages
# Use 'option' to select which set of colour corrections you want to use:
# 'option=1' is the WMAP9 and Planck 2013 numbers
# 'option=2' is the WMAP 2015 and Planck 2015 numbers
# 'option=3' is the WMAP 2015 and Planck 2018 numbers (DEFAULT)
# If you don't want to use the latest version, you MUST set option to preserve the same behaviour from future versions.
# Set alpha=<val> to use a power law, or td=<val> and bd=<val> to use a modified black body
# Set debug=True if you want some extra debug messages to appear
# Set returnfreq=True if you want the code to return [freq, correction], otherwise it will just return correction
#
# Version history:
# Mike Peel 01-Feb-2013 v1.0 Initial version
# Mike Peel 04-Feb-2013 v1.1 Correct convention
# Locke Spencer 05-Feb-2013: v1.2 Changed name to LFI_fastCC from planckcc (it only works for LFI)
# Changed nested IF..ELSE groups to case statements
# Changed invalid detector/frequency output to zero and removed internal stop in the code.
# Mike Peel 24-Jul-2014 v2.0 Added WMAP (based on values from Paddy Leahy), renamed to fastcc. Note that function calls from v1 won't work with v2 without modification.
# Mike Peel 13-Aug-2014 v2.1 Updated WMAP colour corrections, taking into account frequency drift during the mission (values from Paddy Leahy).
# Mike Peel 06-Nov-2014 v2.2 Added 'dev' parameter (updated LFI and WMAP numbers from Paddy Leahy, including LFI bandpass shifts); without this parameter the published values for LFI and WMAP will be returned.
# Mike Peel 12-Mar-2015 v2.3 Update 70GHz values to fits to corrected colour corrections from Paddy Leahy
# Mike Peel 23-Mar-2015 v2.4 Update WMAP colour corrections to corrected values from Paddy Leahy.
# Mike Peel 22-Jan-2016 v2.5 Convert from IDL to Python
# Mike Peel 17-Jul-2019 v2.6 Swap 'dev' for 'latest' parameter, add QUIJOTE MFI for testing
# Mike Peel 17-Jul-2019 v2.6a Revised QUIJOTE numbers
# Mike Peel 18-Jul-2019 v2.7 Adding CBASS
# Mike Peel 06-Oct-2020 v2.8 New QUIJOTE numbers
# Mike Peel 16-Nov-2020 v2.9 BREAKING CHANGE, 'latest' is now 'option'. Adding HFI power laws.
# Mike Peel 15-Jan-2021 v3.0 BREAKING CHANGE, frequency/detector labels now have prefixes. Upgrading to return frequencies and to prepare for colour corrections for thermal dust models for Planck HFI (not added in this version). Updated numbers for MFI, HFI, C-BASS.
# Mike Peel 10-Feb-2021 v3.1 Adding DIRBE and IRAS
def fastcc_old(freq, alpha=False, td=False, bd=False, detector=False, debug=False, option=3, returnfreq=False):
# Define dictionaries containing the coefficients for different detectors and frequencies
# WMAP9 + Planck 2013 + QUIJOTE MFI original
frequencies_v1 = {
'Q111': [0.99278484, 0.00709364, -0.00182065, 11.2],
'Q113': [0.99583466, 0.00512841, -0.00151745, 12.8],
'Q217': [1.00166741, 4.87517031e-04, -6.63221982e-04, 16.7],
'Q219': [0.997955472, 1.66235456e-03, -4.36898290e-04, 18.7],
'Q311': [0.99421638, 0.00712698, -0.00234507, 11.1],
'Q313': [0.98683305, 0.01021644, -0.00182772, 12.9],
'Q417': [0.996066342, 3.10394890e-03, -5.71903939e-04, 17.0],
'Q419': [0.997016199, 2.40564506e-03, -4.58929918e-04, 19.0],
'P30': [0.98520, 0.0131778, -0.00302, 28.4],
'P44': [0.99059, 0.0079600, -0.00169, 44.1],
'P70': [0.98149, 0.0152737, -0.00325, 70.4],
'P100': [0.9951437650323804, -0.007369184015019507, -0.004219721586609552, 100.0],
'P143': [1.010279726985317, 0.006104370487138567, -0.004343504886286414, 143.0],
'P217': [0.9851008169926466, -0.016072766879219946, -0.0035796643275518014, 217.0],
'P353': [0.9838102656623505, -0.017294824120252014, -0.0032959086890859243, 353.0],
'P545': [0.9858044871754406, -0.014536137607886598, -0.004194156574955682, 545.0],
'P857': [1.0015212847910664, -0.00030701728952350806, -0.004261697246303725, 857.0],
'WK' : {'nu': [20.6, 22.8, 24.9], 'w': [0.332906, 0.374325, 0.292768], 'dT': 1.013438},
'WKa': {'nu': [30.4, 33.0, 35.6], 'w': [0.322425, 0.387532, 0.290043], 'dT': 1.028413},
'WQ' : {'nu': [37.8, 40.7, 43.8], 'w': [0.353635, 0.342752, 0.303613], 'dT': 1.043500},
'WV' : {'nu': [55.7, 60.7, 66.2], 'w': [0.337805, 0.370797, 0.291399], 'dT': 1.098986},
'WW' : {'nu': [87.0, 93.5, 100.8], 'w': [0.337633, 0.367513, 0.294854], 'dT': 1.247521},
'DB10': [1.0056317, -0.0052173, -0.0119257, 1249],
'DB9': [1.0347912, 0.0245728, -0.0095350, 2141],
'DB8': [0.9593942, -0.0469581, -0.0075185, 2997],
'DB7': [0.9079217, -0.0942761, -0.0068850, 4995],
'DB6': [0.8160551, -0.1717965, 0.0103011, 11988],
'DB5': [0.9816717, -0.0327394, -0.0178211, 24975],
'DB4': [0.9947178, -0.0060948, -0.0008378, 61163],
'DB3': [1.0030533, -0.0001524, -0.0032236, 85629],
'DB2': [1.0064020, 0.0050962, -0.0012763, 136227],
'DB1': [1.0073260, 0.0044317, -0.0028791, 239760],
'I100': [0.9899184805240909, -0.01970072476335274, -0.007706943391147654, 2997],
'I60': [0.9510100573154361, -0.06111819772388552, -0.016457316462171055, 4995],
'I25': [0.9123700815757735, -0.08972760549528734, -0.0056369170040417305, 11988],
'I12': [0.9083422603187424, -0.09300485963152248, -0.008759896726856715, 24975]
}
detectors_v1 = {
'P18': [0.98836, 0.0123556, -0.00394, 70.4],
'P19': [0.93933, 0.0375844, -0.00225, 70.4],
'P20': [0.95663, 0.0285644, -0.00273, 70.4],
'P21': [0.97140, 0.0209690, -0.00318, 70.4],
'P22': [1.02220,-0.0077263, -0.00327, 70.4],
'P23': [1.00098, 0.0029940, -0.00240, 70.4],
'P24': [0.99571, 0.0053247, -0.00175, 44.1],
'P25': [0.98988, 0.0082248, -0.00161, 44.1],
'P26': [0.98557, 0.0107023, -0.00175, 44.1],
'P27': [0.98513, 0.0129780, -0.00288, 28.4],
'P28': [0.98516, 0.0134605, -0.00318, 28.4]
}
# WMAP9 modified by Paddy Leahy, Planck 2015, MFI 2019 pre-release, CBASS-N pre-release
frequencies_v2 = {
'CBASSNI': [1.000103213196618, -0.0007238230723748647, -0.0013363809246677324, 4.76],
'CBASSNP': [0.998561438218094, -0.0059052869678747595, -0.001680320871507042, 4.76],
'Q111': [0.9925526276311687, 0.007161407883127753, -0.0017891332783659003, 11.2],
'Q113': [0.9949649181723395, 0.005394042720463821, -0.0014382949498306515, 12.8],
'Q111p': [0.9925526276311687, 0.007161407883127753, -0.0017891332783659003, 11.2],
'Q113p': [0.9949649181723395, 0.005394042720463821, -0.0014382949498306515, 12.8],
'Q217': [1.0129709167366905, -0.005101169068593444, -0.000683203301567257, 16.7],
'Q219': [1.0175292512259428, -0.007544762181222079, -0.0006248503973819523, 18.7],
'Q217p': [1.0165157773037472, -0.006419637626097819, -0.000927550610591879, 16.7],
'Q219p': [1.0136255722145442, -0.004544629474433171, -0.0010878048910708117, 18.7],
'Q311': [0.9820571573496972, 0.011947716397192746, -0.0015316600265756597, 11.1],
'Q313': [1.002376171424373, 0.00087053237460555, -0.0010541678118863593, 12.9],
'Q311p': [0.9843034690253142, 0.011094990021336104, -0.0016791051042741416, 11.1],
'Q313p': [0.9958959030027292, 0.0051175051270606255, -0.0014905894344412235, 12.9],
'Q417': [0.9888926591458963, 0.006986281593109233, -0.0007107060258669477, 17.0],
'Q419': [0.9886433438856964, 0.007541246196285672, -0.0009156379893644272, 19.0],
'Q417p': [1.0029823815141663, 0.0008640490621996672, -0.0012140291472187072, 17.0],
'Q419p': [0.9843617866675408, 0.010330165097893152, -0.0012211561793953436, 19.0],
'P30': [1.00513, 0.00301399, -0.00300699, 28.4],
'P44': [0.994769, 0.00596703, -0.00173626, 44.1],
'P70': [0.989711, 0.0106943, -0.00328671, 70.4],
'P100': [0.9952835351962233, -0.007239481180040377, -0.004211453482240249, 100.0],
'P143': [1.00994594645371, 0.005811737546852095, -0.004342394286587356, 143.0],
'P217': [0.9850957294640018, -0.016079422733509176, -0.0035799396324725217, 217.0],
'P353': [0.9838850223400122, -0.017222883189337086, -0.003294659291023683, 353.0],
'P545': [0.9858927513258451, -0.01445625909566499, -0.004198782898699968, 545.0],
'P857': [1.0016037903615955, -0.0002352573927594772, -0.00426643435387609, 857.0],
'WK' : [0.972902, 0.0190469, -0.00276464, 22.8],
'WKa': [0.983787, 0.0117567, -0.00183716, 33.0],
'WQ' : [0.996854, 0.00496893, -0.00181359, 40.6],
'WV' : [0.980322, 0.0143631, -0.00223596, 60.8],
'WW' : [0.984848, 0.0112743, -0.00164595, 93.5],
'DB10': [1.0056317, -0.0052173, -0.0119257, 1249],
'DB9': [1.0347912, 0.0245728, -0.0095350, 2141],
'DB8': [0.9593942, -0.0469581, -0.0075185, 2997],
'DB7': [0.9079217, -0.0942761, -0.0068850, 4995],
'DB6': [0.8160551, -0.1717965, 0.0103011, 11988],
'DB5': [0.9816717, -0.0327394, -0.0178211, 24975],
'DB4': [0.9947178, -0.0060948, -0.0008378, 61163],
'DB3': [1.0030533, -0.0001524, -0.0032236, 85629],
'DB2': [1.0064020, 0.0050962, -0.0012763, 136227],
'DB1': [1.0073260, 0.0044317, -0.0028791, 239760],
'I100': [0.9899184805240909, -0.01970072476335274, -0.007706943391147654, 2997],
'I60': [0.9510100573154361, -0.06111819772388552, -0.016457316462171055, 4995],
'I25': [0.9123700815757735, -0.08972760549528734, -0.0056369170040417305, 11988],
'I12': [0.9083422603187424, -0.09300485963152248, -0.008759896726856715, 24975]
}
detectors_v2 = {
'P18': [0.977484, 0.0185055, -0.00391209, 70.4],
'P19': [0.965314, 0.0234026, -0.00256943, 70.4],
'P20': [0.968436, 0.0220869, -0.00285115, 70.4],
'P21': [0.982854, 0.0142877, -0.00317682, 70.4],
'P22': [1.049, -0.0237173, -0.00288312, 70.4],
'P23': [0.990172, 0.0091968, -0.00238961, 70.4],
'P1823': [0.983195, 0.0141778, -0.00317682, 70.4],
'P1922': [1.00978, -0.000698302, -0.00328272, 70.4],
'P2021': [0.97712, 0.0175904, -0.00308092, 70.4],
'P24': [0.999958, 0.00309391, -0.00177223, 44.1],
'P25': [0.994381, 0.00591109, -0.00162038, 44.1],
'P26': [0.990046, 0.00854446, -0.00177223, 44.1],
'P2526': [0.992115, 0.00717982, -0.00167233, 44.1],
'P27': [1.00503, 0.00276424, -0.00282717, 28.4],
'P28': [1.00491, 0.00334266, -0.00313287, 28.4],
'WK11': [0.939366, 0.0346715, -0.00214346, 22.8],
'WK12': [1.00894, 0.000982418, -0.00276923, 22.8],
'WK1': [0.972902, 0.0190469, -0.00276464, 22.8],
'WKa11': [0.974784, 0.0159578, -0.00161958, 33.0],
'WKa12': [0.992978, 0.00737502, -0.00200839, 33.0],
'WKa1': [0.983787, 0.0117567, -0.00183716, 33.0],
'WQ11': [0.990948, 0.00846474, -0.00204555, 40.6],
'WQ12': [0.998159, 0.00404356, -0.00167233, 40.6],
'WQ1': [0.994548, 0.00627672, -0.00186693, 40.6],
'WQ21': [0.981607, 0.0126181, -0.00166893, 40.6],
'WQ22': [1.01705, -0.00573297, -0.0016989, 40.6],
'WQ2': [0.998986, 0.00378172, -0.00176723, 40.6],
'WV11': [0.939474, 0.0354285, -0.00155105, 60.8],
'WV12': [0.994737, 0.006396, -0.00217822, 60.8],
'WV1': [0.966309, 0.0217416, -0.00209331, 60.8],
'WV21': [1.00662, -0.000113686, -0.00217942, 60.8],
'WV22': [0.977227, 0.0160255, -0.00220999, 60.8],
'WV2': [0.991701, 0.0082012, -0.00226214, 60.8],
'WW11': [0.988343, 0.00956424, -0.00211948, 93.5],
'WW12': [0.9838, 0.0120015, -0.00173207, 93.5],
'WW1': [0.986087, 0.0107974, -0.00193167, 93.5],
'WW21': [0.978714, 0.0149705, -0.00148032, 93.5],
'WW22': [0.992004, 0.00655744, -0.00146334, 93.5],
'WW2': [0.985324, 0.0108262, -0.00149331, 93.5],
'WW31': [0.977457, 0.0155997, -0.00131688, 93.5],
'WW32': [0.993636, 0.0054001, -0.00134126, 93.5],
'WW3': [0.985473, 0.0105855, -0.00135485, 93.5],
'WW41': [0.991452, 0.0072962, -0.00181239, 93.5],
'WW42': [0.973071, 0.0185705, -0.00153746, 93.5],
'WW4': [0.982185, 0.0130277, -0.00170889, 93.5]
}
# WMAP9 modified by Paddy Leahy, Planck LFI 2015, MFI 2019 pre-release, CBASS-N pre-release, HFI 2018
frequencies_v3 = {
'CBASSNI': [1.000103213196618, -0.0007238230723748647, -0.0013363809246677324, 4.76],
'CBASSNP': [0.998561438218094, -0.0059052869678747595, -0.001680320871507042, 4.76],
'Q111': [0.9925526276311687, 0.007161407883127753, -0.0017891332783659003, 11.2],
'Q113': [0.9949649181723395, 0.005394042720463821, -0.0014382949498306515, 12.8],
'Q111p': [0.9925526276311687, 0.007161407883127753, -0.0017891332783659003, 11.2],
'Q113p': [0.9949649181723395, 0.005394042720463821, -0.0014382949498306515, 12.8],
# Ricardo's
'Q217': [1.0151076e+00, -6.2980512e-03, -6.6328899e-04, 16.7],
'Q219': [1.0044873e+00, -6.9880270e-04, -8.0008415e-04, 18.7],
'Q217p': [1.0164309e+00, -6.8967971e-03, -6.9669675e-04, 16.7],
'Q219p': [1.0063189e+00, -1.5465975e-03, -8.3820865e-04, 18.7],
'Q311': [9.7503167e-01, 1.5154881e-02, -1.3419595e-03, 11.1],
'Q313': [1.0020006e+00, 1.2096321e-03, -1.1181610e-03, 12.9],
'Q311p': [9.7435313e-01, 1.5561411e-02, -1.3759293e-03, 11.1],
'Q313p': [1.0014578e+00, 1.5677144e-03, -1.1603758e-03, 12.9],
'Q417': [ 9.9242616e-01, 5.1233089e-03, -6.6559127e-04, 17.0],
'Q419': [9.8860997e-01, 7.0407907e-03, -6.6380308e-04, 19.0],
'Q417p': [9.9417585e-01, 4.4213212e-03, -7.5650186e-04, 17.0],
'Q419p': [9.8834890e-01, 7.2843521e-03, -7.2142464e-04, 19.0],
# Because corr and uncorr are separate
'Q217a': [1.0124857e+00, -4.8081060e-03, -7.4939791e-04, 16.7],
'Q219a': [1.0250959e+00, -1.1331024e-02, -6.7586231e-04, 18.7],
'Q217pa': [1.0131496e+00, -5.0831265e-03, -7.7903963e-04, 16.7],
'Q219pa': [1.0251949e+00, -1.1307628e-02, -7.1259105e-04, 18.7],
'Q311a': [9.8683834e-01, 9.7809471e-03, -1.6118117e-03, 11.1],
'Q313a': [9.9982220e-01, 2.4378647e-03, -1.1876230e-03, 12.9],
'Q311pa': [9.8786569e-01, 9.3773920e-03, -1.6670182e-03, 11.1],
'Q313pa': [9.9832255e-01, 3.2854939e-03, -1.2350217e-03, 12.9],
'Q417a': [9.9408644e-01, 4.3199980e-03, -6.8160536e-04, 17.0],
'Q419a': [9.9183798e-01, 5.6213369e-03, -7.6962094e-04, 19.0],
'Q417pa': [9.9838507e-01, 2.3409829e-03, -7.7473023e-04, 17.0],
'Q419pa': [9.9225020e-01, 5.5417600e-03, -8.3547790e-04, 19.0],
# Mine
# 'Q217': [1.0129709167366905, -0.005101169068593444, -0.000683203301567257, 16.7],
# 'Q219': [1.0175292512259428, -0.007544762181222079, -0.0006248503973819523, 18.7],
# 'Q217p': [1.0165157773037472, -0.006419637626097819, -0.000927550610591879, 16.7],
# 'Q219p': [1.0136255722145442, -0.004544629474433171, -0.0010878048910708117, 18.7],
# 'Q311': [0.9820571573496972, 0.011947716397192746, -0.0015316600265756597, 11.1],
# 'Q313': [1.002376171424373, 0.00087053237460555, -0.0010541678118863593, 12.9],
# 'Q311p': [0.9843034690253142, 0.011094990021336104, -0.0016791051042741416, 11.1],
# 'Q313p': [0.9958959030027292, 0.0051175051270606255, -0.0014905894344412235, 12.9],
# 'Q417': [0.9888926591458963, 0.006986281593109233, -0.0007107060258669477, 17.0],
# 'Q419': [0.9886433438856964, 0.007541246196285672, -0.0009156379893644272, 19.0],
# 'Q417p': [1.0029823815141663, 0.0008640490621996672, -0.0012140291472187072, 17.0],
# 'Q419p': [0.9843617866675408, 0.010330165097893152, -0.0012211561793953436, 19.0],
# Ricardo's
'P30': [1.0060073, 0.00247349, -0.00292103, 28.4],
'P44': [0.9949296, 0.00569585, -0.00168994, 44.1],
'P70': [0.99120146, 0.00978357, -0.00324235, 70.4],
# Paddy's
# 'P30': [1.00513, 0.00301399, -0.00300699, 28.4],
# 'P44': [0.994769, 0.00596703, -0.00173626, 44.1],
# 'P70': [0.989711, 0.0106943, -0.00328671, 70.4],
'P100': [0.9960219846097942, -0.00654302733954478, -0.00416413824546881, 100.0],
'P143': [1.0111101391244646, 0.006818336941786147, -0.0043482778766929025, 143.0],
'P217': [0.9874219751512573, -0.013958018248228142, -0.003712910348781007, 217.0],
'P353': [0.9855790668991027, -0.015716578392508118, -0.0032909215453657656, 353.0],
'P545': [0.9857797576167087, -0.01455866885981098, -0.0041925161876140765, 545.0],
'P857': [1.0026826793529224, 0.0007381414746500997, -0.004248209090549633, 857.0],
# Ricardo's
'WK' : [0.97299904, 0.01883689, -0.00267575, 22.8],
'WKa': [0.9849469, 0.01105459, -0.00177685, 33.0],
'WQ' : [0.99638957, 0.00525705, -0.00183922, 40.6],
'WV' : [0.97854257, 0.01513189, -0.00212611, 60.8],
'WW' : [0.98464006, 0.01126085, -0.00155777, 93.5],
# Paddy's
# 'WK' : [0.972902, 0.0190469, -0.00276464, 22.8],
# 'WKa': [0.983787, 0.0117567, -0.00183716, 33.0],
# 'WQ' : [0.996854, 0.00496893, -0.00181359, 40.6],
# 'WV' : [0.980322, 0.0143631, -0.00223596, 60.8],
# 'WW' : [0.984848, 0.0112743, -0.00164595, 93.5],
'DB10': [1.0056317e+00, -6.4834543e-03, -1.1925717e-02, 2.3065088e-04, 1249],
'DB9': [1.0347912e+00, 2.5405537e-02, -9.5349792e-03, -1.5169126e-04, 2141],
'DB8': [9.5939422e-01, -4.8364848e-02, -7.5184624e-03, 2.5625768e-04, 2997],
'DB7': [9.0792167e-01, -9.9896029e-02, -6.8849851e-03, 1.0237540e-03, 4995],
'DB6': [8.1605506e-01, -1.7407244e-01, 1.0301138e-02, 4.1460118e-04, 11988],
'DB5': [9.8167169e-01, -3.6703132e-02, -1.7821072e-02, 7.2205620e-04, 24975],
'DB4': [9.9471784e-01, -6.1251973e-03, -8.3776598e-04, 5.5378068e-06, 61163],
'DB3': [1.0030533e+00, -1.7146974e-04, -3.2236280e-03, 3.4781212e-06, 85629],
'DB2': [1.0064020e+00, 5.1325657e-03, -1.2763232e-03, -6.6162706e-06, 136227],
'DB1': [1.0073260e+00, 4.4526956e-03, -2.8791293e-03, -3.8249291e-06, 239760],
'I100': [9.8682648e-01, -2.0946426e-02, -7.6484028e-03, 1.4026849e-04, 2997],
'I60': [9.5354623e-01, -6.4501286e-02, -1.7309224e-02, 8.4418210e-04, 4995],
'I25': [9.1217232e-01, -9.4449066e-02, -5.8258590e-03, 8.7096798e-04, 11988],
'I12': [9.0728289e-01, -1.0321426e-01, -9.2115393e-03, 1.4914416e-03, 24975]
}
# These haven't changed
detectors_v3 = detectors_v2
retfreq = 0.0
# Pull out the desired coefficients from the above arrays
if (detector != False):
if (debug == True):
print('Using detector ' + str(detector))
if (option == 3):
cc = detectors_v3.get(detector, 0)
elif (option == 2):
cc = detectors_v2.get(detector, 0)
else:
cc = detectors_v1.get(detector, 0)
if (cc == 0):
print('Invalid detector specified for fastcc ('+str(detector)+'), returning zero.')
if returnfreq:
return [0,0]
else:
return 0
else:
if (debug == True):
print('Using frequency ' + str(freq))
if (option == 3):
cc = frequencies_v3.get(freq, 0)
elif (option == 2):
cc = frequencies_v2.get(freq, 0)
else:
cc = frequencies_v1.get(freq, 0)
if (cc == 0):
print('Invalid frequency specified for fastcc ('+str(freq)+'), returning zero.')
if returnfreq:
return [0,0]
else:
return 0
if (type(cc) is dict):
# We have WMAP values
beta=-2.0+alpha
T0 = 1.0 * (cc['nu'][0]/cc['nu'][1]) ** beta
T1 = 1.0
T2 = 1.0 * (cc['nu'][2]/cc['nu'][1]) ** beta
dT = 1.0 # Because conversion from T_CMB to T_RJ is done elsewhere.
fastCC = 1.0 / (cc['dT'] * (cc['w'][0]*T0 + cc['w'][1]*T1 + cc['w'][2]*T2))
retfreq = cc['nu'][1]
else:
if len(cc) == 5:
fastCC = cc[0] + cc[1]*alpha + cc[2]*(alpha**2) + cc[3]*(alpha**2)
retfreq = cc[4]
else:
fastCC = cc[0] + cc[1]*alpha + cc[2]*(alpha**2)
retfreq = cc[3]
if returnfreq:
return [retfreq,fastCC]
else:
return fastCC