Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fitmodel: remove regtype optional argument #137

Merged
merged 1 commit into from
Apr 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions deerlab/fitmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
def fitmodel(Vexp, t, r, dd_model='P', bg_model=bg_hom3d, ex_model=ex_4pdeer,
dd_par0=None, bg_par0=None, ex_par0=None, verbose=False,
dd_lb=None, bg_lb=None, ex_lb=None, dd_ub=None, bg_ub=None, ex_ub=None,
weights=1, uq='covariance', regparam='aic', regtype = 'tikhonov',
tol=1e-10,maxiter=1e8):
weights=1, uq='covariance', regparam='aic', tol=1e-10,maxiter=1e8):
r"""
Fits a dipolar model to the experimental signal ``V`` with time axis ``t``, using
distance axis ``r``. The model is specified by the distance distribution (dd),
Expand Down Expand Up @@ -121,15 +120,6 @@ def fitmodel(Vexp, t, r, dd_model='P', bg_model=bg_hom3d, ex_model=ex_4pdeer,
The regularization parameter can be manually specified by passing a scalar value
instead of a string. The default ``'aic'``.

regtype : string, optional
Regularization functional type:

* ``'tikhonov'`` - Tikhonov regularizaton
* ``'tv'`` - Total variation regularization
* ``'huber'`` - Huber regularization

The default is ``'tikhonov'``.

tol : scalar, optional
Tolerance value for convergence of the NNLS algorithm. If not specified, the value is set to ``tol = 1e-10``.

Expand Down Expand Up @@ -519,7 +509,7 @@ def regularization_analysis(Vexp):
Ks = [dl.dipolarkernel(ts,r) for ts in t]

# Linear regularization fit
fit = dl.fitregmodel(Vexp,Ks,r,regtype,regparam, weights=weights,uq=uqanalysis,tol=tol,maxiter=maxiter)
fit = dl.fitregmodel(Vexp,Ks,r,'tikhonov',regparam, weights=weights,uq=uqanalysis,tol=tol,maxiter=maxiter)
Pfit = fit.P
Pfit_uq = fit.uncertainty
scales = np.atleast_1d(fit.scale)
Expand Down