<commit_before>'use strict';

var srlog = SIREPO.srlog;
var srdbg = SIREPO.srdbg;

SIREPO.appReportTypes = [
    '<div data-ng-switch-when="lattice" data-lattice="" class="sr-plot" data-model-name="{{ modelKey }}"></div>',
].join('');
SIREPO.appHomeTab = 'lattice';
SIREPO.SINGLE_FRAME_ANIMATION = ['beamEvolutionAnimation'];
SIREPO.appFieldEditors = [
    '<div data-ng-switch-when="LatticeBeamlineList" data-ng-class="fieldClass">',
      '<div data-lattice-beamline-list="" data-model="model" data-field="field"></div>',
    '</div>',
    '<div data-ng-switch-when="TurnCount" data-ng-class="fieldClass">',
      '<div data-turn-count-field="" field="field" data-model="model"></div>',
    '</div>',
].join('');
SIREPO.appImportText = 'Import a MAD-X Lattice';
SIREPO.FILE_UPLOAD_TYPE = {
    'bunch-particleFile': '.h5,.hdf5',
};
SIREPO.app.config(function() {
    if (SIREPO.IS_LOGGED_OUT) {
        return;
    }
    SIREPO.addRoutes(SIREPO.APP_SCHEMA.localRoutes);
});

SIREPO.app.controller('LatticeController', function(latticeService) {
    var self = this;
    self.latticeService = latticeService;

    self.advancedNames = ['DIPEDGE', 'ECOLLIMATOR', 'HKICKER', 'HMONITOR', 'MARKER', 'MULTIPOLE', 'NLLENS', 'RCOLLIMATOR', 'SEXTUPOLE', 'SOLENOID', 'SROTATION', 'VKICKER', 'VMONITOR'];

    self.basicNames = ['DRIFT', 'MONITOR', 'KICKER', 'QUADRUPOLE', 'RFCAVITY', 'SBEND'];

    self.elementColor = {
        QUADRUPOLE: 'red',
        SEXTUPOLE: 'lightgreen',
        VKICKER: 'blue',
    };

    self.elementPic = {
        aperture: ['ECOLLIMATOR', 'RCOLLIMATOR'],
        bend: ['HKICKER', 'KICKER', 'MULTIPOLE', 'SBEND'],
        drift: ['DRIFT'],
        magnet: ['QUADRUPOLE', 'SEXTUPOLE', 'VKICKER'],
        rf: ['RFCAVITY'],
        solenoid: ['SOLENOID'],
        watch: ['HMONITOR', 'MARKER', 'MONITOR', 'VMONITOR'],
        zeroLength: ['DIPEDGE', 'NLLENS', 'SROTATION'],
    };

    self.titleForName = function(name) {
        return SIREPO.APP_SCHEMA.view[name].description;
    };
});

SIREPO.app.controller('SynergiaSourceController', function (appState, panelState, requestSender, $scope) {
    var self = this;

    function calculateBunchParameters() {
        requestSender.getApplicationData(
            {
                method: 'calculate_bunch_parameters',
                bunch: appState.clone(appState.models.bunch),
            },
            function(data) {
                if (data.bunch && appState.isLoaded()) {
                    appState.models.bunch = data.bunch;
                }
            });
    }

    function processBeamDefinition() {
        processBunchFields();<commit_msg>fix #1230 MULTIPOLE is a zero-length element<commit_after>'use strict';

var srlog = SIREPO.srlog;
var srdbg = SIREPO.srdbg;

SIREPO.appReportTypes = [
    '<div data-ng-switch-when="lattice" data-lattice="" class="sr-plot" data-model-name="{{ modelKey }}"></div>',
].join('');
SIREPO.appHomeTab = 'lattice';
SIREPO.SINGLE_FRAME_ANIMATION = ['beamEvolutionAnimation'];
SIREPO.appFieldEditors = [
    '<div data-ng-switch-when="LatticeBeamlineList" data-ng-class="fieldClass">',
      '<div data-lattice-beamline-list="" data-model="model" data-field="field"></div>',
    '</div>',
    '<div data-ng-switch-when="TurnCount" data-ng-class="fieldClass">',
      '<div data-turn-count-field="" field="field" data-model="model"></div>',
    '</div>',
].join('');
SIREPO.appImportText = 'Import a MAD-X Lattice';
SIREPO.FILE_UPLOAD_TYPE = {
    'bunch-particleFile': '.h5,.hdf5',
};
SIREPO.app.config(function() {
    if (SIREPO.IS_LOGGED_OUT) {
        return;
    }
    SIREPO.addRoutes(SIREPO.APP_SCHEMA.localRoutes);
});

SIREPO.app.controller('LatticeController', function(latticeService) {
    var self = this;
    self.latticeService = latticeService;

    self.advancedNames = ['DIPEDGE', 'ECOLLIMATOR', 'HKICKER', 'HMONITOR', 'MARKER', 'MULTIPOLE', 'NLLENS', 'RCOLLIMATOR', 'SEXTUPOLE', 'SOLENOID', 'SROTATION', 'VKICKER', 'VMONITOR'];

    self.basicNames = ['DRIFT', 'MONITOR', 'KICKER', 'QUADRUPOLE', 'RFCAVITY', 'SBEND'];

    self.elementColor = {
        QUADRUPOLE: 'red',
        SEXTUPOLE: 'lightgreen',
        VKICKER: 'blue',
    };

    self.elementPic = {
        aperture: ['ECOLLIMATOR', 'RCOLLIMATOR'],
        bend: ['HKICKER', 'KICKER', 'SBEND'],
        drift: ['DRIFT'],
        magnet: ['QUADRUPOLE', 'SEXTUPOLE', 'VKICKER'],
        rf: ['RFCAVITY'],
        solenoid: ['SOLENOID'],
        watch: ['HMONITOR', 'MARKER', 'MONITOR', 'VMONITOR'],
        zeroLength: ['DIPEDGE', 'MULTIPOLE', 'NLLENS', 'SROTATION'],
    };

    self.titleForName = function(name) {
        return SIREPO.APP_SCHEMA.view[name].description;
    };
});

SIREPO.app.controller('SynergiaSourceController', function (appState, panelState, requestSender, $scope) {
    var self = this;

    function calculateBunchParameters() {
        requestSender.getApplicationData(
            {
                method: 'calculate_bunch_parameters',
                bunch: appState.clone(appState.models.bunch),
            },
            function(data) {
                if (data.bunch && appState.isLoaded()) {
                    appState.models.bunch = data.bunch;
                }
            });
    }

    function processBeamDefinition() {
        processBunchFields();
{'fraction_non_alphanumeric': 0.175372430699604, 'fraction_numerical': 0.0015085800490288515, 'mean_word_length': 3.202852614896989, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '2545793', 'n_tokens_mistral': 1915, 'n_tokens_neox': 1884, 'n_words': 293}