Quick start¶
Install¶
To install the package and its dependencies, clone the repository and run the following command in the repository root directory
pip install --upgrade numpy scipy
pip install [-e] .
or equivalently (let pip do the cloning)
pip install --upgrade numpy scipy
pip install git+https://github.com/ckoerber/lsqfit-gui@master
(lsqfit
and gvar
require numpy
and scipy
as build dependencies. Installing these packages before install gvar
ensures a smooth installation.)
Usage¶
The GUI can be started either:
directly from another python script
# some_script.py
from lsqfit import nonlinear_fit
from lsqfitgui import run_server
...
fit = nonlinear_fit(data, fcn=fcn, prior=prior)
run_server(fit)
or over the entry point, which requires a
gvar
pickled fit and an import path to the fit function. As an example, first export the fit running the following script,
#other_script.py
import gvar as gv
from lsqfit import nonlinear_fit
def fcn(x, p):
y = ...
return y
...
fit = nonlinear_fit(data, fcn=fcn, prior=prior)
gv.dump(fit, "fit.p")
and run the GUI with
lsqfitgui [--function other_script.py:fcn] fit.p
Advanced usage¶
See also the examples/
folder and documentation.