Преглед изворни кода

Support for transmitter (and receiver) arrays in kernel calculation

tags/1.6.1
Trevor Irons пре 5 година
родитељ
комит
1c1919ddea
4 измењених фајлова са 69 додато и 28 уклоњено
  1. 18
    3
      akvo/gui/akvoGUI.py
  2. 2
    2
      akvo/gui/callScript.py
  3. 18
    12
      akvo/gui/main.ui
  4. 31
    11
      akvo/tressel/calcAkvoKernel.py

+ 18
- 3
akvo/gui/akvoGUI.py Прегледај датотеку

@@ -441,7 +441,20 @@ class ApplicationWindow(QtWidgets.QMainWindow):
441 441
 
442 442
         #self.K0akvoDataFile = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
443 443
         #akvoData = QtWidgets.QFileDialog.getOpenFileName(self, 'Open Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
444
-        txCoil = self.ui.txListWidget.currentItem().text() 
444
+
445
+        txCoilList = self.ui.txListWidget.selectedItems() #currentItem().text() 
446
+        txCoils = []
447
+        for txCoil in txCoilList:
448
+            print("txCoil", txCoil.text())
449
+            txCoils.append(txCoil.text())
450
+        
451
+        rxCoilList = self.ui.txListWidget.selectedItems() #currentItem().text() 
452
+        rxCoils = []
453
+        for rxCoil in rxCoilList:
454
+            print("rxCoil", rxCoil.text())
455
+            rxCoils.append(rxCoil.text())
456
+
457
+
445 458
         saveStr = QtWidgets.QFileDialog.getSaveFileName(self, "Save kernel as", fpath, r"Merlin KernelV0 (*.yml)")[0] 
446 459
 
447 460
         intDict = dict()
@@ -459,6 +472,9 @@ class ApplicationWindow(QtWidgets.QMainWindow):
459 472
         intDict["maxLevel"] = self.ui.maxLevel.value()
460 473
         intDict["branchTol"] = self.ui.branchTol.value()
461 474
 
475
+        intDict["txCoils"] = txCoils
476
+        intDict["rxCoils"] = rxCoils
477
+
462 478
         # conductivity model... 
463 479
         #tops = self.ui.layerTableWidget.col(0)
464 480
         #print("Tops", tops)
@@ -488,12 +504,11 @@ class ApplicationWindow(QtWidgets.QMainWindow):
488 504
         kpo = open( "kparams.yml", 'w' )
489 505
         node.dump(intDict, kpo)
490 506
 
491
-
492 507
         callBox = callScript(  ) #QtWidgets.QDialog() 
493 508
         
494 509
         callBox.ui = Ui_callScript()
495 510
         callBox.ui.setupUi( callBox )
496
-        callBox.setupCB( self.K0akvoDataFile, txCoil, "kparams.yml", saveStr  )
511
+        callBox.setupCB( self.K0akvoDataFile, "kparams.yml", saveStr  )
497 512
         
498 513
         callBox.exec_()
499 514
         callBox.show()

+ 2
- 2
akvo/gui/callScript.py Прегледај датотеку

@@ -10,7 +10,7 @@ class callScript(QDialog):
10 10
     #def __init__(self):
11 11
     #    super().__init__()
12 12
     
13
-    def setupCB(self, akvoData, TxCoil, kernelParams, SaveStr):
13
+    def setupCB(self, akvoData, kernelParams, SaveStr):
14 14
 
15 15
         #QtGui.QWidget.__init__(self)
16 16
         #uic.loadUi('redirect.ui', self)
@@ -24,7 +24,7 @@ class callScript(QDialog):
24 24
 
25 25
         #print ('Starting process')
26 26
         #self.process.start('python', ['calcAkvoKernel.py', akvoData, TxCoil, SaveStr])
27
-        self.process.start('akvoK0', [ akvoData, TxCoil, kernelParams, SaveStr])
27
+        self.process.start('akvoK0', [ akvoData, kernelParams, SaveStr])
28 28
 
