Hi Zoltan,
I expect the issue is coming from the way threading is implemented in Python. As far as my understanding goes; because we are running a main central loop, if you take “too long” to execute something in a function (within this loop) it can cause a crash.
The way to work around this is to run whatever your function is (which calls this measurement 20 times) in a thread (see the thread starting/executing lines which arise frequently in the code, for example in the PumpModulation function). If you do this then your function will not block the main loop from executing (e.g. the process that is updating data to the HTML UI), and thus it have the timeout problem.
Regarding how the averaging happens; each “MeasureOD” measurement is an average intensity over approx 0.7 seconds of laser. In the automated experimental procedure it measures four such periods and takes the average of these. However, if you just click “Measure” in the UI then only a single (0.7s long) OD measurement is performed.