ISISComputingGroup / ibex_bluesky_core

Core bluesky plan stubs & devices for use at ISIS. Not instrument/technique specific.
https://isiscomputinggroup.github.io/ibex_bluesky_core/
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Use uncertainties in plots and fits #22

Open Tom-Willemsen opened 2 months ago

Tom-Willemsen commented 2 months ago

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:

Tom-Willemsen commented 2 weeks 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)