Open rmlmcfadden opened 3 years ago
I agree. I actually did this in another code a while back so here's the solution (note to self):
betai = 1./beta
pd_T1 = gamma(1./beta)/beta
pd_beta = -T1*gamma(betai)*(1+betai*polygamma(0,betai))*square(betai)
T1avg = T1*pd_T1
dT1avg = sqrt( (pd_T1*dT1)**2 + (pd_beta*dbeta)**2 + 2*cov*pd_T1*pd_beta)
The tedious part is making sure that the covariance is accessible in some reasonable way that doesn't break anything else. Otherwise tracking will be a pain if, for example, one wants to fit multiple str exp.
I will get to this eventually.
Describe the bug
In the calculation of the β-averaged T1, <T1>, done here:
https://github.com/dfujim/bfit/blob/b196318903430bfa03f883c8f231d17a96abaf35/bfit/gui/tab_fit_files.py#L1580-L1604
the covariance of β and T1 isn't used when estimating the uncertainty.
To Reproduce
Any stretched exponential fit done through the GUI.
Expected behaviour
That the covariance would be used in the error propagation. Accounting for it is crucial here, as the two parameters, coming from the same fit, will always be correlated.
Desktop
Additional context
Discovered while looking for an API in bfit do this in a scripted analysis.