29 29
     def setupQTInv(self, params):
30 30
 

+ 18
- 12
akvo/gui/main.ui Прегледај датотеку

@@ -6,7 +6,7 @@
6 6
    <rect>
7 7
     <x>0</x>
8 8
     <y>0</y>
9
-    <width>1142</width>
9
+    <width>1230</width>
10 10
     <height>875</height>
11 11
    </rect>
12 12
   </property>
@@ -638,7 +638,7 @@ background: dark grey;
638 638
                 <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
639 639
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
640 640
 p, li { white-space: pre-wrap; }
641
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:12pt; font-weight:400; font-style:italic;&quot;&gt;
641
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:italic;&quot;&gt;
642 642
 &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Serif'; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
643 643
                </property>
644 644
               </widget>
@@ -710,8 +710,8 @@ background: dark grey;
710 710
         <rect>
711 711
          <x>0</x>
712 712
          <y>0</y>
713
-         <width>537</width>
714
-         <height>982</height>
713
+         <width>543</width>
714
+         <height>889</height>
715 715
         </rect>
716 716
        </property>
717 717
        <property name="sizePolicy">
@@ -3761,6 +3761,9 @@ background: dark grey;
3761 3761
                  <property name="alternatingRowColors">
3762 3762
                   <bool>true</bool>
3763 3763
                  </property>
3764
+                 <property name="selectionMode">
3765
+                  <enum>QAbstractItemView::MultiSelection</enum>
3766
+                 </property>
3764 3767
                 </widget>
3765 3768
                </item>
3766 3769
                <item row="2" column="1" colspan="2">
@@ -3774,6 +3777,9 @@ background: dark grey;
3774 3777
                  <property name="alternatingRowColors">
3775 3778
                   <bool>true</bool>
3776 3779
                  </property>
3780
+                 <property name="selectionMode">
3781
+                  <enum>QAbstractItemView::MultiSelection</enum>
3782
+                 </property>
3777 3783
                 </widget>
3778 3784
                </item>
3779 3785
               </layout>
@@ -4106,8 +4112,8 @@ background: dark grey;
4106 4112
               <rect>
4107 4113
                <x>0</x>
4108 4114
                <y>0</y>
4109
-               <width>96</width>
4110
-               <height>26</height>
4115
+               <width>98</width>
4116
+               <height>28</height>
4111 4117
               </rect>
4112 4118
              </property>
4113 4119
              <attribute name="label">
@@ -4119,8 +4125,8 @@ background: dark grey;
4119 4125
               <rect>
4120 4126
                <x>0</x>
4121 4127
                <y>0</y>
4122
-               <width>96</width>
4123
-               <height>26</height>
4128
+               <width>411</width>
4129
+               <height>79</height>
4124 4130
               </rect>
4125 4131
              </property>
4126 4132
              <attribute name="label">
@@ -4416,8 +4422,8 @@ background: red;
4416 4422
              <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
4417 4423
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
4418 4424
 p, li { white-space: pre-wrap; }
4419
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;
4420
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;All processing steps are recorded here for your records&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
4425
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
4426
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;All processing steps are recorded here for your records&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
4421 4427
             </property>
4422 4428
            </widget>
4423 4429
            <widget class="QLabel" name="label_74">
@@ -4447,8 +4453,8 @@ p, li { white-space: pre-wrap; }
4447 4453
     <rect>
4448 4454
      <x>0</x>
4449 4455
      <y>0</y>
4450
-     <width>1142</width>
4451
-     <height>30</height>
4456
+     <width>1230</width>
4457
+     <height>22</height>
4452 4458
     </rect>
4453 4459
    </property>
4454 4460
    <widget class="QMenu" name="menuOpen_GMR_RAW_Header">

+ 31
- 11
akvo/tressel/calcAkvoKernel.py Прегледај датотеку

