forked from ctrendafilova/FisherLens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep_test_gamma.py
76 lines (70 loc) · 1.77 KB
/
step_test_gamma.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
import subprocess as sp
import numpy as np
import matplotlib.pyplot as plot
step_table = {
(-6, 0): 27,
(-5, 0): 27,
(-4, 0): 27,
(-3, 0): 26,
(-2, 0): 26,
(-1, 0): 26,
(0, 0): 24,
(1, 0): 23,
(2, 0): 22,
(3, 0): 21,
(-6, 2): 25,
(-5, 2): 24,
(-4, 2): 23,
(-3, 2): 22,
(-2, 2): 21,
(-1, 2): 20,
(0, 2): 19,
(1, 2): 18,
(2, 2): 17,
(3, 2): 16,
(-6, 4): 24,
(-5, 4): 22,
(-4, 4): 20,
(-3, 4): 19,
(-2, 4): 17,
(-1, 4): 16,
(0, 4): 16,
(1, 4): 14,
(2, 4): 13,
(3, 4): 12,
}
f_sky = 0.4
TAU_PRIOR = True
mode = 2
constraints = []
if mode == 1:
for ss_exp in range(-35, -25):
try:
cmd = ['python', 'fisherGenerateDataClass_example.py', str(10**ss_exp)]
print(' '.join(cmd))
proc = sp.Popen(cmd)
proc.wait()
except Exception as e:
print(e)
#print(f'{m} joined!')
elif mode == 2:
for ss_exp in range(-35, -25):
f = f'decay_g{str(abs(float(ss_exp)))}'
try:
print(f'{f}.pkl')
fish = np.load(f'CLASS_delens/results/{f}.pkl', allow_pickle=True)['fisherGaussian']['delensed']
if TAU_PRIOR:
fish[4, :] = 0
fish[:, 4] = 0
fish[4, 4] = 1 / 0.0074 ** 2
cov = np.linalg.inv(fish) / f_sky
constraints.append(np.sqrt(cov[-1, -1]) * 2)
except:
print(f'Skipping 10^{ss_exp}')
print(constraints)
plot.loglog(10.**np.array(list(range(-35, -25))), constraints)
plot.xlabel('Step Size in Derivative')
plot.ylabel('Constraint from Forecast')
plot.axhline(y=1e-6/9e16, color='r', linestyle='--')
plot.legend(['CMB-S4 (Fisher)', 'Planck'])
plot.show()