Closed pathfinder49 closed 3 days ago
So I think the answer here is that the code here is behaving broadly as expected (AFAICT it's reproducing what scipy's curve_fit would do, which is at least one definition of reasonableness!).
As discussed IRL, the issue is that there is an extremely high degree of covariance between the parameters so calculating the variance is numerically challenging. I think this is a case of this not being a reasonable thing to expect to "just work". You /might/ find that the MLE-based NormalFitter does a better job than the default one based on curve_fit, but you'd have to test that.
What I think we should do however is to add the covariance matrix to the fitter's output to make debugging this kind of thing easier. I'll open a separate issue for that.
Covariances are now exported in https://github.com/OxIonics/ionics_fits/pull/189
Brief description
Using
LaserFlopTimeDisplacedThermal
with floatedalpha
andn_bar
Error bars are unreasonably large in fits.Details
I'm developing diagnostics for displaced thermal states. Attempting to fit
alpha
andn_bar
to the data in the image below I get a moderatly good fit (shown by the line). (all other parameters are fixed)However, logging the fit results (after changing the analysis experiment to show more significant figures) I get fit parameters with unreasonable uncertainties: These uncertainties are inconsistent with the data being fitted by several orders of magnitude.
Loading the experiment data in a notebook, it appears that the issue only arises when alpha and n_bar are floated together. The actual fitted value is insensitive to these both being floated. However the stated uncertainty is very sensitive. See notebook in https://github.com/OxIonics/analysis/pull/328/commits/2d8675c6a8dfc09c946c2f9c3cb2362c723c4ce6
I am surprised by this behavior as I would have expected: