Skip to main content

Fit python library

Project description

FFit. Fit python library.


Pypi Python 3.7+ License Code style: black CodeFactor Codecov Download Stats Documentation

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

ffit-1.0.1.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ffit-1.0.1-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

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

Hashes for ffit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 53c778b054653a960087a85b90cb65820a41a52425f345fb2eba776a71f2e6f8
MD5 fd9c21f6826786d98f2b2d2bcbec2607
BLAKE2b-256 5e66e40066a0988d9dcf1660a3c62ba0ddc9d417a5c94b437bbd5637e9b0fef3

See more details on using hashes here.

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

Hashes for ffit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5c5ae8b7e83b634e5c1c94fc19043c51c6b8037cac1e764bc3df4bb7201fa82
MD5 78cad9beadf7bd4d1a1c332baac60aa7
BLAKE2b-256 89d2aa30205b9d740dbd6de2b3822df5a02c11d9cde928aa15710422cd290528

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page