Browse Source

final version of SiAgSi plotting

Konstantin Ladutenko 10 years ago
parent
commit
af5915b75d
2 changed files with 20 additions and 19 deletions
  1. 3 2
      bessel.cc
  2. 17 17
      tests/python/field-SiAgSi.py

+ 3 - 2
bessel.cc

@@ -137,9 +137,10 @@ namespace nmie {
       if ( 2 <= n ) {
 	csa = csj[0];
 	csb = csj[1];
-	m = msta1 ( a0, 200 );
+	int precision = 1;
+	m = msta1 ( a0, 200*precision);
 	if ( m < n ) nm = m;
-	else m = msta2 ( a0, n, 15 );
+	else m = msta2 ( a0, n, 15*precision);
 	cf0 = 0.0;
 	cf1 = 1.0e-100;
 	for (int k = m; k>=0; --k) {

+ 17 - 17
tests/python/field-SiAgSi.py

@@ -73,7 +73,7 @@ m[0, 2] = index_Si/nm
 print "x =", x
 print "m =", m
 
-npts = 281
+npts = 1281
 
 scan = np.linspace(-2.0*x[0, 2], 2.0*x[0, 2], npts)
 
@@ -107,8 +107,8 @@ try:
     fig = plt.figure()
     ax = fig.add_subplot(111)
     # Rescale to better show the axes
-    scale_x = np.linspace(min(coordX)*1.064/2.0/np.pi/nm, max(coordX)*1.064/2.0/np.pi/nm, npts)
-    scale_z = np.linspace(min(coordZ)*1.064/2.0/np.pi/nm, max(coordZ)*1.064/2.0/np.pi/nm, npts)
+    scale_x = np.linspace(min(coordX)*WL/2.0/np.pi/nm, max(coordX)*WL/2.0/np.pi/nm, npts)
+    scale_z = np.linspace(min(coordZ)*WL/2.0/np.pi/nm, max(coordZ)*WL/2.0/np.pi/nm, npts)
 
     # Define scale ticks
     # min_tick = min(min_tick, np.amin(edata))
@@ -129,23 +129,23 @@ try:
     pos = list(cbar.ax.get_position().bounds)
     fig.text(pos[0] - 0.02, 0.925, '|E|/|E$_0$|', fontsize = 14)
 
-    plt.xlabel('Z')
-    plt.ylabel('X')
+    plt.xlabel('Z, nm')
+    plt.ylabel('X, nm')
 
-    # # This part draws the nanoshell
-    # from matplotlib import patches
+    # This part draws the nanoshell
+    from matplotlib import patches
 
-    # s1 = patches.Arc((0, 0), 1.0*x[0, 0], 1.0*x[0, 0],  angle=0.0, zorder=2,
-    #                  theta1=0.0, theta2=360.0, linewidth=1, color='black')
-    # ax.add_patch(s1)
+    s1 = patches.Arc((0, 0), 2.0*core_r, 2.0*core_r,  angle=0.0, zorder=2,
+                     theta1=0.0, theta2=360.0, linewidth=1, color='black')
+    ax.add_patch(s1)
 
-    # s2 = patches.Arc((0, 0), 2.0*x[0, 1], 2.0*x[0, 1], angle=0.0, zorder=2,
-    #                  theta1=0.0, theta2=360.0, linewidth=1, color='black')
-    # ax.add_patch(s2) 
-    # s3 = patches.Arc((0, 0), 2.0*x[0, 2], 2.0*x[0, 2], angle=0.0, zorder=2,
-    #                  theta1=0.0, theta2=360.0, linewidth=1, color='black')
-    # ax.add_patch(s3) 
-    # # End of drawing
+    s2 = patches.Arc((0, 0), 2.0*inner_r, 2.0*inner_r, angle=0.0, zorder=2,
+                     theta1=0.0, theta2=360.0, linewidth=1, color='black')
+    ax.add_patch(s2) 
+    s3 = patches.Arc((0, 0), 2.0*outer_r, 2.0*outer_r, angle=0.0, zorder=2,
+                     theta1=0.0, theta2=360.0, linewidth=1, color='black')
+    ax.add_patch(s3) 
+    # End of drawing
 
     plt.draw()