Konstantin Ladutenko 10 роки тому
батько
коміт
91979cd477
2 змінених файлів з 22 додано та 20 видалено
  1. 5 3
      compare.cc
  2. 17 17
      tests/python/field-dielectric-sphere.py

+ 5 - 3
compare.cc

@@ -242,10 +242,10 @@ int main(int argc, char *argv[]) {
     // for (int i = 0; i < samples; ++i) {
     //range.push_back( from_coord + (to_coord-from_coord)/(static_cast<double>(samples)-1)*i );
     //range.push_back(size*0.01);
-    //range.push_back(size*0.99999);
+    range.push_back(size*0.99999);
     //range.push_back(R/2.0);
-    //range.push_back(size*1.00001);
-    range.push_back(3);
+    range.push_back(size*1.00001);
+    //range.push_back(3);
     //printf("r=%g  ", range.back());
     //}
     //printf("r/2 = %g\n", R/2.0);
@@ -268,6 +268,8 @@ int main(int argc, char *argv[]) {
     // Test solid sphere
     x = {size};
     m = {std::complex<double>(2.000000,0.00)};
+    //m = {std::complex<double>(1.414213562, 0.00)};
+
     L = x.size();
     int pl = 0;
     int nmax = 0;

+ 17 - 17
tests/python/field-dielectric-sphere.py

@@ -66,8 +66,8 @@ terms, E, H = fieldnlay(x, m, coord)
 Er = np.absolute(E)
 
 # |E|/|Eo|
-Eh = np.sqrt(Er[0, :, 0]**2 + Er[0, :, 1]**2 + Er[0, :, 2]**2)
-#Eh = Er[0, :, 0]**2 + Er[0, :, 1]**2 + Er[0, :, 2]**2
+#Eh = np.sqrt(Er[0, :, 0]**2 + Er[0, :, 1]**2 + Er[0, :, 2]**2)
+Eh = Er[0, :, 0]**2 + Er[0, :, 1]**2 + Er[0, :, 2]**2
 
 result = np.vstack((coordX, coordY, coordZ, Eh)).transpose()
 
@@ -76,8 +76,8 @@ try:
     from matplotlib import cm
     from matplotlib.colors import LogNorm
 
-    min_tick = 0.16
-    max_tick = 0.18
+    min_tick = 0.25
+    max_tick = 1.0
 
     edata = np.resize(Eh, (npts, npts))
 
@@ -88,14 +88,14 @@ try:
     scale_y = np.linspace(min(coordY), max(coordY), npts)
 
     # Define scale ticks
-    # min_tick = max(0.1, min(min_tick, np.amin(edata)))
-    # max_tick = max(max_tick, np.amax(edata))
+    min_tick = max(0.1, min(min_tick, np.amin(edata)))
+    max_tick = max(max_tick, np.amax(edata))
     #scale_ticks = np.power(10.0, np.linspace(np.log10(min_tick), np.log10(max_tick), 6))
-    scale_ticks = np.linspace(min_tick,max_tick, 11)
+    scale_ticks = np.linspace(min_tick,max_tick, 5)
     #scale_ticks = np.linspace(0, 2, 11)
 
     # Interpolation can be 'nearest', 'bilinear' or 'bicubic'
-    cax = ax.imshow(edata, interpolation = 'nearest', cmap = cm.afmhot,
+    cax = ax.imshow(edata, interpolation = 'nearest', cmap = cm.jet,
                     origin = 'lower', vmin = min_tick, vmax = max_tick,
                     #origin = 'lower', vmin = 0.16, vmax = 0.18,
                     extent = (min(scale_x), max(scale_x), min(scale_y), max(scale_y))
@@ -111,17 +111,17 @@ try:
     plt.xlabel('X')
     plt.ylabel('Y')
 
-    # This part draws the nanoshell
-    from matplotlib import patches
+    # # This part draws the nanoshell
+    # from matplotlib import patches
 
-    s1 = patches.Arc((0, 0), 2.0*x[0, 0], 2.0*x[0, 0], angle=0.0, zorder=2,
-                      theta1=0.0, theta2=360.0, linewidth=1, color='#00fa9a')
-    ax.add_patch(s1)
+    # s1 = patches.Arc((0, 0), 2.0*x[0, 0], 2.0*x[0, 0], angle=0.0, zorder=2,
+    #                   theta1=0.0, theta2=360.0, linewidth=1, color='#00fa9a')
+    # ax.add_patch(s1)
 
-    s2 = patches.Arc((0, 0), 2.0*x[0, 0], 2.0*x[0, 0], angle=0.0, zorder=2,
-                      theta1=0.0, theta2=360.0, linewidth=1, color='#00fa9a')
-    ax.add_patch(s2)
-    # End of drawing
+    # s2 = patches.Arc((0, 0), 2.0*x[0, 0], 2.0*x[0, 0], angle=0.0, zorder=2,
+    #                   theta1=0.0, theta2=360.0, linewidth=1, color='#00fa9a')
+    # ax.add_patch(s2)
+    # # End of drawing
 
     plt.draw()