Browse Source

Fix to bug not allowing Rx loops to be different from Tx

master
Trevor Irons 1 year ago
parent
commit
d6dee00430

+ 2
- 2
akvo/gui/akvoGUI.py View File

476
             print("txCoil", txCoil.text())
476
             print("txCoil", txCoil.text())
477
             txCoils.append(txCoil.text())
477
             txCoils.append(txCoil.text())
478
         
478
         
479
-        rxCoilList = self.ui.txListWidget.selectedItems() #currentItem().text() 
479
+        rxCoilList = self.ui.rxListWidget.selectedItems() #currentItem().text() 
480
         rxCoils = []
480
         rxCoils = []
481
         for rxCoil in rxCoilList:
481
         for rxCoil in rxCoilList:
482
             print("rxCoil", rxCoil.text())
482
             print("rxCoil", rxCoil.text())
1510
         #self.ui.lcdNumberResampFreq.display( self.RAWDataProc.samp )
1510
         #self.ui.lcdNumberResampFreq.display( self.RAWDataProc.samp )
1511
  
1511
  
1512
         self.mpl_toolbar = NavigationToolbar2QT(self.ui.mplwidget, self.ui.mplwidget)
1512
         self.mpl_toolbar = NavigationToolbar2QT(self.ui.mplwidget, self.ui.mplwidget)
1513
-        self.ui.mplwidget.draw()
1513
+        #self.ui.mplwidget.draw() # this was crashing? 
1514
 
1514
 
1515
     def loadRAW(self):
1515
     def loadRAW(self):
1516
 
1516
 

+ 3
- 3
akvo/gui/main.ui View File

760
            <enum>Qt::LeftToRight</enum>
760
            <enum>Qt::LeftToRight</enum>
761
           </property>
761
           </property>
762
           <property name="currentIndex">
762
           <property name="currentIndex">
763
-           <number>0</number>
763
+           <number>4</number>
764
           </property>
764
           </property>
765
           <property name="elideMode">
765
           <property name="elideMode">
766
            <enum>Qt::ElideLeft</enum>
766
            <enum>Qt::ElideLeft</enum>
4215
               <rect>
4215
               <rect>
4216
                <x>0</x>
4216
                <x>0</x>
4217
                <y>0</y>
4217
                <y>0</y>
4218
-               <width>96</width>
4219
-               <height>26</height>
4218
+               <width>411</width>
4219
+               <height>67</height>
4220
               </rect>
4220
               </rect>
4221
              </property>
4221
              </property>
4222
              <attribute name="label">
4222
              <attribute name="label">

akvo/terminal/plotyaml.py → akvo/terminal/plotData.py View File

3
 import numpy as np
3
 import numpy as np
4
 
4
 
5
 import matplotlib.pyplot as plt
5
 import matplotlib.pyplot as plt
6
+
6
 import seaborn as sns
7
 import seaborn as sns
7
 sns.set(style="ticks")
8
 sns.set(style="ticks")
9
+
8
 import cmocean 
10
 import cmocean 
9
 from SEGPlot import *
11
 from SEGPlot import *
10
 from matplotlib.ticker import FormatStrFormatter
12
 from matplotlib.ticker import FormatStrFormatter
70
                     IM[q] = akvo.Gated[pulse][chan]["Q-" + str(q)+" IM"].data
72
                     IM[q] = akvo.Gated[pulse][chan]["Q-" + str(q)+" IM"].data
71
                     #X[q] = akvo.Gated[pulse][chan]["Q-" + str(q)+" RE"].data
73
                     #X[q] = akvo.Gated[pulse][chan]["Q-" + str(q)+" RE"].data
72
             Windows = akvo.Gated[pulse]["windows"].data
74
             Windows = akvo.Gated[pulse]["windows"].data
75
+            Centres = akvo.Gated[pulse]["abscissa"].data
76
+            
77
+
73
             Q = np.array(akvo.Pulses[pulse]["current"].data)
78
             Q = np.array(akvo.Pulses[pulse]["current"].data)
74
             print("pulse length ", akvo.pulseLength[0])
79
             print("pulse length ", akvo.pulseLength[0])
75
             Q *= akvo.pulseLength[0]
80
             Q *= akvo.pulseLength[0]
76
        
81
        
77
             fig = plt.figure( figsize=( pc2in(20), pc2in(26) ) ) 
82
             fig = plt.figure( figsize=( pc2in(20), pc2in(26) ) ) 
78
             ax1 = fig.add_axes([.25,.05,.6,.9])
83
             ax1 = fig.add_axes([.25,.05,.6,.9])
