22#include "MantidHistogramData/HistogramX.h"
23#include "MantidHistogramData/HistogramY.h"
27namespace CurveFitting {
47 const std::string
name()
const override {
return "RefinePowderInstrumentParameters"; }
49 const std::string
summary()
const override {
return "Parameters include Dtt1, Dtt1t, Dtt2t, Zero, Zerot. "; }
52 int version()
const override {
return 2; }
55 const std::string
category()
const override {
return "Diffraction\\Fitting"; }
66 std::map<std::string, double> ¶meters);
70 const std::vector<std::string> ¶meternames,
71 std::vector<double> &stepsizes, std::vector<double> &lowerbounds,
72 std::vector<double> &upperbounds);
75 void genPeakCentersWorkspace(
bool montecarlo,
size_t numbestfit);
89 void fitInstrumentParameters();
93 size_t workspaceindex);
108 void doParameterSpaceRandomWalk(std::vector<std::string> parnames, std::vector<double> lowerbounds,
109 std::vector<double> upperbounds, std::vector<double> stepsizes,
size_t maxsteps,
110 double stepsizescalefactor,
bool fit2);
113 void getD2TOFFuncParamNames(std::vector<std::string> &parnames);
118 const Mantid::HistogramData::HistogramE &rawE);
125 const Mantid::HistogramData::HistogramX &xVals, std::vector<double> &vec_n);
171 double x = ((xf - x0) *
y - (xf * y0 - x0 * yf)) / (yf - y0);
178 double y = ((xf * y0 - x0 * yf) +
x * (yf - y0)) / (xf - x0);
Base class from which all concrete algorithm classes should be derived.
Class for marking algorithms as deprecated.
Implements FunctionDomain1D with its own storage in form of a std::vector.
A class to store values calculated by a function.
RefinePowderInstrumentParameters : Algorithm to refine instrument geometry parameters only.
std::map< std::string, double > m_OrigParameters
Map to store the original (input) parameters.
std::vector< std::string > m_PeakFunctionParameterNames
Peak function parameter names.
size_t m_MinNumFittedPeaks
Minimum number of fitted peaks for refinement.
Functions::ThermalNeutronDtoTOFFunction_sptr m_Function
Modelling function.
std::map< std::string, double > m_FuncParameters
Map for function (instrument parameter)
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
std::string parseFitResult(API::IAlgorithm_sptr fitalg, double &chi2)
Parse the fitting result.
std::vector< std::pair< double, std::vector< double > > > m_BestFitParameters
N sets of the peak parameter values for the best N chi2 for MC.
std::string parseFitParameterWorkspace(API::ITableWorkspace_sptr paramws)
Parse Fit() output parameter workspace.
std::map< std::vector< int >, double > m_PeakErrors
Map for all peaks' error (fitted vs. experimental): [HKL]: Chi^2.
std::map< std::vector< int >, Functions::BackToBackExponential_sptr > m_Peaks
Map for all peaks to fit individually.
DataObjects::Workspace2D_sptr m_dataWS
Output Workspace containing the dspacing ~ TOF peak positions.
double m_BestGSLChi2
Best Chi2 ever.
std::vector< std::pair< double, std::vector< double > > > m_BestMCParameters
N sets of the peak parameter values for the best N chi2 for MC.
std::vector< std::pair< double, double > > m_BestFitChi2s
N sets of the homemade chi2 and gsl chi2.
int version() const override
Algorithm's version for identification overriding a virtual method.
const std::string summary() const override
Summary of algorithms purpose.
double m_MinSigma
Minimum allowed sigma of a peak.
size_t m_MaxNumberStoredParameters
Maximum number of data stored.
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
double linearInterpolateX(double x0, double xf, double y0, double yf, double y)
Formular for linear iterpolation: X = [(xf-x0)*Y - (xf*y0-x0*yf)]/(yf-y0)
double linearInterpolateY(double x0, double xf, double y0, double yf, double x)
Formula for linear interpolation: Y = ( (xf*y0-x0*yf) + x*(yf-y0) )/(xf-x0)
std::shared_ptr< ThermalNeutronDtoTOFFunction > ThermalNeutronDtoTOFFunction_sptr
std::shared_ptr< BackToBackExponential > BackToBackExponential_sptr
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
std::shared_ptr< TableWorkspace > TableWorkspace_sptr
shared pointer to Mantid::DataObjects::TableWorkspace
Helper class which provides the Collimation Length for SANS instruments.