Browse Source

more intuitive file selection in kernel and inversion

tags/1.6.1
Trevor Irons 5 years ago
parent
commit
d73806348f
2 changed files with 253 additions and 71 deletions
  1. 67
    9
      akvo/gui/akvoGUI.py
  2. 186
    62
      akvo/gui/main.ui

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

142
         self.ui.calcQGO.pressed.connect( self.calcQ )
142
         self.ui.calcQGO.pressed.connect( self.calcQ )
143
         self.ui.FDSmartStackGO.pressed.connect( self.FDSmartStack )
143
         self.ui.FDSmartStackGO.pressed.connect( self.FDSmartStack )
144
         self.ui.harmonicGO.pressed.connect( self.harmonicModel )       
144
         self.ui.harmonicGO.pressed.connect( self.harmonicModel )       
145
+        
146
+        self.ui.K0Data.pressed.connect( self.K0DataSelect )       
147
+        
148
+        self.ui.invDataButton.pressed.connect( self.invDataSelect )       
149
+        self.ui.invKernelButton.pressed.connect( self.invKernelSelect )       
145
 
150
 
146
         self.ui.f0K1Spin.valueChanged.connect( self.LCDHarmonics )
151
         self.ui.f0K1Spin.valueChanged.connect( self.LCDHarmonics )
147
         self.ui.f0KNSpin.valueChanged.connect( self.LCDHarmonics )
152
         self.ui.f0KNSpin.valueChanged.connect( self.LCDHarmonics )
318
             self.ui.ProcTabs.removeTab(0)    
323
             self.ui.ProcTabs.removeTab(0)    
319
             self.ui.ProcTabs.removeTab(0)    
324
             self.ui.ProcTabs.removeTab(0)    
320
     
325
     
326
+    def invDataSelect(self):
327
+        try:
328
+            with open('.akvo.last.path') as f: 
329
+                fpath = f.readline()  
330
+                pass
331
+        except IOError as e:
332
+            fpath = '.'
333
+        
334
+        self.akvoDataFile = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
335
+        self.ui.dataText.clear()   
336
+        self.ui.dataText.append( self.akvoDataFile )   
337
+    
338
+    def K0DataSelect(self):
339
+        try:
340
+            with open('.akvo.last.path') as f: 
341
+                fpath = f.readline()  
342
+                pass
343
+        except IOError as e:
344
+            fpath = '.'
345
+        
346
+        self.K0akvoDataFile = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
347
+        self.ui.K0DataText.clear()   
348
+        self.ui.K0DataText.append( self.K0akvoDataFile )  
349
+
350
+        # populate combo box with loops 
351
+
352
+        with open(self.K0akvoDataFile) as f:
353
+            parse = yaml.load( f, Loader=yaml.Loader )
354
+        
355
+        self.ui.txListWidget.clear()
356
+        self.ui.rxListWidget.clear()
357
+        for loop in parse.META["Loops"]:
358
+            print(loop)
359
+            self.ui.txListWidget.addItem( parse.META["Loops"][loop] )
360
+            self.ui.rxListWidget.addItem( parse.META["Loops"][loop] )
361
+            
362
+        self.ui.txListWidget.setCurrentRow(0)
363
+        self.ui.rxListWidget.setCurrentRow(0)
364
+         
365
+ 
366
+    def invKernelSelect(self):
367
+        try:
368
+            with open('.akvo.last.path') as f: 
369
+                fpath = f.readline()  
370
+                pass
371
+        except IOError as e:
372
+            fpath = '.'
373
+        
374
+        self.K0file = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Kernel File', fpath, r"Akvo kernels (*.yml)")[0]
375
+        self.ui.kernelText.clear()   
376
+        self.ui.kernelText.append(self.K0file)   
377
+    
321
     def QTInv(self):
378
     def QTInv(self):
379
+    
322
         print("Big RED INVERT BUTTON")
380
         print("Big RED INVERT BUTTON")
323
         
381
         
324
         try:
382
         try:
328
         except IOError as e:
386
         except IOError as e:
329
             fpath = '.'
387
             fpath = '.'
330
         
388
         
