Selaa lähdekoodia

Tweaks for plots in FastTIMES

tags/1.6.1
Trevor Irons 5 vuotta sitten
vanhempi
commit
ad0ffb74d4

+ 15
- 14
akvo/gui/akvoGUI.py Näytä tiedosto

@@ -874,7 +874,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
874 874
         #INFO["samp"] = self.RAWDataProc.samp
875 875
         INFO["nPulseMoments"] = self.RAWDataProc.nPulseMoments
876 876
         #INFO["deadTime"] = self.RAWDataProc.deadTime
877
-        INFO["processed"] = "Akvo v"  + self.Akvo_VERSION + ", on "  + time.strftime("%d/%m/%Y")
877
+        INFO["processed"] = "Akvo v"  + VERSION + ", on "  + time.strftime("%d/%m/%Y")
878 878
         # Pulse current info
879 879
         ip = 0
880 880
         INFO["Pulses"] = {}
@@ -1425,7 +1425,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
1425 1425
         self.lock("harmonic noise modelling")
1426 1426
         
1427 1427
         Harm = OrderedDict()
1428
-        Harm["STEP"] = "Harmonic modelling"
1428
+        Harm["STEP " + str(len(self.YamlNode.Processing))] = "Harmonic modelling"
1429 1429
         Harm["NF"] = str( self.ui.NHarmonicsFreqsSpin.value() ) 
1430 1430
         Harm["Segments"] = str( self.ui.NSegments.value() ) 
1431 1431
         Harm["Proc. ref."] = self.ui.harmRef.isChecked() 
@@ -1502,14 +1502,15 @@ class ApplicationWindow(QtWidgets.QMainWindow):
1502 1502
         
1503 1503
         # Log processing 
1504 1504
         Adapt = OrderedDict()
1505
-        Adapt["STEP"] = "TD noise cancellation"
1506
-        print(Adapt) # this locks STEP in as first...
1507
-        Adapt["n_Taps"] = str(self.ui.MTapsSpinBox.value())
1508
-        Adapt["lambda"] = str(self.ui.adaptLambdaSpinBox.value())
1509
-        Adapt["truncate"] = str(self.ui.adaptTruncateSpinBox.value())
1510
-        Adapt["mu"] = str(self.ui.adaptMuSpinBox.value()) 
1511
-        Adapt["PCA"] = str(self.ui.PCAComboBox.currentText())
1512
-        #print(Adapt)
1505
+        Adapt["STEP " + str(len(self.YamlNode.Processing)) ] = "TD noise cancellation"
1506
+        #print(Adapt) # this locks STEP in as first...
1507
+        Adapt["n_Taps"] = self.ui.MTapsSpinBox.value()
1508
+        Adapt["lambda"] = self.ui.adaptLambdaSpinBox.value()
1509
+        Adapt["truncate"] = self.ui.adaptTruncateSpinBox.value()
1510
+        Adapt["mu"] = self.ui.adaptMuSpinBox.value()
1511
+        Adapt["PCA"] = self.ui.PCAComboBox.currentText()
1512
+        #Adapt # this locsk in the dict ordering...
1513
+        #print(Adapt) # this locks in the dict...
1513 1514
         self.YamlNode.Processing.append(Adapt)
1514 1515
         self.Log( )
1515 1516
 
@@ -1526,7 +1527,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
1526 1527
         self.lock("Summing data channels")
1527 1528
         
1528 1529
         Sum = OrderedDict()
1529
-        Sum["STEP"] = "Channel sum"
1530
+        Sum["STEP " + str(len(self.YamlNode.Processing))] = "Channel sum"
1530 1531
         self.YamlNode.Processing.append(Sum)
1531 1532
         self.Log( )
1532 1533
 
@@ -1606,7 +1607,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
1606 1607
         
1607 1608
         # Log processing 
1608 1609
         Band = OrderedDict()
1609
-        Band["STEP"] = "Bandpass filter"
1610
+        Band["STEP " + str(len(self.YamlNode.Processing))] = "Bandpass filter"
1610 1611
         Band["central_nu"] = str(self.ui.CentralVSpinBox.value())
1611 1612
         Band["passband"] = str(self.ui.passBandSpinBox.value())
1612 1613
         Band["stopband"] = str(self.ui.stopBandSpinBox.value()) 
@@ -1627,7 +1628,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
1627 1628
 
1628 1629
         # Log processing 
1629 1630
         Resample = OrderedDict() 
1630
-        Resample["STEP"] = "Resample"
1631
+        Resample["STEP "+ str(len(self.YamlNode.Processing))] = "Resample"
1631 1632
         Resample["downsample factor"] = str(self.ui.downSampleSpinBox.value())
1632 1633
         Resample["truncate length"] = str(self.ui.truncateSpinBox.value()) 
1633 1634
         self.YamlNode.Processing.append(Resample)
@@ -1725,7 +1726,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
1725 1726
         
1726 1727
         # Log processing 
1727 1728
         Window = OrderedDict()
1728
-        Window["STEP"] = "Window filter"
1729
+        Window["STEP " + str(len(self.YamlNode.Processing))] = "Window filter"
1729 1730
         Window["type"] = str(self.ui.windowTypeComboBox.currentText()) 
1730 1731
         Window["width"] = str(self.ui.windowBandwidthSpinBox.value()) 
1731 1732
         Window["centre"] = str(self.ui.CentralVSpinBox.value() )

+ 40
- 36
akvo/gui/mydynamicmplcanvas.py Näytä tiedosto

@@ -40,7 +40,8 @@ class MyDynamicMplCanvas(MyMplCanvas):
40 40
         self.compute_initial_figure()
41 41
 
42 42
     def reAxH(self, num, shx=True, shy=True):
43
-        
43
+        fs = 10
44
+ 
44 45
         try:
45 46
             for ax in fig.axes:
46 47
                 self.fig.delaxes(ax)
@@ -54,28 +55,29 @@ class MyDynamicMplCanvas(MyMplCanvas):
54 55
         for n in range(num):
55 56
             if n == 0:
56 57
                 self.ax1 = self.fig.add_subplot( 1, num, 1)
57
-                self.ax1.tick_params(axis='both', which='major', labelsize=8)
58
+                self.ax1.tick_params(axis='both', which='major', labelsize=fs)
58 59
                 self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
59 60
                 self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='x')  
60
-                self.ax1.yaxis.get_offset_text().set_size(8) 
61
-                self.ax1.xaxis.get_offset_text().set_size(8) 
61
+                self.ax1.yaxis.get_offset_text().set_size(fs) 
62
+                self.ax1.xaxis.get_offset_text().set_size(fs) 
62 63
             if n == 1:
63 64
                 self.ax2 = self.fig.add_subplot( 1, num, 2)
64
-                self.ax2.tick_params(axis='both', which='major', labelsize=8)
65
+                self.ax2.tick_params(axis='both', which='major', labelsize=fs)
65 66
                 self.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
66
-                self.ax2.yaxis.get_offset_text().set_size(8) 
67
+                self.ax2.yaxis.get_offset_text().set_size(fs) 
67 68
             if n == 2:
68 69
                 self.ax3 = self.fig.add_subplot( 1, num, 3) 
69
-                self.ax3.tick_params(axis='both', which='major', labelsize=8)
70
+                self.ax3.tick_params(axis='both', which='major', labelsize=fs)
70 71
                 self.ax3.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
71
-                self.ax3.yaxis.get_offset_text().set_size(8) 
72
+                self.ax3.yaxis.get_offset_text().set_size(fs) 
72 73
             if n == 3:
73 74
                 self.ax4 = self.fig.add_subplot( 1, num, 4) 
74
-                self.ax4.tick_params(axis='both', which='major', labelsize=8)
75
+                self.ax4.tick_params(axis='both', which='major', labelsize=fs)
75 76
                 self.ax4.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
76
-                self.ax4.yaxis.get_offset_text().set_size(8) 
77
+                self.ax4.yaxis.get_offset_text().set_size(fs) 
77 78
     
78 79
     def reAxH2(self, num, shx=True, shy=True):
80
+        fs = 10
79 81
         try:
80 82
             for ax in fig.axes:
81 83
                 self.fig.delaxes(ax)
@@ -89,40 +91,40 @@ class MyDynamicMplCanvas(MyMplCanvas):
89 91
         for n in range(num):
90 92
             if n == 0:
91 93
                 self.ax1 = self.fig.add_subplot( 2, num, 1)
92
-                self.ax1.tick_params(axis='both', which='major', labelsize=8)
94
+                self.ax1.tick_params(axis='both', which='major', labelsize=fs)
93 95
                 self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
94
-                self.ax1.yaxis.get_offset_text().set_size(8) 
96
+                self.ax1.yaxis.get_offset_text().set_size(fs) 
95 97
                 self.ax21 = self.fig.add_subplot( 2, num, num+1)
96
-                self.ax21.tick_params(axis='both', which='major', labelsize=8)
98
+                self.ax21.tick_params(axis='both', which='major', labelsize=fs)
97 99
                 self.ax21.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
98
-                self.ax21.yaxis.get_offset_text().set_size(8) 
100
+                self.ax21.yaxis.get_offset_text().set_size(fs) 
99 101
             if n == 1:
100 102
                 self.ax2 = self.fig.add_subplot( 2, num, 2, sharex=self.ax1, sharey=self.ax1)
101
-                self.ax2.tick_params(axis='both', which='major', labelsize=8)
103
+                self.ax2.tick_params(axis='both', which='major', labelsize=fs)
102 104
                 self.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
103
-                self.ax2.yaxis.get_offset_text().set_size(8) 
105
+                self.ax2.yaxis.get_offset_text().set_size(fs) 
104 106
                 self.ax22 = self.fig.add_subplot( 2, num, num+2, sharex=self.ax21, sharey=self.ax21)
105
-                self.ax22.tick_params(axis='both', which='major', labelsize=8)
107
+                self.ax22.tick_params(axis='both', which='major', labelsize=fs)
106 108
                 self.ax22.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
107
-                self.ax22.yaxis.get_offset_text().set_size(8) 
109
+                self.ax22.yaxis.get_offset_text().set_size(fs) 
108 110
             if n == 2:
109 111
                 self.ax3 = self.fig.add_subplot( 2, num, 3, sharex=self.ax1, sharey=self.ax1)
110
-                self.ax3.tick_params(axis='both', which='major', labelsize=8)
112
+                self.ax3.tick_params(axis='both', which='major', labelsize=fs)
111 113
                 self.ax3.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
112
-                self.ax3.yaxis.get_offset_text().set_size(8) 
114
+                self.ax3.yaxis.get_offset_text().set_size(fs) 
113 115
                 self.ax23 = self.fig.add_subplot( 2, num, num+3, sharex=self.ax21, sharey=self.ax21)
114
-                self.ax23.tick_params(axis='both', which='major', labelsize=8)
116
+                self.ax23.tick_params(axis='both', which='major', labelsize=fs)
115 117
                 self.ax23.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
116
-                self.ax23.yaxis.get_offset_text().set_size(8) 
118
+                self.ax23.yaxis.get_offset_text().set_size(fs) 
117 119
             if n == 3:
118 120
                 self.ax4 = self.fig.add_subplot( 2, num, 4, sharex=self.ax1, sharey=self.ax1 )
119
-                self.ax4.tick_params(axis='both', which='major', labelsize=8)
121
+                self.ax4.tick_params(axis='both', which='major', labelsize=fs)
120 122
                 self.ax4.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
121
-                self.ax4.yaxis.get_offset_text().set_size(8) 
123
+                self.ax4.yaxis.get_offset_text().set_size(fs) 
122 124
                 self.ax24 = self.fig.add_subplot( 2, num, num+4, sharex=self.ax21, sharey=self.ax21 )
123
-                self.ax24.tick_params(axis='both', which='major', labelsize=8)
125
+                self.ax24.tick_params(axis='both', which='major', labelsize=fs)
124 126
                 self.ax24.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
125
-                self.ax24.yaxis.get_offset_text().set_size(8) 
127
+                self.ax24.yaxis.get_offset_text().set_size(fs) 
126 128
             if n == 4:
127 129
                 self.ax5 = self.fig.add_subplot( 2, num, 5, sharex=self.ax1, sharey=self.ax1 )
128 130
                 self.ax5.tick_params(axis='both', which='major', labelsize=8)
@@ -195,14 +197,14 @@ class MyDynamicMplCanvas(MyMplCanvas):
195 197
         else:
196 198
             self.ax2 = self.fig.add_subplot(212)
197 199
 
198
-        self.ax1.tick_params(axis='both', which='major', labelsize=8)
199
-        self.ax2.tick_params(axis='both', which='major', labelsize=8)
200
+        self.ax1.tick_params(axis='both', which='major', labelsize=10)
201
+        self.ax2.tick_params(axis='both', which='major', labelsize=10)
200 202
 
201 203
         self.ax1.ticklabel_format(style='scientific', scilimits=(0,0), axis='y')  
202 204
         self.ax2.ticklabel_format(style='scientific', scilimits=(0,0), axis='y')  
203 205
 
204
-        self.ax1.yaxis.get_offset_text().set_size(8) 
205
-        self.ax2.yaxis.get_offset_text().set_size(8) 
206
+        self.ax1.yaxis.get_offset_text().set_size(10) 
207
+        self.ax2.yaxis.get_offset_text().set_size(10) 
206 208
     
207 209
     def softClear(self):
208 210
         for ax in self.fig.get_axes():
@@ -212,6 +214,8 @@ class MyDynamicMplCanvas(MyMplCanvas):
212 214
 
213 215
     def reAx3(self, shx=True, shy=True):
214 216
 
217
+        fs = 10
218
+
215 219
         try:
216 220
             self.fig.clear()
217 221
         except:
@@ -257,17 +261,17 @@ class MyDynamicMplCanvas(MyMplCanvas):
257 261
         #self.fig.set_edgecolor('red')
258 262
         #self.ax1.set_axis_bgcolor('green')
259 263
 
260
-        self.ax1.tick_params(axis='both', which='major', labelsize=8)
261
-        self.ax2.tick_params(axis='both', which='major', labelsize=8)
262
-        self.ax3.tick_params(axis='both', which='major', labelsize=8)
264
+        self.ax1.tick_params(axis='both', which='major', labelsize=fs)
265
+        self.ax2.tick_params(axis='both', which='major', labelsize=fs)
266
+        self.ax3.tick_params(axis='both', which='major', labelsize=fs)
263 267
 
264 268
         self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
265 269
         self.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
266 270
         self.ax3.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
267 271
 
268
-        self.ax1.yaxis.get_offset_text().set_size(8) 
269
-        self.ax2.yaxis.get_offset_text().set_size(8)    
270
-        self.ax3.yaxis.get_offset_text().set_size(8)    
272
+        self.ax1.yaxis.get_offset_text().set_size(fs) 
273
+        self.ax2.yaxis.get_offset_text().set_size(fs)    
274
+        self.ax3.yaxis.get_offset_text().set_size(fs)    
271 275
  