79
-            im = ax1.pcolormesh(Windows,Q,CA, cmap=cmocean.cm.curl_r, vmin=-np.max(np.abs(CA)), vmax=(np.max(np.abs(CA))))
84
+            #im = ax1.pcolormesh(Windows, Q, CA, cmap=cmocean.cm.curl_r, vmin=-np.max(np.abs(CA)), vmax=(np.max(np.abs(CA))))
85
+            im = ax1.pcolormesh(Centres, Q, CA, cmap=cmocean.cm.curl_r, vmin=-np.max(np.abs(CA)), vmax=(np.max(np.abs(CA))))
80
             cb = plt.colorbar( im, orientation='horizontal', pad=.175,  )
86
             cb = plt.colorbar( im, orientation='horizontal', pad=.175,  )
81
             cb.set_label("FID (nV)", fontsize=10)
87
             cb.set_label("FID (nV)", fontsize=10)
82
             cb.ax.tick_params(labelsize=10) 
88
             cb.ax.tick_params(labelsize=10) 
101
     #plt.matshow(IM)
107
     #plt.matshow(IM)
102
     plt.savefig("data.pgf")
108
     plt.savefig("data.pgf")
103
     plt.savefig("data.png", dpi=300)
109
     plt.savefig("data.png", dpi=300)
104
-    #plt.show()
110
+    plt.show()
105
 
111
 
106
 if __name__ == "__main__":
112
 if __name__ == "__main__":
107
     akvo = loadAkvoData( sys.argv[1] ) #, "Chan. 1")
113
     akvo = loadAkvoData( sys.argv[1] ) #, "Chan. 1")

+ 8
- 8
akvo/terminal/plotKernel.py View File

29
     K = 1e9*catLayers(K0.K0)
29
     K = 1e9*catLayers(K0.K0)
30
     q = np.array(K0.PulseI.data)* (float)(K0.Taup)
30
     q = np.array(K0.PulseI.data)* (float)(K0.Taup)
31
 
31
 
32
+    centres = (np.array(K0.Interfaces.data[0:-1]) + np.array(K0.Interfaces.data[1::])) / 2
33
+
32
     fig = plt.figure( figsize=(pc2in(20),pc2in(20)) )
34
     fig = plt.figure( figsize=(pc2in(20),pc2in(20)) )
33
     fig.add_axes((.2,.2,.65,.7))
35
     fig.add_axes((.2,.2,.65,.7))
34
     #plt.pcolor(K0.Interfaces.data, K0.PulseI.data, np.abs(K))
36
     #plt.pcolor(K0.Interfaces.data, K0.PulseI.data, np.abs(K))
35
     #plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.gray_r)
37
     #plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.gray_r)
36
     #plt.contourf(q, K0.Interfaces.data[0:-1], np.abs(K), cmap=cmocean.cm.tempo)
38
     #plt.contourf(q, K0.Interfaces.data[0:-1], np.abs(K), cmap=cmocean.cm.tempo)
37
-    plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.tempo)
39
+    #plt.pcolormesh(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.tempo, shading='nearest')
40
+    plt.pcolormesh(q, centres, np.abs(K), cmap=cmocean.cm.tempo, shading='nearest')
38
     plt.colorbar(label=r"$\left| \overline{\mathcal{V}_N}(0) \right|$ (nV)")
41
     plt.colorbar(label=r"$\left| \overline{\mathcal{V}_N}(0) \right|$ (nV)")
39
 
42
 
40
     ax1 = plt.gca()
43
     ax1 = plt.gca()
53
     plt.gca().set_ylabel("depth (m)")
56
     plt.gca().set_ylabel("depth (m)")
54
     plt.savefig("kernel.pdf")
57
     plt.savefig("kernel.pdf")
55
 
58
 
56
-    sound = np.sum(K, axis=0)
57
-    plt.figure()
58
-    plt.plot(q, np.abs(sound))
59
-
60
-    
61
-
62
-    plt.savefig("sound.pdf")
59
+    #sound = np.sum(K, axis=0)
60
+    #plt.figure()
61
+    #plt.plot(q, np.abs(sound))
62
+    #plt.savefig("sound.pdf")
63
 
63
 
64
     plt.show()
64
     plt.show()
65
     #print(yaml.dump(K0))
65
     #print(yaml.dump(K0))

+ 3
- 0
akvo/tressel/calcAkvoKernel.py View File

67
         print ("usage  akvoKO   AkvoDataset.yaml   kparams.yaml  SaveString.yaml " )
67
         print ("usage  akvoKO   AkvoDataset.yaml   kparams.yaml  SaveString.yaml " )
68
         exit()
68
         exit()
69
 
69
 
70
+    print("Loading data")
70
     AKVO = loadAkvoData(sys.argv[1])
71
     AKVO = loadAkvoData(sys.argv[1])
71
 
72
 
73
+    print("Building Kernel")
72
     B_inc = AKVO.META["B_0"]["inc"]  
74
     B_inc = AKVO.META["B_0"]["inc"]  