331
-        akvoDatafile = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
332
-        K0file = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Kernel File', fpath, r"Akvo kernels (*.yml)")[0]
389
+        #K0file = self.ui.kernelText.text()
390
+        #akvoDataFile = self.ui.dataText.text()   
333
 
391
 
334
         T2lo = self.ui.T2low.value()
392
         T2lo = self.ui.T2low.value()
335
         T2hi = self.ui.T2hi.value()
393
         T2hi = self.ui.T2hi.value()
336
         NT2 = self.ui.NT2.value()
394
         NT2 = self.ui.NT2.value()
337
         dataChan = self.ui.invChan.currentText()
395
         dataChan = self.ui.invChan.currentText()
338
-       
339
 
396
 
340
         t2Obj = self.ui.T2Objective.currentText()
397
         t2Obj = self.ui.T2Objective.currentText()
341
         depthObj = self.ui.depthObjective.currentText()
398
         depthObj = self.ui.depthObjective.currentText()
344
         invDict = dict()
401
         invDict = dict()
345
         invDict["data"] = dict()
402
         invDict["data"] = dict()
346
         invDict["data"] = dict() 
403
         invDict["data"] = dict() 
347
-        invDict["data"][akvoDatafile] = dict()
348
-        invDict["data"][akvoDatafile]["channels"] = [dataChan,]
349
-        invDict["K0"] = [K0file,]
404
+        invDict["data"][self.akvoDataFile] = dict()
405
+        invDict["data"][self.akvoDataFile]["channels"] = [dataChan,]
406
+        invDict["K0"] = [self.K0file,]
350
         invDict["T2Bins"] = dict()
407
         invDict["T2Bins"] = dict()
351
         invDict["T2Bins"]["low"] = T2lo
408
         invDict["T2Bins"]["low"] = T2lo
352
         invDict["T2Bins"]["high"] = T2hi
409
         invDict["T2Bins"]["high"] = T2hi
375
         except IOError as e:
432
         except IOError as e:
376
             fpath = '.'
433
             fpath = '.'
377
 
434
 
