Fitspy: a generic tool to fit spectra in python
Project description
Fitspy is a generic tool dedicated to fit spectra in python with a GUI that aims to be as simple and intuitive to use as possible.
Processed spectra may be independent of each other or may result from 2D-maps acquisitions.
Example of fitspy 2D-map frame interacting with the main GUI.
The fitting algorithm has multiprocessing capabilities and relies on
the lmfit library.
Bounds and constraints can be set on each peaks models parameter.
The predefined peak models considered in Fitspy are :
Gaussian
Lorentzian
Asymetric Gaussian
Asymetric Lorentzian
Pseudovoigt
A constant
, linear
, parabolic
or exponential
background model can
also be added in the fitting.
In both cases, user-defined models
can be added.
All actions allowed with the GUI can be executed in script mode (see
examples here).
These actions (like baseline and peaks definition, parameters constraints, ...) can be saved in a Fitspy model
and replayed as-is or applied to other new spectra datasets.
Installation
pip install fitspy
Tests and examples execution
pip install pytest
git clone https://github.com/CEA-MetroCarac/fitspy.git
cd fitspy
pytest
python example/ex_gui_auto_decomposition.py
...
Quick start
Launch the application:
fitspy
Then, from the top to the bottom of the right panel:
Select
file(s)- (Optional) Define the X-range
- Define the baseline to
subtract
(left or right click on the figure to add or delete (resp.) a baseline point) - (Optional) Normalize the spectrum/spectra
- Click on the
Peaks
panel to activate it - Select
Peak model
and add peaks (left or right click on the figure to add or delete (resp.) a peak) - (Optional) Add a background (BKG model) to be fitted
- (Optional) Use Parameters to set bounds and constraints
Fit
the selected spectrum/spectra- (Optional) Save the parameters in .csv format
- (Optional) Save the Model in a .json file (to be replayed later)
See the documentation for more details.
Authors information
In case you use the results of this code in an article, please cite:
-
Quéméré P., (2024). Fitspy: A python package for spectral decomposition. Journal of Open Source Software. (submitted)
-
Newville M., (2014). LMFIT: Non-Linear Least-Square Minimization and Curve-Fitting for Python. Zenodo. doi: 10.5281/zenodo.11813.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fitspy-2024.2.tar.gz
.
File metadata
- Download URL: fitspy-2024.2.tar.gz
- Upload date:
- Size: 24.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dec0c2facb8627137e0701d9e90f68642e91043b6f91d870af890bf97e5ef9a2 |
|
MD5 | b6b9a82ee77ac7ebf2af8f5d4b798920 |
|
BLAKE2b-256 | 23f5c14680b97668864e34ea5856276a189584c5bfd3f0ba05e2efa9a7477c77 |
File details
Details for the file fitspy-2024.2-py3-none-any.whl
.
File metadata
- Download URL: fitspy-2024.2-py3-none-any.whl
- Upload date:
- Size: 56.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8ca0199a9494faa11211d913dc9886f5c90ce5d1544ae72b6133a69a2cfe473 |
|
MD5 | 30b5e9e61b841a96e360d2cdf284d210 |
|
BLAKE2b-256 | dff08759bf31179cc85a7a275bd20a9f1be171e3c112d369fe1e20786ec9ebfb |