Skip to content

Improve randomness of non guiding dithering

Simone Tisa requested to merge simont/kstars:improve_nonguiding_dithering into master

As described in #89 (closed), non guiding dithering seems non really random, with an evident drifting over time.

This MR should solve the issue. At the beginning I thought the issue was due to the use of rand() instead of the higher quality <random>-provided functions, but eventually I found out that the cause is much more subtle. Rand() was used to randomize each pulse magnitude. The resulting final position is thus the sum of(roughly) uniformly distributed numbers. It's easy to see that this sum is equal to n*(average_of_the_dithering_pulses) where n is the number of pulses. If the average is not exactly 0, which is very likely for small number of trial, this number will tend to assume not negligible values, and thus the drifting. Morever, in the actual implementation the average of the dithering pulse is set on purpose to be different from 0.

I thus took a different approach. Using <random> functions, I do not generate directly the guiding pulses, but instead the RA and DEC displacement with respect to the position at the beginning of the capture task, and then calculate the actual pulse to be applied to reach that displacement, taking into account all the previously applied guiding pulses. It this way the total displacement is by design confined into the interval (-ditherPulse;+ditherPulse), and the resulting (RA;DEC) point cloud is well dispersed over a square.

I confirmed the improvement by analyzing the log. Still not tested on field.

Edited by Simone Tisa

Merge request reports