Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Algorithms::MaxentCalculator Class Referencefinal

MaxentCalculator : This class performs one maxent iteration and calculates chi-sq, angle between gradient of S and gradient of chi-sq, search directions and quadratic coefficients. More...

#include <MaxentCalculator.h>

Public Member Functions

double calculateChiSquared (const std::vector< double > &data) const
 Calculate ChiSq = 1 / N sum_i [ data_i - dataCalc_i ]^2 / [ error_i ]^2. More...
 
std::vector< double > calculateData (const std::vector< double > &image) const
 
std::vector< double > calculateImage (const std::vector< double > &data) const
 
double getAngle () const
 Returns the angle between the gradient of chi-square and the gradient of the entropy (calculated and initialized in calculateQuadraticCoefficients()) More...
 
double getChisq ()
 Returns chi-square. More...
 
std::vector< double > getImage () const
 Returns the (reconstructed) image. More...
 
QuadraticCoefficients getQuadraticCoefficients () const
 Returns the quadratic coefficients. More...
 
std::vector< double > getReconstructedData () const
 Returns the reconstructed (calculated) data. More...
 
std::vector< std::vector< double > > getSearchDirections () const
 Returns the search directions (in image space) More...
 
void iterate (const std::vector< double > &data, const std::vector< double > &errors, const std::vector< double > &image, double background, const std::vector< double > &linearAdjustments, const std::vector< double > &constAdjustments)
 Performs an iteration and calculates everything: search directions (SB. More...
 
 MaxentCalculator ()=delete
 
 MaxentCalculator (MaxentEntropy_sptr entropy, MaxentTransform_sptr transform)
 Constructor. More...
 
virtual ~MaxentCalculator ()=default
 

Private Member Functions

std::vector< double > calculateChiGrad () const
 Calculates the gradient of chi-square using the experimental data, calculated data and errors. More...
 
void calculateChisq ()
 Calculates chi-square. More...
 

Private Attributes

double m_angle
 
double m_background
 
double m_chisq
 
QuadraticCoefficients m_coeffs
 
std::vector< double > m_data
 
std::vector< double > m_dataCalc
 
std::vector< std::vector< double > > m_directionsIm
 
MaxentEntropy_sptr m_entropy
 
std::vector< double > m_errors
 
std::vector< double > m_image
 
MaxentTransform_sptr m_transform
 

Detailed Description

MaxentCalculator : This class performs one maxent iteration and calculates chi-sq, angle between gradient of S and gradient of chi-sq, search directions and quadratic coefficients.

Calculations are based on J. Skilling and R. K. Bryan: "Maximum entropy image reconstruction: general algorithm" (1984), section 3.6.

Definition at line 24 of file MaxentCalculator.h.

Constructor & Destructor Documentation

◆ MaxentCalculator() [1/2]

Mantid::Algorithms::MaxentCalculator::MaxentCalculator ( MaxentEntropy_sptr  entropy,
MaxentTransform_sptr  transform 
)

Constructor.

Parameters
entropy: pointer to MaxentEntropy object defining the entropy formula to use
transform: pointer to MaxentTransform object defining how to transform from data space to image space and vice-versa

Definition at line 20 of file MaxentCalculator.cpp.

◆ MaxentCalculator() [2/2]

Mantid::Algorithms::MaxentCalculator::MaxentCalculator ( )
delete

◆ ~MaxentCalculator()

virtual Mantid::Algorithms::MaxentCalculator::~MaxentCalculator ( )
virtualdefault

Member Function Documentation

◆ calculateChiGrad()

std::vector< double > Mantid::Algorithms::MaxentCalculator::calculateChiGrad ( ) const
private

Calculates the gradient of chi-square using the experimental data, calculated data and errors.

Returns
: The gradient of chi-square as a vector

Definition at line 29 of file MaxentCalculator.cpp.

References m_data, m_dataCalc, and m_errors.

Referenced by iterate().

◆ calculateChisq()

void Mantid::Algorithms::MaxentCalculator::calculateChisq ( )
private

Calculates chi-square.

Definition at line 315 of file MaxentCalculator.cpp.

References calculateChiSquared(), m_chisq, m_data, m_dataCalc, and m_errors.

Referenced by iterate().

◆ calculateChiSquared()

double Mantid::Algorithms::MaxentCalculator::calculateChiSquared ( const std::vector< double > &  data) const

Calculate ChiSq = 1 / N sum_i [ data_i - dataCalc_i ]^2 / [ error_i ]^2.

Definition at line 324 of file MaxentCalculator.cpp.

References m_data, and m_errors.

Referenced by calculateChisq().

◆ calculateData()

std::vector< double > Mantid::Algorithms::MaxentCalculator::calculateData ( const std::vector< double > &  image) const

Definition at line 136 of file MaxentCalculator.cpp.

References m_transform.

◆ calculateImage()

std::vector< double > Mantid::Algorithms::MaxentCalculator::calculateImage ( const std::vector< double > &  data) const

Definition at line 140 of file MaxentCalculator.cpp.

References m_transform.

◆ getAngle()

double Mantid::Algorithms::MaxentCalculator::getAngle ( ) const

Returns the angle between the gradient of chi-square and the gradient of the entropy (calculated and initialized in calculateQuadraticCoefficients())

Returns
: The angle

Definition at line 116 of file MaxentCalculator.cpp.

References m_angle.

Referenced by Mantid::Algorithms::MaxEnt::exec().

◆ getChisq()

double Mantid::Algorithms::MaxentCalculator::getChisq ( )

Returns chi-square.

Returns
: Chi-square

Definition at line 128 of file MaxentCalculator.cpp.

References m_chisq.

Referenced by Mantid::Algorithms::MaxEnt::exec(), and iterate().

◆ getImage()

std::vector< double > Mantid::Algorithms::MaxentCalculator::getImage ( ) const

Returns the (reconstructed) image.

Returns
: The image as a vector

Definition at line 77 of file MaxentCalculator.cpp.

References m_image.

Referenced by Mantid::Algorithms::MaxEnt::exec().

◆ getQuadraticCoefficients()

QuadraticCoefficients Mantid::Algorithms::MaxentCalculator::getQuadraticCoefficients ( ) const

Returns the quadratic coefficients.

Returns
: The quadratic coefficients

Definition at line 102 of file MaxentCalculator.cpp.

References QuadraticCoefficients::c1, m_coeffs, and Mantid::Kernel::Matrix< T >::size().

Referenced by Mantid::Algorithms::MaxEnt::exec().

◆ getReconstructedData()

std::vector< double > Mantid::Algorithms::MaxentCalculator::getReconstructedData ( ) const

Returns the reconstructed (calculated) data.

Returns
: The reconstructed data as a vector

Definition at line 64 of file MaxentCalculator.cpp.

References m_dataCalc.

Referenced by Mantid::Algorithms::MaxEnt::exec().

◆ getSearchDirections()

std::vector< std::vector< double > > Mantid::Algorithms::MaxentCalculator::getSearchDirections ( ) const

Returns the search directions (in image space)

Returns
: The search directions

Definition at line 90 of file MaxentCalculator.cpp.

References m_directionsIm.

Referenced by Mantid::Algorithms::MaxEnt::exec().

◆ iterate()

void Mantid::Algorithms::MaxentCalculator::iterate ( const std::vector< double > &  data,
const std::vector< double > &  errors,
const std::vector< double > &  image,
double  background,
const std::vector< double > &  linearAdjustments,
const std::vector< double > &  constAdjustments 
)

Performs an iteration and calculates everything: search directions (SB.

21), quadratic coefficients (SB. 22), angle between the gradient of chi-square and the gradient of the entropy, and chi-sqr

Parameters
data: [input] The experimental data as a vector (real or complex)
errors: [input] The experimental errors as a vector (real or complex)
image: [input] The image as a vector (real or complex)
background: [input] The background
linearAdjustments[input] Optional linear adjustments (complex)
constAdjustments[input] Optional constant adjustments (complex)

Definition at line 155 of file MaxentCalculator.cpp.

References QuadraticCoefficients::c1, QuadraticCoefficients::c2, calculateChiGrad(), calculateChisq(), getChisq(), m_angle, m_background, m_chisq, m_coeffs, m_data, m_dataCalc, m_directionsIm, m_entropy, m_errors, m_image, m_transform, QuadraticCoefficients::s1, and QuadraticCoefficients::s2.

Referenced by Mantid::Algorithms::MaxEnt::exec().

Member Data Documentation

◆ m_angle

double Mantid::Algorithms::MaxentCalculator::m_angle
private

Definition at line 74 of file MaxentCalculator.h.

Referenced by getAngle(), and iterate().

◆ m_background

double Mantid::Algorithms::MaxentCalculator::m_background
private

Definition at line 72 of file MaxentCalculator.h.

Referenced by iterate().

◆ m_chisq

double Mantid::Algorithms::MaxentCalculator::m_chisq
private

Definition at line 76 of file MaxentCalculator.h.

Referenced by calculateChisq(), getChisq(), and iterate().

◆ m_coeffs

QuadraticCoefficients Mantid::Algorithms::MaxentCalculator::m_coeffs
private

Definition at line 80 of file MaxentCalculator.h.

Referenced by getQuadraticCoefficients(), and iterate().

◆ m_data

std::vector<double> Mantid::Algorithms::MaxentCalculator::m_data
private

Definition at line 64 of file MaxentCalculator.h.

Referenced by calculateChiGrad(), calculateChisq(), calculateChiSquared(), and iterate().

◆ m_dataCalc

std::vector<double> Mantid::Algorithms::MaxentCalculator::m_dataCalc
private

Definition at line 70 of file MaxentCalculator.h.

Referenced by calculateChiGrad(), calculateChisq(), getReconstructedData(), and iterate().

◆ m_directionsIm

std::vector<std::vector<double> > Mantid::Algorithms::MaxentCalculator::m_directionsIm
private

Definition at line 78 of file MaxentCalculator.h.

Referenced by getSearchDirections(), and iterate().

◆ m_entropy

MaxentEntropy_sptr Mantid::Algorithms::MaxentCalculator::m_entropy
private

Definition at line 83 of file MaxentCalculator.h.

Referenced by iterate().

◆ m_errors

std::vector<double> Mantid::Algorithms::MaxentCalculator::m_errors
private

Definition at line 66 of file MaxentCalculator.h.

Referenced by calculateChiGrad(), calculateChisq(), calculateChiSquared(), and iterate().

◆ m_image

std::vector<double> Mantid::Algorithms::MaxentCalculator::m_image
private

Definition at line 68 of file MaxentCalculator.h.

Referenced by getImage(), and iterate().

◆ m_transform

MaxentTransform_sptr Mantid::Algorithms::MaxentCalculator::m_transform
private

Definition at line 85 of file MaxentCalculator.h.

Referenced by calculateData(), calculateImage(), and iterate().


The documentation for this class was generated from the following files: