\(\renewcommand\AA{\unicode{x212B}}\)
Mantid’s optimisation framework is split into different components:
Each of these can be swapped out for a different component that has some
other behaviour to maximise flexibility. Only the functions themselves
can be written in Python. The new Python functions are treated on exactly the
same level as the shipped C++
functions and offer the same level of
interactivity within the GUI.
Mantid currently has the concept of 2 different function types:
The basic class structure for a function definition looks like:
from mantid.api import *
import numpy as np
# You choose which type you would like by picking the super class
class Example1DFunction(IFunction1D): # or IPeakFunction
def category(self):
return 'Examples'
# explained later
# Register with Mantid
FunctionFactory.subscribe(Example1DFunction)
The category
is optional and defines where the function is shown in some
parts of the GUI.
Contents