Bladeren bron

Added mechanism to align kernels with akvo data

master
Trevor Irons 7 jaren geleden
bovenliggende
commit
5739971928
4 gewijzigde bestanden met toevoegingen van 30 en 11 verwijderingen
  1. 6
    11
      examples/KV0-3loops.cpp
  2. 2
    0
      examples/KernelV0.cpp
  3. 5
    0
      include/KernelV0.h
  4. 17
    0
      src/KernelV0.cpp

+ 6
- 11
examples/KV0-3loops.cpp Bestand weergeven

@@ -40,10 +40,6 @@ int main(int argc, char** argv) {
40 40
         // Set mag field info
41 41
         // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
42 42
         earth->SetMagneticFieldIncDecMag( 67, 0, 52750, NANOTESLA );
43
-        //earth->SetMagneticFieldIncDecMag( 90, 0, 52750, NANOTESLA );
44
-        std::cout << "B0 " << earth->GetMagneticField( ).transpose() << std::endl;
45
-        std::cout << "hat BO " << earth->GetMagneticFieldUnitVector().transpose() << std::endl ;
46
-        std::cout << "hat |BO| " << earth->GetMagneticFieldUnitVector().norm() << std::endl ;
47 43
 
48 44
     // Transmitter loops
49 45
     auto Tx1 = CircularLoop(21, 15, 100+offset/2., 100-offset/2.);
@@ -89,10 +85,10 @@ int main(int argc, char** argv) {
89 85
     // We could, I suppose, take the earth model in here? For non-linear that
90 86
     // may be more natural to work with?
91 87
     std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
92
-    std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
88
+    //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
93 89
     //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2")};//, std::string("Coil 3") };
94
-    //std::vector<std::string> rx = {std::string(argv[3])};
95
-    Kern->CalculateK0( tx, rx, true );
90
+    std::vector<std::string> rx = {std::string(argv[3])};
91
+    Kern->CalculateK0( tx, rx, false );
96 92
 
97 93
     std::ofstream dout = std::ofstream(std::string("k0-3Tx-RxCh-") + std::string(argv[3]) + std::string("-tol") + std::string(argv[1])+ std::string(".dat"));
98 94
     dout << "# Transmitters: ";
@@ -115,10 +111,9 @@ int main(int argc, char** argv) {
115 111
         dout << Kern->GetKernel().imag() << std::endl;
116 112
         dout.close();
117 113
 
118
-    //std::ofstream out = std::ofstream(std::string("k0-3Tx-RxCh1-")+std::string(argv[1])+std::string(".yaml"));
119
-    //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
120
-    //out << *Kern;
121
-    //out.close();
114
+    std::ofstream out = std::ofstream(std::string("k0-3Tx-RxCh-") + std::string(argv[3]) + std::string("-tol") + std::string(argv[1])+ std::string(".yaml"));
115
+    out << *Kern;
116
+    out.close();
122 117
 }
123 118
 
124 119
 std::shared_ptr<Lemma::PolygonalWireAntenna> CircularLoop ( int nd, Real Radius, Real Offsetx, Real Offsety ) {

+ 2
- 0
examples/KernelV0.cpp Bestand weergeven

@@ -48,6 +48,8 @@ int main(int argc, char** argv) {
48 48
         Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0).finished() );
49 49
         Kern->SetTolerance( 1e-12 ); // 1e-12
50 50
 
51
+        Kern->AlignWithAkvoDataset( YAML::LoadFile(argv[2]) );
52
+
51 53
         Kern->SetPulseDuration(0.020);
52 54
         VectorXr I(36);
53 55
 

+ 5
- 0
include/KernelV0.h Bestand weergeven

@@ -166,6 +166,11 @@ namespace Lemma {
166 166
         }		// -----  end of method KernelV0::SetIntegrationOrigin  -----
167 167
 
168 168
         /**
169
+         *  Aligns the kernel settings with an Akvo Processed dataset.
170
+         */
171
+        void AlignWithAkvoDataset( const YAML::Node& node ) ;
172
+
173
+        /**
169 174
          *   Assign transmiter coils
170 175
          */
171 176
         inline void PushCoil( const std::string& label, std::shared_ptr<PolygonalWireAntenna> ant ) {

+ 17
- 0
src/KernelV0.cpp Bestand weergeven

@@ -112,6 +112,23 @@ namespace Lemma {
112 112
 
113 113
     //--------------------------------------------------------------------------------------
114 114
     //       Class:  KernelV0
115
+    //      Method:  AlignWithAkvoDataset
116
+    //--------------------------------------------------------------------------------------
117
+    void KernelV0::AlignWithAkvoDataset( const YAML::Node& node ) {
118
+        if (node["processed"].as<std::string>().substr(0,4) == "Akvo") {
119
+            std::cout << "Akvo file read\n";
120
+            std::cout << node["processed"] << std::endl;
121
+        }
122
+        if (node["pulseType"].as<std::string>() == "FID") {
123
+            PulseI  = node["Pulse 1"]["current"].as<VectorXr>();
124
+            this->SetPulseDuration( node["pulseLength"].as<double>() );
125
+        } else {
126
+            std::cerr << "Pulse Type " << node["PulseType"] << "is not supported\n";
127
+        }
128
+    }
129
+
130
+    //--------------------------------------------------------------------------------------
131
+    //       Class:  KernelV0
115 132
     //      Method:  DeSerialize
116 133
     //--------------------------------------------------------------------------------------
117 134
     void KernelV0::CalculateK0 (const std::vector< std::string>& Tx, const std::vector<std::string >& Rx,

Laden…
Annuleren
Opslaan