node script to average trials together