interactive_curve_fit: A Python project enables you to do curve fitting on spectrum data interactively on GUI. You can visualize your spectrum and fit the optional number of peaks on GUI using Scipy.optimize.curve_fit method.
Project description
interactive_curve_fit
A Python project enables you to do curve fitting on spectrum data interactively on GUI. You can visualize your spectrum and fit the optional number of peaks on GUI using Scipy.optimize.curve_fit method.
How to use?
Try tutorial.py with your spectrum data!
Spectrum data format must be like the table below
x | y |
---|---|
0 | 1 |
1 | 13 |
2 | 30 |
3 | 43 |
4 | 31 |
5 | 11 |
... | ... |
Steps to curve-fit
-
Teach your initial guess of the positions of each peaks roughly to Fitter.
from interactive_curve_fit import read_data, Guessor, Fitter data = read_data(data, headers=2, sep=',') guessor = Guessor(data, background=10, method='drag') guess = guessor.guess()
Initial Guess method
- mouse-dragging (wrap up peak area by mouse-dragging)
- click (click the top and the both edges of each peaks)
Screenshot
-
Give your spectrum data and your guess to Fitter.
fitter = Fitter(data, guess) fitter.run(method='gaussian')
Supported fitting functions
- gaussian function
- polynomial function
Output information includes
- position (x, y) of each peaks
- baseline height of the spectrum
- bandwidth of each peaks with its CI (confidential interval)
-
Save the fitting results
fitter.save_data('out/fitting_result.csv')
-
Other features
bmp_to_csv converts bmp file to csv file.
from interactive_curve_fit import bmg_to_csv bmp_to_csv('data/line_spectrum.bmp') data = read_data('data/line_spectrum.csv')
Fitter can visualize fitting results
fitter.plot_fit()
Fitter can also display fitting results on terminal
fitter.display_results_terminal(ci=2)
Supported supectrum file format
-
ascii file(.asc .csv .txt etc..)
-
bmp image(.bmp .jpg .png .jpeg etc..)
excel sheet files, table of html are planed to be suported in the near future.
Features that are planned to be supported!
- baseline correlation
- other fitting functions (e.g. binomical distribution function)
- automated guessor method using wavelet transform and CNN
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
Hashes for interactive_curve_fit-0.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3a618b1873fe7f815614d8b90e8c9ec69a769797287c06301bb7426eb110269 |
|
MD5 | c8a81f6f4e4f933f8dbf20b026f2be26 |
|
BLAKE2b-256 | 5f57f290152d09d07e17cd72be2651e86bf62bff61e6bdad363d34ebf17816c2 |
Hashes for interactive_curve_fit-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ab7baa6efe0b59d85fd8f5287524a844c78811cc02d92fda30703e9ad7f949f |
|
MD5 | f9a7fd719c1f8846f6996df44513e434 |
|
BLAKE2b-256 | 1b7236dc55d5de85ec2831f7a3390b85e7d61ec4775e5458775158cf8546a2c1 |