Browse Source

Updates for better integration with Akvo

master
Trevor Irons 5 years ago
parent
commit
0d25529377

+ 1
- 1
CMakeLists.txt View File

1
 # Configure Merlin 
1
 # Configure Merlin 
2
 set(MERLIN_VERSION_MAJOR "0")
2
 set(MERLIN_VERSION_MAJOR "0")
3
 set(MERLIN_VERSION_MINOR "0")
3
 set(MERLIN_VERSION_MINOR "0")
4
-set(MERLIN_VERSION_PATCH "2")
4
+set(MERLIN_VERSION_PATCH "3")
5
 set(MERLIN_VERSION "\"${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}.${MERLIN_VERSION_PATCH}\"")
5
 set(MERLIN_VERSION "\"${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}.${MERLIN_VERSION_PATCH}\"")
6
 set(MERLIN_VERSION_NOQUOTES "${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}.${MERLIN_VERSION_PATCH}")
6
 set(MERLIN_VERSION_NOQUOTES "${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}.${MERLIN_VERSION_PATCH}")
7
 
7
 

+ 2
- 0
examples/CMakeLists.txt View File

32
 
32
 
33
 INSTALL_TARGETS( "/share/Merlin/"
33
 INSTALL_TARGETS( "/share/Merlin/"
34
 	KernelV0
34
 	KernelV0
35
+	KernelV0-2
36
+	KernelAligner
35
 	Coupling
37
 	Coupling
36
 	Interference
38
 	Interference
37
 )
39
 )

+ 0
- 1
examples/KernelAligner.cpp View File

28
         exit(EXIT_SUCCESS);
28
         exit(EXIT_SUCCESS);
29
     }
29
     }
30
     auto K0 = KernelV0::NewSP();
30
     auto K0 = KernelV0::NewSP();
31
-
32
     std::cout << *K0 << std::endl;
31
     std::cout << *K0 << std::endl;
33
 }
32
 }

+ 1
- 0
examples/KernelV0-2.cpp View File

30
 
30
 
31
     std::cout << "Using kernel paramaters: " << argv[1] << std::endl;
31
     std::cout << "Using kernel paramaters: " << argv[1] << std::endl;
32
     auto Kern = KernelV0::DeSerialize( YAML::LoadFile(argv[1]) );
32
     auto Kern = KernelV0::DeSerialize( YAML::LoadFile(argv[1]) );
33
+    std::cout << "Kernel DeSerialized successful" << std::endl;
33
 
34
 
34
     std::vector<std::string> tx = {std::string(argv[2])};
35
     std::vector<std::string> tx = {std::string(argv[2])};
35
     std::vector<std::string> rx = {std::string(argv[3])};
36
     std::vector<std::string> rx = {std::string(argv[3])};

+ 29
- 22
examples/KernelV0.cpp View File

24
 
24
 
25
 int main(int argc, char** argv) {
25
 int main(int argc, char** argv) {
26
 
26
 
27
-    Real offset = atof(argv[1]);
27
+    if (argc < 6) {             // 1          2           3                    4                5
28
+        std::cout << "./KernelV0 TxCoil.yaml RxCoil.yaml  EMEarthModel.yaml    AkvoDataSet.yaml Output.yaml \n";
29
+        exit(EXIT_SUCCESS);
30
+    }
28
 
31
 
29
 	auto earth = LayeredEarthEM::NewSP();
32
 	auto earth = LayeredEarthEM::NewSP();
30
 		earth->SetNumberOfLayers(3);
33
 		earth->SetNumberOfLayers(3);
34
         // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
37
         // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
35
         earth->SetMagneticFieldIncDecMag( 67, 9, 52750, NANOTESLA );
38
         earth->SetMagneticFieldIncDecMag( 67, 9, 52750, NANOTESLA );
36
 
39
 
37
-    // Transmitter loops
38
-    auto Tx1 = CircularLoop(21, 15, 100, 100);
39
-    auto Tx2 = CircularLoop(21, 15, 100, 100 + offset); // 100, 115, 124.8, 130
40
-    //auto Tx1 = CircularLoop(60, 15, 0, 0); // was 60
40
+        auto Tx1 = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[1]) );
41
+        auto Tx2 = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[2]) );
42
+
43
+        //////////////////////////////////////               _
44
+        Tx1->SetCurrent(1.);                //               |
45
+        Tx1->SetNumberOfTurns(1);           //    Set these from Akvo input!
46
+        Tx1->SetNumberOfFrequencies(1);     //               |
47
+        Tx1->SetFrequency(0,2246);          //               |
48
+        Tx2->SetCurrent(1.);                //               |
49
+        Tx2->SetNumberOfTurns(1);           //           \   |   /
50
+        Tx2->SetNumberOfFrequencies(1);     //            \  |  /
51
+        Tx2->SetFrequency(0,2246);          //             \ | /
52
+        //////////////////////////////////////               _
41
 
