Make sure that the S-curve fits succeed (at least, do not fail silently)
Summary
This issue is opened to make sure that the failed Scurves fit reported by Giovanni on GitHub (gem-plotting-tools#257) do not happen anymore with the new tools, and particularly not silently.
From the original issue:
For a small number of channels (usually around 10 over the 3072 in a chamber), we can have the scurves fit that give an oddly small sigma, which is not physical (below 0.1 fC). Presentation link.
Note that failed fits can have an impact during the trimming algorithm, if aligning the channels "on noise".
What is the expected correct behavior?
The Scurves fit should not fail silently.
Relevant logs and/or screenshots
See the original GitHub issue.
Possible fixes
One can check the \chi^2
of the fit, better choose the initial parameters, and/or imprive the fit function. In addition, not using the time the process ID as the random generator seed (as done in legacy) would allow to be able to reproduce the failed fits.
Alternatively, from the original issue:
The scurve fit should be repeated in case we see that the scurve sigma is below 0.1 fC, because this is a clear indicator that the fit was failing. The width of the scurves is usually above 0.2 fC and also for those aforementioned channels, this is almost always the case. It can happen that the channels are disconnected due to a damaging discharge, so, in that case the sigma can be very small. Therefore, we can limit the trials that the fit can be performed before giving up.
This proposal has the caveat to be based on an arbitrary value for the Scurve sigma.