Browse Source

Final tweaks before pushing to Pypi

tags/1.6.1
Trevor Irons 3 years ago
parent
commit
1fa08aee43
1 changed files with 25 additions and 11 deletions
  1. 25
    11
      akvo/tressel/invertTA.py

+ 25
- 11
akvo/tressel/invertTA.py View File

234
         mmax = np.max(np.abs(VV))
234
         mmax = np.max(np.abs(VV))
235
         mmin = np.min(VV)
235
         mmin = np.min(VV)
236
 
236
 
237
-        obs = ax1.pcolor(TT, QQQ, VV, cmap=cmocean.cm.curl_r, vmin=-mmax, vmax=mmax)
237
+        obs = ax1.pcolor(TT, QQQ, VV, cmap=cmocean.cm.curl_r, vmin=-mmax, vmax=mmax, shading='nearest')  # pcolor edge not defined 
238
         ax1.set_title("observed")
238
         ax1.set_title("observed")
239
  
239
  
240
         pre = np.dot(KQT[ich*ntq:(ich+1)*ntq,:], inv)
240
         pre = np.dot(KQT[ich*ntq:(ich+1)*ntq,:], inv)
241
  
241
  
242
         PRE = np.reshape( pre, np.shape(VV)  )
242
         PRE = np.reshape( pre, np.shape(VV)  )
243
-        prem = ax2.pcolor(TT, QQQ, PRE, cmap=cmocean.cm.curl_r, vmin=-mmax, vmax=mmax )
243
+        prem = ax2.pcolor(TT, QQQ, PRE, cmap=cmocean.cm.curl_r, vmin=-mmax, vmax=mmax,shading='nearest' )
244
         ax2.set_title("predicted")
244
         ax2.set_title("predicted")
245
 
245
 
246
         cbar = plt.colorbar(prem, axc1)
246
         cbar = plt.colorbar(prem, axc1)
250
 
250
 
251
         DIFF = (PRE-VV) / VVS
251
         DIFF = (PRE-VV) / VVS
252
         md = np.max(np.abs(DIFF))
252
         md = np.max(np.abs(DIFF))
253
-        dim = ax3.pcolor(TT, QQQ, DIFF, cmap=cmocean.cm.balance, vmin=-md, vmax=md)
253
+        dim = ax3.pcolor(TT, QQQ, DIFF, cmap=cmocean.cm.balance, vmin=-md, vmax=md, shading='nearest')
254
         ax3.set_title("misfit / $\widehat{\sigma}$")
254
         ax3.set_title("misfit / $\widehat{\sigma}$")
255
     
255
     
256
         cbar2 = plt.colorbar(dim, axc2)
256
         cbar2 = plt.colorbar(dim, axc2)
357
             mmax = np.max(np.abs(VV))
357
             mmax = np.max(np.abs(VV))
358
             mmin = np.min(VV)
358
             mmin = np.min(VV)
359
 
359
 
360
-            obs = ax1.pcolor(TT, QQQ, VV, cmap=cmocean.cm.curl_r, vmin=-mmax, vmax=mmax)
360
+            obs = ax1.pcolor(TT, QQQ, VV, cmap=cmocean.cm.curl_r, vmin=-mmax, vmax=mmax, shading='nearest')
361
             ax1.set_title("observed")
361
             ax1.set_title("observed")
362
 
362
 
363
             ## Here neds to change  
363
             ## Here neds to change  
364
             pre = np.abs(np.dot(KQTc[ich*ntq:(ich+1)*ntq,:], inv))
364
             pre = np.abs(np.dot(KQTc[ich*ntq:(ich+1)*ntq,:], inv))
365
  
365
  
366
             PRE = np.reshape( pre, np.shape(VV)  )
366
             PRE = np.reshape( pre, np.shape(VV)  )
367
-            prem = ax2.pcolor(TT, QQQ, PRE, cmap=cmocean.cm.curl_r, vmin=-mmax, vmax=mmax )
367
+            prem = ax2.pcolor(TT, QQQ, PRE, cmap=cmocean.cm.curl_r, vmin=-mmax, vmax=mmax, shading='nearest' )
368
             ax2.set_title("predicted")
368
             ax2.set_title("predicted")
369
 
369
 
370
             cbar = plt.colorbar(prem, axc1)
370
             cbar = plt.colorbar(prem, axc1)
374
 
374
 
375
             DIFF = (PRE-VV) / VVS
375
             DIFF = (PRE-VV) / VVS
376
             md = np.max(np.abs(DIFF))
376
             md = np.max(np.abs(DIFF))