378
-        akvoData = QtWidgets.QFileDialog.getOpenFileName(self, 'Open Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
379
-        txCoil = QtWidgets.QFileDialog.getOpenFileName(self, 'Open Tx File', fpath, r"Akvo datafiles (*.yaml, *.yml)")[0] 
435
+        #self.K0akvoDataFile = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
436
+        #akvoData = QtWidgets.QFileDialog.getOpenFileName(self, 'Open Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
437
+        txCoil = self.ui.txListWidget.currentItem().text() 
380
         saveStr = QtWidgets.QFileDialog.getSaveFileName(self, "Save kernel as", fpath, r"Merlin KernelV0 (*.yml)")[0] 
438
         saveStr = QtWidgets.QFileDialog.getSaveFileName(self, "Save kernel as", fpath, r"Merlin KernelV0 (*.yml)")[0] 
381
 
439
 
382
         intDict = dict()
440
         intDict = dict()
428
         
486
         
429
         callBox.ui = Ui_callScript()
487
         callBox.ui = Ui_callScript()
430
         callBox.ui.setupUi( callBox )
488
         callBox.ui.setupUi( callBox )
431
-        callBox.setupCB( akvoData, txCoil, "kparams.yml", saveStr  )
489
+        callBox.setupCB( self.K0akvoDataFile, txCoil, "kparams.yml", saveStr  )
432
         
490
         
433
         callBox.exec_()
491
         callBox.exec_()
434
         callBox.show()
492
         callBox.show()

+ 186
- 62
akvo/gui/main.ui View File

711
          <x>0</x>
711
          <x>0</x>
712
          <y>0</y>
712
          <y>0</y>
713
          <width>537</width>
713
          <width>537</width>
714
-         <height>982</height>
714
+         <height>999</height>
715
         </rect>
715
         </rect>
716
        </property>
716
        </property>
717
        <property name="sizePolicy">
717
        <property name="sizePolicy">
3688
                <item>
3688
                <item>
3689
                 <widget class="QTableWidget" name="layerTableWidget">
3689
                 <widget class="QTableWidget" name="layerTableWidget">
3690
                  <property name="toolTip">
3690
                  <property name="toolTip">
3691
-                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This table is used to enter coil geometries the format is as follows: each row specifies a single point on a coil. The first column is the coil index (using the GMR channel is useful), the next three colums specify the point in Northing, Easting, and Elevation. These can either be local coordinates or global ones. The final column specifies the loop radius if it is a circle or figure 8, for non circular or figure 8 loops leave this column blank. For figure-8 loops the coils do not need to be touching (see Irons and Kass, 2017). If a given index has 1 row it will be a circular loop, two rows will be a figure 8, and more than that will be a polygonal representation of the points, linearlly interpolated between them. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
3691
+                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This table is used to enter a resistivity model. For each layer the top and bottom interfaces should be specified in m, z is positive down. The top layer must begin at 0. The bottom layer is infinite and should not have a bottom specified. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
3692
+                 </property>
3693
+                </widget>
3694
+               </item>
3695
+              </layout>
3696
+             </widget>
3697
+            </item>
3698
+            <item>
3699
+             <widget class="QGroupBox" name="groupBox_7">
3700
+              <property name="minimumSize">
3701
+               <size>
3702
+                <width>0</width>
3703
+                <height>100</height>
3704
+               </size>
3705
+              </property>
3706
+              <property name="title">
3707
+               <string>Align with Akvo processed dataset</string>
3708
+              </property>
3709
+              <layout class="QGridLayout" name="gridLayout_20">
3710
+               <item row="2" column="0">
3711
+                <widget class="QLabel" name="label_84">
3712
+                 <property name="text">
3713
+                  <string>Rx</string>
3714
+                 </property>
3715
+                </widget>
3716
+               </item>
3717
+               <item row="1" column="0">
3718
+                <widget class="QLabel" name="label_83">
3719
+                 <property name="text">
3720
+                  <string>Tx</string>
3721
+                 </property>
3722
+                </widget>
3723
+               </item>
3724
+               <item row="0" column="0">
3725
+                <widget class="QPushButton" name="K0Data">
3726
+                 <property name="text">
3727
+                  <string>Data file</string>
3728
+                 </property>
3729
+                </widget>
3730
+               </item>
3731
+               <item row="0" column="2">
3732
+                <widget class="QTextEdit" name="K0DataText">
3733
+                 <property name="maximumSize">
3734
+                  <size>
3735
+                   <width>16777215</width>
3736
+                   <height>60</height>
3737
+                  </size>
3738
+                 </property>
3739
+                 <property name="font">
3740
+                  <font>
3741
+                   <pointsize>8</pointsize>
3742
+                   <italic>true</italic>
3743
+                  </font>
3744
+                 </property>
3745
+                </widget>
3746
+               </item>
3747
+               <item row="1" column="1" colspan="2">
3748
+                <widget class="QListWidget" name="txListWidget">
3749
+                 <property name="maximumSize">
3750
+                  <size>
3751
+                   <width>16777215</width>
3752
+                   <height>70</height>
3753
+                  </size>
3754
+                 </property>
3755
+                 <property name="alternatingRowColors">
3756
+                  <bool>true</bool>
3757
+                 </property>
3758
+                </widget>
3759
+               </item>
3760
+               <item row="2" column="1" colspan="2">
3761
+                <widget class="QListWidget" name="rxListWidget">
3762
+                 <property name="maximumSize">
3763
+                  <size>
3764
+                   <width>16777215</width>
3765
+                   <height>70</height>
3766
+                  </size>
3767
+                 </property>
3768
+                 <property name="alternatingRowColors">
3769
+                  <bool>true</bool>
3692
                  </property>
3770
                  </property>
3693
                 </widget>
3771
                 </widget>
3694
                </item>
3772
                </item>
4120
                <string>QT Inversion</string>
4198
                <string>QT Inversion</string>
4121
               </property>
4199
               </property>
4122
               <layout class="QGridLayout" name="gridLayout_19">
4200
               <layout class="QGridLayout" name="gridLayout_19">
4123
-               <item row="5" column="0" colspan="2">
4124
-                <widget class="QPushButton" name="invertButton">
4125
-                 <property name="styleSheet">
4126
-                  <string notr="true">#invertButton {
4127
-font-size:29pt;
4128
-font-weight: bold;
4129
-color: white;
4130
-background: red;
4131
-}</string>
4132
-                 </property>
4133
-                 <property name="text">
4134
-                  <string>Invert</string>
4135
-                 </property>
4136
-                </widget>
4137
-               </item>
4138
-               <item row="4" column="0">
4139
-                <widget class="QLabel" name="label_81">
4140
-                 <property name="text">
4141
-                  <string>initial alpha </string>
4142
-                 </property>
4143
-                </widget>
4144
-               </item>
4145
-               <item row="4" column="1">
4146
-                <widget class="QSpinBox" name="initialAlpha">
4147
-                 <property name="maximum">
4148
-                  <number>10000000</number>
4149
-                 </property>
4150
-                 <property name="value">
4151
-                  <number>1000000</number>
4152
-                 </property>
4153
-                </widget>
4154
-               </item>
4155
-               <item row="1" column="0">
4156
-                <widget class="QLabel" name="label_79">
4157
-                 <property name="text">
4158
-                  <string>Data channel</string>
4159
-                 </property>
4160
-                </widget>
4161
-               </item>
4162
                <item row="2" column="1">
