14#include <boost/python/list.hpp>
15#include <boost/python/object.hpp>
18namespace PythonInterface {
26 IFunctionAdapter(PyObject *self, std::string functionMethod, std::string derivMethod);
35 std::string
name()
const override;
37 const std::string
category()
const override;
45 const boost::python::object &validator);
97 void evaluateFunction(
double *out,
const double *xValues,
const size_t nData)
const;
double value
The value of the point.
Attribute is a non-fitting parameter.
This is an interface to a fitting function - a semi-abstarct class.
virtual void declareParameter(const std::string &name, double initValue=0, const std::string &description="")=0
Declare a new parameter.
Represents the Jacobian in IFitFunction::functionDeriv.
Provides a layer to hook into the protected functions of IFunction.
void init() override
Declare all attributes & parameters.
IFunctionAdapter & operator=(const IFunctionAdapter &)=delete
Disable assignment operator.
void declareFitParameter(const std::string &name, double initValue, const std::string &description)
Declare a named parameter with initial value & description.
static void setAttributePythonValue(IFunction &self, const std::string &name, const boost::python::object &value)
Set the attribute's value.
static boost::python::list createPythonEquivalentFunctions(const IFunction &self)
Split this function (if needed) into a list of independent functions.
void declareFitParameterZeroInit(const std::string &name)
Declare a named parameter with initial value = 0.0.
std::string name() const override
Returns the name of the function.
PyObject * m_self
The Python portion of the object.
void evaluateFunction(double *out, const double *xValues, const size_t nData) const
Evaluate the function by calling the overridden method.
PyObject * getSelf() const
void evaluateDerivative(API::Jacobian *out, const double *xValues, const size_t nData) const
Evaluate the derivative by calling the overridden method.
const std::string category() const override
Specify a category for the function.
void setAttribute(const std::string &attName, const API::IFunction::Attribute &attr) override
Called by the framework when an attribute has been set.
bool derivativeOverridden() const
std::string m_functionName
The name of the method to evaluate the function.
IFunctionAdapter(const IFunctionAdapter &)=delete
The PyObject must be supplied to construct the object.
bool m_derivOveridden
Flag if the derivateive method is overridden (avoids multiple checks)
std::string m_derivName
The name of the method to evaluate the derivative.
void declareFitParameterNoDescr(const std::string &name, double initValue)
Declare a named parameter with initial value.
void setActiveParameter(size_t i, double value) override
Override this method to make fitted parameters different from the declared.
void declareAttribute(const std::string &name, const boost::python::object &defaultValue)
Declare an attribute with an initial value.
double activeParameter(size_t i) const override
Override this method to make fitted parameters different from the declared.
static PyObject * getAttributeValue(const IFunction &self, const std::string &name)
Get a named attribute value.
Helper class which provides the Collimation Length for SANS instruments.