# File lib/visage-app/collectd/json.rb, line 116
      def downsample_array(samples, old_resolution, new_resolution)
        return samples unless samples.length > 0
        timer_start = Time.now
        new_samples = []
        if (new_resolution > 0) and (old_resolution > 0) and (new_resolution % old_resolution == 0)
          groups_of = samples.length / (new_resolution / old_resolution)
          return samples unless groups_of > 0
          samples.in_groups(groups_of, false) {|group|
            new_samples << group.compact.mean
          }
        else
          raise "downsample_array: cowardly refusing to downsample as old_resolution (#{old_resolution.to_s}) doesn't go into new_resolution (#{new_resolution.to_s}) evenly, or new_resolution or old_resolution are zero."
        end
        timer = Time.now - timer_start

        new_samples
      end