circle-fit


Namecircle-fit JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryA Circle Fitting Library for Python
upload_time2023-05-05 19:12:57
maintainer
docs_urlNone
author
requires_python>=3.7
licenseCopyright (c) 2022 Michael Klear Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords circle fitting data science
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![LICENCE](https://img.shields.io/github/license/AlliedToasters/circle-fit)
[![Flake8](https://github.com/AlliedToasters/circle-fit/actions/workflows/flake8.yml/badge.svg)](https://github.com/AlliedToasters/circle-fit/actions/workflows/flake8.yml)
[![PyTest](https://github.com/AlliedToasters/circle-fit/actions/workflows/PyTest.yml/badge.svg)](https://github.com/AlliedToasters/circle-fit/actions/workflows/PyTest.yml)
![Version](https://img.shields.io/pypi/v/circle-fit)
![Python](https://img.shields.io/pypi/pyversions/circle-fit)
# Circle-Fit
## A Circle Fitting Library for Python
Given a collection of points in 2D space, a common problem is finding the parameters of a circle that best approximate 
these points. This library implements a collection of different circle fitting algorithms:

```
- hyperLSQ()      : Least squares circle fit with "hyperaccuracy" by Kenichi Kanatani, Prasanna Rangarajan
- standardLSQ()   : Least squares circle fit, standard version.
- riemannSWFLa()  : Riemann circle fit, SWFL version A
- lm()            : Levenberg-Marquardt in the full (a,b,R) parameter space
- prattSVD()      : Algebraic circle fit by V. Pratt
- taubinSVD()     : Algebraic circle fit by G. Taubin
- hyperSVD()      : Algebraic circle fit with "hyperaccuracy"
- kmh()           : Consistent circle fit by A. Kukush, I. Markovsky, S. Van Huffel
```

Most of these algorithms are based on the original MATLAB implementations by Nikolai Chernov: 
https://people.cas.uab.edu/~mosya/cl/MATLABcircle.html

Each algorithm may work better in specific cases. If you are in doubt about which to use, `taubinSVD()`
is a good starting point.

## Installation
`circle-fit` is available from PyPi. Run the following in a command line terminal:
`pip install circle-fit`

## Example
Fit a circle to four `(x,y)` points.
```
from circle_fit import taubinSVD
point_coordinates = [[1, 0], [-1, 0], [0, 1], [0, -1]]
xc, yc, r, sigma = taubinSVD(point_coordinates)
```

## Data format
Your data must have at least two points in 2-D space. The algorithms in `circle-fit` expects either 
a 2D List or numpy ndarray of shape `(n, 2)`, where n is the number of points in your dataset.

All the algorithms available in this library return four values:
```
- xc    : x-coordinate of solution center (float)
- yc    : y-coordinate of solution center (float)
- r     : Radius of solution (float)
- sigma : Residual error of solution (float)
```

### View the fit
The function `plot_data_circle(coords, xc, yc, r)` can be used to open a plot window which shows you data points with
a circle fit overlaid on top. Example use:
```
xc, yc, r, sigma = taubinSVD(point_coordinates)
plot_data_circle(point_coordinates, xc, yc, r)
```

### Contributors and Maintainers
This library is a community collaboration, all work is voluntary.

#### To Contribute
Please open a pull request with the changes you would like to contribute ([example](https://github.com/AlliedToasters/circle-fit/pull/10))

#### Contact
As we are volunteers, please be patient when requesting support. You can either open an issue if you think you've found a bug with the code, or contact one of us directly if you have a user issue:

 - michael.r.klear@gmail.com
 - mag.lauritzen@gmail.com


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "circle-fit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "circle fitting,data science",
    "author": "",
    "author_email": "Michael Klear <michael.r.klear@gmail.com>, Magne Eik Lauritzen <mag.lauritzen@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1c/4e/c6263534b6fdf1a33d19deada6846c8e063c8c8d2b16e57bd41b79a4b346/circle_fit-0.2.1.tar.gz",
    "platform": null,
    "description": "![LICENCE](https://img.shields.io/github/license/AlliedToasters/circle-fit)\n[![Flake8](https://github.com/AlliedToasters/circle-fit/actions/workflows/flake8.yml/badge.svg)](https://github.com/AlliedToasters/circle-fit/actions/workflows/flake8.yml)\n[![PyTest](https://github.com/AlliedToasters/circle-fit/actions/workflows/PyTest.yml/badge.svg)](https://github.com/AlliedToasters/circle-fit/actions/workflows/PyTest.yml)\n![Version](https://img.shields.io/pypi/v/circle-fit)\n![Python](https://img.shields.io/pypi/pyversions/circle-fit)\n# Circle-Fit\n## A Circle Fitting Library for Python\nGiven a collection of points in 2D space, a common problem is finding the parameters of a circle that best approximate \nthese points. This library implements a collection of different circle fitting algorithms:\n\n```\n- hyperLSQ()      : Least squares circle fit with \"hyperaccuracy\" by Kenichi Kanatani, Prasanna Rangarajan\n- standardLSQ()   : Least squares circle fit, standard version.\n- riemannSWFLa()  : Riemann circle fit, SWFL version A\n- lm()            : Levenberg-Marquardt in the full (a,b,R) parameter space\n- prattSVD()      : Algebraic circle fit by V. Pratt\n- taubinSVD()     : Algebraic circle fit by G. Taubin\n- hyperSVD()      : Algebraic circle fit with \"hyperaccuracy\"\n- kmh()           : Consistent circle fit by A. Kukush, I. Markovsky, S. Van Huffel\n```\n\nMost of these algorithms are based on the original MATLAB implementations by Nikolai Chernov: \nhttps://people.cas.uab.edu/~mosya/cl/MATLABcircle.html\n\nEach algorithm may work better in specific cases. If you are in doubt about which to use, `taubinSVD()`\nis a good starting point.\n\n## Installation\n`circle-fit` is available from PyPi. Run the following in a command line terminal:\n`pip install circle-fit`\n\n## Example\nFit a circle to four `(x,y)` points.\n```\nfrom circle_fit import taubinSVD\npoint_coordinates = [[1, 0], [-1, 0], [0, 1], [0, -1]]\nxc, yc, r, sigma = taubinSVD(point_coordinates)\n```\n\n## Data format\nYour data must have at least two points in 2-D space. The algorithms in `circle-fit` expects either \na 2D List or numpy ndarray of shape `(n, 2)`, where n is the number of points in your dataset.\n\nAll the algorithms available in this library return four values:\n```\n- xc    : x-coordinate of solution center (float)\n- yc    : y-coordinate of solution center (float)\n- r     : Radius of solution (float)\n- sigma : Residual error of solution (float)\n```\n\n### View the fit\nThe function `plot_data_circle(coords, xc, yc, r)` can be used to open a plot window which shows you data points with\na circle fit overlaid on top. Example use:\n```\nxc, yc, r, sigma = taubinSVD(point_coordinates)\nplot_data_circle(point_coordinates, xc, yc, r)\n```\n\n### Contributors and Maintainers\nThis library is a community collaboration, all work is voluntary.\n\n#### To Contribute\nPlease open a pull request with the changes you would like to contribute ([example](https://github.com/AlliedToasters/circle-fit/pull/10))\n\n#### Contact\nAs we are volunteers, please be patient when requesting support. You can either open an issue if you think you've found a bug with the code, or contact one of us directly if you have a user issue:\n\n - michael.r.klear@gmail.com\n - mag.lauritzen@gmail.com\n\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2022 Michael Klear  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A Circle Fitting Library for Python",
    "version": "0.2.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/AlliedToasters/circle-fit/issues",
        "Homepage": "https://github.com/AlliedToasters/circle-fit"
    },
    "split_keywords": [
        "circle fitting",
        "data science"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1df4078a419a977e74663033fc9e299d8421a2f0ac991251345a23d8b69c1342",
                "md5": "56ea0a4b7465324b47f14f01c6569a9b",
                "sha256": "45c3813638e29354fd3b65eb9c03dea37125b31d2c8dad2e7f98c5edcdb2f428"
            },
            "downloads": -1,
            "filename": "circle_fit-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "56ea0a4b7465324b47f14f01c6569a9b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9370,
            "upload_time": "2023-05-05T19:12:55",
            "upload_time_iso_8601": "2023-05-05T19:12:55.003467Z",
            "url": "https://files.pythonhosted.org/packages/1d/f4/078a419a977e74663033fc9e299d8421a2f0ac991251345a23d8b69c1342/circle_fit-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c4ec6263534b6fdf1a33d19deada6846c8e063c8c8d2b16e57bd41b79a4b346",
                "md5": "4773bacf4e0517c19324eed10195054b",
                "sha256": "54a8f361887fdcbcec15fd681e55051de7d4e8143e45353c082c58ba32e7dcb4"
            },
            "downloads": -1,
            "filename": "circle_fit-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4773bacf4e0517c19324eed10195054b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 273191,
            "upload_time": "2023-05-05T19:12:57",
            "upload_time_iso_8601": "2023-05-05T19:12:57.163461Z",
            "url": "https://files.pythonhosted.org/packages/1c/4e/c6263534b6fdf1a33d19deada6846c8e063c8c8d2b16e57bd41b79a4b346/circle_fit-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-05 19:12:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AlliedToasters",
    "github_project": "circle-fit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "circle-fit"
}
        
Elapsed time: 0.06605s