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, render_to_html=False)

  or

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

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.

If render_to_html == True, then a static page is rendered.

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.12.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fit_plot-0.1.12-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fit_plot-0.1.12.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fit_plot-0.1.12.tar.gz
Algorithm Hash digest
SHA256 79e2b657f66bb0ee09e057380e65f6ae4027ddc5454f74e0d7fa10a58b15283b
MD5 a4d165359351101f85d802e95d013f00
BLAKE2b-256 b8a810bac7da51c704030d7919760731aea8fe5511089bbd01ebb0ed072f66be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fit_plot-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fit_plot-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 1a1c5b6d9128af766dd14254e01aba9a870e1f5ec39351c0a748edb59f0b208d
MD5 8c46af5e04ac60989dda4e7cb0a28fe9
BLAKE2b-256 63605492a31d03cced2a592a633de1861ccfad8eb3700af46ec9754749db2c85

See more details on using hashes here.

Supported by

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