4201
                <item row="2" column="1">
4163
-                <widget class="QComboBox" name="T2Objective">
4202
+                <widget class="QComboBox" name="invChan">
4164
                  <item>
4203
                  <item>
4165
                   <property name="text">
4204
                   <property name="text">
4166
-                   <string>Smallest</string>
4205
+                   <string>Chan. 1</string>
4167
                   </property>
4206
                   </property>
4168
                  </item>
4207
                  </item>
4169
                  <item>
4208
                  <item>
4170
                   <property name="text">
4209
                   <property name="text">
4171
-                   <string>Smoothest</string>
4210
+                   <string>Chan. 2</string>
4172
                   </property>
4211
                   </property>
4173
                  </item>
4212
                  </item>
4174
                  <item>
4213
                  <item>
4175
                   <property name="text">
4214
                   <property name="text">
4176
-                   <string>Both</string>
4215
+                   <string>Chan. 3</string>
4216
+                  </property>
4217
+                 </item>
4218
+                 <item>
4219
+                  <property name="text">
4220
+                   <string>Chan. 4</string>
4177
                   </property>
4221
                   </property>
4178
                  </item>
4222
                  </item>
4179
                 </widget>
4223
                 </widget>
4180
                </item>
4224
                </item>
4181
-               <item row="1" column="1">
4182
-                <widget class="QComboBox" name="invChan">
4225
+               <item row="4" column="1">
4226
+                <widget class="QComboBox" name="depthObjective">
4183
                  <item>
4227
                  <item>
4184
                   <property name="text">
4228
                   <property name="text">
4185
-                   <string>Chan. 1</string>
4229
+                   <string>Smallest</string>
4186
                   </property>
4230
                   </property>
4187
                  </item>
4231
                  </item>
4232
+                </widget>
4233
+               </item>
4234
+               <item row="3" column="1">
4235
+                <widget class="QComboBox" name="T2Objective">
4188
                  <item>
4236
                  <item>
4189
                   <property name="text">
4237
                   <property name="text">
4190
-                   <string>Chan. 2</string>
4238
+                   <string>Smallest</string>
4191
                   </property>
4239
                   </property>
4192
                  </item>
4240
                  </item>
4193
                  <item>
4241
                  <item>
4194
                   <property name="text">
4242
                   <property name="text">
4195
-                   <string>Chan. 3</string>
4243
+                   <string>Smoothest</string>
4196
                   </property>
4244
                   </property>
4197
                  </item>
4245
                  </item>
4198
                  <item>
4246
                  <item>
4199
                   <property name="text">
4247
                   <property name="text">
4200
-                   <string>Chan. 4</string>
4248
+                   <string>Both</string>
4201
                   </property>
4249
                   </property>
4202
                  </item>
4250
                  </item>
4203
                 </widget>
4251
                 </widget>
4204
                </item>
4252
                </item>
4205
-               <item row="2" column="0">
4253
+               <item row="3" column="0">
4206
                 <widget class="QLabel" name="label_80">
4254
                 <widget class="QLabel" name="label_80">
