-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGWspectrumcalc.py
More file actions
53 lines (38 loc) · 1.44 KB
/
Copy pathGWspectrumcalc.py
File metadata and controls
53 lines (38 loc) · 1.44 KB
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
"""
This script calculates the GW spectrum. This is intended to be used in a local
computer for testing out the result for summing over small k-modes. For 30 frequency
bins, it takes couple of minutes for kmax = 2.
If parallelization is expected, use GWscanner.py
"""
import numpy as np
from dwboundedbycs import DWBoundedbyCS
defectGW = DWBoundedbyCS()
kmax = 2
flist = np.logspace(-9, 5, 30)
result = np.array([0.] * len(flist))
for i in range(len(result)):
result[i] = sum([defectGW.OmegaGWcalcDWCS(1e13, 246, flist[i], k) for k in range(1, kmax)])
print(np.column_stack((flist, result)))
"""
This script calculates the GW spectrum for pure gauge CS. This is intended to be used in a local
computer for testing out the result for summing over small k-modes. For 30 frequency
bins, it takes couple of minutes for kmax = 2.
If parallelization is expected, use GWscanner.py
"""
import numpy as np
from gaugedcs import CosmicString
defectGW = CosmicString()
kmax = 100
flist = np.logspace(-9, 5, 30)
def GWscanner(Lambda_val):
result = np.array([0.] * len(flist))
for i in range(len(result)):
result[i] = sum([defectGW.OmegaGWcalcCS(Lambda_val, flist[i], k) for k in range(1, kmax)])
final_result = np.column_stack((flist, result))
# save results in a text file
np.savetxt(f'CSGW_{np.log10(Lambda_val)}.txt', final_result)
return final_result
GWscanner(1.0e12)
GWscanner(1.0e13)
GWscanner(1.0e14)
GWscanner(1.0e15)