Introduction
What is Fitspy
Fitspy is a dedicated tool for spectral fitting — and only for spectral fitting — with the following characteristics:
Agnostic Nature: Fitspy is not tied to any specific physical quantity or database. It is designed to process spectra regardless of their x-support and y-intensity without requiring prior knowledge.
Python Implementation: Fitspy is coded in Python. As a result, spectra can be easily processed using Python scripts, catering to individuals with basic knowledge of the language.
User Models: Fitspy allows users to input their own models either in the form of literal expressions (for simple models) or through Python scripts (for more complex models).
2D Maps: Fitspy has been designed to handle spectra derived from 2D acquisitions. Note that the beyond “2D”, dimensions can encompass time or any other dimension. When dealing with 2D data, an interactive map in the Fitspy GUI allows users to locate and select spectra of interest easily.
Multiprocessing Capabilities: Fitspy enables spectral fit processing on multiple processors, enhancing efficiency.
Constrained Parameters: Leveraging the lmfit library, Fitspy empowers users to impose constraints on parameter ranges or establish constraints between parameters using literal expressions.
Simple GUI: Fitspy has been designed to be as intuitive and simple to use as possible (subjective criterion).
Therefore, the features of Fitspy make it an ideal tool for quickly fitting a few spectra through its GUI or for fitting several thousand of spectra (or more) by python batches.
Install and launching
For a basic install (ie without the examples, tests and the related datasets):
pip install fitspy
fitspy
For a full install and examples and tests execution:
git clone https://github.com/CEA-MetroCarac/fitspy.git
fitspy
# examples execution
cd fitspy/examples
python ex_gui_auto_decomposition.py
python ex_gui_reload_model.py
...
# tests execution
pip install pytest
cd fitspy
pytest
Quick start
Once the Fitspy GUI has opened, from top to bottom of the right panel, the strict minimum operations (in red) for a spectrum fitting consists of:
(1) Select file(s) from
Select Files
orSelect Dir
(6) Click on the
Peaks
panel to activate it (if not)(7) Select a
Peak model
(8) Select a peak point on the main figure (with left/right click on the figure to add/delete a baseline point)
Repeat the last two actions as needed
(10)
Fit
the spectrum/spectra selected in the files selector widget orFit All
the spectra(12)
Save (.csv)
the fitting parameters

(The entire workflow is described here ).
How Fitspy works
The main class of Fitspy is Spectra
(inherited from list) that contains a list of Spectrum
objects.
For each of these Spectrum
objects, a (x, y) profile is associated. (More details here).
Additionally, 2D maps of spectra (named SpectraMap
) that consist in a set of Spectrum
with associated grid coordinates can be provided as input according to a dedicated format. (More details here).
The spectra processing are based on BaseLine
(optional) and peaks models
like Gaussian, Lorentzian, … used to fit the spectra profiles.
