Browse Source

More tweaks to the GUI for better use experience.

tags/1.6.1
Trevor Irons 5 years ago
parent
commit
2a0f40eb3c
4 changed files with 27 additions and 22 deletions
  1. 9
    6
      akvo/gui/akvoGUI.py
  2. 0
    3
      akvo/gui/main.ui
  3. 5
    4
      akvo/tressel/harmonic.py
  4. 13
    9
      akvo/tressel/mrsurvey.py

+ 9
- 6
akvo/gui/akvoGUI.py View File

1024
         self.ui.BandPassBox.setEnabled(False)
1024
         self.ui.BandPassBox.setEnabled(False)
1025
         self.ui.downSampleGroupBox.setEnabled(False)
1025
         self.ui.downSampleGroupBox.setEnabled(False)
1026
         self.ui.windowFilterGroupBox.setEnabled(False)
1026
         self.ui.windowFilterGroupBox.setEnabled(False)
1027
+        self.ui.harmonicBox.setEnabled(False)
1027
 #        self.ui.despikeGroupBox.setEnabled(False)
1028
 #        self.ui.despikeGroupBox.setEnabled(False)
1028
         self.ui.adaptBox.setEnabled(False)
1029
         self.ui.adaptBox.setEnabled(False)
1029
         self.ui.adaptFDBox.setEnabled(False)
1030
         self.ui.adaptFDBox.setEnabled(False)
1069
         # Harmonic
1070
         # Harmonic
1070
         self.ui.harmonicBox.setEnabled(True)
1071
         self.ui.harmonicBox.setEnabled(True)
1071
         self.ui.harmonicBox.setChecked(True)
1072
         self.ui.harmonicBox.setChecked(True)
1073
+        self.LCDHarmonics()
1074
+        self.LCDHarmonics2()
1072
 
1075
 
1073
         # sum group box
1076
         # sum group box
1074
         try:
1077
         try:
1075
             if len(self.dataChan) > 1:
1078
             if len(self.dataChan) > 1:
1076
                 self.ui.sumDataBox.setEnabled(True)
1079
                 self.ui.sumDataBox.setEnabled(True)
1077
-                self.ui.sumDataBox.setChecked(True)
1080
+                self.ui.sumDataBox.setChecked(False)
1078
         except:
1081
         except:
1079
             pass
1082
             pass
1080
 
1083
 
1157
                 self.YamlNode.Processing["Harmonic modelling"]["f1Ks"] = str( self.ui.f1KsSpin.value() )
1160
                 self.YamlNode.Processing["Harmonic modelling"]["f1Ks"] = str( self.ui.f1KsSpin.value() )
1158
                 self.YamlNode.Processing["Harmonic modelling"]["f1"] = str( self.ui.f1Spin.value() )
1161
                 self.YamlNode.Processing["Harmonic modelling"]["f1"] = str( self.ui.f1Spin.value() )
1159
             self.Log()
1162
             self.Log()
1160
-        else:
1161
-            err_msg = "Harmonic modelling noise cancellation has already been applied!"
1162
-            reply = QtWidgets.QMessageBox.critical(self, 'Error', 
1163
-                err_msg) 
1164
-            return 
1163
+        #else:
1164
+        #    err_msg = "Harmonic modelling noise cancellation has already been applied!"
1165
+        #    reply = QtWidgets.QMessageBox.critical(self, 'Error', 
1166
+        #        err_msg) 
1167
+        #    return 
1165
 
1168
 
1166
         self.lock("harmonic noise modelling")
1169
         self.lock("harmonic noise modelling")
1167
 
1170
 

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

1154
                </item>
1154
                </item>
1155
                <item row="4" column="2">
1155
                <item row="4" column="2">
1156
                 <widget class="QLCDNumber" name="lcdH1F">
1156
                 <widget class="QLCDNumber" name="lcdH1F">
1157
-                 <property name="enabled">
1158
-                  <bool>false</bool>
1159
-                 </property>
1160
                  <property name="styleSheet">
1157
                  <property name="styleSheet">
1161
                   <string notr="true">#lcdH1F {
1158
                   <string notr="true">#lcdH1F {
1162
 color: green;
1159
 color: green;

+ 5
- 4
akvo/tressel/harmonic.py View File

40
 def minHarmonic(sN, fs, t, f0, k1, kN, ks):
40
 def minHarmonic(sN, fs, t, f0, k1, kN, ks):
41
     
41
     
42
     # CG, BFGS, Newton-CG, L-BFGS-B, TNC, SLSQP, dogleg, trust-ncg, trust-krylov, trust-exact and trust-constr
42
     # CG, BFGS, Newton-CG, L-BFGS-B, TNC, SLSQP, dogleg, trust-ncg, trust-krylov, trust-exact and trust-constr
43
-    #res = minimize(harmonicNorm, np.array((f0)), args=(sN, fs, t, k1, kN, ks), jac='2-point', method='BFGS') # hess=None, bounds=None )
43
+    res = minimize(harmonicNorm, np.array((f0)), args=(sN, fs, t, k1, kN, ks), jac='2-point', method='BFGS') # hess=None, bounds=None )
44
     
44
     
45
     #############
45
     #############
46
     # Reduced N #
46
     # Reduced N #
51
     ########## 
51
     ########## 
52
     # Bounds #
52
     # Bounds #
53
     ##########
53
     ##########
54
-    print("bounded search for f0", f0)
55
-    bnds = ( (f0-0.125, f0+0.125), )
54
+    #print("bounded search for f0 with 10", f0)
55
+    #bnds = ( (f0-0.125, f0+0.125), )
56
     #print("len f0", len( [f0,] ))
