|
@@ -0,0 +1,67 @@
|
|
|
+#!/usr/bin/env python3
|
|
|
+# -*- coding: UTF-8 -*-
|
|
|
+import numpy as np
|
|
|
+import matplotlib.pyplot as plt
|
|
|
+file_ext="pdf"
|
|
|
+#dirname="Si-sphere-step2.5-dipole"
|
|
|
+
|
|
|
+#distance = [100,200,400,800,1200,1600,2000]
|
|
|
+#dirname="Si-sphere-step5-dipole-far"
|
|
|
+
|
|
|
+# distance = [1,2,3,4,5,6,7,8,9,10]
|
|
|
+# dirname="Si-sphere-step5-dipole-far-long"
|
|
|
+
|
|
|
+distance = [2,4,6,8,10,12,14,16,18,20,22]
|
|
|
+dirname="Si-sphere-step5-dipole-far-long22"
|
|
|
+
|
|
|
+data = []
|
|
|
+
|
|
|
+for i in distance:
|
|
|
+# print(i, dirname+"/d%i.txt"%i)
|
|
|
+ data.append(
|
|
|
+ np.transpose(
|
|
|
+ np.loadtxt(dirname+"/r%i.txt"%i, delimiter=", ",skiprows=3)
|
|
|
+ )#[-2]
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+for i in range(len(distance)):
|
|
|
+ R = distance[i]
|
|
|
+ print(R)
|
|
|
+ plt.semilogy(data[i][0,:], data[i][1,:]*np.sqrt(R))
|
|
|
+plt.xlabel(r'$\lambda$, nm')
|
|
|
+plt.ylabel(r'$Abs(E_x) \sqrt{R}$')
|
|
|
+plt.savefig(dirname+"_plot."+file_ext)
|
|
|
+plt.clf()
|
|
|
+
|
|
|
+WLs=[300,350,400,450,600,700,800]
|
|
|
+#WLs=[300,350,400,450,600,700]
|
|
|
+
|
|
|
+def find_nearest(array,value):
|
|
|
+ idx = (np.abs(array-value)).argmin()
|
|
|
+ return array[idx],idx
|
|
|
+
|
|
|
+WLs_idx = []
|
|
|
+for wl in WLs:
|
|
|
+ val, idx = find_nearest(data[0][0,:],wl/1000)
|
|
|
+ WLs_idx.append(idx)
|
|
|
+# print(val,idx, " --> ", data[0][0,idx])
|
|
|
+
|
|
|
+
|
|
|
+legend = []
|
|
|
+for i in range(len(WLs)):
|
|
|
+ pl_data = []
|
|
|
+ idx = WLs_idx[i]
|
|
|
+ legend.append(str(WLs[i])+" nm")
|
|
|
+ for point in range(len(distance)):
|
|
|
+ R = distance[point]
|
|
|
+ pl_data.append(data[point][1,idx]*np.sqrt(R))
|
|
|
+ plt.semilogy(distance, pl_data,marker="o")
|
|
|
+plt.legend(legend)
|
|
|
+# #plt.xlabel(r'THz')
|
|
|
+plt.xlabel(r'Monitor R, $\mu$m')
|
|
|
+plt.ylabel(r'$Abs(E_x) \sqrt{R}$',labelpad=-5)
|
|
|
+# plt.title(' r = '+str(core_r))
|
|
|
+plt.savefig(dirname+"_WLs."+file_ext)
|
|
|
+plt.clf()
|
|
|
+plt.close()
|