Local threshold tuning creates triple s-curve
The local threshold tuning sometimes create a triple s-curve:
It happens for pixels that either have always 100% occupancy or 0% occupancy independent of the TDAC setting. In that case the best_results_map is never updated. So even though the local threshold moves closer to the desired threshold, it gives you the default TDAC value.
If you add a <= instead of a < in:
https://gitlab.cern.ch/silab/bdaq53/-/blob/development/bdaq53/scans/tune_local_threshold.py#L148
it takes the latest TDAC value with the smallest difference and you get a nice s-curve:
Edited by Dominik Koukola