<commit_before>var data;
var graph,graph2;

function loadData(d,attr){

	// Remove extra newlines at the end
	d = d.replace(/[\n\r]$/,"");

	data = CSV2JSON(d,[{'name':'unixdate','format':'number'},
								{'name':'date','format':'date'},
								{'name':'T','format':'number'},
								{'name':'L','format':'number'}
	]);

	processLoad();

	return this;
}

function processLoad(){

	var G = {};
	G.sum = function(a) { var i, sum; for (i = 0, sum = 0; i < a.length; sum += a[i++]) {}; return sum; };
	G.mean = function(a) { return G.sum(a) / a.length; };
	
	if(data && data.length > 0){

		var temp = [];
		var light = [];
		var smooth = new Array();
		var s1 = new Array();
		var s2 = new Array();

		// Assume all the gas and electric points have the same dates for the same rows (may not be true though
		for(var i = 0; i < data.length ; i++){
			if(data[i].date){
				s1.push({x:data[i].date,y:data[i].T,err:2,date:(data[i].date).toISOString()});
				s2.push({x:data[i].date,y:data[i].L,date:(data[i].date).toISOString()});
			}
		}
		var dx = 900*1000;
		var n = Math.round((data[data.length-1].date.getTime() - data[0].date.getTime())/dx);
		var sigma2 = Math.pow(3600,2);
		for(var i = 0; i < n ;i++){
			var d = new Date(Math.round(data[0].date.getTime()/dx)*dx + dx*i);
			var v = new Array();
			var weight = 0;
			var neg = false;
			var pos = false;
			for(var j = 0; j < data.length; j++){
				diff = (data[j].date - d)/1000;
				w = Math.exp(-(diff*diff)/sigma2);
				if(w > 0.1){
					if(diff < 0) neg = true;
					if(diff > 0) pos = true;
					weight += w;
					v.push(w * data[j].T);
				}
			}
			if(v.length > 0 && neg && pos) smooth.push({x:d, y: (G.sum(v)/weight).toFixed(1), date: d.toISOString() });
		}
		
		temp.push({
			// Data in the form [{x:x1,y:y1,err:err1},...{x:xn,y:yn,err:errn}]
			data: s1,
			color: '#D60303',
			points: { show: true, radius: 3, errors: 0.3 },<commit_msg>Change data format (reducing file size)<commit_after>var data;
var graph,graph2;

function loadData(d,attr){

	// Remove extra newlines at the end
	d = d.replace(/[\n\r]$/,"");

	data = CSV2JSON(d,[{'name':'unixdate','format':'number'},
								/*{'name':'date','format':'date'},*/
								{'name':'T','format':'number'},
								{'name':'L','format':'number'}
	]);

	processLoad();

	return this;
}

function processLoad(){

	var G = {};
	G.sum = function(a) { var i, sum; for (i = 0, sum = 0; i < a.length; sum += a[i++]) {}; return sum; };
	G.mean = function(a) { return G.sum(a) / a.length; };
	
	if(data && data.length > 0){

		var temp = [];
		var light = [];
		var smooth = new Array();
		var s1 = new Array();
		var s2 = new Array();

		// Assume all the gas and electric points have the same dates for the same rows (may not be true though
		for(var i = 0; i < data.length ; i++){
			if(data[i].unixdate){
				data[i].date = new Date(data[i].unixdate*1000);
				s1.push({x:data[i].date, y:data[i].T, err:2, date:data[i].date.toISOString()});
				s2.push({x:data[i].date, y:data[i].L, date:data[i].date.toISOString()});
			}
		}
		// Build smoothed, running, average
		var dx = 900*1000;
		var n = Math.round((data[data.length-1].date.getTime() - data[0].date.getTime())/dx);
		var sigma2 = Math.pow(3600,2);
		for(var i = 0; i < n ;i++){
			var d = new Date(Math.round(data[0].date.getTime()/dx)*dx + dx*i);
			var v = new Array();
			var weight = 0;
			var neg = false;
			var pos = false;
			for(var j = 0; j < data.length; j++){
				diff = (data[j].date - d)/1000;
				w = Math.exp(-(diff*diff)/sigma2);
				if(w > 0.1){
					if(diff < 0) neg = true;
					if(diff > 0) pos = true;
					weight += w;
					v.push(w * data[j].T);
				}
			}
			if(v.length > 0 && neg && pos) smooth.push({x:d, y: (G.sum(v)/weight).toFixed(1), date: d.toISOString() });
		}
		
		temp.push({
			// Data in the form [{x:x1,y:y1,err:err1},...{x:xn,y:yn,err:errn}]
			data: s1,
			color: '#D60303',
			points: { show: true, radius: 3, errors: 0.3 },
{'fraction_non_alphanumeric': 0.22776792500633392, 'fraction_numerical': 0.027869267798327844, 'mean_word_length': 3.0285714285714285, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '5458768', 'n_tokens_mistral': 1862, 'n_tokens_neox': 1555, 'n_words': 377}