<commit_before>define(function(require) {

    'use strict';

    var _ = require('underscore');

    var PhysicsUtil = require('common/quantum/models/physics-util');

    var PEffectSimulation = require('models/simulation');

    var GraphView = require('views/graph');

    var FREQUENCY_MULTIPLIER = 1E-15;

    /**
     * 
     */
    var EnergyVsFrequencyGraphView = GraphView.extend({

        initialize: function(options) {
            var xStart = 0;
            var xEnd = PhysicsUtil.wavelengthToFrequency(PEffectSimulation.MIN_WAVELENGTH) * FREQUENCY_MULTIPLIER;
            var xStep = (xEnd - xStart) / 4;

            options = _.extend({
                title: 'Electron Energy vs Light Frequency',
                x: {
                    start: xStart,
                    end:   xEnd,
                    step:  xStep,
                    label: 'Frequency (x10^15 Hz)',
                    showNumbers: true,
                    decimals: 2
                },
                y: {
                    start: 0,
                    end:   PhysicsUtil.wavelengthToEnergy(PEffectSimulation.MIN_WAVELENGTH),
                    step:  2,
                    label: 'Energy (eV)',
                    showNumbers: true
                },
                lineColor: '#2575BA'
            }, options);

            GraphView.prototype.initialize.apply(this, [options]);
        },

        /**
         * Updates the graph
         */
        update: function() {
            this.draw();
        }

    });


    return EnergyVsFrequencyGraphView;
});<commit_msg>Woot! The Electron Energy vs Light Frequency graph is working too.  So that's a wrap.  Now to implement the screenshot feature.<commit_after>define(function(require) {

    'use strict';

    var _ = require('underscore');

    var PhysicsUtil = require('common/quantum/models/physics-util');

    var PEffectSimulation = require('models/simulation');

    var GraphView = require('views/graph');

    var FREQUENCY_MULTIPLIER = 1E-15;

    /**
     * 
     */
    var EnergyVsFrequencyGraphView = GraphView.extend({

        initialize: function(options) {
            var xStart = 0;
            var xEnd = PhysicsUtil.wavelengthToFrequency(PEffectSimulation.MIN_WAVELENGTH) * FREQUENCY_MULTIPLIER;
            var xStep = (xEnd - xStart) / 4;

            options = _.extend({
                title: 'Electron Energy vs Light Frequency',
                x: {
                    start: xStart,
                    end:   xEnd,
                    step:  xStep,
                    label: 'Frequency (x10^15 Hz)',
                    showNumbers: true,
                    decimals: 2
                },
                y: {
                    start: 0,
                    end:   PhysicsUtil.wavelengthToEnergy(PEffectSimulation.MIN_WAVELENGTH),
                    step:  2,
                    label: 'Energy (eV)',
                    showNumbers: true
                },
                lineColor: '#2575BA'
            }, options);

            GraphView.prototype.initialize.apply(this, [options]);

            this.listenTo(this.simulation, 'voltage-changed', this.voltageChanged);
            this.listenTo(this.simulation.beam, 'change:wavelength', this.wavelengthChanged);
            this.listenTo(this.simulation.beam, 'change:photonsPerSecond', this.beamIntensityChanged);
            this.listenTo(this.simulation.target, 'change:targetMaterial', this.targetMaterialChanged);
        },

        /**
         * Updates the graph
         */
        update: function() {
            this.updateGraph();
        },

        updateGraph: function() {
            if (this.beamOn) {
                var wavelength = this.simulation.getWavelength();
                var frequency = PhysicsUtil.wavelengthToFrequency(wavelength) * FREQUENCY_MULTIPLIER;
                var workFunction = this.simulation.target.getMaterial().getWorkFunction();
                var energy = Math.max(0, PhysicsUtil.wavelengthToEnergy(wavelength) - workFunction);

                if ((this.lastFrequencyRecorded < this.kneeFrequency && frequency > this.kneeFrequency) ||
                    (this.lastFrequencyRecorded > this.kneeFrequency && frequency < this.kneeFrequency)
                ) {
                    this.points.push(this.createPoint(
                        this.kneeFrequency, 
                        0
                    ));
                }

                this.points.push(this.createPoint(
                    frequency, 
                    energy
                ));

                this.lastFrequencyRecorded = frequency;
            }

            this.draw();
        },

        determineKneeFrequency() {
            return PhysicsUtil.wavelengthToFrequency(PhysicsUtil.energyToWavelength(this.simulation.getWorkFunction()));
        },

        targetMaterialChanged: function() {
            this.kneeFrequency = this.determineKneeFrequency() * FREQUENCY_MULTIPLIER;
            this.clearPoints();
            this.updateGraph();
        },

        voltageChanged: function() {
            this.kneeFrequency = this.determineKneeFrequency() * FREQUENCY_MULTIPLIER;
            this.updateGraph();
        },

        wavelengthChanged: function() {
            this.updateGraph();
        },

        beamIntensityChanged: function() {
            if (this.simulation.beam.get('photonsPerSecond') === 0) {
                this.beamOn = false;
                this.clearPoints();
                this.updateGraph();
            }
            else {
                this.beamOn = true;
                this.updateGraph();
            }
        }

    });


    return EnergyVsFrequencyGraphView;
});
{'fraction_non_alphanumeric': 0.10042060988433228, 'fraction_numerical': 0.006133894146512443, 'mean_word_length': 1.5296985815602837, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4739348', 'n_tokens_mistral': 1634, 'n_tokens_neox': 1425, 'n_words': 265}