-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSquareRR_AOPS_Fig_S06.py
195 lines (179 loc) · 10.1 KB
/
SquareRR_AOPS_Fig_S06.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
187
188
189
190
191
192
193
194
195
"""
The code for the research presented in the paper titled "Enabling inverse design of plasmon-based nonlinear square resonators with deep neural networks."
This code corresponds to the Forward Deep Neural Network (DNN) section of the article.
This code regenerates the Fig. S6 of the paper.
Please cite the paper in any publication using this code.
"""
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.font_manager import FontProperties
Loss = pd.read_csv("SquareRR_AOPS_Fig_S06.csv")
Loss=Loss.to_numpy()
# fig S6m
plt.plot(Loss[:,0],Loss[:,6], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,8], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-40-80-160-320-160-80-40-20-10-5] FC NN', fontname='Helvetica', fontsize=13, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6m.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6k
plt.plot(Loss[:,0],Loss[:,6], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,10], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-40-80-160-80-40-20-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6k.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6i
plt.plot(Loss[:,0],Loss[:,6], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,12], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-40-80-40-20-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6i.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6g
plt.plot(Loss[:,0],Loss[:,6], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,14], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-40-20-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Times New Roman', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6g.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6e
plt.plot(Loss[:,0],Loss[:,6], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,16], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6e.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6c
plt.plot(Loss[:,0],Loss[:,6], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,18], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6c.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6a
plt.plot(Loss[:,0],Loss[:,6], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,20], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('NN with 1 hidden layer', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6a.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6n
plt.plot(Loss[:,0],Loss[:,7], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,9], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-40-80-160-320-160-80-40-20-10-5] FC NN', fontname='Helvetica', fontsize=13, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6n.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6l
plt.plot(Loss[:,0],Loss[:,7], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,11], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-40-80-160-80-40-20-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6l.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6j
plt.plot(Loss[:,0],Loss[:,7], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,13], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-40-80-40-20-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6j.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig Sh
plt.plot(Loss[:,0],Loss[:,7], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,15], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-40-20-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6h.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6f
plt.plot(Loss[:,0],Loss[:,7], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,17], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-20-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6f.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6d
plt.plot(Loss[:,0],Loss[:,7], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,19], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('[5-10-5] FC NN', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='Helvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("P2_FigureS6d.png", format="png", dpi=600, bbox_inches="tight")
plt.show()
# fig S6b
plt.plot(Loss[:,0],Loss[:,7], linewidth=2, color=((255/255, 127/255, 14/255)))
plt.plot(Loss[:,0],Loss[:,21], linewidth=2, color=((0/255, 114/255, 189/255)), linestyle='--')
plt.title('NN with 1 hidden layer', fontname='Helvetica', fontsize=14, loc='center')
plt.xlabel('Wavelength(nm)', fontname='Helvetica', fontsize=14)
plt.ylabel('Transmission', fontname='THelvetica', fontsize=14)
plt.xticks(fontfamily='Helvetica', fontsize=12)
plt.yticks(fontfamily='Helvetica', fontsize=12)
font_prop = FontProperties(family="Helvetica", size=14)
plt.legend(['FDTD', 'DL'], prop=font_prop)
plt.savefig("EP2_FigureS6b.png", format="png", dpi=600, bbox_inches="tight")
plt.show()