73
     B_dec = AKVO.META["B_0"]["dec"]  
75
     B_dec = AKVO.META["B_0"]["dec"]  
74
     B0    = AKVO.META["B_0"]["intensity"]  
76
     B0    = AKVO.META["B_0"]["intensity"]  
107
 
109
 
108
     ## TODO 
110
     ## TODO 
109
     # pass this in...
111
     # pass this in...
112
+    print("Building layered earth model")
110
     lmod = em1d.LayeredEarthEM() 
113
     lmod = em1d.LayeredEarthEM() 
111
 
114
 
112
     nlay = len(kparams["sigs"])
115
     nlay = len(kparams["sigs"])

+ 10
- 6
akvo/tressel/invertTA.py View File

28
 
28
 
29
 import pandas as pd
29
 import pandas as pd
30
 
30
 
31
+# For Mihai, but consider letting fonts be user selected. 
32
+#import matplotlib.pyplot as plt
33
+#plt.rcParams["font.family"] = "arial"
31
 
34
 
32
 import matplotlib.colors as colors
35
 import matplotlib.colors as colors
33
 
36
 
84
     #Z *= 1e-9 
87
     #Z *= 1e-9 
85
     #ZS *= 1e-9 
88
     #ZS *= 1e-9 
86
 
89
 
87
-    J = AKVO.Pulses["Pulse 1"]["current"].data 
88
-    J = np.append(J,J[-1]+(J[-1]-J[-2]))
90
+    J = np.array(AKVO.Pulses["Pulse 1"]["current"].data) 
91
+    #J = np.append(J,J[-1]+(J[-1]-J[-2])) # This was a pcolor hack, get rid of this
92
+    #print("J", J)
89
     Q = AKVO.pulseLength[0]*J
93
     Q = AKVO.pulseLength[0]*J
90
     return Z, ZS, AKVO.Gated["Pulse 1"]["abscissa"].data, Q
94
     return Z, ZS, AKVO.Gated["Pulse 1"]["abscissa"].data, Q
91
 
95
 
223
         ax3.set_xlabel("time (s)")
227
         ax3.set_xlabel("time (s)")
224
 
228
 
225
         #TT, QQQ = np.meshgrid(tg, np.ravel(QQ))
229
         #TT, QQQ = np.meshgrid(tg, np.ravel(QQ))
226
-        
227
         TT, QQQ = np.meshgrid(tg, np.ravel(QQ[ich]))
230
         TT, QQQ = np.meshgrid(tg, np.ravel(QQ[ich]))
228
-        nq = np.shape(QQ[ich])[0] - 1 # to account for padding in pcolor 
231
+
232
+        nq = np.shape(QQ[ich])[0] #- 1               # -1 to account for padding in pcolor, but this was changed 
229
         nt = np.shape(tg)[0]
233
         nt = np.shape(tg)[0]
230
         ntq = nt*nq
234
         ntq = nt*nq
231
         
235
         
232
-        VV = V[ich*nq:ich*nq+nq,:]   # slice this channel
236
+        VV  =  V[ich*nq:ich*nq+nq,:] # slice this channel
233
         VVS = VS[ich*nq:ich*nq+nq,:] # slice this channel
237
         VVS = VS[ich*nq:ich*nq+nq,:] # slice this channel
234
 
238
 
235
         mmax = np.max(np.abs(VV))
239
         mmax = np.max(np.abs(VV))
351
             #TT, QQQ = np.meshgrid(tg, np.ravel(QQ))
355
             #TT, QQQ = np.meshgrid(tg, np.ravel(QQ))
352
         
356
         
353
             TT, QQQ = np.meshgrid(tg, np.ravel(QQ[ich]))
357
             TT, QQQ = np.meshgrid(tg, np.ravel(QQ[ich]))
354
-            nq = np.shape(QQ[ich])[0] - 1 # to account for padding in pcolor 
358
+            nq = np.shape(QQ[ich])[0]  # to account for padding in pcolor, this changed 
355
             nt = np.shape(tg)[0]
359
             nt = np.shape(tg)[0]
356
             ntq = nt*nq
360
             ntq = nt*nq
357
         
361
         

+ 5
- 1
akvo/tressel/logbarrier.py View File

1
 from __future__ import division
1
 from __future__ import division
2
 import numpy as np
2
 import numpy as np
3
-from scipy.sparse.linalg import iterative  as iter
3
+try:
4
+    from scipy.sparse.linalg import iterative  as iter
5
+except:  # newer python gets rid of iterative module
6
+    import scipy.sparse.linalg as iter 
7
+
4
 from scipy.sparse import eye as seye
8
 from scipy.sparse import eye as seye
5
 import pylab 
9
 import pylab 
6
 import pprint 
10
 import pprint 

+ 5
- 5
akvo/tressel/mrsurvey.py View File

