Evaluating uncertainty in a model that returns complex numbers

35 views
Skip to first unread message

JP Dehollain

unread,
Jun 28, 2023, 9:33:20 PM6/28/23
to lmfit-py
I am using lmfit to fit data that is described by a model that returns an array complex numbers (e.g., the polar trace of a radiofrequency signal). When I run fit_result.eval_uncertainty() it returns an array of floats. So my question is, how is the uncertainty in the model output being calculated?

Matt Newville

unread,
Jun 28, 2023, 10:54:28 PM6/28/23
to lmfi...@googlegroups.com
Hi JP,

On Wed, Jun 28, 2023 at 8:33 PM JP Dehollain <jpdeh...@gmail.com> wrote:
I am using lmfit to fit data that is described by a model that returns an array complex numbers (e.g., the polar trace of a radiofrequency signal). When I run fit_result.eval_uncertainty() it returns an array of floats. So my question is, how is the uncertainty in the model output being calculated?

Yes, fitting methods use strictly Float64 arrays.  For a model that uses complex values, real/imaginary pairs will be used.

JP Dehollain

unread,
Jul 2, 2023, 8:52:02 PM7/2/23
to lmfit-py
Thanks Matt, but that doesn't really answer my question. lmfit can handle arrays of complex numbers (using real/imaginary float64 pairs as you stated), but when it applies the .eval_uncertainty() method, it returns an array of single floats. So I am asking how that method is calculating the model output uncertainty when that output is complex.

Matt Newville

unread,
Jul 3, 2023, 11:09:01 AM7/3/23
to lmfi...@googlegroups.com
Hi JP, 

Ah, thanks for the clarification, I must have missed that point.   Yes, you are right: currently `ModelResult.eval_uncertainty` is not properly handling models that return complex values.     

That should be fixable, and I hope we can get that fixed and released soon...


--
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 on the web visit https://groups.google.com/d/msgid/lmfit-py/61ab043d-b858-4b27-a31c-15bf46fe9e2en%40googlegroups.com.


--
--Matt Newville <newville at cars.uchicago.edu630-327-7411
Reply all
Reply to author
Forward
0 new messages