Skip to main content

Tool for fitting lines to data

Project description

fit_plot

  • Fit data with a straight line chosen by clicking points on a plot.

Requires: ipympl

To use:

  import fit_plot
  %matplotlib widget
  
  fit_plots.line(unique_name, xdata, ydata, yerr, chi2=False, input_boxes=True)

  or

  fit_plots.with_background(unique_name, xdata, ydata, yerr,chi2=False, input_boxes=True)

where xdata, ydata and yerr must be numpy arrays of at least two points.

Click in the data portion of the figure to set a point for the fit line. Whichever point you click closer to will move to the new position.

For with_background(), a background value can be set: choose the Floor radio button, then click at the desired level of background.

If chi2 == True, a chi-squared value will be calulated and displayed.

If input_boxes == True (default) boxes are displayed so that the slope, intercept, and "floor" values may be entered manually.

Caveats:

  1. if you change the unique name, the fit parameters will be lost.

  2. fit parameters are stored in hidden files and won't travel if the notebook is renamed or moved to another directory.

  3. any plots made after using one of these functions should start with plt.figure()

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

fit_plot-0.1.9.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

fit_plot-0.1.9-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file fit_plot-0.1.9.tar.gz.

File metadata

  • Download URL: fit_plot-0.1.9.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.7

File hashes

Hashes for fit_plot-0.1.9.tar.gz
Algorithm Hash digest
SHA256 895a0590fa8ec53f5aa177d64d834768f1d0e4de2489526dbef85d7e1b4248da
MD5 fc34ffa93d53a7eae8cf69f4f48c2c24
BLAKE2b-256 f20ce11a250ff3287676736a19593d9e86efff9f06c269fd74f785c89b50b754

See more details on using hashes here.

File details

Details for the file fit_plot-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: fit_plot-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.7

File hashes

Hashes for fit_plot-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a410ef0d63798d3c667bea2f4588263bb94e20dc4fbeb2c0277113225d264d2f
MD5 2bc6b74c5fb84d7de71dc41aa982eafe
BLAKE2b-256 387eb9c1e810ce73d66124c01a42331ae59e858ec5b650e32b15c9655a1616cc

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