diff --git a/Core/Correlations/IPeakShape.cpp b/Core/Correlations/IPeakShape.cpp index e932ee78425ba9ba09266f3276e2b904ce45479f..b30ed91af77d70aee6b9e7a4282353c6ec7c2d45 100644 --- a/Core/Correlations/IPeakShape.cpp +++ b/Core/Correlations/IPeakShape.cpp @@ -48,7 +48,7 @@ double FisherPrefactor(double kappa) } } -double VonMisesPrefactor(double kappa) +double MisesPrefactor(double kappa) { if (kappa <= 0.0) { return 1.0 / (2.0 * M_PI); @@ -202,10 +202,10 @@ double LorentzFisherPeakShape::evaluate(const kvector_t q, const kvector_t q_lat } // ************************************************************************** // -// class VonMisesFisherGaussPeakShape +// class MisesFisherGaussPeakShape // ************************************************************************** // -VonMisesFisherGaussPeakShape::VonMisesFisherGaussPeakShape(double max_intensity, double radial_size, +MisesFisherGaussPeakShape::MisesFisherGaussPeakShape(double max_intensity, double radial_size, kvector_t zenith, double kappa_1, double kappa_2) : m_max_intensity(max_intensity), m_radial_size(radial_size), m_zenith(zenith.unit()), @@ -213,15 +213,15 @@ VonMisesFisherGaussPeakShape::VonMisesFisherGaussPeakShape(double max_intensity, { } -VonMisesFisherGaussPeakShape::~VonMisesFisherGaussPeakShape() = default; +MisesFisherGaussPeakShape::~MisesFisherGaussPeakShape() = default; -VonMisesFisherGaussPeakShape* VonMisesFisherGaussPeakShape::clone() const +MisesFisherGaussPeakShape* MisesFisherGaussPeakShape::clone() const { - return new VonMisesFisherGaussPeakShape(m_max_intensity, m_radial_size, m_zenith, m_kappa_1, + return new MisesFisherGaussPeakShape(m_max_intensity, m_radial_size, m_zenith, m_kappa_1, m_kappa_2); } -double VonMisesFisherGaussPeakShape::evaluate(const kvector_t q, +double MisesFisherGaussPeakShape::evaluate(const kvector_t q, const kvector_t q_lattice_point) const { // radial part @@ -247,13 +247,13 @@ double VonMisesFisherGaussPeakShape::evaluate(const kvector_t q, m_phi = std::acos(q_ortho.unit().dot(m_ux)); m_theta = std::acos(q.unit().dot(m_zenith)); double pre_1 = FisherPrefactor(m_kappa_1); - double pre_2 = VonMisesPrefactor(m_kappa_2); + double pre_2 = MisesPrefactor(m_kappa_2); double integral = m_integrator.integrate([&](double phi) -> double { return integrand(phi); }, 0.0, M_TWOPI); return m_max_intensity * radial_part * pre_1 * pre_2 * integral; } -double VonMisesFisherGaussPeakShape::integrand(double phi) const +double MisesFisherGaussPeakShape::integrand(double phi) const { kvector_t u_q = std::sin(m_theta) * std::cos(phi) * m_ux + std::sin(m_theta) * std::sin(phi) * m_uy + std::cos(m_theta) * m_zenith; @@ -263,24 +263,24 @@ double VonMisesFisherGaussPeakShape::integrand(double phi) const } // ************************************************************************** // -// class VonMisesGaussPeakShape +// class MisesGaussPeakShape // ************************************************************************** // -VonMisesGaussPeakShape::VonMisesGaussPeakShape(double max_intensity, double radial_size, +MisesGaussPeakShape::MisesGaussPeakShape(double max_intensity, double radial_size, kvector_t zenith, double kappa) : m_max_intensity(max_intensity), m_radial_size(radial_size), m_zenith(zenith.unit()), m_kappa(kappa) { } -VonMisesGaussPeakShape::~VonMisesGaussPeakShape() = default; +MisesGaussPeakShape::~MisesGaussPeakShape() = default; -VonMisesGaussPeakShape* VonMisesGaussPeakShape::clone() const +MisesGaussPeakShape* MisesGaussPeakShape::clone() const { - return new VonMisesGaussPeakShape(m_max_intensity, m_radial_size, m_zenith, m_kappa); + return new MisesGaussPeakShape(m_max_intensity, m_radial_size, m_zenith, m_kappa); } -double VonMisesGaussPeakShape::evaluate(const kvector_t q, const kvector_t q_lattice_point) const +double MisesGaussPeakShape::evaluate(const kvector_t q, const kvector_t q_lattice_point) const { m_uy = m_zenith.cross(q_lattice_point); kvector_t zxq = m_zenith.cross(q); @@ -295,13 +295,13 @@ double VonMisesGaussPeakShape::evaluate(const kvector_t q, const kvector_t q_lat kvector_t q_ortho = q - q.dot(m_zenith) * m_zenith; m_phi = std::acos(q_ortho.unit().dot(m_ux)); m_theta = std::acos(q.unit().dot(m_zenith)); - double pre = VonMisesPrefactor(m_kappa); + double pre = MisesPrefactor(m_kappa); double integral = m_integrator.integrate([&](double phi) -> double { return integrand(phi); }, 0.0, M_TWOPI); return m_max_intensity * pre * integral; } -double VonMisesGaussPeakShape::integrand(double phi) const +double MisesGaussPeakShape::integrand(double phi) const { kvector_t q_rot = m_qr * (std::sin(m_theta) * std::cos(phi) * m_ux diff --git a/Core/Correlations/IPeakShape.h b/Core/Correlations/IPeakShape.h index 394b486ecb5ee491157dca686daa66fb381f91e1..6ee2e7f97a11c2706b6de5f43cb45180971d45c2 100644 --- a/Core/Correlations/IPeakShape.h +++ b/Core/Correlations/IPeakShape.h @@ -19,6 +19,7 @@ #include "Core/Tools/Integrator.h" #include "Core/Vector/Vectors3D.h" + //! Pure virtual interface class that defines the peak shape of a Bragg peak. //! //! @ingroup samples_internal @@ -38,6 +39,7 @@ public: virtual bool angularDisorder() const { return false; } }; + //! Class that implements an isotropic Gaussian peak shape of a Bragg peak. //! //! @ingroup samples_internal @@ -60,6 +62,7 @@ private: double m_domainsize; }; + //! Class that implements an isotropic Lorentzian peak shape of a Bragg peak. //! //! @ingroup samples_internal @@ -82,8 +85,9 @@ private: double m_domainsize; }; + //! Class that implements a peak shape that is Gaussian in the radial direction and -//! uses the von Mises-Fisher distribution in the angular direction. +//! uses the Mises-Fisher distribution in the angular direction. //! //! @ingroup samples_internal @@ -107,8 +111,9 @@ private: double m_kappa; }; + //! Class that implements a peak shape that is Lorentzian in the radial direction and -//! uses the von Mises-Fisher distribution in the angular direction. +//! uses the Mises-Fisher distribution in the angular direction. //! //! @ingroup samples_internal @@ -132,20 +137,21 @@ private: double m_kappa; }; + //! Class that implements a peak shape that is Gaussian in the radial direction and a -//! convolution of a von Mises-Fisher distribution with a von Mises distribution on the +//! convolution of a Mises-Fisher distribution with a Mises distribution on the //! two-sphere //! //! @ingroup samples_internal -class BA_CORE_API_ VonMisesFisherGaussPeakShape : public IPeakShape +class BA_CORE_API_ MisesFisherGaussPeakShape : public IPeakShape { public: - VonMisesFisherGaussPeakShape(double max_intensity, double radial_size, kvector_t zenith, + MisesFisherGaussPeakShape(double max_intensity, double radial_size, kvector_t zenith, double kappa_1, double kappa_2); - ~VonMisesFisherGaussPeakShape() override; + ~MisesFisherGaussPeakShape() override; - VonMisesFisherGaussPeakShape* clone() const override; + MisesFisherGaussPeakShape* clone() const override; void accept(INodeVisitor* visitor) const override { visitor->visit(this); } @@ -164,19 +170,20 @@ private: mutable RealIntegrator m_integrator; }; -//! Class that implements a peak shape that is a convolution of a von Mises-Fisher distribution + +//! Class that implements a peak shape that is a convolution of a Mises-Fisher distribution //! with a 3d Gaussian //! //! @ingroup samples_internal -class BA_CORE_API_ VonMisesGaussPeakShape : public IPeakShape +class BA_CORE_API_ MisesGaussPeakShape : public IPeakShape { public: - VonMisesGaussPeakShape(double max_intensity, double radial_size, kvector_t zenith, + MisesGaussPeakShape(double max_intensity, double radial_size, kvector_t zenith, double kappa); - ~VonMisesGaussPeakShape() override; + ~MisesGaussPeakShape() override; - VonMisesGaussPeakShape* clone() const override; + MisesGaussPeakShape* clone() const override; void accept(INodeVisitor* visitor) const override { visitor->visit(this); }