-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGWplotter.py
More file actions
166 lines (128 loc) · 5.99 KB
/
GWplotter.py
File metadata and controls
166 lines (128 loc) · 5.99 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
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
# -*- coding: utf-8 -*-
"""
This file plots the GW spectrum from pre-calculated data using GWscanner.py,
along with various interferometer sensitivities/upper bounds/observations.
"""
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import numpy as np
import os
from plotinterferometer import plot_all_interferometers
# Get the current working directory
current_dir = os.getcwd()
# Define the name of the folder containing the data
folder_name = '2hdmGWdata'
# Now we load and plot the pre-calculated GW spectrum.
# GW spectrum for U(1) breaking at 10^{12} GeV, Z2 breaking at 246 GeV
def plot_Lambda12():
# Load the data from the text file
file_path = os.path.join(current_dir, folder_name, 'DWCSGW_12.0_246.0.txt')
data12 = np.loadtxt(file_path)
# separate the columns
freq = data12[:, 0]
OmegaGW12 = data12[:, 1]
# pure CS case
file_path = os.path.join(current_dir, folder_name, 'CSGW_12.0.txt')
dataCS12 = np.loadtxt(file_path)
# separate the columns
freqCS = dataCS12[:, 0]
OmegaCSGW12 = dataCS12[:, 1]
# get rid of the pairs where GW amplitude is zero
nonzero_indices = np.nonzero(OmegaGW12)
freq_nonzero = freq[nonzero_indices]
OmegaGW12_nonzero = OmegaGW12[nonzero_indices]
plt.loglog(freq_nonzero, OmegaGW12_nonzero, color='purple', linewidth=2.2)
plt.loglog(freqCS, OmegaCSGW12, color='purple', linewidth=2.2, linestyle=':')
# GW spectrum for U(1) breaking at 10^{13} GeV, Z2 breaking at 246 GeV
def plot_Lambda13():
# Load the data from the text file
file_path = os.path.join(current_dir, folder_name, 'DWCSGW_13.0_246.0.txt')
data13 = np.loadtxt(file_path)
# separate the columns
freq = data13[:, 0]
OmegaGW13 = data13[:, 1]
# pure CS case
file_path = os.path.join(current_dir, folder_name, 'CSGW_13.0.txt')
dataCS13 = np.loadtxt(file_path)
# separate the columns
freqCS = dataCS13[:, 0]
OmegaCSGW13 = dataCS13[:, 1]
# get rid of the pairs where GW amplitude is zero
nonzero_indices = np.nonzero(OmegaGW13)
freq_nonzero = freq[nonzero_indices]
OmegaGW13_nonzero = OmegaGW13[nonzero_indices]
plt.loglog(freq_nonzero, OmegaGW13_nonzero, color='darkblue', linewidth=2.2)
plt.loglog(freqCS, OmegaCSGW13, color='darkblue', linewidth=2.2, linestyle=':')
# GW spectrum for U(1) breaking at 10^{14} GeV, Z2 breaking at 246 GeV
def plot_Lambda14():
# Load the data from the text file
file_path = os.path.join(current_dir, folder_name, 'DWCSGW_14.0_246.0.txt')
data14 = np.loadtxt(file_path)
# separate the columns
freq = data14[:, 0]
OmegaGW14 = data14[:, 1]
# pure CS case
file_path = os.path.join(current_dir, folder_name, 'CSGW_14.0.txt')
dataCS14 = np.loadtxt(file_path)
# separate the columns
freqCS = dataCS14[:, 0]
OmegaCSGW14 = dataCS14[:, 1]
# get rid of the pairs where GW amplitude is zero
nonzero_indices = np.nonzero(OmegaGW14)
freq_nonzero = freq[nonzero_indices]
OmegaGW14_nonzero = OmegaGW14[nonzero_indices]
plt.loglog(freq_nonzero, OmegaGW14_nonzero, color='orange', linewidth=2.2)
plt.loglog(freqCS, OmegaCSGW14, color='orange', linewidth=2.2, linestyle=':')
# GW spectrum for U(1) breaking at 10^{15} GeV, Z2 breaking at 246 GeV
def plot_Lambda15():
# Load the data from the text file
file_path = os.path.join(current_dir, folder_name, 'DWCSGW_15.0_246.0.txt')
data15 = np.loadtxt(file_path)
# separate the columns
freq = data15[:, 0]
OmegaGW15 = data15[:, 1]
# pure CS case
file_path = os.path.join(current_dir, folder_name, 'CSGW_15.0.txt')
dataCS15 = np.loadtxt(file_path)
# separate the columns
freqCS = dataCS15[:, 0]
OmegaCSGW15 = dataCS15[:, 1]
# get rid of the pairs where GW amplitude is zero
nonzero_indices = np.nonzero(OmegaGW15)
freq_nonzero = freq[nonzero_indices]
OmegaGW15_nonzero = OmegaGW15[nonzero_indices]
plt.loglog(freq_nonzero, OmegaGW15_nonzero, color='red', linewidth=2.2)
plt.loglog(freqCS, OmegaCSGW15, color='red', linewidth=2.2, linestyle=':')
# Set font family to Latin Modern Roman for LaTeX text
plt.rcParams['font.family'] = 'Latin Modern Roman'
plt.rcParams.update({
"text.usetex": True,
"font.family": "Latin Modern Roman"
})
# make the final plot
fig, ax = plt.subplots(figsize=(4*1.67, 4), dpi=600)
# Adding ticks on all sides
plt.tick_params(axis='both', which='both', direction='in', bottom=True, top=True, left=True, right=True)
# set axis limits to be displayed
plt.xlim(1e-9, 1e4)
plt.ylim(1e-18, 1e-7)
# put labels on the axes
plt.xlabel(r'$f$ [Hz]')
plt.ylabel(r'$\Omega_{\mathrm{GW}}h^2$')
# Now we combine all the plots into one
plot_all_interferometers() # interferometer plots
plot_Lambda12() # GW spectrum for U(1) breaking at 10^{12} GeV, Z2 breaking at 246 GeV
plot_Lambda13() # GW spectrum for U(1) breaking at 10^{13} GeV, Z2 breaking at 246 GeV
plot_Lambda14() # GW spectrum for U(1) breaking at 10^{14} GeV, Z2 breaking at 246 GeV
plot_Lambda15() # GW spectrum for U(1) breaking at 10^{15} GeV, Z2 breaking at 246 GeV
# plot legend
line_blank = mlines.Line2D([], [], color='blue', linestyle=' ', linewidth=0.5, label=r'$v_{\mathrm{SM}} = 246$ GeV')
line_purple = mlines.Line2D([], [], color='purple', linestyle='-', linewidth=1.5, label=r'$v_{\mathrm M} = 10^{12}\ {\rm GeV}$')
line_blue = mlines.Line2D([], [], color='darkblue', linestyle='-', linewidth=1.5, label=r'$v_{\mathrm M} = 10^{13}\ {\rm GeV}$')
line_orange = mlines.Line2D([], [], color='orange', linestyle='-', linewidth=1.5, label=r'$v_{\mathrm M} = 10^{{14}}\ {\rm GeV}$')
line_red = mlines.Line2D([], [], color='red', linestyle='-', linewidth=1.5, label=r'$v_{\mathrm M} = 10^{15}\ {\rm GeV}$')
plt.legend(handles=[line_blank, line_purple, line_blue, line_orange, line_red], loc = (0.74,0.045), framealpha=0.2, fontsize=8, edgecolor='black') #best upper-right
# save the figure
plt.savefig('GWspectrum.png', dpi=600)
# show plot
plt.show()