377
-            dim = ax3.pcolor(TT, QQQ, DIFF, cmap=cmocean.cm.balance, vmin=-md, vmax=md)
377
+            dim = ax3.pcolor(TT, QQQ, DIFF, cmap=cmocean.cm.balance, vmin=-md, vmax=md, shading='nearest')
378
             ax3.set_title("misfit / $\widehat{\sigma}$")
378
             ax3.set_title("misfit / $\widehat{\sigma}$")
379
     
379
     
380
             cbar2 = plt.colorbar(dim, axc2)
380
             cbar2 = plt.colorbar(dim, axc2)
487
     ax1 = fig.add_axes( [.2,.15,.6,.7] )
487
     ax1 = fig.add_axes( [.2,.15,.6,.7] )
488
     im = ax1.pcolor(X, Y, INV.T, cmap=cmocean.cm.tempo) #cmap='viridis')
488
     im = ax1.pcolor(X, Y, INV.T, cmap=cmocean.cm.tempo) #cmap='viridis')
489
     im.set_edgecolor('face')
489
     im.set_edgecolor('face')
490
-    ax1.set_xlim( T2Bins[0], T2Bins2[-1] )
490
+    ax1.set_xlim( T2Bins[0], T2Bins[-1] )
491
     ax1.set_ylim( ifaces[-1], ifaces[0] )
491
     ax1.set_ylim( ifaces[-1], ifaces[0] )
492
     cb = plt.colorbar(im, label = u"PWC (m$^3$/m$^3$)") #, format='%1.1f')
492
     cb = plt.colorbar(im, label = u"PWC (m$^3$/m$^3$)") #, format='%1.1f')
493
     cb.locator = MaxNLocator( nbins = 4)
493
     cb.locator = MaxNLocator( nbins = 4)
540
     #ax.axhline( y=ifaces[SNRidx], xmin=0, xmax=1, color='black', linestyle='dashed'  )
540
     #ax.axhline( y=ifaces[SNRidx], xmin=0, xmax=1, color='black', linestyle='dashed'  )
541
     if CalcDOI:
541
     if CalcDOI:
542
         ax.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed'  )
542
         ax.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed'  )
543
-    
543
+
544
+    # Hide the right and top spines
545
+    ax.spines['right'].set_visible(False)
546
+    ax.spines['top'].set_visible(False)
547
+    # Only show ticks on the left and bottom spines
548
+    ax.yaxis.set_ticks_position('left')
549
+    ax.xaxis.set_ticks_position('bottom')   
550
+ 
544
     plt.savefig("akvoInversionWC.pdf")
551
     plt.savefig("akvoInversionWC.pdf")
545
     plt.legend()  
552
     plt.legend()  
546
     
553
     
559
     ##############  NONLINEAR RESULT   ##########################
566
     ##############  NONLINEAR RESULT   ##########################
560
 
567
 
561
     if nonLinearRefinement: 
568
     if nonLinearRefinement: 
562
-        Y,X = meshgrid( ifaces, T2Bins )
569
+        Y,X = meshgrid( ifaces, T2Bins2 )
563
         fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
570
         fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
564
         ax1 = fig.add_axes( [.2,.15,.6,.7] )
571
         ax1 = fig.add_axes( [.2,.15,.6,.7] )
565
         im = ax1.pcolor(X, Y, INVc.T, cmap=cmocean.cm.tempo) #cmap='viridis')
572
         im = ax1.pcolor(X, Y, INVc.T, cmap=cmocean.cm.tempo) #cmap='viridis')
595
         if CalcDOI:
602
         if CalcDOI:
596
             ax2.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed'  )
603
             ax2.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed'  )
597
         #ax2.xaxis.set_label_position('bottom') 
604
         #ax2.xaxis.set_label_position('bottom') 
598
-        fig.suptitle("Non linear inversion")
605
+        #fig.suptitle("Non linear inversion")
599
         plt.savefig("akvoInversionNL.pdf")
606
         plt.savefig("akvoInversionNL.pdf")
600
 
607
 
601
 
608
 
627
         if CalcDOI:
634
         if CalcDOI:
628
             ax.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed'  )
635
             ax.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed'  )
629
     
636
     
630
-        plt.savefig("akvoInversionWC.pdf")
637
+        # Hide the right and top spines
638
+        ax.spines['right'].set_visible(False)
639
+        ax.spines['top'].set_visible(False)
640
+        # Only show ticks on the left and bottom spines
641
+        ax.yaxis.set_ticks_position('left')
642
+        ax.xaxis.set_ticks_position('bottom')   
643
+    
644
+        plt.savefig("akvoNLInversionWC.pdf")
631
         plt.legend()  
645
         plt.legend()  
632
 
646
 
633
 
647
 

Loading…
Cancel
Save