Browse Source

Added mechanism to align kernels with akvo data

master
Trevor Irons 7 years ago
parent
commit
5739971928
4 changed files with 30 additions and 11 deletions
  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 View File

40
         // Set mag field info
40
         // Set mag field info
41
         // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
41
         // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
42
         earth->SetMagneticFieldIncDecMag( 67, 0, 52750, NANOTESLA );
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
     // Transmitter loops
44
     // Transmitter loops
49
     auto Tx1 = CircularLoop(21, 15, 100+offset/2., 100-offset/2.);
45
     auto Tx1 = CircularLoop(21, 15, 100+offset/2., 100-offset/2.);
89
     // We could, I suppose, take the earth model in here? For non-linear that
85
     // We could, I suppose, take the earth model in here? For non-linear that
90
     // may be more natural to work with?
86
     // may be more natural to work with?
91
     std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
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
     //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2")};//, std::string("Coil 3") };
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
     std::ofstream dout = std::ofstream(std::string("k0-3Tx-RxCh-") + std::string(argv[3]) + std::string("-tol") + std::string(argv[1])+ std::string(".dat"));
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
     dout << "# Transmitters: ";
94
     dout << "# Transmitters: ";
115
         dout << Kern->GetKernel().imag() << std::endl;
111
         dout << Kern->GetKernel().imag() << std::endl;
116
         dout.close();
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
 std::shared_ptr<Lemma::PolygonalWireAntenna> CircularLoop ( int nd, Real Radius, Real Offsetx, Real Offsety ) {
119
 std::shared_ptr<Lemma::PolygonalWireAntenna> CircularLoop ( int nd, Real Radius, Real Offsetx, Real Offsety ) {

+ 2
- 0
examples/KernelV0.cpp View File

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

+ 5
- 0
include/KernelV0.h View File

166
         }		// -----  end of method KernelV0::SetIntegrationOrigin  -----
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
          *   Assign transmiter coils
174
          *   Assign transmiter coils
170
          */
175
          */
171
         inline void PushCoil( const std::string& label, std::shared_ptr<PolygonalWireAntenna> ant ) {
176
         inline void PushCoil( const std::string& label, std::shared_ptr<PolygonalWireAntenna> ant ) {

+ 17
- 0
src/KernelV0.cpp View File

112
 
112
 
113
     //--------------------------------------------------------------------------------------
113
     //--------------------------------------------------------------------------------------
114
     //       Class:  KernelV0
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
     //      Method:  DeSerialize
132
     //      Method:  DeSerialize
116
     //--------------------------------------------------------------------------------------
133
     //--------------------------------------------------------------------------------------
117
     void KernelV0::CalculateK0 (const std::vector< std::string>& Tx, const std::vector<std::string >& Rx,
134
     void KernelV0::CalculateK0 (const std::vector< std::string>& Tx, const std::vector<std::string >& Rx,

Loading…
Cancel
Save