Weighted vs Unweighted Residuals

23 views
Skip to first unread message

Virginia McGhee

unread,
Jan 15, 2025, 9:48:10 PMJan 15
to lmfit-py
From a previous post, I found that ModelResult.plot or ModelResult.plot_residuals gives a plot of the unweighted residuals and ModelResult.residual gives an array of weighted residuals.  Is there a way to have ModelResult.plot give the weighted residuals instead?  I have tried setting yerr to the list used when generating the ModelResult, but it still gives the unweighted residuals.

Thanks,
Virginia

Matt Newville

unread,
Jan 16, 2025, 10:45:18 AMJan 16
to lmfi...@googlegroups.com
Hi Virginia,

Making such plots yourself should not be too much work. 

I fully embrace the idea that data visualization and plotting are important.  But this is not a plotting library, and I am reluctant to do much with the ModelResult plotting routines.  I would be inclined to remove these methods completely, but I know lots of people use them.  So I would say that I think these routines are okay to keep, but they are never going to be full-featured or do what everyone wants. 

OTOH, if someone wanted to support a project for plotting results from lmfit, that would be fine with me.  A general-purpose fitting GUI or rich set of Jupyter tools would be nice to have.  I have some GUI parts for lmfit-based fitting in some of my other codes, but not quite general-purpose, say like fityk.  I think that would be nice to have too, but would also be some effort.

I might ask you and others here how valuable that would be.



--
You received this message because you are subscribed to the Google Groups "lmfit-py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmfit-py+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lmfit-py/12137c6a-0d07-4397-82fd-c2d95b712been%40googlegroups.com.


--
--Matt Newville <newville at cars.uchicago.edu630-327-7411

Jonathan Gutow

unread,
Jan 16, 2025, 11:02:07 AMJan 16
to lmfi...@googlegroups.com
Virginia.

To help you develop templates to do what you particularly want you might look at jupyter_Pandas_GUI (https://jupyterphysscilab.github.io/jupyter_Pandas_GUI/pandas_GUI.html). It provides some GUI code building tools inside jupyter for using lmfit to do fits and make plots. Once you have something sort of like what you want, you can make modifications to exactly meet your needs.

full disclosure: I am the primary developer of this tool.

Happy fitting.

Dr. Jonathan Gutow
Halsey Science Room 412
Chemistry Department
UW Oshkosh
web: https://cms.gutow.uwosh.edu/Gutow
e-mail: gu...@uwosh.edu
Ph: 920-424-1326

Reply all
Reply to author
Forward
0 new messages