Surface NMR forward modelling
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ForwardFID.h 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 08/28/2017 08:49:51 AM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2017, University of Utah
  15. * @copyright Copyright (c) 2017, Lemma Software, LLC
  16. */
  17. #ifndef FORWARDFID_INC
  18. #define FORWARDFID_INC
  19. #pragma once
  20. #include <random>
  21. #include "LayeredEarthEM.h"
  22. #include "PolygonalWireAntenna.h"
  23. #include "EMEarth1D.h"
  24. #include "MerlinObject.h"
  25. #include "DataFID.h"
  26. #include "KernelV0.h"
  27. #include "LayeredEarthMR.h"
  28. namespace Lemma {
  29. /**
  30. * \ingroup Merlin
  31. * \brief Forward modelling for FID sNMR pulses
  32. * \details This class performs forward modelling of sNMR
  33. * FID experiments.
  34. */
  35. class ForwardFID : public MerlinObject {
  36. friend std::ostream &operator<<(std::ostream &stream, const ForwardFID &ob);
  37. public:
  38. // ==================== LIFECYCLE =======================
  39. /**
  40. * Default constructor.
  41. * @note This method is locked, and cannot be called directly.
  42. * The reason that the method is public is to enable the use
  43. * of make_shared whilst enforcing the use of shared_ptr,
  44. * in c++-17, this curiosity may be resolved.
  45. * @see ForwardFID::NewSP
  46. */
  47. explicit ForwardFID ( const ctor_key& );
  48. /**
  49. * DeSerializing constructor.
  50. * @note This method is locked, and cannot be called directly.
  51. * The reason that the method is public is to enable the use
  52. * of make_shared whilst enforcing the use of shared_ptr,
  53. * in c++-17, this curiosity may be resolved.
  54. * @see ForwardFID::DeSerialize
  55. */
  56. ForwardFID ( const YAML::Node& node, const ctor_key& );
  57. /**
  58. * Default destructor.
  59. * @note This method should never be called due to the mandated
  60. * use of smart pointers. It is necessary to keep the method
  61. * public in order to allow for the use of the more efficient
  62. * make_shared constructor.
  63. */
  64. virtual ~ForwardFID ();
  65. /**
  66. * Uses YAML to serialize this object.
  67. * @return a YAML::Node
  68. * @see ForwardFID::DeSerialize
  69. */
  70. virtual YAML::Node Serialize() const;
  71. /*
  72. * Factory method for generating concrete class.
  73. * @return a std::shared_ptr of type ForwardFID
  74. */
  75. static std::shared_ptr< ForwardFID > NewSP();
  76. /**
  77. * Constructs an ForwardFID object from a YAML::Node.
  78. * @see ForwardFID::Serialize
  79. */
  80. static std::shared_ptr<ForwardFID> DeSerialize(const YAML::Node& node);
  81. // ==================== OPERATORS =======================
  82. // ==================== OPERATIONS =======================
  83. /**
  84. * Performs forward model calculation based on input parameters
  85. * @return Merlin class representing data
  86. */
  87. std::shared_ptr<DataFID> ForwardModel( std::shared_ptr<LayeredEarthMR> );
  88. // ==================== ACCESS =======================
  89. /**
  90. * Sets windows using the edges in a Eigen VectorXr
  91. * @param[in] Edges are the edges of the time gate windows
  92. */
  93. void SetWindowEdges( const VectorXr& Edges );
  94. /**
  95. * Sets the windows for calculation as a series of log spaced windows.
  96. * This method calculates the window edges, so the centres will be n-1
  97. * @param[in] first is the beginning of the vector
  98. * @param[in] last is the last element in the vector
  99. * @param[in] n is the number of elements
  100. */
  101. void SetLogSpacedWindows(const Real& first, const Real& last, const int& n);
  102. /**
  103. * @param[in] K0 is the initial amplitude imaging kernel
  104. */
  105. void SetKernel( std::shared_ptr< KernelV0 > K0 );
  106. /**
  107. * @param[in] floor is the standard deviation of the noise (zero mean),
  108. * defaults to zero
  109. */
  110. void SetNoiseFloor( const Real& floor );
  111. // ==================== INQUIRY =======================
  112. /**
  113. * Returns the name of the underlying class, similiar to Python's type
  114. * @return string of class name
  115. */
  116. virtual inline std::string GetName() const {
  117. return CName;
  118. }
  119. protected:
  120. // ==================== LIFECYCLE =======================
  121. /** Copy is disabled */
  122. ForwardFID( const ForwardFID& ) = delete;
  123. private:
  124. /**
  125. * Calculates the QT matrix
  126. * @param[in] T2StarBins are the T2* bins to use
  127. */
  128. void CalcQTMatrix( VectorXr T2StarBins );
  129. // ==================== DATA MEMBERS =========================
  130. /** ASCII string representation of the class name */
  131. static constexpr auto CName = "ForwardFID";
  132. /** Imaging kernel used in calculation */
  133. std::shared_ptr< KernelV0 > Kernel = nullptr;
  134. /** Noise floor for additive Gaussian noise */
  135. Real NoiseFloor = 0.;
  136. /** Time gate windows */
  137. VectorXr WindowEdges;
  138. /** Time gate centres */
  139. VectorXr WindowCentres;
  140. /** QT matrix */
  141. MatrixXcr QT;
  142. /** Include RDP effects? */
  143. bool RDP = false;
  144. }; // ----- end of class ForwardFID -----
  145. } // ----- end of namespace Lemma ----
  146. /* vim: set tabstop=4 expandtab: */
  147. /* vim: set filetype=cpp: */
  148. #endif // ----- #ifndef FORWARDFID_INC -----