53
 
42
     auto Kern = KernelV0::NewSP();
54
     auto Kern = KernelV0::NewSP();
43
         Kern->PushCoil( "Coil 1", Tx1 );
55
         Kern->PushCoil( "Coil 1", Tx1 );
46
 
58
 
47
         Kern->SetIntegrationSize( (Vector3r() << 200,200,200).finished() );
59
         Kern->SetIntegrationSize( (Vector3r() << 200,200,200).finished() );
48
         Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0).finished() );
60
         Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0).finished() );
49
-        Kern->SetTolerance( 1e-12 ); // 1e-12
61
+        Kern->SetTolerance( 1e-9 ); // 1e-12
50
 
62
 
51
-        Kern->AlignWithAkvoDataset( YAML::LoadFile(argv[2]) );
63
+        auto AkvoDataNode = YAML::LoadFile(argv[4]);
64
+        Kern->AlignWithAkvoDataset( AkvoDataNode );
52
 
65
 
53
-        Kern->SetPulseDuration(0.020);
54
-        VectorXr I(36);
66
+        // These should to into AlignWithAkvoDataSet...
67
+        Kern->SetPulseDuration( AkvoDataNode["pulseLength"][0].as<Real>() );
68
+        Kern->SetPulseCurrent( AkvoDataNode["Pulses"]["Pulse 1"]["current"].as<VectorXr>() ); // nbins, low, high
55
 
69
 
56
-        // off from VC by 1.075926340216996
57
-        // Pulses from Wyoming Red Buttes exp 0
58
-        I << 397.4208916184016, 352.364477036168, 313.0112765842783, 278.37896394065376, 247.81424224324982,
59
-             220.77925043190442, 196.76493264105017, 175.31662279234038, 156.0044839325404, 138.73983004230124,
60
-             123.42064612625474, 109.82713394836259, 97.76534468972267, 87.06061858367781, 77.56000002944572, 69.1280780096311,
61
-             61.64250263640252, 54.99473044877554, 49.091182970515476, 43.84634004556388, 39.184136917167976, 35.03619319797924,
62
-             31.347205894128976, 28.06346770557137, 25.139117042424758, 22.53420773366429, 20.214205433283347,
63
-             18.144318026099942, 16.299965972298878, 14.652633628829891, 13.184271405688083, 11.870540177313893,
64
-             10.697057141915716, 9.64778948429609, 8.709338689612677, 7.871268012862094;
65
-        //Kern->SetPulseCurrent( VectorXr::LinSpaced( 1, 10, 200 )  ); // nbins, low, high
66
-        Kern->SetPulseCurrent( I ); // nbins, low, high
67
 
70
 
68
         //VectorXr interfaces = VectorXr::LinSpaced( 41, .5, 45.5 ); // nlay, low, high
71
         //VectorXr interfaces = VectorXr::LinSpaced( 41, .5, 45.5 ); // nlay, low, high
69
         VectorXr interfaces = VectorXr::LinSpaced( 51, .5, 45.5 ); // nlay, low, high
