|
Mantid
|
Time dependence of the polarization function for a static muon interacting with nuclear spin. More...
#include <Meier.h>
Public Member Functions | |
| const std::string | category () const override |
| The categories the Fit function belong to. | |
| void | function1D (double *out, const double *xValues, const size_t nData) const override |
| Function you want to fit to. | |
| void | init () override |
| Function initialization. Declare function parameters in this method. | |
| std::string | name () const override |
| Returns the function's name. | |
Public Member Functions inherited from Mantid::API::ParamFunction | |
| IFunction_sptr | getContainingFunction (const ParameterReference &ref) const |
| Get the containing function. | |
| IFunction_sptr | getContainingFunction (IFunction_sptr fun) |
| Get the containing function. | |
| double | getError (const std::string &name) const override |
| Get the fitting error for a parameter by name. | |
| double | getError (size_t i) const override |
| Get the fitting error for a parameter. | |
| double | getParameter (const std::string &name) const override |
| Get parameter by name. | |
| double | getParameter (size_t i) const override |
| Get i-th parameter. | |
| size_t | getParameterIndex (const ParameterReference &ref) const override |
| Return parameter index from a parameter reference. | |
| bool | hasParameter (const std::string &name) const override |
| Check if function has a parameter with this name. | |
| bool | isExplicitlySet (size_t i) const override |
| Checks if a parameter has been set explicitly. | |
| size_t | nParams () const override |
| Total number of parameters. | |
| std::string | parameterDescription (size_t i) const override |
| Returns the description of parameter i. | |
| size_t | parameterIndex (const std::string &name) const override |
| Returns the index of parameter name. | |
| std::string | parameterName (size_t i) const override |
| Returns the name of parameter i. | |
| ParamFunction () | |
| Default constructor. | |
| void | setError (const std::string &name, double err) override |
| Set the fitting error for a parameter by name. | |
| void | setError (size_t i, double err) override |
| Set the fitting error for a parameter. | |
| void | setParameter (const std::string &name, const double &value, bool explicitlySet=true) override |
| Set parameter by name. | |
| void | setParameter (size_t, const double &value, bool explicitlySet=true) override |
| Set i-th parameter. | |
| void | setParameterDescription (const std::string &name, const std::string &description) override |
| Set description of parameter by name. | |
| void | setParameterDescription (size_t, const std::string &description) override |
| Set i-th parameter description. | |
Public Member Functions inherited from Mantid::API::IFunction | |
| std::string | asString () const |
| Writes itself into a string. | |
| bool | cancellationRequestReceived () const |
| Returns true if a progress reporter is set & evalaution has been requested to stop. | |
| virtual const std::vector< std::string > | categories () const |
| Function to return all of the categories that contain this algorithm. | |
| virtual const std::string | categorySeparator () const |
| Function to return the sperator token for the category string. | |
| virtual std::shared_ptr< IFunction > | clone () const |
| Virtual copy constructor. | |
| virtual int64_t | estimateNoProgressCalls () const |
| Returns an estimate of the number of progress reports a single evaluation of the function will have. | |
| IFunction () | |
| Constructor. | |
| IFunction (const IFunction &)=delete | |
| No copying. | |
| virtual void | initialize () |
| Iinialize the function. | |
| virtual void | iterationFinished () |
| Called at the end of an iteration. | |
| virtual void | iterationStarting () |
| Called at the start of each iteration. | |
| IFunction & | operator= (const IFunction &)=delete |
| No copying. | |
| virtual void | registerFunctionUsage (bool internal) |
| Registers the usage of the algorithm with the UsageService. | |
| void | reportProgress (const std::string &msg="") const |
| Reports progress with an optional message. | |
| virtual void | setMatrixWorkspace (std::shared_ptr< const API::MatrixWorkspace > workspace, size_t wi, double startX, double endX) |
| Set matrix workspace. | |
| void | setProgressReporter (std::shared_ptr< Kernel::ProgressBase > reporter) |
| Attach a progress reporter. | |
| virtual void | setWorkspace (std::shared_ptr< const Workspace > ws) |
| Set the workspace. | |
| virtual | ~IFunction () |
| Virtual destructor. | |
| bool | isFixed (size_t i) const |
| Check if a parameter i is fixed. | |
| bool | isFixedByDefault (size_t i) const |
| Check if a parameter i is fixed by default (not by user). | |
| void | fix (size_t i, bool isDefault=false) |
| Removes a parameter i from the list of active. | |
| void | unfix (size_t i) |
| Restores a declared parameter i to the active status. | |
| void | fixParameter (const std::string &name, bool isDefault=false) |
| Fix a parameter. | |
| void | unfixParameter (const std::string &name) |
| Free a parameter. | |
| void | fixAll (bool isDefault=false) |
| Fix all parameters. | |
| void | unfixAll () |
| Free all parameters. | |
| void | unfixAllDefault () |
| Free all parameters fixed by default. | |
| void | fixAllActive (bool isDefault=false) |
| Fix all active parameters. | |
| std::vector< std::string > | getParameterNames () const |
| Return a vector with all parameter names. | |
| virtual double | activeParameter (size_t i) const |
| Value of i-th active parameter. | |
| virtual void | setActiveParameter (size_t i, double value) |
| Set new value of i-th active parameter. | |
| virtual std::string | nameOfActive (size_t i) const |
| Returns the name of active parameter i. | |
| virtual std::string | descriptionOfActive (size_t i) const |
| Returns the name of active parameter i. | |
| bool | isActive (size_t i) const |
| Check if an active parameter i is actually active. | |
| virtual void | tie (const std::string &parName, const std::string &expr, bool isDefault=false) |
| Tie a parameter to other parameters (or a constant) | |
| virtual void | addTies (const std::string &ties, bool isDefault=false) |
| Add several ties. | |
| virtual void | applyTies () |
| Apply the ties. | |
| virtual void | removeTie (const std::string &parName) |
| Removes the tie off a parameter. | |
| virtual void | clearTies () |
| Remove all ties. | |
| virtual bool | removeTie (size_t i) |
| Removes i-th parameter's tie. | |
| virtual ParameterTie * | getTie (size_t i) const |
| Get the tie of i-th parameter. | |
| virtual bool | ignoreTie (const ParameterTie &) const |
| Ignore a tie. | |
| void | sortTies (const bool checkOnly=false) |
| Put all ties in order in which they will be applied correctly. | |
| std::string | writeTies () const |
| Write a parameter tie to a string. | |
| virtual void | addConstraints (const std::string &str, bool isDefault=false) |
| Add a list of conatraints from a string. | |
| virtual void | addConstraint (std::unique_ptr< IConstraint > ic) |
| Add a constraint to function. | |
| virtual IConstraint * | getConstraint (size_t i) const |
| Get constraint of i-th parameter. | |
| virtual void | removeConstraint (const std::string &parName) |
| Remove a constraint. | |
| virtual void | setConstraintPenaltyFactor (const std::string &parName, const double &c) |
| Set a constraint penalty. | |
| std::string | writeConstraints () const |
| Write a parameter constraint to a string. | |
| virtual void | clearConstraints () |
| Remove all constraints. | |
| virtual size_t | nAttributes () const |
| Returns the number of attributes associated with the function. | |
| virtual std::vector< std::string > | getAttributeNames () const |
| Returns a list of attribute names. | |
| virtual std::string | attributeName (size_t index) const |
| Get name of ith attribute. | |
| virtual Attribute | getAttribute (const std::string &name) const |
| Return a value of attribute attName. | |
| virtual void | setAttribute (const std::string &name, const Attribute &) |
| Set a value to attribute attName. | |
| virtual bool | hasAttribute (const std::string &name) const |
| Check if attribute attName exists. | |
| template<typename T > | |
| void | setAttributeValue (const std::string &attName, const T &value) |
| Set an attribute value. | |
| void | setAttributeValue (const std::string &attName, const char *value) |
| Overload for const char* values. | |
| void | setAttributeValue (const std::string &attName, const std::string &value) |
| Set string attribute by value. | |
| virtual std::shared_ptr< IFunction > | getFunction (size_t i) const |
| Returns the pointer to i-th child function. | |
| virtual std::size_t | nFunctions () const |
| Number of child functions. | |
| virtual void | setUpForFit () |
| Set up the function for a fit. | |
| virtual size_t | getValuesSize (const FunctionDomain &domain) const |
| Get number of values for a given domain. | |
| virtual size_t | getNumberDomains () const |
| Get number of domains required by this function. | |
| virtual std::vector< std::shared_ptr< IFunction > > | createEquivalentFunctions () const |
| Split this function (if needed) into a list of independent functions. | |
| void | calNumericalDeriv (const FunctionDomain &domain, Jacobian &jacobian) |
| Calculate numerical derivatives. | |
| double | calculateStepSize (const double parameterValue) const |
| Calculate step size for the given parameter value. | |
| void | setCovarianceMatrix (const std::shared_ptr< Kernel::Matrix< double > > &covar) |
| Set the covariance matrix. | |
| std::shared_ptr< const Kernel::Matrix< double > > | getCovarianceMatrix () const |
| Get the covariance matrix. | |
| void | setReducedChiSquared (double chi2) |
| Set the reduced chi^2. | |
| double | getReducedChiSquared () const |
| Get the reduced chi^2. | |
| void | setParallel (bool on) |
| Set the parallel hint. | |
| bool | isParallel () const |
| Get the parallel hint. | |
| void | setHandler (std::unique_ptr< FunctionHandler > handler) |
| Set a function handler. | |
| FunctionHandler * | getHandler () const |
| Return the handler. | |
| virtual void | setStepSizeMethod (const StepSizeMethod method) |
| Sets the StepSizeMethod to use when calculation the step size. | |
Public Member Functions inherited from Mantid::API::IFunction1D | |
| virtual void | derivative (const FunctionDomain &domain, FunctionValues &values, const size_t order=1) const |
| virtual void | derivative1D (double *out, const double *xValues, const size_t nData, const size_t order) const |
| Function to calculate the derivatives of the data set. | |
| void | function (const FunctionDomain &domain, FunctionValues &values) const override |
| Evaluates the function for all arguments in the domain. | |
| void | functionDeriv (const FunctionDomain &domain, Jacobian &jacobian) override |
| Derivatives of function with respect to active parameters. | |
| virtual void | functionDeriv1D (Jacobian *jacobian, const double *xValues, const size_t nData) |
| Derivatives of function with respect to active parameters. | |
Private Member Functions | |
| void | calculatePx (std::valarray< double > &Px, const std::valarray< double > &xValues, const std::valarray< double > &cos2AlphaSquared, const std::valarray< double > &negativeLambda, const std::valarray< double > &positiveLambda, const double &J2) const |
| Calculates the polarization in the x direction. | |
| void | calculatePz (std::valarray< double > &Pz, const std::valarray< double > &xValues, const std::valarray< double > &cos2AlphaSquared, const std::valarray< double > &negativeLambda, const std::valarray< double > &positiveLambda, const double &J2) const |
| Calculates the polarization in the z direction. | |
| double | getBaseLambda (const double &OmegaQ, const double &OmegaD, const double &J) const |
| Calculates and returns the value of lambda for the special cases i.e it is the value of the first element of the negative lambda and the value of the last element of the negative This function is used by precomputeIntermediateSteps to calculate intermediate steps. | |
| double | getCos2AlphaSquared (const double &q1, const double &qq) const |
| Calculates and returns the value of cos 2*alpha sequared at a given index i This function is used by precomputeIntermediateSteps to calculate intermediate steps. | |
| double | getNegativeLambda (const double &q3, const double &Wm) const |
| Calculates and returns the value of negative lambda This function is used by precomputeIntermediateSteps to calculate intermediate steps. | |
| double | getPositiveLambda (const double &q3, const double &Wm) const |
| Calculates and returns the value of positive lambda This function is used by precomputeIntermediateSteps to calculate intermediate steps. | |
| double | getQ1 (const double &m, const double &OmegaQ, const double &OmegaD) const |
| Calculates and returns the value of q1 This function is used by precomputeIntermediateSteps to calculate intermediate steps. | |
| double | getQ2 (const double &m, const double &J, const double &OmegaD) const |
| Calculates and returns the value of q2 This function is used by precomputeIntermediateSteps to calculate intermediate steps. | |
| double | getQ3 (const double &J, const double &OmegaQ, const double &OmegaD) const |
| Calculates and returns the value of q2 This function is used by precomputeIntermediateSteps to calculate intermediate steps. | |
| double | getQQ (const double &q1, const double &q2) const |
| Calculates and returns the value of qq This function is used by precomputeIntermediateSteps to calculate intermediate steps. | |
| void | precomputeIntermediateSteps (std::valarray< double > &cos2AlphaSquared, std::valarray< double > &negativeLambda, std::valarray< double > &positiveLambda, const double &J2) const |
| Precomputes intermediate terms used to calculate the polrization in the x and z directions. | |
Additional Inherited Members | |
Public Types inherited from Mantid::API::IFunction | |
| enum | ParameterStatus { Active , Fixed , FixedByDefault , Tied } |
| Describe parameter status in relation to fitting: Active: Fit varies such parameter directly. More... | |
| enum class | StepSizeMethod { DEFAULT , SQRT_EPSILON } |
| Describes the method in which the step size will be calculated: DEFAULT: Uses the traditional Mantid method of calculating the step size. More... | |
Protected Types inherited from Mantid::API::IFunction1D | |
| template<typename FunctionType > | |
| using | Function1DMethod = void(FunctionType::*)(double *, const double *, const size_t) const |
Protected Member Functions inherited from Mantid::API::ParamFunction | |
| void | clearAllParameters () |
| Nonvirtual member which removes all declared parameters. | |
| void | declareParameter (const std::string &name, double initValue=0, const std::string &description="") override |
| Declare a new parameter. | |
| virtual double * | getParameterAddress (size_t i) |
| Get the address of the parameter. For use in UserFunction with mu::Parser. | |
| ParameterStatus | getParameterStatus (size_t i) const override |
| Get status of parameter. | |
| void | setParameterStatus (size_t i, ParameterStatus status) override |
| Change status of parameter. | |
Protected Member Functions inherited from Mantid::API::IFunction | |
| double | convertValue (double value, Kernel::Unit_sptr &outUnit, const std::shared_ptr< const MatrixWorkspace > &ws, size_t wsIndex) const |
| Convert a value from one unit (inUnit) to unit defined in workspace (ws) | |
| void | convertValue (std::vector< double > &values, Kernel::Unit_sptr &outUnit, const std::shared_ptr< const MatrixWorkspace > &ws, size_t wsIndex) const |
| Convert values from unit defined in workspace (ws) to outUnit. | |
| virtual void | declareAttributes () |
| Override to declare function attributes. | |
| virtual void | declareParameters () |
| Override to declare function parameters. | |
| void | declareAttribute (const std::string &name, const API::IFunction::Attribute &defaultValue) |
| Declare a single attribute. | |
| void | declareAttribute (const std::string &name, const API::IFunction::Attribute &defaultValue, const Kernel::IValidator &validator) |
| Declare a single attribute with validator. | |
| void | checkAttributeName (const std::string &name) |
| Check Attribute to declare does not already exist. | |
| void | storeAttributeValue (const std::string &name, const API::IFunction::Attribute &value) |
| Store an attribute's value. | |
| void | storeReadOnlyAttribute (const std::string &name, const API::IFunction::Attribute &value) const |
| A read-only ("mutable") attribute can be stored in a const method. | |
| virtual void | addTie (std::unique_ptr< ParameterTie > tie) |
| Add a new tie. Derived classes must provide storage for ties. | |
| bool | hasOrderedTies () const |
| void | applyOrderedTies () |
| virtual std::string | writeToString (const std::string &parentLocalAttributesStr="") const |
| Writes itself into a string. | |
Protected Member Functions inherited from Mantid::API::IFunction1D | |
| template<typename EvaluationMethod > | |
| void | calcNumericalDerivative1D (Jacobian *jacobian, EvaluationMethod func1D, const double *xValues, const size_t nData) |
| Calculate a numerical derivative for the 1D data. | |
| virtual void | histogram1D (double *out, double left, const double *right, const size_t nBins) const |
| Calculate histogram data for the given bin boundaries. | |
| virtual void | histogramDerivative1D (Jacobian *jacobian, double left, const double *right, const size_t nBins) const |
| Derivatives of the histogram1D with respect to active parameters. | |
Protected Attributes inherited from Mantid::API::IFunction | |
| bool | m_isParallel |
| Flag to hint that the function is being used in parallel computations. | |
| std::unique_ptr< FunctionHandler > | m_handler |
| Pointer to a function handler. | |
| std::shared_ptr< Kernel::ProgressBase > | m_progReporter |
| Pointer to the progress handler. | |
Static Protected Attributes inherited from Mantid::API::IFunction1D | |
| static Kernel::Logger | g_log |
| Logger instance. | |
Time dependence of the polarization function for a static muon interacting with nuclear spin.
Meier parameters:
Meier attributes:
|
private |
Calculates the polarization in the x direction.
| Px | :: the polarization in the x direction (output parameter) |
| xValues | :: input x values (input parameter) |
| cos2AlphaSquared | :: cos of 2*alpha squared (input parameter) |
| positiveLambda | :: negative lambda (input parameter) |
| negativeLambda | :: positive lambda (input parameter) |
| J2 | :: 2 * total angular momentum quantum number multiplied by 2 (input parameter) |
Definition at line 234 of file Meier.cpp.
References Mantid::Geometry::d.
Referenced by function1D().
|
private |
Calculates the polarization in the z direction.
| Pz | :: the polarization in the x direction (output parameter) |
| xValues | :: input x values (input parameter) |
| cos2AlphaSquared | :: cos of 2*alpha squared (input parameter) |
| positiveLambda | :: negative lambda (input parameter) |
| negativeLambda | :: positive lambda (input parameter) |
| J2 | :: 2 * total angular momentum quantum number multiplied by 2 (input parameter) |
Definition at line 268 of file Meier.cpp.
Referenced by function1D().
|
inlineoverridevirtual |
The categories the Fit function belong to.
Categories must be listed as a semi colon separated list. For example: "General, Muon\\Custom" which adds a function to the category "General" and the sub-category "Muon\\Custom"
Reimplemented from Mantid::API::IFunction.
|
overridevirtual |
Function you want to fit to.
Implements Mantid::API::IFunction1D.
Definition at line 53 of file Meier.cpp.
References Mantid::API::IFunction::Attribute::asDouble(), calculatePx(), calculatePz(), Mantid::API::IFunction::getAttribute(), Mantid::API::ParamFunction::getParameter(), and precomputeIntermediateSteps().
|
private |
Calculates and returns the value of lambda for the special cases i.e it is the value of the first element of the negative lambda and the value of the last element of the negative This function is used by precomputeIntermediateSteps to calculate intermediate steps.
| OmegaQ | :: Angular Frequency due to dipolar coupling (MHz) |
| OmegaD | :: Angular Frequency due to quadrupole interaction of the nuclear spin (MHz) due to a field gradient |
| J | :: Total angular momentum quanutm number |
Definition at line 212 of file Meier.cpp.
Referenced by precomputeIntermediateSteps().
|
private |
Calculates and returns the value of cos 2*alpha sequared at a given index i This function is used by precomputeIntermediateSteps to calculate intermediate steps.
| q1 | :: the value of q1 |
| :: the value of qq |
Definition at line 223 of file Meier.cpp.
Referenced by precomputeIntermediateSteps().
|
private |
Calculates and returns the value of negative lambda This function is used by precomputeIntermediateSteps to calculate intermediate steps.
| q3 | :: The value of q3 |
| Wm | :: The value of Wm |
Definition at line 201 of file Meier.cpp.
Referenced by precomputeIntermediateSteps().
|
private |
Calculates and returns the value of positive lambda This function is used by precomputeIntermediateSteps to calculate intermediate steps.
| q3 | :: The value of q3 |
| Wm | :: The value of Wm |
Definition at line 192 of file Meier.cpp.
Referenced by precomputeIntermediateSteps().
|
private |
Calculates and returns the value of q1 This function is used by precomputeIntermediateSteps to calculate intermediate steps.
| m | :: Current Index |
| OmegaQ | :: Angular Frequency due to dipolar coupling (MHz) |
| OmegaD | :: Angular Frequency due to quadrupole interaction of the nuclear spin (MHz) due to a field gradient |
Definition at line 148 of file Meier.cpp.
References Mantid::Geometry::m.
Referenced by precomputeIntermediateSteps().
|
private |
Calculates and returns the value of q2 This function is used by precomputeIntermediateSteps to calculate intermediate steps.
| m | :: Current Index |
| J | :: Total angular momentum quanutm number |
| OmegaD | :: Angular Frequency due to quadrupole interaction of the nuclear spin (MHz) due to a field gradient |
Definition at line 160 of file Meier.cpp.
References Mantid::Geometry::m.
Referenced by precomputeIntermediateSteps().
|
private |
Calculates and returns the value of q2 This function is used by precomputeIntermediateSteps to calculate intermediate steps.
| m | :: Current Index |
| OmegaQ | :: Angular Frequency due to dipolar coupling (MHz) |
| OmegaD | :: Angular Frequency due to quadrupole interaction of the nuclear spin (MHz) due to a field gradient |
Definition at line 172 of file Meier.cpp.
References Mantid::Geometry::m.
Referenced by precomputeIntermediateSteps().
|
private |
Calculates and returns the value of qq This function is used by precomputeIntermediateSteps to calculate intermediate steps.
| q1 | :: the value of q1 |
| q2 | :: the value of q2 |
Definition at line 183 of file Meier.cpp.
Referenced by precomputeIntermediateSteps().
|
overridevirtual |
Function initialization. Declare function parameters in this method.
Initialize the function. Calls declareAttributes & declareParameters.
Reimplemented from Mantid::API::IFunction.
Definition at line 40 of file Meier.cpp.
References Mantid::API::IFunction::declareAttribute(), and Mantid::API::ParamFunction::declareParameter().
|
inlineoverridevirtual |
Returns the function's name.
Implements Mantid::API::IFunction.
|
private |
Precomputes intermediate terms used to calculate the polrization in the x and z directions.
All value arrays will be resized to J2 + 2 and set to their respective quantities
| cos2AlphaSquared | :: cos of 2*alpha squared (output parameter) |
| positiveLambda | :: negative lambda (output parameter) |
| negativeLambda | :: positive lambda (output parameter) |
| J2 | :: 2 * total angular momentum quantum number (input parameter) |
Definition at line 90 of file Meier.cpp.
References getBaseLambda(), getCos2AlphaSquared(), getNegativeLambda(), Mantid::API::ParamFunction::getParameter(), getPositiveLambda(), getQ1(), getQ2(), getQ3(), getQQ(), and Mantid::Geometry::m.
Referenced by function1D().