<commit_before><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Kalman Filter Analysis</title>
    <style>

        body {
            font: 10px sans-serif;
        }

        .axis path,
        .axis line {
            fill: none;
            stroke: #000;
            shape-rendering: crispEdges;
        }

        .x.axis path {
            display: none;
        }

        .line {
            fill: none;
            stroke: steelblue;
            stroke-width: 1.5px;
        }

        .area {
            fill-opacity: 0.3;
        }

    </style>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>

    var DEG = 57.295780,
            actual, kalman, variance,
            remaining = 3;

    function makeChart(v) {
        var margin = {top: 5, right: 35, bottom: 20, left: 35},
                width = 450 - margin.left - margin.right,
                height = 250 - margin.top - margin.bottom;

        var color = d3.scale.category20()
                .domain(d3.keys(actual[0]).filter(function (key) {
                    return key !== "T";
                }));

        var data = actual.map(function(d, i) {
            if (["Phi", "Theta", "Psi"].indexOf(v) > -1) {
                k = DEG;
            } else {
                k = 1;
            }
            return {T: +d.T,
                actual: k*d[v],
                kalman: k*kalman[i][v],
                lower: k*kalman[i][v]-k*variance[i][v],
                upper: k*kalman[i][v]+k*variance[i][v]
            };
        });

        var x = d3.scale.linear()
                .range([0, width])
                .domain(d3.extent(data, function (d) {
                    return +d.T;
                }));

        var y = d3.scale.linear()
                .range([height, 0])
                .domain([
                    d3.min(data.slice(5, data.length-1), function(v) {
                            return d3.min([v.lower, v.actual]);
                        }),
                    d3.max(data.slice(5, data.length-1), function (v) {
                            return d3.max([v.upper, v.actual]);
                    })
                ]);

        var xAxis = d3.svg.axis()
                .scale(x)
                .orient("bottom");

        var yAxis = d3.svg.axis()
                .scale(y)
                .orient("left");

        function line(z) {
            return d3.svg.line()
                    .interpolate("basis")
                    .x(function (d) { return x(d.T); })
                    .y(function (d) { return y(d[z]); });
        }

        var area = d3.svg.area()
                .interpolate("basis")
                .x(function(d) { return x(d.T); })
                .y0(function(d) { return y(d.lower); })
                .y1(function(d) { return y(d.upper); });

        var chart = d3.select("body").append("svg")
                .attr("width", width + margin.left + margin.right)
                .attr("height", height + margin.top + margin.bottom)
                .append("g")
                .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

        chart.append("g")
                .attr("class", "x axis")
                .attr("transform", "translate(0," + height + ")")
                .call(xAxis);

        chart.append("g")
                .attr("class", "y axis")
                .call(yAxis)
                .append("text")
                .attr("transform", "rotate(-90)")
                .attr("y", 6)
                .attr("dy", ".71em")
                .style("text-anchor", "end");

        var lines = chart.selectAll(".city")
                .data([data])
                .enter().append("g")
                .attr("class", "city");

        lines.append("path")
                .attr("class", "area")
                .attr("d", area)
                .style("fill", color(v));

//        lines.append("path")
//                .attr("class", "line")
//                .attr("d", line("upper"))
//                .style("stroke", color(v));
//
//        lines.append("path")
//                .attr("class", "line")
//                .attr("d", line("lower"))
//                .style("stroke", color(v));

        lines.append("path")
                .attr("class", "line")
                .attr("d", line("kalman"))
                .style("stroke", color(v));

        lines.append("path")
                .attr("class", "line")
                .attr("d", line("actual"))
                .style("stroke", "Black");

        chart.append("text")
                .attr("x", width/2)
                .attr("y", margin.top)
                .attr("text-anchor", "middle")
                .attr("alignment-baseline", "hanging")
                .style("font-size", "12px")
                .text(v);
    }

    d3.csv("k_state.csv", function (error, data) {
        if (error) throw error;

        actual = data;
        if (!--remaining) makeAll();
    });

    d3.csv("k_kalman.csv", function (error, data) {
        if (error) throw error;

        kalman = data;
        if (!--remaining) makeAll();
    });
    d3.csv("k_var.csv", function (error, data) {
        if (error) throw error;

        variance = data;
        if (!--remaining) makeAll();
    });

    function makeAll() {
        makeChart("Ux");
        makeChart("Uy");
        makeChart("Uz");
        makeChart("Phi");
        makeChart("Theta");
        makeChart("Psi");
        makeChart("Vx");
        makeChart("Vy");
        makeChart("Vz");
        makeChart("Mx");
        makeChart("My");
        makeChart("Mz");
    }