72
         VectorXr interfaces = VectorXr::LinSpaced( 51, .5, 45.5 ); // nlay, low, high
76
 
79
 
77
     // We could, I suppose, take the earth model in here? For non-linear that
80
     // We could, I suppose, take the earth model in here? For non-linear that
78
     // may be more natural to work with?
81
     // may be more natural to work with?
79
-    std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2") };
82
+    //std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2") };
83
+    std::vector<std::string> tx = {std::string("Coil 1")};  //, std::string("Coil 2") };
80
     std::vector<std::string> rx = {std::string("Coil 2")};
84
     std::vector<std::string> rx = {std::string("Coil 2")};
81
     Kern->CalculateK0( tx, rx, false );
85
     Kern->CalculateK0( tx, rx, false );
82
 
86
 
87
+/*
83
     std::ofstream dout = std::ofstream(std::string("k-Tx2coil-Rx1coil-offset-")+ std::string(argv[1])+ std::string(".dat"));
88
     std::ofstream dout = std::ofstream(std::string("k-Tx2coil-Rx1coil-offset-")+ std::string(argv[1])+ std::string(".dat"));
84
     //std::ofstream dout = std::ofstream(std::string("k-coincident.dat"));
89
     //std::ofstream dout = std::ofstream(std::string("k-coincident.dat"));
85
         dout << interfaces.transpose() << std::endl;
90
         dout << interfaces.transpose() << std::endl;
89
         dout << "#imag\n";
94
         dout << "#imag\n";
90
         dout << Kern->GetKernel().imag() << std::endl;
95
         dout << Kern->GetKernel().imag() << std::endl;
91
         dout.close();
96
         dout.close();
97
+*/
92
 
98
 
93
-    std::ofstream out = std::ofstream(std::string("k-Tx2coil-Rx1coil-offset-")+std::string(argv[1])+std::string(".yaml"));
99
+    //std::ofstream out = std::ofstream(std::string("k-Tx2coil-Rx1coil-offset-")+std::string(argv[1])+std::string(".yaml"));
100
+    std::ofstream out = std::ofstream(std::string(argv[5]));
94
     //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
101
     //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
95
     out << *Kern;
102
     out << *Kern;
96
     out.close();
103
     out.close();

+ 2
- 2
include/KernelV0.h View File

20
 #define  KERNELV0_INC
20
 #define  KERNELV0_INC
21
 
21
 
22
 #pragma once
22
 #pragma once
23
-#include "LemmaObject.h"
23
+#include "MerlinObject.h"
24
 #include "LayeredEarthEM.h"
24
 #include "LayeredEarthEM.h"
25
 #include "PolygonalWireAntenna.h"
25
 #include "PolygonalWireAntenna.h"
26
 #include "EMEarth1D.h"
26
 #include "EMEarth1D.h"
58
      * \details This class calculates the imaging kernel for a free induction decay
58
      * \details This class calculates the imaging kernel for a free induction decay
59
      *          pulse. The methodology follows from Weichman et al., 2000.
59
      *          pulse. The methodology follows from Weichman et al., 2000.
60
      */
60
      */
