Browse Source

Support for transmitter (and receiver) arrays in kernel calculation

tags/1.6.1
Trevor Irons 4 years ago
parent
commit
1c1919ddea
4 changed files with 69 additions and 28 deletions
  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 View File

441
 
441
 
442
         #self.K0akvoDataFile = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
442
         #self.K0akvoDataFile = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
443
         #akvoData = QtWidgets.QFileDialog.getOpenFileName(self, 'Open Datafile File', fpath, r"Akvo datafiles (*.yaml)")[0]
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
         saveStr = QtWidgets.QFileDialog.getSaveFileName(self, "Save kernel as", fpath, r"Merlin KernelV0 (*.yml)")[0] 
458
         saveStr = QtWidgets.QFileDialog.getSaveFileName(self, "Save kernel as", fpath, r"Merlin KernelV0 (*.yml)")[0] 
446
 
459
 
447
         intDict = dict()
460
         intDict = dict()
459
         intDict["maxLevel"] = self.ui.maxLevel.value()
472
         intDict["maxLevel"] = self.ui.maxLevel.value()
460
         intDict["branchTol"] = self.ui.branchTol.value()
473
         intDict["branchTol"] = self.ui.branchTol.value()
461
 
474
 
475
+        intDict["txCoils"] = txCoils
476
+        intDict["rxCoils"] = rxCoils
477
+
462
         # conductivity model... 
478
         # conductivity model... 
463
         #tops = self.ui.layerTableWidget.col(0)
479
         #tops = self.ui.layerTableWidget.col(0)
464
         #print("Tops", tops)
480
         #print("Tops", tops)
488
         kpo = open( "kparams.yml", 'w' )
504
         kpo = open( "kparams.yml", 'w' )
489
         node.dump(intDict, kpo)
505
         node.dump(intDict, kpo)
490
 
506
 
491
-
492
         callBox = callScript(  ) #QtWidgets.QDialog() 
507
         callBox = callScript(  ) #QtWidgets.QDialog() 
493
         
508
         
494
         callBox.ui = Ui_callScript()
509
         callBox.ui = Ui_callScript()
495
         callBox.ui.setupUi( callBox )
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
         callBox.exec_()
513
         callBox.exec_()
499
         callBox.show()
514
         callBox.show()

+ 2
- 2
akvo/gui/callScript.py View File

10
     #def __init__(self):
10
     #def __init__(self):
11
     #    super().__init__()
11
     #    super().__init__()
12
     
12
     
13
-    def setupCB(self, akvoData, TxCoil, kernelParams, SaveStr):
13
+    def setupCB(self, akvoData, kernelParams, SaveStr):
14
 
14
 
15
         #QtGui.QWidget.__init__(self)
15
         #QtGui.QWidget.__init__(self)
16
         #uic.loadUi('redirect.ui', self)
16
         #uic.loadUi('redirect.ui', self)
24
 
24
 
25
         #print ('Starting process')
25
         #print ('Starting process')
26
         #self.process.start('python', ['calcAkvoKernel.py', akvoData, TxCoil, SaveStr])
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
     def setupQTInv(self, params):
29
     def setupQTInv(self, params):
30
 
30
 

+ 18
- 12
akvo/gui/main.ui View File

6
    <rect>
6
    <rect>
7
     <x>0</x>
7
     <x>0</x>
8
     <y>0</y>
8
     <y>0</y>
9
-    <width>1142</width>
9
+    <width>1230</width>
10
     <height>875</height>
10
     <height>875</height>
11
    </rect>
11
    </rect>
12
   </property>
12
   </property>
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;
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
 &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;
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
 p, li { white-space: pre-wrap; }
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
 &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>
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
                </property>
643
                </property>
644
               </widget>
644
               </widget>
710
         <rect>
710
         <rect>
711
          <x>0</x>
711
          <x>0</x>
712
          <y>0</y>
712
          <y>0</y>
713
-         <width>537</width>
714
-         <height>982</height>
713
+         <width>543</width>
714
+         <height>889</height>
715
         </rect>
715
         </rect>
716
        </property>
716
        </property>
717
        <property name="sizePolicy">
717
        <property name="sizePolicy">
3761
                  <property name="alternatingRowColors">
3761
                  <property name="alternatingRowColors">
3762
                   <bool>true</bool>
3762
                   <bool>true</bool>
3763
                  </property>
3763
                  </property>
3764
+                 <property name="selectionMode">
3765
+                  <enum>QAbstractItemView::MultiSelection</enum>
3766
+                 </property>
3764
                 </widget>
3767
                 </widget>
3765
                </item>
3768
                </item>
3766
                <item row="2" column="1" colspan="2">
3769
                <item row="2" column="1" colspan="2">
3774
                  <property name="alternatingRowColors">
3777
                  <property name="alternatingRowColors">