272 276
     def reAx4(self):
273 277
 

+ 5
- 3
akvo/terminal/plotKernel.py Näytä tiedosto

@@ -9,8 +9,8 @@ from matplotlib.ticker import LogLocator
9 9
 from matplotlib.ticker import FormatStrFormatter
10 10
 import numpy as np
11 11
 import yaml
12
-from  lemma_yaml import *
13
-
12
+from  akvo.tressel.lemma_yaml import *
13
+from akvo.tressel.SlidesPlot import *
14 14
 import cmocean 
15 15
 
16 16
 def catLayers(K0):
@@ -29,11 +29,13 @@ if __name__ == "__main__":
29 29
     K = 1e9*catLayers(K0.K0)
30 30
     q = np.array(K0.PulseI.data)* (float)(K0.Taup)
31 31
 
32
+    fig = plt.figure( figsize=(pc2in(20),pc2in(20)) )
33
+    fig.add_axes((.2,.2,.65,.7))
32 34
     #plt.pcolor(K0.Interfaces.data, K0.PulseI.data, np.abs(K))
33 35
     #plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.gray_r)
34 36
     #plt.contourf(q, K0.Interfaces.data[0:-1], np.abs(K), cmap=cmocean.cm.tempo)
35 37
     plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.tempo)
36
-    plt.colorbar()
38
+    plt.colorbar(label=r"$\left| \overline{\mathcal{V}_N}(0) \right|$ (nV)")
37 39
 
38 40
     ax1 = plt.gca()
39 41
     ax1.set_ylim( ax1.get_ylim()[1], ax1.get_ylim()[0]  )

+ 6
- 4
akvo/tressel/SlidesPlot.py Näytä tiedosto

@@ -2,10 +2,12 @@
2 2
 # GJI final pub specs                                                           #
3 3
 import matplotlib                                                               #
4 4
 from matplotlib import rc                                                           #
5
-matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{timet,amsmath,amssymb}"]  #
6
-rc('font',**{'family':'sans-serif','serif':['timet']})                                   #
7
-rc('font',**{'size':11})                                                             #
8
-rc('text', usetex=True)                                                             #
5
+
6
+#matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{timet,amsmath,amssymb}"]  #
7
+#rc('font',**{'family':'sans-serif','serif':['timet']})                                   #
8
+#rc('font',**{'size':11})                                                             #
9
+#rc('text', usetex=True)                                                             #
10
+
9 11
 # converts pc that GJI is defined in to inches                                      # 
10 12
 # In GEOPHYSICS \textwidth = 42pc                                               #
11 13
 #        \columnwidth = 20pc                                                    #

+ 3
- 3
akvo/tressel/decay.py Näytä tiedosto

@@ -84,7 +84,7 @@ def quadratureDetect2(X, Y, tt, method, loss, x0="None"):
84 84
 
85 85
     #method = ['trf','dogbox','lm'][method_int]
86 86
     #loss = ['linear','soft_l1','cauchy','huber'][loss_int] 
87
-    print ("method", method, 'loss', loss) 
87
+    #print ("method", method, 'loss', loss) 
88 88
     if x0=="None":
89 89
         if method == 'lm':
90 90
             x0 = np.array( [50., 0., 0., .200] ) # A0, zeta, df, T2 
@@ -94,11 +94,11 @@ def quadratureDetect2(X, Y, tt, method, loss, x0="None"):
94 94
         else:
95 95
             x0 = np.array( [50., 0., 0., .200] ) # A0, zeta, df, T2 
96 96
             res_lsq = least_squares(fun, x0, args=(tt, np.concatenate((X, Y))), loss=loss, f_scale=1.0,\
97
-                    bounds=( [5, -np.pi, -5, .001] , [1000., np.pi, 5, .800] ),
97
+                    bounds=( [5, -np.pi, -5, .001] , [5000., np.pi, 5, .800] ),
98 98
                     method=method 
99 99
                     )
100 100
         x = res_lsq.x 
101
-        print ("A0={} zeta={} df={} T2={}".format(x[0],x[1],x[2],x[3]))
101
+        #print ("A0={} zeta={} df={} T2={}".format(x[0],x[1],x[2],x[3]))
102 102
     else:
103 103
         res_lsq = least_squares(fun, x0, args=(tt, np.concatenate((X, Y))), loss=loss, f_scale=1.0,\
104 104
             #bounds=( [1., -np.pi, -5, .005] , [1000., np.pi, 5, .800] ),

+ 9
- 24
akvo/tressel/invertTA.py Näytä tiedosto

@@ -89,14 +89,16 @@ def loadK0(fname):
89 89
 
90 90
 def main():
91 91
 
92
-    if (len (sys.argv) < 3):
93
-        print ("python invertTA.py  K0.dat  Data.yaml")
94
-    print (sys.argv[1])
92
+    if (len (sys.argv) < 2):
93
+        print ("akvoQT   invertParameters.yaml")
94
+        exit()
95
+    
95 96
     with open(sys.argv[1], 'r') as stream:
96 97
         try:
97 98
             cont = (yaml.load(stream, Loader=yaml.Loader))
98 99
         except yaml.YAMLError as exc:
99 100
             print(exc)
101
+
100 102
     ###############################################
101 103
     # Load in data
102 104
     ###############################################
@@ -114,16 +116,6 @@ def main():
114 116
         VS[0] = np.concatenate( (VS[0], VS[iv]) )
115 117
     V = V[0]
116 118
     VS = VS[0]
117
-    
118
-    #plt.matshow(V, cmap='RdBu', vmin=-np.max(np.abs(V)), vmax=np.max(np.abs(V)))
119
-    #plt.title("data")
120
-    #plt.colorbar()
121
-    #plt.show()
122
-    #exit()    
123
-
124
-    #plt.matshow(VS, cmap='inferno', vmin=-np.max(np.abs(VS)), vmax=np.max(np.abs(VS)))
125
-    #plt.title("error")
126
-    #plt.colorbar()
127 119
 
128 120
     ###############################################
129 121
     # Load in kernels
@@ -142,19 +134,13 @@ def main():
142 134
     ############################################### 
143 135
     T2Bins = np.logspace( np.log10(cont["T2Bins"]["low"]), np.log10(cont["T2Bins"]["high"]), cont["T2Bins"]["number"], endpoint=True, base=10)  
144 136
     KQT = buildKQT(K0,tg,T2Bins)
145
-    #plt.matshow(KQT)
146 137
 
147
-    # Chan. 1    reg = 1.5   
148
-    # Chan. 2    reg = 1.35
149
-    # Chan. 4    reg = 1.95  
150 138
  
151 139
     ###############################################
152 140
     # Invert
153 141
     ############################################### 
154 142
     print("Calling inversion", flush=True)
155
-    inv, ibreak, errn, phim, phid, mkappa = logBarrier(KQT, np.ravel(V), T2Bins, "lcurve", MAXITER=150, sigma=np.ravel(VS), alpha=1e6, smooth="Smallest" ) #, smooth=True) # 
156
-                     #logBarrier(A, b, T2Bins, lambdastar, x_0=0, xr=0, alpha=10, mu1=10, mu2=10, smooth=False, MAXITER=70, fignum=1000, sigma=1, callback=None):
157
-    #return x, ibreak, np.sqrt(phid/len(b)), PHIM, PHID/len(b), np.argmax(kappa)
143
+    inv, ibreak, errn, phim, phid, mkappa = logBarrier(KQT, np.ravel(V), T2Bins, "lcurve", MAXITER=150, sigma=np.ravel(VS), alpha=1e6, smooth="Smallest" ) 
158 144
 
159 145
 
160 146
     ###############################################
@@ -178,10 +164,9 @@ def main():
178 164
 
179 165
     T2Bins = np.append( T2Bins, T2Bins[-1] + (T2Bins[-1]-T2Bins[-2]) )
180 166
     
181
-    print( np.shape(inv), len(ifaces)-1,cont["T2Bins"]["number"] )
182 167
     INV = np.reshape(inv, (len(ifaces)-1,cont["T2Bins"]["number"]) )
183 168
     Y,X = meshgrid( ifaces, T2Bins )
184
-    fig = plt.figure( figsize=(pc2in(17.0),pc2in(18.)) )
169
+    fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
185 170
     ax1 = fig.add_axes( [.2,.15,.6,.7] )
186 171
     im = ax1.pcolor(X, Y, INV.T, cmap=cmocean.cm.tempo) #cmap='viridis')
187 172
     im.set_edgecolor('face')
@@ -192,8 +177,8 @@ def main():
192 177
     cb.ax.yaxis.set_offset_position('left')                         
193 178
     cb.update_ticks()
194 179
  
195
-    #ax1.set_xlabel(u"$T_2^*$ (ms)")
196
-    #ax1.set_ylabel(u"depth (m)$")
180
+    ax1.set_xlabel(u"$T_2^*$ (ms)")
181
+    ax1.set_ylabel(u"depth (m)")
197 182
     
198 183
     ax1.get_xaxis().set_major_formatter(FormatStrFormatter('%1.0f'))
199 184
     ax1.get_yaxis().set_major_formatter(FormatStrFormatter('%1.0f'))

+ 18
- 5
akvo/tressel/logbarrier.py Näytä tiedosto

@@ -8,6 +8,8 @@ from scipy.optimize import nnls
8 8
 
9 9
 import matplotlib.pyplot as plt
10 10
 
11
+from akvo.tressel.SlidesPlot import * 
12
+
11 13
 def PhiB(mux, minVal, x):
12 14
     phib = mux * np.abs( np.sum(np.log( x-minVal)) )
13 15
     return phib
@@ -247,15 +249,26 @@ def logBarrier(A, b, T2Bins, lambdastar, x_0=0, xr=0, alpha=10, mu1=10, mu2=10,
247 249
                 if np.sqrt(phid/len(b)) <= 1:
248 250
                     ibreak=0
249 251
 
250
-                plt.figure()
252
+                fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
253
+                ax1 = fig.add_axes( [.2,.15,.6,.7] )
251 254
                 #plt.plot( (np.array(PHIM)),  np.log(np.array(PHID)/len(b)), '.-')
252 255
                 #plt.plot(  ((np.array(PHIM))[np.argmax(kappa)]) , np.log( (np.array(PHID)/len(b))[np.argmax(kappa)] ), '.', markersize=12)
253 256
                 #plt.axhline()
254
-                plt.plot( np.log(np.array(PHIM)),  np.log(np.sqrt(np.array(PHID)/len(b))), '.-')
255
-                plt.plot( np.log(np.array(PHIM))[np.argmax(kappa)], np.log(np.sqrt(np.array(PHID)/len(b))[np.argmax(kappa)]), '.', markersize=12)
257
+                lns1 = plt.plot( np.log(np.array(PHIM)),  np.log(np.sqrt(np.array(PHID)/len(b))), '.-', label="L curve")
258
+                lns2 = plt.plot( np.log(np.array(PHIM))[np.argmax(kappa)], np.log(np.sqrt(np.array(PHID)/len(b))[np.argmax(kappa)]), '.', markersize=12, label="$\lambda^*$")
256 259
                 ax2 = plt.twinx()
257
-                ax2.plot( np.log(np.array(PHIM)), kappa, color='green', label="lcurve" )
258
-                plt.legend()
260
+                lns3 = ax2.plot( np.log(np.array(PHIM)), kappa, color='orange', label="curvature" )
261
+
262
+                # Single legend 
263
+                lns = lns1+lns3
264
+                labs = [l.get_label() for l in lns]
265
+                ax2.legend(lns, labs, loc=0)
266
+
267
+                ax1.set_xlabel("$\phi_m$")
268
+                ax1.set_ylabel("$\phi_d$")
269
+                
270
+                ax2.set_ylabel("curvature")
271
+
259 272
                 plt.savefig('lcurve.pdf')
260 273
                 break
261 274
 

+ 127
- 84
akvo/tressel/mrsurvey.py Näytä tiedosto

@@ -17,6 +17,9 @@ import matplotlib.pyplot as plt
17 17
 import matplotlib.ticker 
18 18
 from matplotlib.ticker import MaxNLocator
19 19
 
20
+import seaborn as sns 
21
+from akvo.tressel.SlidesPlot import deSpine
22
+
20 23
 import multiprocessing 
21 24
 import itertools 
22 25
 
@@ -301,6 +304,7 @@ class GMRDataProcessor(SNMRDataProcessor):
301 304
         pass   
302 305
  
303 306
     def TDSmartStack(self, outlierTest, MADcutoff, canvas):
307
+        fs = 10 # fontsize 
304 308
         #print("Line 300 in mrsurvey")
305 309
         Stack = {}
306 310
         # align for stacking and modulate
@@ -362,11 +366,11 @@ class GMRDataProcessor(SNMRDataProcessor):
362 366
                 ax1.yaxis.set_major_formatter(y_formatter)
363 367
 
364 368
                 ax1.plot( 1e3*self.DATADICT[pulse]["TIMES"], np.average(  SimpleStack[pulse][chan], 0 )) #, color='darkblue' )
365
-                ax1.set_title("Ch." + str(chan) + ": avg FID", fontsize=8)
366
-                ax1.set_xlabel(r"time (ms)", fontsize=8)
369
+                ax1.set_title("Ch." + str(chan) + ": avg FID", fontsize=fs)
370
+                ax1.set_xlabel(r"time (ms)", fontsize=fs)
367 371
 
368 372
                 if ichan == 0:
369
-                    ax1.set_ylabel(r"signal (nV)", fontsize=8)
373
+                    ax1.set_ylabel(r"signal (nV)", fontsize=fs)
370 374
                 else:
371 375
                     plt.setp(ax1.get_yticklabels(), visible=False)
372 376
                     plt.setp(ax1.get_yaxis().get_offset_text(), visible=False) 
@@ -503,7 +507,7 @@ class GMRDataProcessor(SNMRDataProcessor):
503 507
                 #im2 = ax2.matshow( db, aspect='auto', cmap=cmocean.cm.ice, vmin=vvmin, vmax=vvmax)
504 508
                 if ichan == 0:
505 509
                     #ax2.set_ylabel(r"$q$ (A $\cdot$ s)", fontsize=8)
506
-                    ax2.set_ylabel(r"pulse index", fontsize=8)
510
+                    ax2.set_ylabel(r"pulse index", fontsize=10)
507 511
                     #ax1.set_ylabel(r"FID (nV)", fontsize=8)
508 512
                 else:
509 513
                     #ax2.yaxis.set_ticklabels([])
@@ -528,15 +532,17 @@ class GMRDataProcessor(SNMRDataProcessor):
528 532
                 ichan += 1   
529 533
 
530 534
 
531
-        canvas.fig.subplots_adjust(hspace=.1, wspace=.05, left=.075, right=.95 )#left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 
535
+        canvas.fig.subplots_adjust(hspace=.35, wspace=.15, left=.15, right=.8 )#left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 
536
+        deSpine(ax1)
532 537
         
533 538
         #cb1 = canvas.fig.colorbar(im, ax=axes[0::2], format='%1.0e', orientation='horizontal', shrink=.35, aspect=30)
534 539
         #cb1.ax.tick_params(axis='both', which='major', labelsize=8)
535 540
         #cb1.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
536 541
 
537 542
         cb2 = canvas.fig.colorbar(im2[-1], ax=axes[1::2], format='%1.0e', orientation='horizontal', shrink=.35, aspect=30)
538
-        cb2.ax.tick_params(axis='both', which='major', labelsize=8)
539
-        cb2.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
543
+        cb2.ax.tick_params(axis='both', which='major', labelsize=fs)
544
+        cb2.set_label(r"$\left| \mathcal{V}_N \right|$ (nV)", fontsize=fs)
545
+                    
540 546
 
541 547
         #canvas.fig.tight_layout() 
542 548
         canvas.draw()
@@ -564,15 +570,16 @@ class GMRDataProcessor(SNMRDataProcessor):
564 570
             canvas = mpl plotting axis      
565 571
         """
566 572
         TDPlot = True
567
-        
573
+        fs = 10       
574
+ 
568 575
         if plot:
569 576
             canvas.reAx2(shy=False)
570
-            canvas.ax1.set_ylabel(r"signal (nV)", fontsize=8)
571
-            canvas.ax2.set_ylabel(r"signal (nV)", fontsize=8)
577
+            canvas.ax1.set_ylabel(r"signal (nV)", fontsize=fs)
578
+            canvas.ax2.set_ylabel(r"signal (nV)", fontsize=fs)
572 579
             if TDPlot:
573
-                canvas.ax2.set_xlabel(r"time (s)", fontsize=8)
580
+                canvas.ax2.set_xlabel(r"time (s)", fontsize=fs)
574 581
             else:
575
-                canvas.ax2.set_xlabel(r"frequency (Hz)", fontsize=8)
582
+                canvas.ax2.set_xlabel(r"frequency (Hz)", fontsize=fs)
576 583
                 canvas.ax1.set_yscale('log')
577 584
                 canvas.ax2.set_yscale('log')
578 585
 
@@ -703,8 +710,12 @@ class GMRDataProcessor(SNMRDataProcessor):
703 710
 
704 711
                     if plot:
705 712
                         if procRefs: 
706
-                            canvas.ax1.legend(prop={'size':6}, loc='upper right')
707
-                        canvas.ax2.legend(prop={'size':6}, loc='upper right')
713
+                            canvas.ax1.legend(prop={'size':fs}, loc='upper right')
714
+                            plt.setp(canvas.ax1.get_xticklabels(), visible=False)
715
+                        canvas.ax2.legend(prop={'size':fs}, loc='upper right')
716
+                        deSpine(canvas.ax1)
717
+                        deSpine(canvas.ax2)
718
+                        canvas.fig.tight_layout()
708 719
                         canvas.draw() 
709 720
                 
710 721
                 percent = (int)(1e2*((ipm+istack*self.nPulseMoments)/(self.nPulseMoments*len(self.DATADICT["stacks"])))) 
@@ -766,11 +777,11 @@ class GMRDataProcessor(SNMRDataProcessor):
766 777
                 #ax1.plot( 1e3*self.DATADICT[pulse][chan]["FFT"]["nu"][0:len(SimpleStack[pulse][chan])], np.average(SimpleStack[pulse][chan], 0 )) #, color='darkblue' )
767 778
                 #ax1.pcolor( np.real(SimpleStack[pulse][chan]) ) #, color='darkblue' )
768 779
                 ax1.matshow( np.real(SimpleStack[pulse][chan]), aspect='auto') #, color='darkblue' )
769
-                ax1.set_title("Ch." + str(chan) + ": avg FID", fontsize=8)
770
-                ax1.set_xlabel(r"time (ms)", fontsize=8)
780
+                ax1.set_title("Ch." + str(chan) + ": avg FID", fontsize=10)
781
+                ax1.set_xlabel(r"time (ms)", fontsize=10)
771 782
 
772 783
                 if ichan == 0:
773
-                    ax1.set_ylabel(r"signal [nV]", fontsize=8)
784
+                    ax1.set_ylabel(r"signal [nV]", fontsize=10)
774 785
                 else:
775 786
                     plt.setp(ax1.get_yticklabels(), visible=False)
776 787
                     plt.setp(ax1.get_yaxis().get_offset_text(), visible=False) 
@@ -932,6 +943,7 @@ class GMRDataProcessor(SNMRDataProcessor):
932 943
 #         cb2.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
933 944
 
934 945
         #canvas.fig.tight_layout() 
946
+        deSpine(ax1)
935 947
         canvas.draw()
936 948
         self.doneTrigger.emit() 
937 949
 
@@ -1034,8 +1046,8 @@ class GMRDataProcessor(SNMRDataProcessor):
1034 1046
                     ht = signal.hilbert(xn)*np.exp(-1j*wL*self.DATADICT[pulse]["TIMES"])
1035 1047
                     #############################################################
1036 1048
                     # Quadrature signal 
1037
-                    RE[pulse][chan][ipm,:] = np.real(ht[clip::])   
1038
-                    IM[pulse][chan][ipm,:] = np.imag(ht[clip::])
1049
+                    RE[pulse][chan][ipm,:] = -np.real(ht[clip::])  # negative for consistency with VC  
1050
+                    IM[pulse][chan][ipm,:] =  np.imag(ht[clip::])
1039 1051
                     REmax[pulse] = max(REmax[pulse], np.max(np.real(ht[clip::])))
1040 1052
                     IMmax[pulse] = max(IMmax[pulse], np.max(np.imag(ht[clip::])))
1041 1053
                     #############################################################
@@ -1084,7 +1096,8 @@ class GMRDataProcessor(SNMRDataProcessor):
1084 1096
 
1085 1097
         ###############
1086 1098
         # Plot on GUI #      
1087
-        ############### 
1099
+        ###############
1100
+        fs = 10 
1088 1101
         dcmap = cmocean.cm.curl_r  #"seismic_r" #cmocean.cm.balance_r #"RdBu" #YlGn" # "coolwarm_r"  # diverging 
1089 1102
         canvas.reAxH2(  len(self.DATADICT[ self.DATADICT["PULSES"][0] ]["chan"] ), False, False)
1090 1103
         for pulse in self.DATADICT["PULSES"]:
@@ -1103,29 +1116,27 @@ class GMRDataProcessor(SNMRDataProcessor):
1103 1116
 
1104 1117
             for chan in self.DATADICT[pulse]["chan"]: 
1105 1118
                 ax1 = axes[2*ichan  ]
1106
-                ax2 = axes[2*ichan+1] # TODO fix hard coded number
1119
+                ax2 = axes[2*ichan+1] 
1107 1120
                 if phase == 0: # Re Im 
1108
-                    #print("plot dog", np.shape(QQ), np.shape(self.DATADICT["RE"][pulse][chan]))
1109
-                    #print("QQ", QQ) 
1110 1121
                     im1 = ax1.pcolormesh( time_sp, QQ[iQ], self.DATADICT["RE"][pulse][chan][iQ], cmap=dcmap, \
1111
-                         vmin=-self.DATADICT["REmax"][pulse] , vmax=self.DATADICT["REmax"][pulse] )
1122
+                         vmin=-self.DATADICT["REmax"][pulse] , vmax=self.DATADICT["REmax"][pulse] , rasterized=True)
1112 1123
                     im2 = ax2.pcolormesh( time_sp, QQ[iQ], self.DATADICT["IM"][pulse][chan][iQ], cmap=dcmap, \
1113
-                         vmin=-self.DATADICT["IMmax"][pulse], vmax=self.DATADICT["IMmax"][pulse]  )
1124
+                         vmin=-self.DATADICT["IMmax"][pulse], vmax=self.DATADICT["IMmax"][pulse] , rasterized=True )
1114 1125
                     #im1 = ax1.matshow( self.DATADICT["RE"][pulse][chan][iQ], cmap=dcmap, aspect='auto', \
1115 1126
                     #     vmin=-self.DATADICT["REmax"][pulse] , vmax=self.DATADICT["REmax"][pulse] )
1116 1127
                     #im2 = ax2.matshow( self.DATADICT["IM"][pulse][chan][iQ], cmap=dcmap, aspect='auto', \
1117 1128
                     #     vmin=-self.DATADICT["REmax"][pulse] , vmax=self.DATADICT["REmax"][pulse] )
1118 1129
                 if phase == 1: # Amp phase
1119 1130
                     im1 = ax1.pcolormesh( time_sp, QQ[iQ], self.DATADICT["CA"][pulse][chan][iQ], cmap=dcmap, \
1120
-                         vmin=-self.DATADICT["CAmax"][pulse] , vmax=self.DATADICT["CAmax"][pulse]  )
1131
+                         vmin=-self.DATADICT["CAmax"][pulse] , vmax=self.DATADICT["CAmax"][pulse], rasterized=True  )
1121 1132
                     #im2 = ax2.pcolormesh( time_sp, QQ, self.DATADICT["IP"][pulse][chan], cmap=cmocean.cm.balance, rasterized=True,\
1122 1133
                     im2 = ax2.pcolormesh( time_sp, QQ[iQ], self.DATADICT["IP"][pulse][chan][iQ], cmap=cmocean.cm.delta, \
1123
-                         vmin=-np.pi, vmax=np.pi)
1134
+                         vmin=-np.pi, vmax=np.pi, rasterized=True)
1124 1135
                 if phase == 2: # CA NR
1125 1136
                     im1 = ax1.pcolormesh( time_sp, QQ[iQ], self.DATADICT["CA"][pulse][chan][iQ], cmap=dcmap, \
1126
-                         vmin=-self.DATADICT["CAmax"][pulse] , vmax=self.DATADICT["CAmax"][pulse] )
1137
+                         vmin=-self.DATADICT["CAmax"][pulse] , vmax=self.DATADICT["CAmax"][pulse], rasterized=True )
1127 1138
                     im2 = ax2.pcolormesh( time_sp, QQ[iQ], self.DATADICT["NR"][pulse][chan][iQ], cmap=dcmap, \
1128
-                         vmin=-self.DATADICT["NRmax"][pulse] , vmax=self.DATADICT["NRmax"][pulse] )
1139
+                         vmin=-self.DATADICT["NRmax"][pulse] , vmax=self.DATADICT["NRmax"][pulse], rasterized=True )
1129 1140
 #                     cb2 = canvas.fig.colorbar(im2, ax=ax2, format='%1.0e')
1130 1141
 #                     cb2.set_label("Noise residual (nV)", fontsize=8)
1131 1142
 #                     cb2.ax.tick_params(axis='both', which='major', labelsize=8)
@@ -1150,8 +1161,8 @@ class GMRDataProcessor(SNMRDataProcessor):
1150 1161
                 self.progressTrigger.emit(percent)
1151 1162
                 
1152 1163
                 if ichan == 0:
1153
-                    ax1.set_ylabel(r"$q$ ( $\mathrm{A}\cdot\mathrm{s}$)", fontsize=8)
1154
-                    ax2.set_ylabel(r"$q$ ( $\mathrm{A}\cdot\mathrm{s}$)", fontsize=8)
1164
+                    ax1.set_ylabel(r"$q$ ( $\mathrm{A}\cdot\mathrm{s}$)", fontsize=fs)
1165
+                    ax2.set_ylabel(r"$q$ ( $\mathrm{A}\cdot\mathrm{s}$)", fontsize=fs)
1155 1166
                 else:
1156 1167
                     #ax2.yaxis.set_ticklabels([])
1157 1168
                     #ax1.yaxis.set_ticklabels([])
@@ -1171,29 +1182,40 @@ class GMRDataProcessor(SNMRDataProcessor):
1171 1182
             ax2.set_xlim( np.min(time_sp), np.max(time_sp) )
1172 1183
 
1173 1184
             #ax2.set_xlabel(r"Time since end of pulse  (ms)", fontsize=8)
1174
-            ax2.set_xlabel(r"Time (ms)", fontsize=8)
1185
+            ax2.set_xlabel(r"time (ms)", fontsize=fs)
1186
+        
1187
+        #canvas.fig.subplots_adjust(hspace=.15, wspace=.05, left=.15, right=.85, bottom=.15, top=.9 )#left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 
1188
+        canvas.fig.subplots_adjust(hspace=.15, wspace=.05, left=.15, right=.90, bottom=.15, top=.95 )#left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 
1175 1189
         
1176
-        canvas.fig.subplots_adjust(hspace=.15, wspace=.05, left=.075, right=.95, bottom=.1, top=.95 )#left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 
1177 1190
         tick_locator = MaxNLocator(nbins=3)
1178 1191
 
1179
-        cb1 = canvas.fig.colorbar(im1, ax=axes[0::2], format='%1.0e', orientation='horizontal', shrink=.35, aspect=30)
1180
-        cb1.ax.tick_params(axis='both', which='major', labelsize=8)
1181
-        cb1.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
1192
+        cb1 = canvas.fig.colorbar(im1, ax=axes[0::2], format='%1.0f', orientation='vertical')
1193
+        #cb1 = canvas.fig.colorbar(im1, ax=axes[0::2], format='%1.0f', orientation='horizontal', shrink=.35, aspect=30, pad=.4)
1194
+        cb1.ax.tick_params(axis='both', which='major', labelsize=fs)
1195
+
1182 1196
         cb1.locator = tick_locator
1183 1197
         cb1.update_ticks()
1184 1198
 
1185 1199
         tick_locator2 = MaxNLocator(nbins=3)
1186
-        cb2 = canvas.fig.colorbar(im2, ax=axes[1::2], format='%1.0e', orientation='horizontal', shrink=.35, aspect=30, pad=.2)
1187
-        cb2.ax.tick_params(axis='both', which='major', labelsize=8)
1188
-        if phase == 1: # Amp phase
1189
-            cb2.set_label(r"$\angle \mathcal{V}_N$", fontsize=8)
1200
+        cb2 = canvas.fig.colorbar(im2, ax=axes[1::2], format='%1.0f', orientation='vertical')
1201
+        #cb2 = canvas.fig.colorbar(im2, ax=axes[1::2], format='%1.0f', orientation='horizontal', shrink=.35, aspect=30, pad=.4)
1202
+        cb2.ax.tick_params(axis='both', which='major', labelsize=fs)
1203
+
1204
+        if phase == 0: # Re Im 
1205
+            cb1.set_label(r"$\mathrm{Re} \left( \mathcal{V}_N \right)$ (nV)", fontsize=fs)
1206
+            cb2.set_label(r"$\mathrm{Im} \left( \mathcal{V}_N \right)$ (nV)", fontsize=fs)
1207
+        elif phase == 1: # Amp phase
1208
+            cb1.set_label(r"$\left| \mathcal{V}_N \right|$ (nV)", fontsize=fs)
1209
+            cb2.set_label(r"$\angle \mathcal{V}_N$", fontsize=fs)
1190 1210
         else:
1191
-            cb2.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
1211
+            cb1.set_label(r"$\left| \mathcal{V}_N \right|$ (nV)", fontsize=fs)
1212
+            cb2.set_label(r"noise (nV)", fontsize=fs)
1192 1213
 
1193 1214
 
1194 1215
         cb2.locator = tick_locator2
1195 1216
         cb2.update_ticks()
1196 1217
 
1218
+        #canvas.fig.tight_layout()
1197 1219
         canvas.draw()
1198 1220
         self.doneTrigger.emit() 
1199 1221
 
@@ -1341,7 +1363,9 @@ class GMRDataProcessor(SNMRDataProcessor):
1341 1363
     def plotGateIntegrate( self, gpd, clip, phase, canvas ):
1342 1364
         """ Plot the gate integration 
1343 1365
         """
1344
-        
1366
+       
1367
+        fs = 10 
1368
+ 
1345 1369
         canvas.reAxH2(  len(self.DATADICT[ self.DATADICT["PULSES"][0] ]["chan"] ), False, False)
1346 1370
         axes = canvas.fig.axes
1347 1371
         #cmap = cmocean.cm.balance_r 
@@ -1454,34 +1478,34 @@ class GMRDataProcessor(SNMRDataProcessor):
1454 1478
                 ax2.xaxis.set_major_formatter(formatter) #matplotlib.ticker.FormatStrFormatter('%d.1'))
1455 1479
                 
1456 1480
                 if ichan == 0:
1457
-                    ax1.set_ylabel(r"$q$ ( $\mathrm{A}\cdot\mathrm{s}$)", fontsize=8)
1481
+                    ax1.set_ylabel(r"$q$ ( $\mathrm{A}\cdot\mathrm{s}$)", fontsize=fs)
1458 1482
                     if phase == 2:
1459
-                        ax2.set_ylabel(r"noise est. (nV)", fontsize=8)
1483
+                        ax2.set_ylabel(r"noise est. (nV)", fontsize=fs)
1460 1484
                     else:
1461
-                        ax2.set_ylabel(r"$q$ ( $\mathrm{A}\cdot\mathrm{s}$)", fontsize=8)
1485
+                        ax2.set_ylabel(r"$q$ ( $\mathrm{A}\cdot\mathrm{s}$)", fontsize=fs)
1462 1486
                 else:
1463 1487
                     plt.setp(ax1.get_yticklabels(), visible=False)
1464 1488
                     plt.setp(ax2.get_yticklabels(), visible=False)
1465 1489
         
1466
-                ax2.set_xlabel(r"$t-\tau_p$  (ms)", fontsize=8)
1490
+                ax2.set_xlabel(r"$t-\tau_p$  (ms)", fontsize=fs)
1467 1491
                 ichan += 1 
1468 1492
 
1469 1493
         #canvas.fig.subplots_adjust(hspace=.1, wspace=.05, left=.075, right=.925 )#left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 
1470 1494
         #canvas.fig.tight_layout()
1471 1495
         #canvas.draw()
1472
-        canvas.fig.subplots_adjust(hspace=.15, wspace=.05, left=.075, right=.95, bottom=.1, top=.95 )#left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 
1496
+        canvas.fig.subplots_adjust(hspace=.15, wspace=.05, left=.15, right=.9, bottom=.1, top=.9 )#left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 
1473 1497
         tick_locator = MaxNLocator(nbins=5)
1474 1498
 
1475
-        cb1 = canvas.fig.colorbar(im1, ax=axes[0::2], format='%1.0e', orientation='horizontal', shrink=.35, aspect=30)
1476
-        cb1.ax.tick_params(axis='both', which='major', labelsize=8)
1477
-        cb1.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
1499
+        cb1 = canvas.fig.colorbar(im1, ax=axes[0::2], format='%1.0f', orientation='horizontal', shrink=.35, aspect=30)
1500
+        cb1.ax.tick_params(axis='both', which='major', labelsize=fs)
1501
+        cb1.set_label("$\mathcal{V}_N$ (nV)", fontsize=fs)
1478 1502
         #cb1.locator = tick_locator
1479 1503
         #cb1.update_ticks()
1480 1504
 
1481 1505
         if phase != 2:
1482
-            cb2 = canvas.fig.colorbar(im2, ax=axes[1::2], format='%1.0e', orientation='horizontal', shrink=.35, aspect=30, pad=.2)
1483
-            cb2.ax.tick_params(axis='both', which='major', labelsize=8)
1484
-            cb2.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
1506
+            cb2 = canvas.fig.colorbar(im2, ax=axes[1::2], format='%1.0f', orientation='horizontal', shrink=.35, aspect=30, pad=.2)
1507
+            cb2.ax.tick_params(axis='both', which='major', labelsize=fs)
1508
+            cb2.set_label("$\mathcal{V}_N$ (nV)", fontsize=fs)
1485 1509
 
1486 1510
             cb2.locator = tick_locator
1487 1511
             cb2.update_ticks()
@@ -1652,20 +1676,22 @@ class GMRDataProcessor(SNMRDataProcessor):
1652 1676
                     self.DATADICT[pulse]["qeff"][ipm][istack] = qeff
1653 1677
                     self.DATADICT[pulse]["q_nu"][ipm][istack] = v
1654 1678
                     iistack += 1
1655
-
1656
-                canvas.ax1.set_xlabel("time (ms)", fontsize=8)
1657
-                canvas.ax1.set_ylabel("current (A)", fontsize=8)
1658
-                canvas.draw()
1659
-
1679
+                #canvas.draw()
1660 1680
                         
1661 1681
                 percent = int(1e2* (float)((istack)+ipm*self.DATADICT["nPulseMoments"]) / 
1662 1682
                                    (float)(len(self.DATADICT["PULSES"])*self.DATADICT["nPulseMoments"]*nstack))
1663 1683
                 self.progressTrigger.emit(percent)
1664 1684
 
1665
-            canvas.draw()
1666
-
1685
+            canvas.ax1.set_xlabel("time (ms)", fontsize=10)
1686
+            canvas.ax1.set_ylabel("current (A)", fontsize=10)
1687
+            #canvas.draw()
1667 1688
 
1668 1689
         self.plotQeffNu(cv, canvas.ax2)
1690
+
1691
+        deSpine(canvas.ax1)        
1692
+        deSpine(canvas.ax2)        
1693
+
1694
+        canvas.fig.tight_layout()
1669 1695
         canvas.draw()
1670 1696
         self.doneTrigger.emit() 
1671 1697
 
@@ -1700,11 +1726,11 @@ class GMRDataProcessor(SNMRDataProcessor):
1700 1726
                     self.progressTrigger.emit(percent)
1701 1727
                     istack += 1
1702 1728
             iFID += 1
1703
-        ax.set_xlabel(r"pulse moment index", fontsize=8)
1704
-        ax.set_ylabel(r"$q_{eff}$ [A$\cdot$sec]", fontsize=8)
1729
+        ax.set_xlabel(r"pulse moment index", fontsize=10)
1730
+        ax.set_ylabel(r"$q_{eff}$ (A$\cdot$sec)", fontsize=10)
1705 1731
         ax.set_yscale('log')
1706 1732
         ax.set_xlim(0, ax.get_xlim()[1])
1707
-        ax.legend(loc='upper right', scatterpoints = 1, prop={'size':6})
1733
+        ax.legend(loc='upper right', scatterpoints = 1, prop={'size':10})
1708 1734
 
1709 1735
     def enableDSP(self):
1710 1736
         self.enableDSPTrigger.emit() 
@@ -1800,19 +1826,24 @@ class GMRDataProcessor(SNMRDataProcessor):
1800 1826
                             self.DATADICT[pulse][ichan][ipm][istack] = e[::-1]
1801 1827
                            
1802 1828
      
1803
-                        canvas.ax1.plot( H[pulse][ichan].reshape(-1, len(RX)) ) # , label="taps") 
1829
+                        #canvas.ax1.plot( H[pulse][ichan].reshape(-1, len(RX)) ) # , label="taps") 
1830
+                        canvas.ax1.plot( H[pulse][ichan][::-1].reshape(M, len(RX), order='F' ) ) #.reshape(-1, len(RX)) ) # , label="taps") 
1804 1831
 
1805
-                        canvas.ax2.legend(prop={'size':6}, loc='upper right')
1832
+                        canvas.ax2.legend(prop={'size':10}, loc='upper right')
1806 1833
                         #canvas.ax2.legend(prop={'size':6}, loc='upper right')
1807 1834
 
1808 1835
                         mh = np.max(np.abs( H[pulse][ichan] ))
1809 1836
                         canvas.ax1.set_ylim( -mh, mh )
1810 1837
 
1811
-                        canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
1812
-                        canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
1838
+                        canvas.ax2.set_xlabel(r"time (s)", fontsize=10)
1839
+                        canvas.ax2.set_ylabel(r"signal (nV)", fontsize=10)
1840
+
1841
+                        canvas.ax1.set_xlabel(r"filter tap index", fontsize=10)
1842
+                        canvas.ax1.set_ylabel(r"tap amplitude", fontsize=10)
1813 1843
 
1814
-                        canvas.ax1.set_xlabel(r"filter index", fontsize=8)
1815
-                        canvas.ax1.set_ylabel(r"scale factor", fontsize=8)
1844
+                    canvas.fig.tight_layout()
1845
+                    deSpine(canvas.ax1)
1846
+                    deSpine(canvas.ax2)
1816 1847
 
1817 1848
                     canvas.draw()
1818 1849
 
@@ -2127,10 +2158,11 @@ class GMRDataProcessor(SNMRDataProcessor):
2127 2158
         """
2128 2159
         
2129 2160
         if plot:
2161
+            fs = 10
2130 2162
             canvas.reAx2()
2131
-            canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
2132
-            canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
2133
-            canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
2163
+            canvas.ax1.set_ylabel(r"signal (nV)", fontsize=fs)
2164
+            canvas.ax2.set_xlabel(r"time (s)", fontsize=fs)
2165
+            canvas.ax2.set_ylabel(r"signal (nV)", fontsize=fs)
2134 2166
 
2135 2167
         self.samp /= dec
2136 2168
         self.dt   = 1./self.samp       
@@ -2168,9 +2200,15 @@ class GMRDataProcessor(SNMRDataProcessor):
2168 2200
                         for ichan in self.DATADICT[pulse]["rchan"]:
2169 2201
                             canvas.ax1.plot( RSTIMES, 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
2170 2202
                                 label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " ichan="  + str(ichan))
2171
-                        canvas.ax1.legend(prop={'size':6}, loc='upper right')
2172
-                        canvas.ax2.legend(prop={'size':6}, loc='upper right')
2203
+                        canvas.ax1.legend(prop={'size':fs}, loc='upper right')
2204
+                        canvas.ax2.legend(prop={'size':fs}, loc='upper right')
2205
+                   
2206
+                        deSpine( canvas.ax1 ) 
2207
+                        deSpine( canvas.ax2 ) 
2208
+                        plt.setp(canvas.ax1.get_xticklabels(), visible=False)
2209
+                        canvas.fig.tight_layout()
2173 2210
                         canvas.draw() 
2211
+
2174 2212
                 percent = (int)(1e2*((float)(iFID*self.DATADICT["nPulseMoments"]+(ipm))/( len(self.DATADICT["PULSES"])*self.nPulseMoments)))
2175 2213
                 self.progressTrigger.emit(percent)
2176 2214
             iFID += 1  
@@ -2569,19 +2607,24 @@ class GMRDataProcessor(SNMRDataProcessor):
2569 2607
                     for ichan in rchan:
2570 2608
                         canvas.ax2.plot(self.DATADICT["Pulse 1"]["TIMES"], self.DATADICT["Pulse 1"][ichan][ipm][istack], label="Pulse 1 FID ref ch. "+str(ichan)) #, color='blue')
2571 2609
 
2572
-                    canvas.ax3.legend(prop={'size':6}, loc='upper right')
2573
-                    canvas.ax2.legend(prop={'size':6}, loc='upper right')
2610
+                    # reference axis
2611
+                    canvas.ax2.tick_params(axis='both', which='major', labelsize=10)
2612
+                    canvas.ax2.tick_params(axis='both', which='minor', labelsize=10)
2613
+                    #canvas.ax2.xaxis.set_ticklabels([])
2614
+                    plt.setp(canvas.ax2.get_xticklabels(), visible=False)
2615
+                    canvas.ax2.legend(prop={'size':10}, loc='upper right')
2616
+                    canvas.ax2.set_title("stack "+str(istack)+" pulse index " + str(ipm), fontsize=10)
2617
+                    canvas.ax2.set_ylabel("RAW signal [V]", fontsize=10)
2574 2618
 
2575
-                    canvas.ax1.set_ylabel("Current [A]", fontsize=8) 
2619
+
2620
+                    canvas.ax1.set_ylabel("Current (A)", fontsize=10) 
2576 2621
                     canvas.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y') 
2577
-                    canvas.ax1.set_xlabel("time [s]", fontsize=8)
2578
-                    
2579
-                    canvas.ax2.set_title("stack "+str(istack)+" pulse index " + str(ipm), fontsize=8)
2580
-                    canvas.ax2.set_ylabel("RAW signal [V]", fontsize=8)
2581
-                    canvas.ax3.set_ylabel("RAW signal [V]", fontsize=8)
2582
-                    canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
2583
-                    canvas.ax2.tick_params(axis='both', which='minor', labelsize=6)
2622
+                    canvas.ax1.set_xlabel("time (s)", fontsize=10)
2584 2623
 
2624
+                    canvas.ax3.legend(prop={'size':10}, loc='upper right')
2625
+                    canvas.ax3.set_ylabel("RAW signal [V]", fontsize=10)
2626
+                    
2627
+                    canvas.fig.tight_layout()
2585 2628
                     canvas.draw()
2586 2629
 
2587 2630
             percent = (int) (1e2*((float)((iistack*self.nPulseMoments+ipm+1))  / (len(procStacks)*self.nPulseMoments)))

+ 1
- 1
setup.py Näytä tiedosto

@@ -21,7 +21,7 @@ with open("README.md", "r") as fh:
21 21
     long_description = fh.read()
22 22
 
23 23
 setup(name='Akvo',
24
-      version='1.4.2',
24
+      version='1.4.3',
25 25
       python_requires='>3.7.0', # due to pyLemma
26 26
       description='Surface nuclear magnetic resonance workbench',
27 27
       long_description=long_description,

Loading…
Peruuta
Tallenna