Model2D#
- class hyperspy.models.model2d.Model2D(signal2D, dictionary=None)#
Bases:
BaseModel
Model and data fitting for two dimensional signals.
A model is constructed as a linear combination of
components2D
that are added to the model usingappend()
orextend()
. There are predifined components available in thecomponents2D
module and custom components can made using theExpression
. If needed, new components can be created easily using the code of existing components as a template.Once defined, the model can be fitted to the data using
fit()
ormultifit()
. Once the optimizer reaches the convergence criteria or the maximum number of iterations the new value of the component parameters are stored in the components.It is possible to access the components in the model by their name or by the index in the model. An example is given at the end of this docstring.
Methods
add_signal_range
([x1, x2, y1, y2])Adds the data in the given range from the data range (calibrated values) that will be used by the fitting rountine.
remove_signal_range
([x1, x2, y1, y2])Removes the data in the given range (calibrated values) from the data range that will be used by the fitting rountine
Resets the data range.
set_signal_range
([x1, x2, y1, y2])Use only the selected range defined in its own units in the fitting routine.
Notes
Methods are not yet defined for plotting 2D models or using gradient based optimisation methods.
- add_signal_range(x1=None, x2=None, y1=None, y2=None)#
Adds the data in the given range from the data range (calibrated values) that will be used by the fitting rountine.
- remove_signal_range(x1=None, x2=None, y1=None, y2=None)#
Removes the data in the given range (calibrated values) from the data range that will be used by the fitting rountine
- reset_signal_range()#
Resets the data range.
- set_signal_range(x1=None, x2=None, y1=None, y2=None)#
Use only the selected range defined in its own units in the fitting routine.