mantid.fitfunctions — Wrapper class for composite fitting function

Fuller discussion of how this works with the fitting frameworks is described here.

class mantid.fitfunctions.CompositeFunctionWrapper(*args, **kwargs)

Wrapper class for Composite Fitting Function

__init__(*args, **kwargs)

Called when creating an instance

It should not be called directly

Parameters:
  • args – names of functions in composite function
  • kwargs – any parameters or attributes that must be passed to the composite function itself.
constrainAll(expressions)

Constrain all parameters according local names in expressions.

Parameters:expressions – string of expressions
f(name)

get function specified by name, such as “LinearBackground” for the only LinearBackground function or “Gaussian1” for the second Gaussian function.

Parameters:name – name specifying the function
fixAll(name)

Fix all parameters with the given local name. Every member function must have a parameter of this name.

Parameters:name – name of parameter
flatten()

Return composite function, equal to self, but with every composite function within replaced by its list of functions, so having a pure list of functions. This makes it possible to index and iterate all the functions and use tieAll() and untieAll(). Not to be used with a mixture of product and sum composite functions, because the arithmetic may no longer be correct. The return value is not independent of self.

getCompositeParameterName(name, index)

get composite parameter name of parameter of given name of member function of given index

getIndexOfFunction(name)

get index of function specified by name, such as “LinearBackground” for the only LinearBackground function or “Gaussian1” for the second Gaussian function.

Parameters:name – name specifying the function
getParameter(name)

get value of parameter of specified name

Parameters:name – name of parameter
initByName(name, *args, **kwargs)

intialise composite function of named type. E.g. “ProductFunction” This function would be protected in c++ and should not be called directly except by __init__() functions of this class and subclasses.

Parameters:
  • name – name of class calling this.
  • args – names of functions in composite function
  • kwargs – any parameters or attributes that must be passed to the composite function itself.
tieAll(name)

For each member function, tie the parameter of the given name to the parameter of that name in the first member function. The named parameter must occur in all the member functions.

Parameters:name – name of parameter
unconstrainAll(name)

Unconstrain all parameters of given local name.

Parameters:name – local name of parameter
untieAll(name)

Untie all parameters with the given local name. Every member function must have a parameter of this name.

Parameters:name – local name of parameter
class mantid.fitfunctions.ConvolutionWrapper(*args, **kwargs)

Wrapper class for Convolution Fitting Function

__init__(*args, **kwargs)

Called when creating an instance

It should not be called directly.

Parameters:
  • args – names of functions in composite function
  • kwargs – any parameters or attributes that must be passed to the composite function itself.
class mantid.fitfunctions.FunctionWrapper(name, **kwargs)

Wrapper class for Fitting Function

__init__(name, **kwargs)

Called when creating an instance

Parameters:
  • name – name of fitting function to create or an Ifunction object to wrap.
  • kwargs – standard argument for initializing fit function
constrain(expressions)

Add constraints

Parameters:expressions – string of tie expressions
fix(name)

Fix a parameter.

Parameters:name – name of parameter to be fixed
fixAllParameters()

Fix all parameters.

free(name)

Free a parameter from tie or constraint

Parameters:name – name of parameter to be freed
function

Return the underlying IFunction object

getParameterName(index)

Get the name of the parameter of given index

Parameters:index – index of parameter
name

Return the name of the function

plot(**kwargs)

Plot the function

Parameters:workspace – workspace upon whose x values the function is plotted.
tie(*args, **kwargs)

Add ties.

Parameters:
  • args – one or more dictionaries of ties
  • kwargs – one or more ties
unconstrain(name)

Remove constraints from a parameter

Parameters:name – name of parameter to be unconstrained
untie(name)

Remove tie from parameter.

Parameters:name – name of parameter to be untied
untieAllParameters()

Remove ties from all parameters.

mantid.fitfunctions.IFunction1D

alias of _IFunction1DWrapperCreator

class mantid.fitfunctions.MultiDomainFunctionWrapper(*args, **kwargs)

Wrapper class for Multidomain Fitting Function

__init__(*args, **kwargs)

Called when creating an instance

It should not be called directly

Parameters:
  • args – names of functions in composite function
  • kwargs – any parameters or attributes that must be passed to the composite function itself.
nDomains

Return number of domains

class mantid.fitfunctions.ProductFunctionWrapper(*args, **kwargs)

Wrapper class for Product Fitting Function

__init__(*args, **kwargs)

Called when creating an instance

It should not be called directly.

Parameters:
  • args – names of functions in composite function
  • kwargs – any parameters or attributes that must be passed to the composite function itself.