@@ -62,7 +62,7 @@ def loadAkvoData(fnamein):
62 62
 
63 63
 def main():
64 64
 
65
-    if len(sys.argv) < 3:
65
+    if len(sys.argv) < 2:
66 66
         print ("usage  python calcAkvoKernel.py   AkvoDataset.yaml  Coil1.yaml kparams.yaml  SaveString.yaml " )
67 67
         exit()
68 68
 
@@ -75,14 +75,34 @@ def main():
75 75
     fT = AKVO.transFreq
76 76
     #gamma = 2.67518e8
77 77
     #B0 = (fL*2.*np.pi) /gamma * 1e9
78
+    
79
+    # read in kernel params
80
+    kparams = loadAkvoData( sys.argv[2] )
78 81
  
79
-    Coil1 = em1d.PolygonalWireAntenna.DeSerialize( sys.argv[2] )
80
-    Coil1.SetNumberOfFrequencies(1)
81
-    Coil1.SetFrequency(0, fT) 
82
-    Coil1.SetCurrent(1.)
82
+    Kern = mrln.KernelV0()
83 83
 
84
-    # read in kernel params
85
-    kparams = loadAkvoData( sys.argv[3] )
84
+    TX = []
85
+    for tx in kparams['txCoils']:
86
+        Coil1 = em1d.PolygonalWireAntenna.DeSerialize( tx )
87
+        Coil1.SetNumberOfFrequencies(1)
88
+        Coil1.SetFrequency(0, fT) 
89
+        Coil1.SetCurrent(1.)
90
+        Kern.PushCoil( tx.split('.yml')[0], Coil1 )
91
+        TX.append( tx.split('.yml')[0] )
92
+    
93
+    RX = []
94
+    for rx in kparams['rxCoils']:
95
+        if rx not in kparams['txCoils']:
96
+            print("new recv")
97
+            Coil1 = em1d.PolygonalWireAntenna.DeSerialize( rx )
98
+            Coil1.SetNumberOfFrequencies(1)
99
+            Coil1.SetFrequency(0, fT) 
100
+            Coil1.SetCurrent(1.)
101
+            Kern.PushCoil( rx.split('.yml')[0], Coil1 )
102
+        else:
103
+            print("reuse")
104
+        RX.append( rx.split('.yml')[0] )
105
+    
86 106
 
87 107
     ## TODO 
88 108
     # pass this in...
@@ -110,8 +130,7 @@ def main():
110 130
 
111 131
     lmod.SetMagneticFieldIncDecMag( B_inc, B_dec, B0, lc.NANOTESLA )
112 132
 
113
-    Kern = mrln.KernelV0()
114
-    Kern.PushCoil( "Coil 1", Coil1 )
133
+
115 134
     Kern.SetLayeredEarthEM( lmod );
116 135
     Kern.SetIntegrationSize( (kparams["size_n"], kparams["size_e"], kparams["size_d"]) )
117 136
     Kern.SetIntegrationOrigin( (kparams["origin_n"], kparams["origin_e"], kparams["origin_d"]) )
@@ -141,10 +160,11 @@ def main():
141 160
     # autAkvoDataNode = YAML::LoadFile(argv[4]);
142 161
     # Kern->AlignWithAkvoDataset( AkvoDataNode );
143 162
 
144
-    Kern.CalculateK0( ["Coil 1"], ["Coil 1"], False )
163
+    #Kern.CalculateK0( ["Coil 1"], ["Coil 1"], False )
164
+    Kern.CalculateK0( TX, RX, False )
145 165
 
146 166
     #yml = open( 'test' + str(Kern.GetTolerance()) + '.yaml', 'w')
147
-    yml = open( sys.argv[4], 'w' )
167
+    yml = open( sys.argv[3], 'w' )
148 168
     print(Kern, file=yml)
149 169
 
150 170
     # 

Loading…
Откажи
Сачувај