Optimization of radio astronomical observations using Allan variance measurements