# Pyfit
```
pip install ifitpy
```
This fit package permits to, well, fit a given x,y data. It encapsulates both iminuit and curve_fit.
There are two type of functions. Simple (linear, expo) and Complex(gaussian, gaussian2d, poly).
For Simple function `fit(x,y)` are `fit(x,y,p0)` are valid inputs. In the first option the fit attempts to estimate the initial starting point. In the second option, a list of parameters (p0) is used to initialized the fit.
For Complex functions `fit(x,y, n)` are `fit(x,y,p0)` are valid inputs. If n is used, then the algorithm will use this value to generate the fitting function with n components. For example, `fit(xx,yy,n=3)` will fit a sum of two gaussian(2d) or a 3-degree polonimal function. And p0 zero is also estimated. If `fit(x,y,n,p0)` is used, then p0 will be the initialization parameters. Note that `len(p0) = n*parameters_to_fit`.
There's also a `f.fitBinned(xx,yy,bins=50)` option which allows fitting a profile histogram instead of the raw data. This option is often faster and is the recommended one as it takes into account the statistical fluctuation of the data.
Don't forget to check the Tutorial notebook.
### To extract the fit results use
```
from ifitpy import Fitter
f = Fitter("linear") #linear, expo, gaussian, gaussian2d, poly
f.fit([0,10], [0,-10])
p = f.getParams()
print(p) # prints a string with the available variables.
print(p.vars) # list of the results
print(p.m) # slope for the “linear” type
print(p.b) # slope for the “intercept” type
```
### This an ongoing project!
Raw data
{
"_id": null,
"home_page": "https://https://github.com/gpinpereira/Pyfit",
"name": "ifitpy",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "fitting,datascience,iminuit",
"author": "Guilherme Pereira",
"author_email": "guipinper@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4c/e8/898fb505b251d539a2179c3a42be46a892a2581ee49e966fbcdb4eff2ae7/ifitpy-0.0.7.tar.gz",
"platform": null,
"description": "# Pyfit\n\n```\npip install ifitpy\n```\n\nThis fit package permits to, well, fit a given x,y data. It encapsulates both iminuit and curve_fit.\nThere are two type of functions. Simple (linear, expo) and Complex(gaussian, gaussian2d, poly).\nFor Simple function `fit(x,y)` are `fit(x,y,p0)` are valid inputs. In the first option the fit attempts to estimate the initial starting point. In the second option, a list of parameters (p0) is used to initialized the fit.\n\nFor Complex functions `fit(x,y, n)` are `fit(x,y,p0)` are valid inputs. If n is used, then the algorithm will use this value to generate the fitting function with n components. For example, `fit(xx,yy,n=3)` will fit a sum of two gaussian(2d) or a 3-degree polonimal function. And p0 zero is also estimated. If `fit(x,y,n,p0)` is used, then p0 will be the initialization parameters. Note that `len(p0) = n*parameters_to_fit`.\n\nThere's also a `f.fitBinned(xx,yy,bins=50)` option which allows fitting a profile histogram instead of the raw data. This option is often faster and is the recommended one as it takes into account the statistical fluctuation of the data.\nDon't forget to check the Tutorial notebook.\n\n### To extract the fit results use\n```\nfrom ifitpy import Fitter\nf = Fitter(\"linear\") #linear, expo, gaussian, gaussian2d, poly\nf.fit([0,10], [0,-10])\np = f.getParams()\nprint(p) # prints a string with the available variables.\nprint(p.vars) # list of the results\nprint(p.m) # slope for the \u201clinear\u201d type\nprint(p.b) # slope for the \u201cintercept\u201d type\n```\n### This an ongoing project!",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple data fitting package",
"version": "0.0.7",
"split_keywords": [
"fitting",
"datascience",
"iminuit"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "97bb77c1183c2a882e2e4bdfb2eb3671",
"sha256": "aaea95fcd04247cf593f34381ed85c41d102c19e6b5c05e9ff3040b3a3a26535"
},
"downloads": -1,
"filename": "ifitpy-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "97bb77c1183c2a882e2e4bdfb2eb3671",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7523,
"upload_time": "2022-11-30T13:54:41",
"upload_time_iso_8601": "2022-11-30T13:54:41.056924Z",
"url": "https://files.pythonhosted.org/packages/4c/e8/898fb505b251d539a2179c3a42be46a892a2581ee49e966fbcdb4eff2ae7/ifitpy-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-11-30 13:54:41",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "ifitpy"
}