1408
                 ax2 = axes[2*ichan+1] 
1408
                 ax2 = axes[2*ichan+1] 
1409
                 
1409
                 
1410
                 if phase == 0:
1410
                 if phase == 0:
1411
-                    im1 = ax1.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["RE"], cmap=dcmap, vmin=-vmax1, vmax=vmax1)
1412
-                    im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["IM"], cmap=dcmap, vmin=-vmax2, vmax=vmax2)
1411
+                    im1 = ax1.pcolormesh(self.GATED[chan]["GT"], self.GATED[chan]["QQ"], self.GATED[chan]["RE"], shading='nearest', cmap=dcmap, vmin=-vmax1, vmax=vmax1)
1412
+                    im2 = ax2.pcolormesh(self.GATED[chan]["GT"], self.GATED[chan]["QQ"], self.GATED[chan]["IM"], shading='nearest', cmap=dcmap, vmin=-vmax2, vmax=vmax2)
1413
                     #im1 = ax1.matshow(self.GATED[chan]["RE"], cmap=dcmap, vmin=-vmax1, vmax=vmax1, aspect='auto')
1413
                     #im1 = ax1.matshow(self.GATED[chan]["RE"], cmap=dcmap, vmin=-vmax1, vmax=vmax1, aspect='auto')
1414
                     #im2 = ax2.matshow(self.GATED[chan]["IM"], cmap=dcmap, vmin=-vmax2, vmax=vmax2, aspect='auto')
1414
                     #im2 = ax2.matshow(self.GATED[chan]["IM"], cmap=dcmap, vmin=-vmax2, vmax=vmax2, aspect='auto')
1415
                 elif phase == 1:
1415
                 elif phase == 1:
1416
-                    im1 = ax1.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["CA"], cmap=dcmap, vmin=-vmax1, vmax=vmax1)
1417
-                    im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["IP"], cmap=cmocean.cm.delta, vmin=-vmax2, vmax=vmax2)
1416
+                    im1 = ax1.pcolormesh(self.GATED[chan]["GT"], self.GATED[chan]["QQ"], self.GATED[chan]["CA"], shading='nearest', cmap=dcmap, vmin=-vmax1, vmax=vmax1)
1417
+                    im2 = ax2.pcolormesh(self.GATED[chan]["GT"], self.GATED[chan]["QQ"], self.GATED[chan]["IP"], shading='nearest', cmap=cmocean.cm.delta, vmin=-vmax2, vmax=vmax2)
1418
                     #im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["IP"], cmap=cmocean.cm.phase, vmin=-vmax2, vmax=vmax2)
1418
                     #im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["IP"], cmap=cmocean.cm.phase, vmin=-vmax2, vmax=vmax2)
1419
                 elif phase == 2:
1419
                 elif phase == 2:
1420
-                    im1 = ax1.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["CA"], cmap=dcmap, vmin=-vmax1, vmax=vmax1)
1420
+                    im1 = ax1.pcolormesh(self.GATED[chan]["GT"], self.GATED[chan]["QQ"], self.GATED[chan]["CA"], shading='nearest', cmap=dcmap, vmin=-vmax1, vmax=vmax1)
1421
                     #XS = self.bootstrap_sigma(pulse, chan)
1421
                     #XS = self.bootstrap_sigma(pulse, chan)
1422
                     #im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["NR"], cmap=cmap, vmin=-vmax2, vmax=vmax2)
1422
                     #im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["NR"], cmap=cmap, vmin=-vmax2, vmax=vmax2)
1423
                     # bootstrap resample
1423
                     # bootstrap resample

+ 1
- 1
akvo/tressel/nonlinearinv.py View File

21
 def PHI(m, Wd, K, d_obs, Wm, alphastar):
21
 def PHI(m, Wd, K, d_obs, Wm, alphastar):
22
     """
22
     """
23
         Global objective function 
23
         Global objective function 
24
-        x = model to be fit 
24
+        m = model to be fit, unknown 'x' 
25
         Wd = data weighting matrix 
25
         Wd = data weighting matrix 
26
         K = complex forward modelling kernel 
26
         K = complex forward modelling kernel 
27
         d_obs = observed data (modulus)
27
         d_obs = observed data (modulus)

+ 1
- 1
setup.py View File

21
     long_description = fh.read()
21
     long_description = fh.read()
22
 
22
 
23
 setup(name='Akvo',     
23
 setup(name='Akvo',     
24
-      version='1.7.2', 
24
+      version='1.7.3', 
25
       python_requires='>3.7.0', # due to pyLemma 
25
       python_requires='>3.7.0', # due to pyLemma 
26
       description='Surface nuclear magnetic resonance workbench',
26
       description='Surface nuclear magnetic resonance workbench',
27
       long_description=long_description,
27
       long_description=long_description,

Loading…
Cancel
Save