Coder Social home page Coder Social logo

itfit's Introduction

PyPI Downloads PyPI Version

Commit activity License Build

Python Version Wheel



Itfit

Interactive Fitter



Simple, intuitive and interactive application to help fitting common functions to your data.





import matplotlib.pyplot as plt
import itfit

fitter = itfit.Fitter(xdata, ydata)
fitter()
plt.show()

plot = fitter.default_plot_last_fit("x value", r"$\phi$ [s$^{-1}$]", "Itfit default plot")
plot.save_fig("figure.png")

Instalation

Itfit releases are available as wheel packages on PyPI. You can install the last version using pip:

pip install itfit

Documentation

Documentations is automatically generated from code on master push and hosted in github-pages here.

Help

Just open an issue with the question tag (or clic here) and we would love to help!

Contributing

You can contribute with:

Even only feedback is greatly apreciated.

Just create an issue and let us know you want to help!

Licensing

Itfit is released under the Apache License Version 2.0.

itfit's People

Contributors

quanticpony avatar sir-bip-bop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

christphr

itfit's Issues

Add support for y-error in data

Scipy supports y-error in data and we should too.

Proposed behavior
When Fitter is called it could accept a yerror keyword. Like this:

fitter = itfit.Fitter(xdata, ydata, yerror=ydata_error)

How to implement
Include in Data containers an array for y-error as optional.
Use this y-error when present with scipy optimize.

Add filters for data selection

At the moment only the lasso selector is available. It would be useful to include custom filters to select data.

Proposed behavior
Let users define functions that take 2 parameters and return a boolean: True if selected False otherwise.
Example:

fitter = itfit.Fitter(xdata, ydata)
fitter.add_filter(lambda x,y: x<3) 

This example would only use points where x < 3.

Other filters
Maybe we could add sliders to select x_min < x < x_max type of sliders.

Fit Selector

When PlotBuilder accessing fits it's not easy. I suggest a "fit selector" feature.

Proposed behavior
Add a method to itfit.Fitter similar to:

fit: itfit.utils.FitContainer = Fitter.select_fit()

That launches a figure with all fits plotted. When a fit line is selected via click a itfit.utils.FitContainer is returned.

Additionally we could use this selector on itfit.PlotBuilder.plot_fit. Then we could plot multiple fits into a single figure.

Example
For example something like this could be used to plot 2 fits with data:

plot_builder = fitter.get_plot_builder()

plot_builder.plot_fit(color="pink").plot_fit(color="red").with_data()

Captura
Captura2

Fix restrictions not working in DragPoints

Restrictions are not working, they do not apply.
Changes:

  • DragPoint.patch.get_center() to DragPoint.get_center().
  • Save restrictions in DragPoint via DragPointManager.
  • Apply restrictions in DragPoint.get_center().

Add mkdocs

Add automatic documentation with mkdocstrings

Fit results save and load functionality

After the optimization is complete the user should be able to save it. And maybe load it again if wanted.

Proposed behavior
Something like this:

fitter = itfit.Fitter(xdata, ydata)
fitter()
plt.show()

fitter.get_last_fit().save_fit("example.txt")

We probably want 2 files with:

  • Data selected.
  • Optimization details. Statistics and fit related things, as function used.

Add README.md, LICENSE

Add a basic README for new people to know what we are doing, what they should expect and how they can help us improve and add new features.

Add Lorentzian function

Lorentzian fit function. FWHM, central point and maximum could be modified with 2 drag points.

Add plot container

Add a new class wrapper around Matplotlib's Figure/Axis, allowing easy changes in title, labels, styles. Easy plotting fits with or without data

Points merge when left close

DragPoints merge when placed close
When 2 or more DragPoints are place nearby they merge on clic event.

To Reproduce
Steps to reproduce the behavior:

  1. Select any fit function
  2. Put DragPoints touching
  3. Clic and drag any of them

Expected behavior
DragPoints should have a lock when selected, and the selection event should only pick one DragPoint

Add Interval of confidence to the functions and the plot

We could start the treatement of the data and results as a separate folder. I started with the confidence region as they can be directly
plotted next to the fit that's already there, but in here we could start outputing parameters into txt and more stuff.

The first point could be to create a propagate function that runs the propagation of errors after running the fit so it can plot the interval. For that we woudl need to create either the derivative of the function for each class separately or create a second function if we want to use numdiftools

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.