</script>
</body>
</html><commit_msg>Add predict line to sim plots, read in control and meas<commit_after><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Kalman Filter Analysis</title>
    <style>

        body {
            font: 10px sans-serif;
        }

        .axis path,
        .axis line {
            fill: none;
            stroke: #000;
            shape-rendering: crispEdges;
        }

        .x.axis path {
            display: none;
        }

        .line {
            fill: none;
            stroke: steelblue;
            stroke-width: 1.5px;
        }

        .area {
            fill-opacity: 0.3;
        }

    </style>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>

    var DEG = 57.295780,
            actual, predict, kalman, variance, control, measure,
            remaining = 6;

    function makeChart(v) {
        var margin = {top: 5, right: 35, bottom: 20, left: 35},
                width = 450 - margin.left - margin.right,
                height = 250 - margin.top - margin.bottom;

        var color = d3.scale.category20()
                .domain(d3.keys(actual[0]).filter(function (key) {
                    return key !== "T";
                }));

        var data = actual.map(function(d, i) {
            if (["Phi", "Theta", "Psi"].indexOf(v) > -1) {
                k = DEG;
            } else {
                k = 1;
            }
            return {T: +d.T,
                actual: k*d[v],
                predict: k*predict[i][v],
                kalman: k*kalman[i][v],
                lower: k*kalman[i][v]-k*variance[i][v],
                upper: k*kalman[i][v]+k*variance[i][v]
            };
        });

        var x = d3.scale.linear()
                .range([0, width])
                .domain(d3.extent(data, function (d) {
                    return +d.T;
                }));

        var y = d3.scale.linear()
                .range([height, 0])
                .domain([
                    d3.min(data.slice(5, data.length-1), function(v) {
                            return d3.min([v.lower, v.actual]);
                        }),
                    d3.max(data.slice(5, data.length-1), function (v) {
                            return d3.max([v.upper, v.actual]);
                    })
                ]);

        var xAxis = d3.svg.axis()
                .scale(x)
                .orient("bottom");

        var yAxis = d3.svg.axis()
                .scale(y)
                .orient("left");

        function line(z) {
            return d3.svg.line()
                    .interpolate("basis")
                    .x(function (d) { return x(d.T); })
                    .y(function (d) { return y(d[z]); });
        }

        var area = d3.svg.area()
                .interpolate("basis")
                .x(function(d) { return x(d.T); })
                .y0(function(d) { return y(d.lower); })
                .y1(function(d) { return y(d.upper); });

        var chart = d3.select("body").append("svg")
                .attr("width", width + margin.left + margin.right)
                .attr("height", height + margin.top + margin.bottom)
                .append("g")
                .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

        chart.append("g")
                .attr("class", "x axis")
                .attr("transform", "translate(0," + height + ")")
                .call(xAxis);

        chart.append("g")
                .attr("class", "y axis")
                .call(yAxis)
                .append("text")
                .attr("transform", "rotate(-90)")
                .attr("y", 6)
                .attr("dy", ".71em")
                .style("text-anchor", "end");

        var lines = chart.selectAll(".lines")
                .data([data])
                .enter().append("g")
                .attr("class", "lines");

        lines.append("path")
                .attr("class", "area")
                .attr("d", area)
                .style("fill", color(v));

//        lines.append("path")
//                .attr("class", "line")
//                .attr("d", line("upper"))
//                .style("stroke", color(v));
//
//        lines.append("path")
//                .attr("class", "line")
//                .attr("d", line("lower"))
//                .style("stroke", color(v));

        lines.append("path")
                .attr("class", "line")
                .attr("d", line("actual"))
                .style("stroke", "Black");

        lines.append("path")
                .attr("class", "line")
                .attr("d", line("predict"))
                .style("stroke", color(v))
                .style("stroke-dasharray", "5,10");

        lines.append("path")
                .attr("class", "line")
                .attr("d", line("kalman"))
                .style("stroke", color(v));

        chart.append("text")
                .attr("x", width/2)
                .attr("y", margin.top)
                .attr("text-anchor", "middle")
                .attr("alignment-baseline", "hanging")
                .style("font-size", "12px")
                .text(v);
    }

    d3.csv("k_state.csv", function (error, data) {
        if (error) throw error;

        actual = data;
        if (!--remaining) makeAll();
    });

    d3.csv("k_predict.csv", function (error, data) {
        if (error) throw error;

        predict = data;
        if (!--remaining) makeAll();
    });

    d3.csv("k_kalman.csv", function (error, data) {
        if (error) throw error;

        kalman = data;
        if (!--remaining) makeAll();
    });

    d3.csv("k_var.csv", function (error, data) {
        if (error) throw error;

        variance = data;
        if (!--remaining) makeAll();
    });

    d3.csv("k_control.csv", function (error, data) {
        if (error) throw error;

        control = data;
        if (!--remaining) makeAll();
    });

    d3.csv("k_meas.csv", function (error, data) {
        if (error) throw error;

        measure = data;
        if (!--remaining) makeAll();
    });

    function makeAll() {
        makeChart("Ux");
        makeChart("Uy");
        makeChart("Uz");
        makeChart("Phi");
        makeChart("Theta");
        makeChart("Psi");
        makeChart("Vx");
        makeChart("Vy");
        makeChart("Vz");
        makeChart("Mx");
        makeChart("My");
        makeChart("Mz");
    }

</script>
</body>
</html>
{'fraction_non_alphanumeric': 0.17352770645241447, 'fraction_numerical': 0.012755735939700157, 'mean_word_length': 1.2479985105194564, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 37, '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': '1946849', 'n_tokens_mistral': 3825, 'n_tokens_neox': 3526, 'n_words': 698}