Browse Source

Working on passing in all kernel parameters from GUI

tags/1.6.1
Trevor Irons 5 years ago
parent
commit
9decee1562
2 changed files with 22 additions and 30 deletions
  1. 4
    3
      akvo/gui/callScript.py
  2. 18
    27
      akvo/tressel/calcAkvoKernel.py

+ 4
- 3
akvo/gui/callScript.py View File

@@ -15,15 +15,16 @@ class callScript(QDialog):
15 15
         #QtGui.QWidget.__init__(self)
16 16
         #uic.loadUi('redirect.ui', self)
17 17
 
18
-        print ('Connecting process')
18
+        #print ('Connecting process')
19 19
         self.process = QtCore.QProcess(self)
20 20
         self.process.readyReadStandardOutput.connect(self.stdoutReady)
21 21
         self.process.readyReadStandardError.connect(self.stderrReady)
22 22
         self.process.started.connect(lambda: p('Started!'))
23 23
         self.process.finished.connect(lambda: p('Finished!'))
24 24
 
25
-        print ('Starting process')
26
-        self.process.start('python', ['calcAkvoKernel.py', akvoData, TxCoil, SaveStr])
25
+        #print ('Starting process')
26
+        #self.process.start('python', ['calcAkvoKernel.py', akvoData, TxCoil, SaveStr])
27
+        self.process.start('akvoK0', [ akvoData, TxCoil, SaveStr])
27 28
 
28 29
     def append(self, text):
29 30
         cursor = self.ui.textEdit.textCursor()

+ 18
- 27
akvo/tressel/calcAkvoKernel.py View File

@@ -58,27 +58,34 @@ def loadAkvoData(fnamein):
58 58
 
59 59
 
60 60
 def main():
61
+
61 62
     if len(sys.argv) < 3:
62
-        print ("usage  python calcAkvoKernel.py   AkvoDataset.yaml  Coil1.yaml  " )
63
+        print ("usage  python calcAkvoKernel.py   AkvoDataset.yaml  Coil1.yaml SaveString " )
63 64
         exit()
64
-    
65
-    gamma = 2.67518e8
66
-    fL = 2289.
67
-    B0 = (fL*2.*np.pi) /gamma * 1e9
68 65
 
69 66
     AKVO = loadAkvoData(sys.argv[1])
67
+
68
+    B_inc = AKVO.META["B_0"]["inc"]  
69
+    B_dec = AKVO.META["B_0"]["dec"]  
70
+    B0    = AKVO.META["B_0"]["intensity"]  
71
+
72
+    gamma = 2.67518e8
73
+    fT = AKVO.transFreq
74
+    #B0 = (fL*2.*np.pi) /gamma * 1e9
75
+ 
70 76
     Coil1 = em1d.PolygonalWireAntenna.DeSerialize( sys.argv[2] )
71 77
     Coil1.SetNumberOfFrequencies(1)
72
-    Coil1.SetFrequency(0, fL) 
78
+    Coil1.SetFrequency(0, fT) 
73 79
     Coil1.SetCurrent(1.)
74 80
 
75
-
81
+    # pass this in...
76 82
     lmod = em1d.LayeredEarthEM() 
77 83
     lmod.SetNumberOfLayers(4)
78 84
     lmod.SetLayerThickness([15.49, 28.18])
79 85
     lmod.SetLayerConductivity([0.0, 1./16.91, 1./24.06, 1./33.23])
80
-    lmod.SetMagneticFieldIncDecMag( 68.9, 0, B0, lc.NANOTESLA )
81 86
 
87
+    lmod.SetMagneticFieldIncDecMag( B_inc, B_dec, B0, lc.NANOTESLA )
88
+   
82 89
 
83 90
     Kern = mrln.KernelV0()
84 91
     Kern.PushCoil( "Coil 1", Coil1 )
@@ -100,29 +107,13 @@ def main():
100 107
     # autAkvoDataNode = YAML::LoadFile(argv[4]);
101 108
     # Kern->AlignWithAkvoDataset( AkvoDataNode );
102 109
 
103
-    #Kern.SetPulseDuration(0.040)
104
-    #Kern.SetPulseCurrent(  [1.6108818092452406, 1.7549935078885168, 1.7666319459646016, 1.9270787752430283,
105
-    #    1.9455431806179229, 2.111931346726564, 2.1466747256211747, 2.3218217392379588,
106
-    #    2.358359967649008, 2.5495654202189058, 2.5957289164577992, 2.8168532605800802,
107
-    #    2.85505242699187, 3.1599429539069774, 3.2263673040205068, 3.6334182368296544,
108
-    #    3.827985200119751, 4.265671313014058, 4.582237014873297, 5.116839616183394,
109
-    #    5.515173073160611, 6.143620383280934, 6.647972282096122, 7.392577402979211,
110
-    #    8.020737177449933, 8.904435233295793, 9.701975105606063, 10.74508217792577,
111
-    #    11.743887525923592, 12.995985956061467, 14.23723766879807, 15.733870137824457,
112
-    #    17.290155933625808, 19.07016662950366, 21.013341340455703, 23.134181634845618,
113
-    #    25.570925414182238, 28.100862178905476, 31.13848909847073, 34.16791099558486,
114
-    #    37.95775984680512, 41.589619321873165, 46.327607251605286, 50.667786337299205,
115
-    #    56.60102493062895, 61.81174065797068, 69.23049946198458, 75.47409803238031,
116
-    #    84.71658869065816, 92.1855007134236, 103.77129947551164, 112.84577430578537,
117
-    #    127.55127257092909, 138.70199812969176, 157.7443764728878, 171.39653462998626]
118
-    #)
119
-
120 110
     Kern.CalculateK0( ["Coil 1"], ["Coil 1"], False )
121 111
 
122
-    yml = open('akvoK3-' + str(Kern.GetTolerance()) + '.yaml', 'w')
112
+    #yml = open( 'test' + str(Kern.GetTolerance()) + '.yaml', 'w')
113
+    yml = open( sys.argv[3], 'w' )
123 114
     print(Kern, file=yml)
124 115
 
125
-    K0 = Kern.GetKernel()
116
+    #K0 = Kern.GetKernel()
126 117
     
127 118
     #plt.matshow(np.abs(K0))
128 119
     #plt.show()

Loading…
Cancel
Save