HyperSpy API has changed in version 2.0, see the release notes!

Model fitting#

HyperSpy can perform curve fitting of one-dimensional signals (spectra) and two-dimensional signals (images) in n-dimensional data sets. Models are defined by adding individual functions (components in HyperSpy’s terminology) to a BaseModel instance. Those individual components are then summed to create the final model function that can be fitted to the data, by adjusting the free parameters of the individual components.

Models can be created and fit to experimental data in both one and two dimensions i.e. spectra and images respectively. Most of the syntax is identical in either case. A one-dimensional model is created when a model is created for a Signal1D whereas a two- dimensional model is created for a Signal2D.


Plotting and analytical gradient-based fitting methods are not yet implemented for the Model2D class.