forked from mabitbol/sd_foregrounds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_fisher.py
188 lines (177 loc) · 6 KB
/
run_fisher.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
import numpy as np
import fisher
import foregrounds as fg
import spectral_distortions as sd
def sens_vs_dnu(fmax=61, fstep=0.1, sens=[1., 0.1, 0.01, 0.001]):
dnu = np.arange(1, fmax, fstep) * 1.e9
fish = fisher.FisherEstimation()
args = fish.args
N = len(args)
data = {}
for sen in sens:
print "on sens ", sen
data[sen] = {}
for arg in args:
data[sen][arg] = []
for nu in dnu:
scale = sen * (15.e9 / nu)
fish = fisher.FisherEstimation(fstep=nu, mult=scale)
fish.run_fisher_calculation()
for arg in args:
data[sen][arg].append(fish.errors[arg])
x = {}
x['sens'] = sens
x['dnu'] = dnu
x['data'] = data
np.save('datatest', x)
return
def sens_vs_nbins(sens=[1., 0.1, 0.01, 0.001]):
nbins = np.arange(50, 601)[::-1]
dnu = 3.e12 / nbins
fish = fisher.FisherEstimation()
args = fish.args
N = len(args)
data = {}
for sen in sens:
print "on sens ", sen
data[sen] = {}
for arg in args:
data[sen][arg] = []
for nu in dnu:
scale = sen * (15.e9 / nu)
#ps = {'As':0.1, 'alps': 0.1}
#ps = {'As':0.01, 'alps': 0.01}
ps = {}
fish = fisher.FisherEstimation(fstep=nu, mult=scale, priors=ps)
fish.run_fisher_calculation()
for arg in args:
data[sen][arg].append(fish.errors[arg])
x = {}
x['sens'] = sens
x['dnu'] = dnu
x['data'] = data
np.save('senscalc_nbins_0p', x)
return
def drop_vs_dnu(fmax=61, fstep=0.1, drops=[0, 1, 2]):
dnu = np.arange(1, fmax, fstep) * 1.e9
fish = fisher.FisherEstimation()
args = fish.args
N = len(args)
data = {}
for drop in drops:
print "on drop ", drop
data[drop] = {}
for arg in args:
data[drop][arg] = []
for k, nu in enumerate(dnu):
if k % 100 == 0:
print "on k ", k
scale = 15.e9 / nu
ps = {'As':0.01, 'alps': 0.01}
#ps = {'As':0.1, 'alps': 0.1}
fish = fisher.FisherEstimation(fstep=nu, mult=scale, drop=drop, priors=ps)
fish.run_fisher_calculation()
for arg in args:
data[drop][arg].append(fish.errors[arg])
x = {}
x['drops'] = drops
x['dnu'] = dnu
x['data'] = data
np.save('fullcalc_1p_drop012_coarse', x)
return
def drop_vs_dnu_nomu(fmax=61, fstep=0.1, drops=[0, 1, 2]):
dnu = np.arange(1, fmax, fstep) * 1.e9
fish = fisher.FisherEstimation()
fish.set_signals(fncs=[sd.DeltaI_reltSZ_2param_yweight, sd.DeltaI_DeltaT,
fg.thermal_dust_rad, fg.cib_rad, fg.jens_freefree_rad,
fg.jens_synch_rad, fg.spinning_dust, fg.co_rad])
args = fish.args
N = len(args)
data = {}
for drop in drops:
print "on drop ", drop
data[drop] = {}
for arg in args:
data[drop][arg] = []
for k, nu in enumerate(dnu):
if k % 100 == 0:
print "on k ", k
scale = 15.e9 / nu
fish = fisher.FisherEstimation(fstep=nu, mult=scale, drop=drop)
fish.set_signals(fncs=[sd.DeltaI_reltSZ_2param_yweight, sd.DeltaI_DeltaT,
fg.thermal_dust_rad, fg.cib_rad, fg.jens_freefree_rad,
fg.jens_synch_rad, fg.spinning_dust, fg.co_rad])
fish.run_fisher_calculation()
for arg in args:
data[drop][arg].append(fish.errors[arg])
x = {}
x['drops'] = drops
x['dnu'] = dnu
x['data'] = data
np.save('fullcalc_10p_drop012_nomu', x)
return
def drop_vs_nbin(drops=[0, 1, 2]):
nbins = np.arange(50, 601)[::-1]
dnu = 3.e12 / nbins
fish = fisher.FisherEstimation()
args = fish.args
N = len(args)
data = {}
for drop in drops:
print "on drop ", drop
data[drop] = {}
for arg in args:
data[drop][arg] = []
for k, nu in enumerate(dnu):
if k % 100 == 0:
print "on k ", k
scale = 15.e9 / nu
#ps = {'As':0.01, 'alps': 0.01}
ps = {'As':0.1, 'alps': 0.1}
fish = fisher.FisherEstimation(fstep=nu, mult=scale, drop=drop, priors=ps)
fish.run_fisher_calculation()
for arg in args:
data[drop][arg].append(fish.errors[arg])
x = {}
x['drops'] = drops
x['dnu'] = dnu
x['data'] = data
np.save('fullcalc_10p_drop012_nbins_onefifthsynch', x)
return
def drop_vs_nbin_nomu(drops=[0, 1, 2]):
nbins = np.arange(50, 601)[::-1]
dnu = 3.e12 / nbins
fish = fisher.FisherEstimation()
fish.set_signals(fncs=[sd.DeltaI_reltSZ_2param_yweight, sd.DeltaI_DeltaT,
fg.thermal_dust_rad, fg.cib_rad, fg.jens_freefree_rad,
fg.jens_synch_rad, fg.spinning_dust, fg.co_rad])
args = fish.args
N = len(args)
data = {}
for drop in drops:
print "on drop ", drop
data[drop] = {}
for arg in args:
data[drop][arg] = []
for k, nu in enumerate(dnu):
if k % 100 == 0:
print "on k ", k
scale = 15.e9 / nu
fish = fisher.FisherEstimation(fstep=nu, mult=scale, drop=drop)
fish.set_signals(fncs=[sd.DeltaI_reltSZ_2param_yweight, sd.DeltaI_DeltaT,
fg.thermal_dust_rad, fg.cib_rad, fg.jens_freefree_rad,
fg.jens_synch_rad, fg.spinning_dust, fg.co_rad])
fish.run_fisher_calculation()
for arg in args:
data[drop][arg].append(fish.errors[arg])
x = {}
x['drops'] = drops
x['dnu'] = dnu
x['data'] = data
np.save('fullcalc_10p_drop012_nbins_nomu', x)
return
#drop_vs_nbin_nomu()
drop_vs_nbin()
#drop_vs_dnu(fmax=61, fstep=0.1, drops=[0, 1, 2])
#drop_vs_dnu_nomu(fmax=61, fstep=0.1, drops=[0, 1, 2])
#sens_vs_nbins()