4207
                  <property name="text">
4255
                  <property name="text">
4208
                   <string>T2* model objective</string>
4256
                   <string>T2* model objective</string>
4209
                  </property>
4257
                  </property>
4210
                 </widget>
4258
                 </widget>
4211
                </item>
4259
                </item>
4212
-               <item row="3" column="1">
4213
-                <widget class="QComboBox" name="depthObjective">
4214
-                 <item>
4215
-                  <property name="text">
4216
-                   <string>Smallest</string>
4217
-                  </property>
4218
-                 </item>
4219
-                </widget>
4220
-               </item>
4221
-               <item row="3" column="0">
4260
+               <item row="4" column="0">
4222
                 <widget class="QLabel" name="label_82">
4261
                 <widget class="QLabel" name="label_82">
4223
                  <property name="text">
4262
                  <property name="text">
4224
                   <string>Depth model objective</string>
4263
                   <string>Depth model objective</string>
4225
                  </property>
4264
                  </property>
4226
                 </widget>
4265
                 </widget>
4227
                </item>
4266
                </item>
4267
+               <item row="0" column="1">
4268
+                <widget class="QTextBrowser" name="dataText">
4269
+                 <property name="maximumSize">
4270
+                  <size>
4271
+                   <width>16777215</width>
4272
+                   <height>60</height>
4273
+                  </size>
4274
+                 </property>
4275
+                 <property name="font">
4276
+                  <font>
4277
+                   <pointsize>8</pointsize>
4278
+                   <italic>true</italic>
4279
+                  </font>
4280
+                 </property>
4281
+                </widget>
4282
+               </item>
4283
+               <item row="6" column="0" colspan="2">
4284
+                <widget class="QPushButton" name="invertButton">
4285
+                 <property name="styleSheet">
4286
+                  <string notr="true">#invertButton {
4287
+font-size:29pt;
4288
+font-weight: bold;
4289
+color: white;
4290
+background: red;
4291
+}</string>
4292
+                 </property>
4293
+                 <property name="text">
4294
+                  <string>Invert</string>
4295
+                 </property>
4296
+                </widget>
4297
+               </item>
4298
+               <item row="2" column="0">
4299
+                <widget class="QLabel" name="label_79">
4300
+                 <property name="text">
4301
+                  <string>Data channel</string>
4302
+                 </property>
4303
+                </widget>
4304
+               </item>
4305
+               <item row="0" column="0">
4306
+                <widget class="QPushButton" name="invDataButton">
4307
+                 <property name="text">
4308
+                  <string>Select Data</string>
4309
+                 </property>
4310
+                </widget>
4311
+               </item>
4312
+               <item row="5" column="0">
4313
+                <widget class="QLabel" name="label_81">
4314
+                 <property name="text">
4315
+                  <string>initial alpha </string>
4316
+                 </property>
4317
+                </widget>
4318
+               </item>
4319
+               <item row="5" column="1">
4320
+                <widget class="QSpinBox" name="initialAlpha">
4321
+                 <property name="maximum">
4322
+                  <number>10000000</number>
4323
+                 </property>
4324
+                 <property name="value">
4325
+                  <number>1000000</number>
4326
+                 </property>
4327
+                </widget>
4328
+               </item>
4329
+               <item row="1" column="0">
4330
+                <widget class="QPushButton" name="invKernelButton">
4331
+                 <property name="text">
4332
+                  <string>Select Kernel</string>
4333
+                 </property>
4334
+                </widget>
4335
+               </item>
4336
+               <item row="1" column="1">
4337
+                <widget class="QTextEdit" name="kernelText">
4338
+                 <property name="maximumSize">
4339
+                  <size>
4340
+                   <width>16777215</width>
4341
+                   <height>60</height>
4342
+                  </size>
4343
+                 </property>
4344
+                 <property name="font">
4345
+                  <font>
4346
+                   <pointsize>8</pointsize>
4347
+                   <italic>true</italic>
4348
+                  </font>
4349
+                 </property>
4350
+                </widget>
4351
+               </item>
4228
               </layout>
4352
               </layout>
4229
              </widget>
4353
              </widget>
4230
             </item>
4354
             </item>

Loading…
Cancel
Save