Sfoglia il codice sorgente

Edits to fix plotting when numerous cycles are present (interleaves) in GMR speak. Prior plotting assumed monotonically decreasing pulse moments, which is not always the case

tags/1.6.1
Trevor Irons 5 anni fa
parent
commit
de0e5e7cc4
3 ha cambiato i file con 54 aggiunte e 21 eliminazioni
  1. 8
    2
      akvo/gui/akvoGUI.py
  2. 45
    18
      akvo/tressel/mrsurvey.py
  3. 1
    1
      setup.py

+ 8
- 2
akvo/gui/akvoGUI.py Vedi File

@@ -662,10 +662,16 @@ class ApplicationWindow(QtWidgets.QMainWindow):
662 662
                 #    print ("stack q", self.RAWDataProc.DATADICT[pulse]["Q"][ipm,istack-1])
663 663
                 qq.append(np.mean(    self.RAWDataProc.DATADICT[pulse]["Q"][ipm,:]) )
664 664
                 qv.append(np.std(     self.RAWDataProc.DATADICT[pulse]["Q"][ipm,:]/self.RAWDataProc.pulseLength[ip] ))
665
+            qq = np.array(qq)
666
+            qv = np.array(qv)
667
+            iQ = np.argsort(np.array(qq))
668
+            qq = np.array(qq)[iQ]
669
+            print("qq", qq, iQ)
670
+            qv = np.array(qv)[iQ]
665 671
             INFO["Pulses"][pulse] = {}
666 672
             INFO["Pulses"][pulse]["units"] = "A"
667
-            INFO["Pulses"][pulse]["current"] = VectorXr(np.array(qq)/self.RAWDataProc.pulseLength[ip])
668
-            INFO["Pulses"][pulse]["variance"] = VectorXr(np.array(qv))
673
+            INFO["Pulses"][pulse]["current"] = VectorXr(qq/self.RAWDataProc.pulseLength[ip])
674
+            INFO["Pulses"][pulse]["variance"] = VectorXr(qv)
669 675
             ip += 1
670 676
 
671 677
         # Data

+ 45
- 18
akvo/tressel/mrsurvey.py Vedi File

@@ -1004,6 +1004,9 @@ class GMRDataProcessor(SNMRDataProcessor):
1004 1004
                 NR[pulse][chan] = np.zeros( (self.DATADICT["nPulseMoments"],  len(self.DATADICT[pulse]["TIMES"])-clip )  )
1005 1005
                 RE[pulse][chan] = np.zeros( (self.DATADICT["nPulseMoments"],  len(self.DATADICT[pulse]["TIMES"])-clip )  )
1006 1006
                 IM[pulse][chan] = np.zeros( (self.DATADICT["nPulseMoments"],  len(self.DATADICT[pulse]["TIMES"])-clip )  )
1007
+        
1008
+                #QQ = np.average(self.DATADICT[pulse]["Q"], axis=1 )
1009
+                #for ipm in np.argsort(QQ):
1007 1010
                 for ipm in range(0, self.DATADICT["nPulseMoments"]):
1008 1011
                     #t = self.DATADICT[pulse]["TIMES"] - self.DATADICT[pulse]["PULSE_TIMES"][-1]
1009 1012
                     xn = self.DATADICT["stack"][pulse][chan][ipm,:]
@@ -1040,7 +1043,7 @@ class GMRDataProcessor(SNMRDataProcessor):
1040 1043
                     self.progressTrigger.emit(percent)
1041 1044
                 ichan += 1
1042 1045
             self.DATADICT[pulse]["TIMES"] = self.DATADICT[pulse]["TIMES"][clip::]
1043
-
1046
+            
1044 1047
         self.DATADICT["CA"] = CA
1045 1048
         self.DATADICT["IP"] = IP
1046 1049
         self.DATADICT["NR"] = NR
@@ -1075,25 +1078,32 @@ class GMRDataProcessor(SNMRDataProcessor):
1075 1078
             time_sp =  1e3 * (self.DATADICT[pulse]["TIMES"] - self.DATADICT[pulse]["PULSE_TIMES"][-1] )
