Selaa lähdekoodia

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

master
Trevor Irons 1 vuosi sitten
vanhempi
commit
d6dee00430

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

@@ -476,7 +476,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
476 476
             print("txCoil", txCoil.text())
477 477
             txCoils.append(txCoil.text())
478 478
         
479
-        rxCoilList = self.ui.txListWidget.selectedItems() #currentItem().text() 
479
+        rxCoilList = self.ui.rxListWidget.selectedItems() #currentItem().text() 
480 480
         rxCoils = []
481 481
         for rxCoil in rxCoilList:
482 482
             print("rxCoil", rxCoil.text())
@@ -1510,7 +1510,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
1510 1510
         #self.ui.lcdNumberResampFreq.display( self.RAWDataProc.samp )
1511 1511
  
1512 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 1515
     def loadRAW(self):
1516 1516
 

+ 3
- 3
akvo/gui/main.ui Näytä tiedosto

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

akvo/terminal/plotyaml.py → akvo/terminal/plotData.py Näytä tiedosto

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

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

@@ -29,12 +29,15 @@ if __name__ == "__main__":
29 29
     K = 1e9*catLayers(K0.K0)
30 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 34
     fig = plt.figure( figsize=(pc2in(20),pc2in(20)) )
33 35
     fig.add_axes((.2,.2,.65,.7))
34 36
     #plt.pcolor(K0.Interfaces.data, K0.PulseI.data, np.abs(K))
35 37
     #plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.gray_r)
36 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 41
     plt.colorbar(label=r"$\left| \overline{\mathcal{V}_N}(0) \right|$ (nV)")
39 42
 
40 43
     ax1 = plt.gca()
@@ -53,13 +56,10 @@ if __name__ == "__main__":
53 56
     plt.gca().set_ylabel("depth (m)")
54 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 64
     plt.show()
65 65
     #print(yaml.dump(K0))

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

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

+ 10
- 6
akvo/tressel/invertTA.py Näytä tiedosto

@@ -28,6 +28,9 @@ from akvo.tressel import nonlinearinv as nl
28 28
 
29 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 35
 import matplotlib.colors as colors
33 36
 
@@ -84,8 +87,9 @@ def loadAkvoData(fnamein, chan):
84 87
     #Z *= 1e-9 
85 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 93
     Q = AKVO.pulseLength[0]*J
90 94
     return Z, ZS, AKVO.Gated["Pulse 1"]["abscissa"].data, Q
91 95
 
@@ -223,13 +227,13 @@ def main():
223 227
         ax3.set_xlabel("time (s)")
224 228
 
225 229
         #TT, QQQ = np.meshgrid(tg, np.ravel(QQ))
226
-        
227 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 233
         nt = np.shape(tg)[0]
230 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 237
         VVS = VS[ich*nq:ich*nq+nq,:] # slice this channel
234 238
 
235 239
         mmax = np.max(np.abs(VV))
@@ -351,7 +355,7 @@ def main():
351 355
             #TT, QQQ = np.meshgrid(tg, np.ravel(QQ))
352 356
         
353 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 359
             nt = np.shape(tg)[0]
356 360
             ntq = nt*nq
357 361
         

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

@@ -1,6 +1,10 @@
1 1
 from __future__ import division
2 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 8
 from scipy.sparse import eye as seye
5 9
 import pylab 
6 10
 import pprint 

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

@@ -1408,16 +1408,16 @@ class GMRDataProcessor(SNMRDataProcessor):
1408 1408
                 ax2 = axes[2*ichan+1] 
1409 1409
                 
1410 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 1413
                     #im1 = ax1.matshow(self.GATED[chan]["RE"], cmap=dcmap, vmin=-vmax1, vmax=vmax1, aspect='auto')
1414 1414
                     #im2 = ax2.matshow(self.GATED[chan]["IM"], cmap=dcmap, vmin=-vmax2, vmax=vmax2, aspect='auto')
1415 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 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 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 1421
                     #XS = self.bootstrap_sigma(pulse, chan)
1422 1422
                     #im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["NR"], cmap=cmap, vmin=-vmax2, vmax=vmax2)
1423 1423
                     # bootstrap resample

+ 1
- 1
akvo/tressel/nonlinearinv.py Näytä tiedosto

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

+ 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.7.2', 
24
+      version='1.7.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