Open Tom-Willemsen opened 2 months ago
When doing fitting, the weights of each point are 1/uncertainty
. Obviously this is problematic in the case where counts = uncertainty = 0.
I discussed this with the scientists in the scans meeting 2024/10/15 and agreed that when initially generating the uncertainties (in read_spectrum_dataarray
), the uncertainties should be sqrt(N + 0.5)
rather than sqrt(N)
as per poisson counting statistics. This was agreed with CK, RD, JL present. The actual data should be unchanged, the +0.5
is only for uncertainty calculation.
The above approach is both "smooth" and converges towards sqrt(N)
in the limit with high counts, and should also mean that we never get an uncertainty of zero in the fitting side.
When doing this ticket make sure we document the above approach (e.g. write an ADR for it)
As a user, if uncertainties have been published by the underlying device, I would like plots & fits to use them.
This issue depends on all of:
Which must be completed first.
Acceptance criteria:
LivePlotWithUncertainty
wrapper on top ofLivePlot
for this.matplotlib
can already handle plots with error bars, so this is largely "pass data through to matplotlib in the right places".lmfit
takesweights
for each point which can be used to implement this - so this is largely "pass data through to lmfit in the right places".