-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_cavity_simulation_results.py
100 lines (77 loc) · 3.14 KB
/
plot_cavity_simulation_results.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
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import numpy as np
sns.set_theme()
"""
################################################
# --------------- two data sets ---------------#
################################################
"""
df1 = pd.read_csv('height_sweep3_HFSSDesign2.csv', sep=',')
df2 = pd.read_csv('height_sweep3_HFSSDesign3.csv', sep=',')
"""
# both data sets on the same plot
"""
ax = df1.plot(x='Cavity height change', y='Cavity Quality Factor', figsize=(5, 5), marker='o', kind='line')
df2.plot(x='Cavity height change', y='Cavity Quality Factor', ax=ax, marker='o', kind='line')
fig, ax = plt.subplots()
ax.plot(list(df1["Cavity height change"]), list(df1["Cavity Quality Factor"]), marker='o')
ax.plot(list(df2["Cavity height change"]), list(df2["Cavity Quality Factor"]), marker='o')
# and then set to log scale
ax.set(yscale="log")
plt.legend(loc='upper left', labels=['old cavity', 'new cavity'])
"""
# two separate plots
"""
plot = sns.relplot(data=df1, x='Cavity height change', y='Cavity Quality Factor', color='b', marker='o', kind='line')
plot = sns.relplot(data=df2, x='Cavity height change', y='Cavity Quality Factor', color='orange', marker='o', kind='line')
#
plot.set(yscale="log")
"""
########################################################################
"""
# plt.xticks(rotation=30)
# yticks_numbers = [6e10, 1e11, 1.5e11, 2e11, 2.5e11, 3e11]
# yticks_labels = []
# for i in yticks_numbers:
# scientific_notation = "{:.1e}".format(i)
# yticks_labels.append(str(scientific_notation))
#
# plt.yticks(yticks_numbers, yticks_labels)
# #
# plt.subplots_adjust(left=0.20, bottom=0.20)
#
# plt.title('Change in Simulated Cavity Quality Factor')
# # plt.legend(loc='upper left', labels=['old cavity', 'new cavity'])
# plt.ylabel('Quality factor')
# plt.xlabel('Cavity height change')
#
# plt.show()
"""
###################################################################
# --------------- draw one graph with one data set ---------------#
###################################################################
"""
df1 = pd.read_csv('NEW_rod_height_sweep3_11_15_05_HFSSDesign3.csv', sep=',')
plot = sns.relplot(data=df1, x='Cavity rod height', y='Cavity Quality Factor', color='b', marker='o', kind='line')
plot.set(yscale="log")
plt.xticks(rotation=30)
yticks_numbers = np.arange(0.5e11, 5e11, step=0.5e11)
yticks_labels = []
for i in yticks_numbers:
scientific_notation = "{:.1e}".format(i)
yticks_labels.append(str(scientific_notation))
plt.yticks(yticks_numbers, yticks_labels)
plt.subplots_adjust(left=0.20, bottom=0.20)
plt.title('New design')
plt.ylabel('Quality factor')
plt.show()
"""
##################################################################################
"""
# ax = df1.plot(x='Cavity height change', y='Cavity Quality Factor', figsize=(5, 5), marker='o', kind='line')
# df2.plot(x='Cavity height change', y='Cavity Quality Factor', ax=ax, marker='o', kind='line')
# # and then set to log scale
# ax.set(yscale="log")
# plt.legend(loc='upper left', labels=['old cavity', 'new cavity'])