<commit_before>var Anima = Anima || {};

var centerOffset = 0;
var spectrumBuffer = (function() {
  var xDivisions = 30;
  var yDivisions = 25;

  var spectrumBuffer = new Array(xDivisions);
  for (var i = 0; i < xDivisions; ++i) {
    spectrumBuffer[i] = [];
    for (var j = 0; j < yDivisions; ++j) {
      spectrumBuffer[i][j] = 0;
    }
  }

  spectrumBuffer.sampleFromBuffer = function sampleFromBuffer(buffer) {
    var momentSpectrum = new Array(yDivisions);
    for (var i = 0; i < yDivisions; i++) {
      var stepSize = Math.floor(buffer.length/xDivisions);
      momentSpectrum[i] = buffer[i * stepSize];
    }
    spectrumBuffer.shift();
    spectrumBuffer.push( momentSpectrum );
  };

  spectrumBuffer.draw = function draw(processing) {
    var width = window.innerWidth / xDivisions;
    var height = window.innerHeight / 2 / yDivisions;
    for(i = 0; i < xDivisions; ++i) {
      for(j = 0; j < yDivisions; ++j) {
        var x = width * i;
        var y = height * j;
        processing.fill(255, spectrumBuffer[i][j]);
        processing.stroke(255, spectrumBuffer[i][j]);
        processing.rect(x, y, width, height);
        processing.rect(x, window.innerHeight - y - height, width, height);
      }
    }
  };

  return spectrumBuffer;
}) ();

var historyBuffer = (function() {
  var historyBuffer = new Array(1024);
  var strokeOptions = [];

  for (var i = 0; i < historyBuffer.length; ++i) {
    historyBuffer[i] = 0;
  }

  historyBuffer.sampleFromBuffer = function sampleFromBuffer(buffer) {
    var sum = 0;
    var length = buffer.length;
    for(var i = 0; i < length; ++i) { sum += buffer[i]; }

    var moment = sum / (255 * buffer.length) * 500;
    historyBuffer.shift();
    historyBuffer.push(moment);
  };

  historyBuffer.setStroke = function setStroke(options) {
    strokeOptions = options;
  };
<commit_msg>spectrum now uses buckets slash groups slash whatever<commit_after>var Anima = Anima || {};

var centerOffset = 0;
var spectrumBuffer = (function() {
  var xDivisions = 30;
  var yDivisions = 25;

  var spectrumBuffer = new Array(xDivisions);
  for (var i = 0; i < xDivisions; ++i) {
    spectrumBuffer[i] = [];
    for (var j = 0; j < yDivisions; ++j) {
      spectrumBuffer[i][j] = 0;
    }
  }

  spectrumBuffer.sampleFromBuffer = function sampleFromBuffer(buffer) {
    var groupedAverages = groupedAveragesFromBuffer(buffer, yDivisions);
    var momentSpectrum = new Array(yDivisions);

    for (var i = 0; i < yDivisions; i++) {
      momentSpectrum[i] = groupedAverages[i];
    }
    spectrumBuffer.shift();
    spectrumBuffer.push( momentSpectrum );
  };

  spectrumBuffer.draw = function draw(processing) {
    var width = window.innerWidth / xDivisions;
    var height = window.innerHeight / 2 / yDivisions;
    for(i = 0; i < xDivisions; ++i) {
      for(j = 0; j < yDivisions; ++j) {
        var x = width * i;
        var y = height * j;
        processing.fill(255, spectrumBuffer[i][j]);
        processing.stroke(255, spectrumBuffer[i][j]);
        processing.rect(x, y, width, height);
        processing.rect(x, window.innerHeight - y - height, width, height);
      }
    }
  };

  return spectrumBuffer;
}) ();

function groupedAveragesFromBuffer(buffer, numGroups) {
  var averages = [];
  var groupSize = Math.ceil(buffer.length / numGroups);
  for (var i = 0; i < numGroups; i++) {
    var group = buffer.subarray(groupSize * i, groupSize * (i + 1));
    averages[i] = Math.average(group);
  }
  return averages;
}

var historyBuffer = (function() {
  var historyBuffer = new Array(1024);
  var strokeOptions = [];

  for (var i = 0; i < historyBuffer.length; ++i) {
    historyBuffer[i] = 0;
  }

  historyBuffer.sampleFromBuffer = function sampleFromBuffer(buffer) {
    var sum = 0;
    var length = buffer.length;
    for(var i = 0; i < length; ++i) { sum += buffer[i]; }

    var moment = sum / (255 * buffer.length) * 500;
    historyBuffer.shift();
    historyBuffer.push(moment);
  };

  historyBuffer.setStroke = function setStroke(options) {
    strokeOptions = options;
  };

{'fraction_non_alphanumeric': 0.13947757516017742, 'fraction_numerical': 0.016264169541646133, 'mean_word_length': 3.038805970149254, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1768893', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1305, 'n_words': 340}