Skip to main content

Fit conic sections (ellipse, parabola, hyperbola) to a set of 2d points

Project description

🎊 Confitti 🎊 - for Conics Fitting

Fit conic sections (ellipse, parabola, hyperbola) to a set of points

See the presentation

What's new

  • 2024-11-03: Version 0.2.1 released. Fixed bug in writing save files when eccentricity does not vary.
  • 2024-10-16: Version 0.2.0 released. Added ability to save model fit parameters to a file, and to read them back in.
  • For more details, see the full change log.

Installation

pip install confitti

or

uv pip install confitti

will install the package plus the required dependencies (numpy, scipy, lmfit).

Optional dependencies, which are used in the example notebooks, may be pip-installed separately:

  • emcee for MCMC sampling
  • matplotlib, seaborn, and corner for plotting
  • astropy and regions for dealing with celestial coordinates

Usage

See the example jupyter notebooks in the notebooks directory. For example,

  • demo01-basic.ipynb demonstrates basic usage: finding the best-fit parabola (or general conic) to a set of (x, y) points
  • demo02-emcee.ipynb explores uncertainty in the parameters of the best-fit curve by means of mcmc
  • demo03-proplyd.ipynb is an example application to real astronomical data (HST image of a bow shock in the Orion Nebula). This also shows how to save the best-fit parameters to a file.
  • demo04-other-proplyd.ipynb is a second example application to a different bow shock, which turns out very differently because the best-fit arc is an ellipse, rather than a hyperbola
  • demo05-quadrants.ipynb tests that the code can handle axis orientations in all four quadrants and close to the wrap angle of 360 degrees
  • demo06-read-save-files.ipynb demonstrates how to read in the multiple saved files from previous fits.

Prior art

This is the successor project to circle-fit

Some of the literature on the topic of fitting conic sections to points is described here.

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

confitti-0.2.1.tar.gz (13.0 MB view details)

Uploaded Source

Built Distribution

confitti-0.2.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file confitti-0.2.1.tar.gz.

File metadata

  • Download URL: confitti-0.2.1.tar.gz
  • Upload date:
  • Size: 13.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for confitti-0.2.1.tar.gz
Algorithm Hash digest
SHA256 00a404ee69a400371946b6363d34cfa27f97cdb0990be2ee1095a82d1151425f
MD5 47459003ea06cbcf2ed10694feca402a
BLAKE2b-256 045275e8acd987b7f6a816d2e157404eb8c81efc0c2752e3626ae06ff3923058

See more details on using hashes here.

File details

Details for the file confitti-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: confitti-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for confitti-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4dfb7e8e7bcd4694a555f2b0ddf3e7b8d1436adf1ff29f09efa65027fa826f74
MD5 0b132766e2cda97b749a08420eed7b8e
BLAKE2b-256 e19c45dcfd227b83ac5eeb366789e8727dd6f240098528d6cf64f994885d5304

See more details on using hashes here.

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