56
     #print("len f0", len( [f0,] ))
57
     #print("len bnds", len(bnds) )
57
     #print("len bnds", len(bnds) )
58
-    res = minimize(harmonicNorm, (f0,), args=(sN, fs, t, k1, kN, ks), jac='2-point', method='L-BFGS-B', bounds=bnds ) # hess=None, bounds=None )
58
+    #res = minimize(harmonicNorm, (f0,), args=(sN, fs, t, k1, kN, ks), jac='2-point', method='L-BFGS-B', bounds=bnds ) # hess=None, bounds=None )
59
+    #res = minimize(harmonicNorm, (f0,), args=(sN, fs, t, k1, 10, ks), jac='2-point', method='L-BFGS-B', bounds=bnds ) # hess=None, bounds=None )
59
     
60
     
60
     #print(res)
61
     #print(res)
61
     #print ( "guess", guessf0(  harmonicEuler(sN, fs, t, res.x[0], k1, kN, ks), fs  ) )
62
     #print ( "guess", guessf0(  harmonicEuler(sN, fs, t, res.x[0], k1, kN, ks), fs  ) )

+ 13
- 9
akvo/tressel/mrsurvey.py View File

2002
         self.samp /= dec
2002
         self.samp /= dec
2003
         self.dt   = 1./self.samp       
2003
         self.dt   = 1./self.samp       
2004
 
2004
 
2005
-        if truncate:
2006
-            itrunc = (int)( 1e-3*truncate*self.samp )
2007
         iFID = 0  
2005
         iFID = 0  
2008
         for pulse in self.DATADICT["PULSES"]:
2006
         for pulse in self.DATADICT["PULSES"]:
2007
+            RSTIMES = self.DATADICT[pulse]["TIMES"][::dec]
2008
+            if truncate:
2009
+                itrunc = (int)( 1e-3*truncate*self.samp )
2010
+                RSTIMES = RSTIMES[0:itrunc]
2009
             for ipm in range(self.DATADICT["nPulseMoments"]):
2011
             for ipm in range(self.DATADICT["nPulseMoments"]):
2010
                 for istack in self.DATADICT["stacks"]:
2012
                 for istack in self.DATADICT["stacks"]:
2011
                     if plot:
2013
                     if plot:
2014
                         # trim off indices that don't divide evenly
2016
                         # trim off indices that don't divide evenly
2015
                         ndi = np.shape(self.DATADICT[pulse][ichan][ipm][istack])[0]%dec
2017
                         ndi = np.shape(self.DATADICT[pulse][ichan][ipm][istack])[0]%dec
2016
                         if ndi:
2018
                         if ndi:
2017
-                            [self.DATADICT[pulse][ichan][ipm][istack], RSTIMES] = signal.resample(self.DATADICT[pulse][ichan][ipm][istack][0:-ndi],\
2018
-                                         len(self.DATADICT[pulse][ichan][ipm][istack][0:-ndi])//dec,\
2019
-                                         self.DATADICT[pulse]["TIMES"][0:-ndi], window='hamm')
2019
+                            #[self.DATADICT[pulse][ichan][ipm][istack], RSTIMES] = signal.resample(self.DATADICT[pulse][ichan][ipm][istack][0:-ndi],\
2020
+                            #             len(self.DATADICT[pulse][ichan][ipm][istack][0:-ndi])//dec,\
2021
+                            #             self.DATADICT[pulse]["TIMES"][0:-ndi], window='hamm')
2022
+                            self.DATADICT[pulse][ichan][ipm][istack] = signal.decimate(self.DATADICT[pulse][ichan][ipm][istack], dec, n=None, ftype='iir', zero_phase=True)
2020
                         else:
2023
                         else:
2021
-                            [self.DATADICT[pulse][ichan][ipm][istack], RSTIMES] = signal.resample(self.DATADICT[pulse][ichan][ipm][istack],\
2022
-                                         len(self.DATADICT[pulse][ichan][ipm][istack])//dec,\
2023
-                                         self.DATADICT[pulse]["TIMES"], window='hamm')
2024
+                            #[self.DATADICT[pulse][ichan][ipm][istack], RSTIMES] = signal.resample(self.DATADICT[pulse][ichan][ipm][istack],\
2025
+                            #             len(self.DATADICT[pulse][ichan][ipm][istack])//dec,\
2026
+                            #             self.DATADICT[pulse]["TIMES"], window='hamm')
2027
+                            self.DATADICT[pulse][ichan][ipm][istack] = signal.decimate(self.DATADICT[pulse][ichan][ipm][istack], dec, n=None, ftype='iir', zero_phase=True)
2024
                         if truncate:
2028
                         if truncate:
2025
                             self.DATADICT[pulse][ichan][ipm][istack] = self.DATADICT[pulse][ichan][ipm][istack][0:itrunc]
2029
                             self.DATADICT[pulse][ichan][ipm][istack] = self.DATADICT[pulse][ichan][ipm][istack][0:itrunc]
2026
-                            RSTIMES = RSTIMES[0:itrunc]
2030
+
2027
                     if plot:
2031
                     if plot:
2028
                         for ichan in self.DATADICT[pulse]["chan"]:
2032
                         for ichan in self.DATADICT[pulse]["chan"]:
2029
                             canvas.ax2.plot( RSTIMES, 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
2033
                             canvas.ax2.plot( RSTIMES, 1e9*self.DATADICT[pulse][ichan][ipm][istack], \

Loading…
Cancel
Save