1076 1079
                 
1077 1080
             QQ = np.average(self.DATADICT[pulse]["Q"], axis=1 )
1078
- 
1081
+            iQ = np.argsort(QQ)
1082
+
1079 1083
             for chan in self.DATADICT[pulse]["chan"]: 
1080 1084
                 ax1 = axes[2*ichan  ]
1081 1085
                 ax2 = axes[2*ichan+1] # TODO fix hard coded number
1082
-                if phase == 0: # Re Im  
1083
-                    im1 = ax1.pcolormesh( time_sp, QQ, self.DATADICT["RE"][pulse][chan], cmap=dcmap, rasterized=True,\
1086
+                if phase == 0: # Re Im 
1087
+                    print("plot dog", np.shape(QQ), np.shape(self.DATADICT["RE"][pulse][chan]))
1088
+                    print("QQ", QQ) 
1089
+                    im1 = ax1.pcolormesh( time_sp, QQ[iQ], self.DATADICT["RE"][pulse][chan][iQ], cmap=dcmap, \
1084 1090
                          vmin=-self.DATADICT["REmax"][pulse] , vmax=self.DATADICT["REmax"][pulse] )
1085
-                    im2 = ax2.pcolormesh( time_sp, QQ, self.DATADICT["IM"][pulse][chan], cmap=dcmap, rasterized=True,\
1091
+                    im2 = ax2.pcolormesh( time_sp, QQ[iQ], self.DATADICT["IM"][pulse][chan][iQ], cmap=dcmap, \
1086 1092
                          vmin=-self.DATADICT["IMmax"][pulse], vmax=self.DATADICT["IMmax"][pulse]  )
1093
+                    #im1 = ax1.matshow( self.DATADICT["RE"][pulse][chan][iQ], cmap=dcmap, aspect='auto', \
1094
+                    #     vmin=-self.DATADICT["REmax"][pulse] , vmax=self.DATADICT["REmax"][pulse] )
1095
+                    #im2 = ax2.matshow( self.DATADICT["IM"][pulse][chan][iQ], cmap=dcmap, aspect='auto', \
1096
+                    #     vmin=-self.DATADICT["REmax"][pulse] , vmax=self.DATADICT["REmax"][pulse] )
1087 1097
                 if phase == 1: # Amp phase
1088
-                    im1 = ax1.pcolormesh( time_sp, QQ, self.DATADICT["CA"][pulse][chan], cmap=dcmap, rasterized=True,
1098
+                    im1 = ax1.pcolormesh( time_sp, QQ[iQ], self.DATADICT["CA"][pulse][chan][iQ], cmap=dcmap, \
1089 1099
                          vmin=-self.DATADICT["CAmax"][pulse] , vmax=self.DATADICT["CAmax"][pulse]  )
1090 1100
                     #im2 = ax2.pcolormesh( time_sp, QQ, self.DATADICT["IP"][pulse][chan], cmap=cmocean.cm.balance, rasterized=True,\
1091
-                    im2 = ax2.pcolormesh( time_sp, QQ, self.DATADICT["IP"][pulse][chan], cmap=cmocean.cm.delta, rasterized=True,\
1101
+                    im2 = ax2.pcolormesh( time_sp, QQ[iQ], self.DATADICT["IP"][pulse][chan][iQ], cmap=cmocean.cm.delta, \
1092 1102
                          vmin=-np.pi, vmax=np.pi)
1093 1103
                 if phase == 2: # CA NR
1094
-                    im1 = ax1.pcolormesh( time_sp, QQ, self.DATADICT["CA"][pulse][chan], cmap=dcmap, rasterized=True,\
1104
+                    im1 = ax1.pcolormesh( time_sp, QQ[iQ], self.DATADICT["CA"][pulse][chan][iQ], cmap=dcmap, \
1095 1105
                          vmin=-self.DATADICT["CAmax"][pulse] , vmax=self.DATADICT["CAmax"][pulse] )
1096
-                    im2 = ax2.pcolormesh( time_sp, QQ, self.DATADICT["NR"][pulse][chan], cmap=dcmap, rasterized=True,\
1106
+                    im2 = ax2.pcolormesh( time_sp, QQ[iQ], self.DATADICT["NR"][pulse][chan][iQ], cmap=dcmap, \
1097 1107
                          vmin=-self.DATADICT["NRmax"][pulse] , vmax=self.DATADICT["NRmax"][pulse] )
1098 1108
 #                     cb2 = canvas.fig.colorbar(im2, ax=ax2, format='%1.0e')
1099 1109
 #                     cb2.set_label("Noise residual (nV)", fontsize=8)
@@ -1154,7 +1164,10 @@ class GMRDataProcessor(SNMRDataProcessor):
1154 1164
         tick_locator2 = MaxNLocator(nbins=3)
1155 1165
         cb2 = canvas.fig.colorbar(im2, ax=axes[1::2], format='%1.0e', orientation='horizontal', shrink=.35, aspect=30, pad=.2)
1156 1166
         cb2.ax.tick_params(axis='both', which='major', labelsize=8)
1157
-        cb2.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
1167
+        if phase == 1: # Amp phase
1168
+            cb2.set_label(r"$\angle \mathcal{V}_N$", fontsize=8)
1169
+        else:
1170
+            cb2.set_label("$\mathcal{V}_N$ (nV)", fontsize=8)
1158 1171
 
1159 1172
 
1160 1173
         cb2.locator = tick_locator2
@@ -1176,12 +1189,13 @@ class GMRDataProcessor(SNMRDataProcessor):
1176 1189
         
1177 1190
         for pulse in self.DATADICT["PULSES"]:
1178 1191
             QQ = np.average(self.DATADICT[pulse]["Q"], axis=1 )
1192
+            iQ = np.argsort(QQ)
1179 1193
             ichan = 0
1180 1194
             for chan in self.DATADICT[pulse]["chan"]:
1181 1195
                 self.GATED[chan] = {}
1182 1196
                 for ipm in range(0, self.DATADICT["nPulseMoments"]):
1183
-
1184
-                    # Time since pulse rather than since record starts...
1197
+                #for ipm in iQ: 
1198
+                    # Time since pulse end rather than since record starts...
1185 1199
                     #if clip > 0:
1186 1200
                     #    time_sp =  1e3 * (self.DATADICT[pulse]["TIMES"][clip:] - self.DATADICT[pulse]["PULSE_TIMES"][-1] )
1187 1201
                     #else:
@@ -1190,12 +1204,13 @@ class GMRDataProcessor(SNMRDataProcessor):
1190 1204
                     #GT, GD, GTT, sig_stack, isum      = rotate.gateIntegrate( self.DATADICT["CA"][pulse][chan][ipm,:], time_sp, gpd, self.sigma[pulse][chan], 1.5 )
1191 1205
                     #GT2, GP, GTT, sig_stack_err, isum = rotate.gateIntegrate( self.DATADICT["NR"][pulse][chan][ipm,:], time_sp, gpd, self.sigma[pulse][chan], 1.5 ) 
1192 1206
                     
1193
-                    GT, GCA, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["CA"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 1.5 )
1194
-                    GT, GNR, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["NR"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 1.5 )
1195
-                    GT, GRE, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["RE"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 1.5 )
1196
-                    GT, GIM, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["IM"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 1.5 )
1197
-                    GT, GIP, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["IP"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 1.5 )
1207
+                    GT, GCA, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["CA"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 2 )
1208
+                    GT, GNR, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["NR"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 2 )
1209
+                    GT, GRE, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["RE"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 2 )
1210
+                    GT, GIM, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["IM"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 2 )
1211
+                    GT, GIP, GTT, sig_stack, isum  = rotate.gateIntegrate( self.DATADICT["IP"][pulse][chan][ipm], time_sp, gpd, self.sigma[pulse][chan], 2 )
1198 1212
                     
1213
+                    #if ipm == iQ[0]:
1199 1214
                     if ipm == 0:
1200 1215
                     #    self.GATED[chan]["DATA"]  = np.zeros( ( self.DATADICT["nPulseMoments"], len(GT)) )
1201 1216
                     #    self.GATED[chan]["ERR"]   = np.zeros( ( self.DATADICT["nPulseMoments"], len(GT)) )
@@ -1213,6 +1228,11 @@ class GMRDataProcessor(SNMRDataProcessor):
1213 1228
                     #self.GATED[chan]["SIGMA"][ipm] =  sig_stack #_err # GP.real
1214 1229
                     #self.GATED[chan]["ERR"][ipm] =  GP.real
1215 1230
                     
1231
+                    #self.GATED[chan]["CA"][iQ[ipm]] = GCA.real[clip:]
1232
+                    #self.GATED[chan]["NR"][iQ[ipm]] = GNR.real[clip:]
1233
+                    #self.GATED[chan]["RE"][iQ[ipm]] = GRE.real[clip:]
1234
+                    #self.GATED[chan]["IM"][iQ[ipm]] = GIM.real[clip:]
1235
+                    #self.GATED[chan]["IP"][iQ[ipm]] = GIP.real[clip:]
1216 1236
                     self.GATED[chan]["CA"][ipm] = GCA.real[clip:]
1217 1237
                     self.GATED[chan]["NR"][ipm] = GNR.real[clip:]
1218 1238
                     self.GATED[chan]["RE"][ipm] = GRE.real[clip:]
@@ -1223,9 +1243,14 @@ class GMRDataProcessor(SNMRDataProcessor):
1223 1243
                                        (float)(self.DATADICT["nPulseMoments"] * len(self.DATADICT[pulse]["chan"])))
1224 1244
                     self.progressTrigger.emit(percent)
1225 1245
 
1246
+                self.GATED[chan]["CA"] = self.GATED[chan]["CA"][iQ,:]
1247
+                self.GATED[chan]["NR"] = self.GATED[chan]["NR"][iQ,:]
1248
+                self.GATED[chan]["RE"] = self.GATED[chan]["RE"][iQ,:]
1249
+                self.GATED[chan]["IM"] = self.GATED[chan]["IM"][iQ,:]
1250
+                self.GATED[chan]["IP"] = self.GATED[chan]["IP"][iQ,:]
1226 1251
                 self.GATED[chan]["GTT"] = GTT[clip:]
1227 1252
                 self.GATED[chan]["GT"] = GT[clip:]
1228
-                self.GATED[chan]["QQ"] = QQ
1253
+                self.GATED[chan]["QQ"] = QQ[iQ]
1229 1254
                 ichan += 1
1230 1255
         self.doneTrigger.emit() 
1231 1256
 
@@ -1314,6 +1339,8 @@ class GMRDataProcessor(SNMRDataProcessor):
1314 1339
                 if phase == 0:
1315 1340
                     im1 = ax1.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["RE"], cmap=dcmap, vmin=-vmax1, vmax=vmax1)
1316 1341
                     im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["IM"], cmap=dcmap, vmin=-vmax2, vmax=vmax2)
1342
+                    #im1 = ax1.matshow(self.GATED[chan]["RE"], cmap=dcmap, vmin=-vmax1, vmax=vmax1, aspect='auto')
1343
+                    #im2 = ax2.matshow(self.GATED[chan]["IM"], cmap=dcmap, vmin=-vmax2, vmax=vmax2, aspect='auto')
1317 1344
                 elif phase == 1:
1318 1345
                     im1 = ax1.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["CA"], cmap=dcmap, vmin=-vmax1, vmax=vmax1)
1319 1346
                     im2 = ax2.pcolormesh(self.GATED[chan]["GTT"], self.GATED[chan]["QQ"], self.GATED[chan]["IP"], cmap=cmocean.cm.delta, vmin=-vmax2, vmax=vmax2)

+ 1
- 1
setup.py Vedi File

@@ -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.2.7',
24
+      version='1.2.8',
25 25
       description='Surface nuclear magnetic resonance workbench',
26 26
       long_description=long_description,
27 27
       long_description_content_type='text/markdown',

Loading…
Annulla
Salva