Skip to main content

a library for performing two-dimensional curve-fitting

Project description

fitting2d

a library for performing two-dimensional curve-fitting.

Install

pip install . # within this repository

Presumably, it can be also installed from PyPI:

pip install fitting2d

Usage

For more detailed documentation, visit our documentation page.

Classes

Currently, it has only two types of fitting procedures as classes:

  • Ellipse
  • Circle
  • Parabola

Both classes are built as namedtuples.

You can also extend the library by adding the FittingMixin mix-in class to your shape class (built as a namedtuple).

Performing fitting

To perform the fitting procedure, run e.g.

# xp and yp consisting of x- and y- coordinates as arrays
model = Ellipse.fit(xp, yp)

Drawing the fitted shapes

Both classes have the draw method making use the parameter-based representation:

# t being the coordinate parameter
xp, yp = model.draw(t)

The nature of the parameter t above depends on the fitted shape. Some tips are in the docstring for the draw method.

License

Copyright (c) 2020 Keisuke Sehara, the MIT License

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

fitting2d-1.0.0a5.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

fitting2d-1.0.0a5-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

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