updated ruby script to average the analog samples