3775
                   <bool>true</bool>
3778
                   <bool>true</bool>
3776
                  </property>
3779
                  </property>
3780
+                 <property name="selectionMode">
3781
+                  <enum>QAbstractItemView::MultiSelection</enum>
3782
+                 </property>
3777
                 </widget>
3783
                 </widget>
3778
                </item>
3784
                </item>
3779
               </layout>
3785
               </layout>
4106
               <rect>
4112
               <rect>
4107
                <x>0</x>
4113
                <x>0</x>
4108
                <y>0</y>
4114
                <y>0</y>
4109
-               <width>96</width>
4110
-               <height>26</height>
4115
+               <width>98</width>
4116
+               <height>28</height>
4111
               </rect>
4117
               </rect>
4112
              </property>
4118
              </property>
4113
              <attribute name="label">
4119
              <attribute name="label">
4119
               <rect>
4125
               <rect>
4120
                <x>0</x>
4126
                <x>0</x>
4121
                <y>0</y>
4127
                <y>0</y>
4122
-               <width>96</width>
4123
-               <height>26</height>
4128
+               <width>411</width>
4129
+               <height>79</height>
4124
               </rect>
4130
               </rect>
4125
              </property>
4131
              </property>
4126
              <attribute name="label">
4132
              <attribute name="label">
4416
              <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;
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
 &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;
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
 p, li { white-space: pre-wrap; }
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
             </property>
4427
             </property>
4422
            </widget>
4428
            </widget>
4423
            <widget class="QLabel" name="label_74">
4429
            <widget class="QLabel" name="label_74">
4447
     <rect>
4453
     <rect>
4448
      <x>0</x>
4454
      <x>0</x>
4449
      <y>0</y>
4455
      <y>0</y>
4450
-     <width>1142</width>
4451
-     <height>30</height>
4456
+     <width>1230</width>
4457
+     <height>22</height>
4452
     </rect>
4458
     </rect>
4453
    </property>
4459
    </property>
4454
    <widget class="QMenu" name="menuOpen_GMR_RAW_Header">
4460
    <widget class="QMenu" name="menuOpen_GMR_RAW_Header">

+ 31
- 11
akvo/tressel/calcAkvoKernel.py View File

62
 
62
 
63
 def main():
63
 def main():
64
 
64
 
65
-    if len(sys.argv) < 3:
65
+    if len(sys.argv) < 2:
66
         print ("usage  python calcAkvoKernel.py   AkvoDataset.yaml  Coil1.yaml kparams.yaml  SaveString.yaml " )
66
         print ("usage  python calcAkvoKernel.py   AkvoDataset.yaml  Coil1.yaml kparams.yaml  SaveString.yaml " )
67
         exit()
67
         exit()
68
 
68
 
75
     fT = AKVO.transFreq
75
     fT = AKVO.transFreq
76
     #gamma = 2.67518e8
76
     #gamma = 2.67518e8
77
     #B0 = (fL*2.*np.pi) /gamma * 1e9
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
     ## TODO 
107
     ## TODO 
88
     # pass this in...
108
     # pass this in...
110
 
130
 
111
     lmod.SetMagneticFieldIncDecMag( B_inc, B_dec, B0, lc.NANOTESLA )
131
     lmod.SetMagneticFieldIncDecMag( B_inc, B_dec, B0, lc.NANOTESLA )
112
 
132
 
113
-    Kern = mrln.KernelV0()
114
-    Kern.PushCoil( "Coil 1", Coil1 )
133
+
115
     Kern.SetLayeredEarthEM( lmod );
134
     Kern.SetLayeredEarthEM( lmod );
116
     Kern.SetIntegrationSize( (kparams["size_n"], kparams["size_e"], kparams["size_d"]) )
135
     Kern.SetIntegrationSize( (kparams["size_n"], kparams["size_e"], kparams["size_d"]) )
117
     Kern.SetIntegrationOrigin( (kparams["origin_n"], kparams["origin_e"], kparams["origin_d"]) )
136
     Kern.SetIntegrationOrigin( (kparams["origin_n"], kparams["origin_e"], kparams["origin_d"]) )
141
     # autAkvoDataNode = YAML::LoadFile(argv[4]);
160
     # autAkvoDataNode = YAML::LoadFile(argv[4]);
142
     # Kern->AlignWithAkvoDataset( AkvoDataNode );
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
     #yml = open( 'test' + str(Kern.GetTolerance()) + '.yaml', 'w')
166
     #yml = open( 'test' + str(Kern.GetTolerance()) + '.yaml', 'w')
147
-    yml = open( sys.argv[4], 'w' )
167
+    yml = open( sys.argv[3], 'w' )
148
     print(Kern, file=yml)
168
     print(Kern, file=yml)
149
 
169
 
150
     # 
170
     # 

Loading…
Cancel
Save