61
-    class KernelV0 : public LemmaObject {
61
+    class KernelV0 : public MerlinObject {
62
 
62
 
63
         friend std::ostream &operator<<(std::ostream &stream, const KernelV0 &ob);
63
         friend std::ostream &operator<<(std::ostream &stream, const KernelV0 &ob);
64
 
64
 

+ 2
- 2
include/LoopInteractions.h View File

41
 
41
 
42
     /**
42
     /**
43
      * \ingroup Merlin
43
      * \ingroup Merlin
44
-     * \brief
45
-     * \details
44
+     * \brief   Class for calculating the interactions between wire loops.
45
+     * \details The calculations are done in the frequency domain.
46
      */
46
      */
47
     template< INTERACTION Type  >
47
     template< INTERACTION Type  >
48
     class LoopInteractions : public LemmaObject {
48
     class LoopInteractions : public LemmaObject {

+ 8
- 4
src/KernelV0.cpp View File

17
  * @copyright Copyright (c) 2008, Colorado School of Mines
17
  * @copyright Copyright (c) 2008, Colorado School of Mines
18
  */
18
  */
19
 
19
 
20
-
20
+#include "MerlinConfig.h"
21
 #include "KernelV0.h"
21
 #include "KernelV0.h"
22
 #include "FieldPoints.h"
22
 #include "FieldPoints.h"
23
 
23
 
37
     //      Method:  KernelV0
37
     //      Method:  KernelV0
38
     // Description:  constructor (locked)
38
     // Description:  constructor (locked)
39
     //--------------------------------------------------------------------------------------
39
     //--------------------------------------------------------------------------------------
40
-    KernelV0::KernelV0 (const ctor_key& key) : LemmaObject( key ) {
40
+    KernelV0::KernelV0 (const ctor_key& key) : MerlinObject( key ) {
41
 
41
 
42
     }  // -----  end of method KernelV0::KernelV0  (constructor)  -----
42
     }  // -----  end of method KernelV0::KernelV0  (constructor)  -----
43
 
43
 
46
     //      Method:  KernelV0
46
     //      Method:  KernelV0
47
     // Description:  DeSerializing constructor (locked)
47
     // Description:  DeSerializing constructor (locked)
48
     //--------------------------------------------------------------------------------------
48
     //--------------------------------------------------------------------------------------
49
-    KernelV0::KernelV0 (const YAML::Node& node, const ctor_key& key) : LemmaObject(node, key) {
49
+    KernelV0::KernelV0 (const YAML::Node& node, const ctor_key& key) : MerlinObject(node, key) {
50
+
50
         //node["PulseType"] = "FID";
51
         //node["PulseType"] = "FID";
51
         Larmor = node["Larmor"].as<Real>();
52
         Larmor = node["Larmor"].as<Real>();
52
         Temperature = node["Temperature"].as<Real>();
53
         Temperature = node["Temperature"].as<Real>();
116
     //      Method:  Serialize
117
     //      Method:  Serialize
117
     //--------------------------------------------------------------------------------------
118
     //--------------------------------------------------------------------------------------
118
     YAML::Node  KernelV0::Serialize (  ) const {
119
     YAML::Node  KernelV0::Serialize (  ) const {
119
-        YAML::Node node = LemmaObject::Serialize();
120
+
121
+        YAML::Node node = MerlinObject::Serialize();
120
         node.SetTag( GetName() );
122
         node.SetTag( GetName() );
121
 
123
 
122
         // Coils Transmitters & Receivers
124
         // Coils Transmitters & Receivers
173
             std::cout << node["processed"] << std::endl;
175
             std::cout << node["processed"] << std::endl;
174
         }
176
         }
175
         if (node["pulseType"].as<std::string>() == "FID") {
177
         if (node["pulseType"].as<std::string>() == "FID") {
178
+            std::cout << "FID pulse detected" << std::endl;
176
             PulseI  = node["Pulses"]["Pulse 1"]["current"].as<VectorXr>();
179
             PulseI  = node["Pulses"]["Pulse 1"]["current"].as<VectorXr>();
177
             this->SetPulseDuration( node["pulseLength"][0].as<double>() );
180
             this->SetPulseDuration( node["pulseLength"][0].as<double>() );
178
         } else {
181
         } else {
179
             std::cerr << "Pulse Type " << node["PulseType"] << "is not supported\n";
182
             std::cerr << "Pulse Type " << node["PulseType"] << "is not supported\n";
180
         }
183
         }
184
+        std::cout << "Finished with Akvo file read" << std::endl;
181
     }
185
     }
182
 
186
 
183
     //--------------------------------------------------------------------------------------
187
     //--------------------------------------------------------------------------------------

Loading…
Cancel
Save