GUI for lmfit
Project description
Getting Started
- Clone into its own directory (Current working on getting this added to pip, so that it can be installed directly into python environment)
- Copy and Paste the curvefitgui folder into your project
- If on MacOS M1 a conda environment will be needed ... (add link for setting up conda env)
- import the gui
from curvefitgui import curve_fit_gui
- Call curve_fit_gui:
- Set first parameter to None to be able to select predefined functions
- For example:
curve_fit_gui(None,xdata,ydata)
curve_fit_gui function:
This starts up the GUI. The call signature is curve_fit_gui(f,xdata,ydata,xerr=None -> [optional],yerr=None -> [optional],p0=None -> [optional],xlabel="x-axis" -> [optional],ylabel="y-axis" -> [optional],absolute_sigma=False -> [optional],jac=None -> [optional],showgui=True -> [optional],**kwargs, -> [optional])
- f : callable the fit function which if set to None, gives option of selection predefined fit functions
- xdata : 1-D numpy array x-coordinates of the data
- ydata : 1-D numpy array y-coordinates of the data
- yerr : 1-D numpy array, optional (default:None) error/uncertainty in y-values used for weighted fit with a relative weight defined as 1/yerr**2 (for compatibility also the use of the keyword sigma can be used for the same)
- xerr : 1-D numpy array, optional (default:None) error in x-values. For plotting errorbars only and ignored during fitting
- xlabel : string, optional (default:'x-values') x-axis title in the plot
- ylabel : string, optional (default:'y-values') y-axis title in the plot
- title : string, optional data plot title
- p0 : array-like, optional initial values for fit parameters, if not specified 1 is used for each parameter
- showgui : boolean, optional (default=True) if True, the gui is shown, otherwise not
- absolute_sigma : boolean, optional see doc-string scipy.optimize.curve_fit()
- kwargs keyword arguments for compatibility (e.g. you can use sigma to specify the error in y)
User defined functions (not tested)
- To make a user defined function create a function and pass to curve_fit_gui as f. For example:
def linear(x, a, b,c): return y = a * x + b
Customizing Data Plot
The plots are customizable from inside the gui and also from the curve_fit_gui
function call by using keyword arguments or kwargs. The options available from a matplotlib plot are also available for the main data plot
For example: curve_fit_gui(None, xdata, ydata, markerfacecolor="None", linestyle="-"
For a list of optional keyword arguments visit the matplotlib documentation on this page under the list of available Line2D properties: matplotlib.pyplot.plot
- Note: Use full names i.e. linewidth not lw
- In addition, title can be set using title keyword argument i.e
curve_fit_gui(...,...,...,title="More Data")
Customizing Fitline:
Options for customizing fitline inlclude color, linestyle, and thickness. The values are the same from matplotlib, however the argument is preceded with fitline_. For example curve_fit_gui(None, xdata, ydata, fitline_color="red", fitline_linestle="-")
. The possible customizations for fitline are:
- fitline_color
- fitline_linestyle: supported values are '-', '--', '-.', ':', 'None', ' ', '', 'solid', 'dashed', 'dashdot', 'dotted'
- fitline_label
- fitline_linewidth
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for complex-curve-fit-gui-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe4b08e1145eafaedf8f2a24e47b587c308eb2e5321d5918839d597a3c6093c2 |
|
MD5 | 2dd64dc13ed65ff998fffe1b81447b36 |
|
BLAKE2b-256 | 48ae5964d154c678feed8bd175a1bff3eb0fc6c4b41cf479700b890509ce72a5 |