21namespace CurveFitting {
31 const std::string
name()
const override {
return "RefinePowderInstrumentParameters"; }
33 const std::string
summary()
const override {
return "Parameters include Dtt1, Dtt1t, Dtt2t, Zero, Zerot. "; }
36 int version()
const override {
return 3; }
37 const std::vector<std::string>
seeAlso()
const override {
return {
"RefinePowderDiffProfileSeq"}; }
40 const std::string
category()
const override {
return "Diffraction\\Fitting"; }
50 double execFitParametersNonMC();
53 double execFitParametersMC();
56 double doSimulatedAnnealing(std::map<std::string, Parameter> inparammap);
59 void setupRandomWalkStrategy(std::map<std::string, Parameter> ¶mmap,
60 std::vector<std::vector<std::string>> &mcgroups);
63 void addParameterToMCMinimize(std::vector<std::string> &parnamesforMC,
const std::string &parname,
64 std::map<std::string, Parameter> parammap);
67 void proposeNewValues(
const std::vector<std::string> &mcgroup, std::map<std::string, Parameter> &curparammap,
68 std::map<std::string, Parameter> &newparammap,
double currchisq);
71 bool acceptOrDenyChange(
double curchisq,
double newchisq,
double temperature);
74 void bookKeepMCResult(std::map<std::string, Parameter> parammap,
double chisq,
int istep,
int igroup,
75 std::map<std::string, Parameter> &bestparammap);
80 double calculateFunction(
const std::map<std::string, Parameter> ¶mmap, std::vector<double> &vecY);
92 const std::string &minimizer,
int numiters,
double &chi2, std::string &fitstatus);
95 void processInputProperties();
98 void parseTableWorkspaces();
104 void setFunctionParameterValues(
const API::IFunction_sptr &function, std::map<std::string, Parameter> params);
111 void setFunctionParameterFitSetups(
const API::IFunction_sptr &function, std::map<std::string, Parameter> params);
123 void addOrReplace(std::map<std::string, Parameter> ¶meters,
const std::string &parname,
double parvalue);
136 enum {
FIT, MONTECARLO } m_fitMode;
165void convertToDict(std::vector<std::string> strvec, std::map<std::string, size_t> &lookupdict);
168int getStringIndex(std::map<std::string, size_t> lookupdict,
const std::string &key);
172 std::map<std::string, std::pair<double, double>> &parvaluemap);
179void duplicateParameters(std::map<std::string, Parameter> source, std::map<std::string, Parameter> &target);
182void copyParametersValues(std::map<std::string, Parameter> source, std::map<std::string, Parameter> &target);
186 const std::vector<double> &dataE);
Base class from which all concrete algorithm classes should be derived.
Implements FunctionDomain1D with its own storage in form of a std::vector.
A class to store values calculated by a function.
RefinePowderInstrumentParameters3 :
int m_randomSeed
Random seed.
double m_dampingFactor
Damping factor.
int m_numWalkSteps
Monte Carlo random walk steps.
double m_bestChiSq
Book keep for MC.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Functions::ThermalNeutronDtoTOFFunction_sptr m_positionFunc
My function for peak positions.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
DataObjects::Workspace2D_sptr m_dataWS
Data workspace containg peak positions.
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
int m_wsIndex
Workspace index of the peak positions.
const std::string summary() const override
Summary of algorithms purpose.
DataObjects::TableWorkspace_sptr m_paramTable
TableWorkspace containing peak parameters value and fit information.
std::map< std::string, Parameter > m_profileParameters
Data structure (map of Parameters) to hold parameters.
void updateFunctionParameterValues(API::IFunction_sptr function, std::map< std::string, Parameter > ¶ms)
Update parameter values to Parameter map from fuction map.
int version() const override
Algorithm's version for identification overriding a virtual method.
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
double calculateFunctionChiSquare(const std::vector< double > &modelY, const std::vector< double > &dataY, const std::vector< double > &dataE)
Calculate Chi^2.
void duplicateParameters(std::map< std::string, Parameter > source, std::map< std::string, Parameter > &target)
Copy parameters from source to target.
void convertToDict(std::vector< std::string > strvec, std::map< std::string, size_t > &lookupdict)
Convert a vector to a lookup map (dictionary)
int getStringIndex(std::map< std::string, size_t > lookupdict, const std::string &key)
Get the index from lookup dictionary (map)
void restoreFunctionParameterValue(std::map< std::string, std::pair< double, double > > parvaluemap, const API::IFunction_sptr &function, std::map< std::string, Parameter > ¶mmap)
Restore function parameter values to a map.
void copyParametersValues(std::map< std::string, Parameter > source, std::map< std::string, Parameter > &target)
Copy parameters values from source to target.
void storeFunctionParameterValue(const API::IFunction_sptr &function, std::map< std::string, std::pair< double, double > > &parvaluemap)
Store function parameter values to a map.
std::shared_ptr< ThermalNeutronDtoTOFFunction > ThermalNeutronDtoTOFFunction_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.