Explorar o código

updated plot script for fig4

Konstantin Ladutenko %!s(int64=9) %!d(string=hai) anos
pai
achega
1aa0468ed8
Modificáronse 3 ficheiros con 12 adicións e 22 borrados
  1. 2 2
      examples/coating-flow.py
  2. 1 0
      examples/coating-flow.sh
  3. 9 20
      examples/fieldplot.py

+ 2 - 2
examples/coating-flow.py

@@ -104,7 +104,7 @@ if __name__ == '__main__':
             comment='PEC-'+basename
             WL_units='cm'
             flow_total = 39
-            #flow_total = 0
+            #flow_total = 5
             #crossplane='XZ'
             crossplane='YZ'
             #crossplane='XY'
@@ -114,7 +114,7 @@ if __name__ == '__main__':
             #field_to_plot='Eabs'
             #field_to_plot='angleEx'
             fieldplot(x[0],m[0], wl, comment, WL_units, crossplane, field_to_plot, npts,
-                      factor, flow_total, pl=0, outline_width=0.1)
+                      factor, flow_total, pl=0, outline_width=2.0)
 
 
         print "Done!!"

+ 1 - 0
examples/coating-flow.sh

@@ -1,5 +1,6 @@
 #!/bin/sh
 
 python coating-flow.py -w 3.75 -t 0.80 -f index-dv.dat -n 1501
+#python coating-flow.py -w 3.75 -t 0.80 -f index-dv.dat -n 51
 #python coating-flow.py -w 3.75 -t 0.62 -f index-sv.dat -n 1501
 # python coating-flow.py -w 3.75 -t 2.40 -f index-ch.dat -n 501

+ 9 - 20
examples/fieldplot.py

@@ -211,9 +211,11 @@ def fieldplot(x,m, WL, comment='', WL_units=' ', crossplane='XZ', field_to_plot=
 
         # Interpolation can be 'nearest', 'bilinear' or 'bicubic'
         ax.set_title(label)
-        cax = ax.imshow(Eabs_data, interpolation = 'nearest', cmap = cm.jet,
+        my_cmap = cm.jet
+        my_cmap.set_under('w')
+        cax = ax.imshow(Eabs_data, interpolation = 'nearest', cmap = my_cmap,
                         origin = 'lower'
-                        , vmin = min_tick, vmax = max_tick
+                        , vmin = min_tick+max_tick*1e-15, vmax = max_tick
                         , extent = (min(scale_x), max(scale_x), min(scale_z), max(scale_z))
                         #,norm = LogNorm()
                         )
@@ -238,25 +240,12 @@ def fieldplot(x,m, WL, comment='', WL_units=' ', crossplane='XZ', field_to_plot=
         # # This part draws the nanoshell
         from matplotlib import patches
         from matplotlib.path import Path
-        for xx in x:
+        x_edge = (x[-1], x[0])
+        for xx in x_edge:
             r= xx*WL/2.0/np.pi
             s1 = patches.Arc((0, 0), 2.0*r, 2.0*r,  angle=0.0, zorder=1.8,
                              theta1=0.0, theta2=360.0, linewidth=outline_width, color='black')
             ax.add_patch(s1)
-        # 
-        # for flow in range(0,flow_total):
-        #     flow_x, flow_z = GetFlow(scale_x, scale_z, Ec, Hc,
-        #                              min(scale_x)+flow*(scale_x[-1]-scale_x[0])/(flow_total-1),
-        #                              min(scale_z),
-        #                              #0.0,
-        #                              npts*16)
-        #     verts = np.vstack((flow_z, flow_x)).transpose().tolist()
-        #     #codes = [Path.CURVE4]*len(verts)
-        #     codes = [Path.LINETO]*len(verts)
-        #     codes[0] = Path.MOVETO
-        #     path = Path(verts, codes)
-        #     patch = patches.PathPatch(path, facecolor='none', lw=1, edgecolor='yellow')
-        #     ax.add_patch(patch)
         if (crossplane=='XZ' or crossplane=='YZ') and flow_total>0:
 
             from matplotlib.path import Path
@@ -265,7 +254,7 @@ def fieldplot(x,m, WL, comment='', WL_units=' ', crossplane='XZ', field_to_plot=
             step_SP = 2.0*factor*x[-1]/(flow_total-1)
             x0, y0, z0 = 0, 0, 0
             max_length=factor*x[-1]*8
-            #max_length=factor*x[-1]*5
+            #max_length=factor*x[-1]*4
             max_angle = np.pi/160
             if is_flow_extend:
                 rg = range(0,flow_total*2+1)
@@ -299,12 +288,12 @@ def fieldplot(x,m, WL, comment='', WL_units=' ', crossplane='XZ', field_to_plot=
                 codes[0] = Path.MOVETO
                 path = Path(verts, codes)
                 #patch = patches.PathPatch(path, facecolor='none', lw=0.2, edgecolor='white',zorder = 2.7)
-                patch = patches.PathPatch(path, facecolor='none', lw=0.7, edgecolor='white',zorder = 1.9)
+                patch = patches.PathPatch(path, facecolor='none', lw=1.5, edgecolor='white',zorder = 1.9)
                 ax.add_patch(patch)
                 #ax.plot(flow_z_plot, flow_f_plot, 'x',ms=2, mew=0.1, linewidth=0.5, color='k', fillstyle='none')
 
         plt.savefig(comment+"-R"+str(int(round(x[-1]*WL/2.0/np.pi)))+"-"+crossplane+"-"
-                    +field_to_plot+".pdf")
+                    +field_to_plot+".png")
         plt.draw()
 
     #    plt.show()