Fit python library
Project description
FFit. Fit python library.
FFit - Python library for easier fitting.
Install
pip install ffit
For more installation details, please refer to the How to install
How to use
The aim of this library is to simplify the fit routine. Here are some examples of how to use it.
Simple syntax
import ffit as ff
x = np.linspace(1, 10, 100)
y = 2 * np.sin(x) + 3
res = ff.Cos().fit(x, y).res
Plotting result
import ffit as ff
import matplotlib.pyplot as plt
x = np.linspace(1, 10, 100)
y = 2 * np.sin(x) + 3
plt.plot(x, y, '.')
res = ff.Cos().fit(x, y).plot().res
Plotting guess
The quality of fitting is heavily dependent on the initial guess. This library provides initial guesses for various popular functions to ensure effectiveness. However, if something goes awry, you can verify the guess and set it manually.
ff.Cos().guess(x, y).plot()
ff.Cos().guess(x, y, guess=[1,2,3,4]).plot()
ff.Cos().fit(x, y, guess=[1,2,3,4]).plot()
Other functions
Numerous functions are available out of the box. You can refer to the documentation for more details.
Moreover, you can use your custom functions with familiar syntax and still benefit from existing routines.
Any custom function
For any custom function, you can create a custom class for a guessing algorithm or use curve_fit or least_square like this:
def line_func(x, amp, offset):
return amp * x + offset
fit_amp = ff.curve_fit(line_func, x, y).plot().res.amp
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ffit-1.0.1.tar.gz.
File metadata
- Download URL: ffit-1.0.1.tar.gz
- Upload date:
- Size: 34.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53c778b054653a960087a85b90cb65820a41a52425f345fb2eba776a71f2e6f8
|
|
| MD5 |
fd9c21f6826786d98f2b2d2bcbec2607
|
|
| BLAKE2b-256 |
5e66e40066a0988d9dcf1660a3c62ba0ddc9d417a5c94b437bbd5637e9b0fef3
|
File details
Details for the file ffit-1.0.1-py3-none-any.whl.
File metadata
- Download URL: ffit-1.0.1-py3-none-any.whl
- Upload date:
- Size: 33.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5c5ae8b7e83b634e5c1c94fc19043c51c6b8037cac1e764bc3df4bb7201fa82
|
|
| MD5 |
78cad9beadf7bd4d1a1c332baac60aa7
|
|
| BLAKE2b-256 |
89d2aa30205b9d740dbd6de2b3822df5a02c11d9cde928aa15710422cd290528
|