Mantid
|
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 |
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.
Mantid::Algorithms::MaxentCalculator::MaxentCalculator | ( | MaxentEntropy_sptr | entropy, |
MaxentTransform_sptr | transform | ||
) |
Constructor.
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.
|
delete |
|
virtualdefault |
|
private |
Calculates the gradient of chi-square using the experimental data, calculated data and errors.
Definition at line 29 of file MaxentCalculator.cpp.
References m_data, m_dataCalc, and m_errors.
Referenced by iterate().
|
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().
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().
std::vector< double > Mantid::Algorithms::MaxentCalculator::calculateData | ( | const std::vector< double > & | image | ) | const |
Definition at line 136 of file MaxentCalculator.cpp.
References m_transform.
std::vector< double > Mantid::Algorithms::MaxentCalculator::calculateImage | ( | const std::vector< double > & | data | ) | const |
Definition at line 140 of file MaxentCalculator.cpp.
References m_transform.
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())
Definition at line 116 of file MaxentCalculator.cpp.
References m_angle.
Referenced by Mantid::Algorithms::MaxEnt::exec().
double Mantid::Algorithms::MaxentCalculator::getChisq | ( | ) |
Returns chi-square.
Definition at line 128 of file MaxentCalculator.cpp.
References m_chisq.
Referenced by Mantid::Algorithms::MaxEnt::exec(), and iterate().
std::vector< double > Mantid::Algorithms::MaxentCalculator::getImage | ( | ) | const |
Returns the (reconstructed) image.
Definition at line 77 of file MaxentCalculator.cpp.
References m_image.
Referenced by Mantid::Algorithms::MaxEnt::exec().
QuadraticCoefficients Mantid::Algorithms::MaxentCalculator::getQuadraticCoefficients | ( | ) | const |
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().
std::vector< double > Mantid::Algorithms::MaxentCalculator::getReconstructedData | ( | ) | const |
Returns the reconstructed (calculated) data.
Definition at line 64 of file MaxentCalculator.cpp.
References m_dataCalc.
Referenced by Mantid::Algorithms::MaxEnt::exec().
std::vector< std::vector< double > > Mantid::Algorithms::MaxentCalculator::getSearchDirections | ( | ) | const |
Returns the search directions (in image space)
Definition at line 90 of file MaxentCalculator.cpp.
References m_directionsIm.
Referenced by Mantid::Algorithms::MaxEnt::exec().
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
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().
|
private |
Definition at line 74 of file MaxentCalculator.h.
Referenced by getAngle(), and iterate().
|
private |
Definition at line 72 of file MaxentCalculator.h.
Referenced by iterate().
|
private |
Definition at line 76 of file MaxentCalculator.h.
Referenced by calculateChisq(), getChisq(), and iterate().
|
private |
Definition at line 80 of file MaxentCalculator.h.
Referenced by getQuadraticCoefficients(), and iterate().
|
private |
Definition at line 64 of file MaxentCalculator.h.
Referenced by calculateChiGrad(), calculateChisq(), calculateChiSquared(), and iterate().
|
private |
Definition at line 70 of file MaxentCalculator.h.
Referenced by calculateChiGrad(), calculateChisq(), getReconstructedData(), and iterate().
|
private |
Definition at line 78 of file MaxentCalculator.h.
Referenced by getSearchDirections(), and iterate().
|
private |
Definition at line 83 of file MaxentCalculator.h.
Referenced by iterate().
|
private |
Definition at line 66 of file MaxentCalculator.h.
Referenced by calculateChiGrad(), calculateChisq(), calculateChiSquared(), and iterate().
|
private |
Definition at line 68 of file MaxentCalculator.h.
Referenced by getImage(), and iterate().
|
private |
Definition at line 85 of file MaxentCalculator.h.
Referenced by calculateData(), calculateImage(), and iterate().