Skip to content

Commit

Permalink
Merge branch 'master' into 7179-ww-input
Browse files Browse the repository at this point in the history
  • Loading branch information
moellep committed Oct 18, 2024
2 parents e8e7e32 + 0210c18 commit e201175
Show file tree
Hide file tree
Showing 26 changed files with 279 additions and 423 deletions.
6 changes: 5 additions & 1 deletion sirepo/package_data/static/css/sirepo.css
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@
font-size: 14px;
text-anchor: middle;
}
.sr-plot text.z-axis-footer {
font-size: 14px;
text-anchor: end;
}
.sr-plot .katex {
font-size: 18px;
}
Expand Down Expand Up @@ -596,10 +600,10 @@
div.sr-plot .z-axis-label,
div.sr-plot .y-axis-label,
div.sr-plot .x-axis-label,
div.sr-plot .z-axis-footer,
.y-axis-label
{
font-size: 12px;
text-anchor: middle;
}
div.sr-plot .main-title {
font-size: 12px;
Expand Down
9 changes: 5 additions & 4 deletions sirepo/package_data/static/html/plot3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<div><svg class="sr-plot" style="position: relative" ng-attr-width="{{ margin.left + noLabelPad + canvasSize.width + rightPanelWidth }}" ng-attr-height="{{ margin.top + margin.bottom + canvasSize.height + bottomPanelHeight }}">
<g ng-attr-transform="translate({{ margin.left + noLabelPad }},{{ margin.top }})">
<text class="focus-hint" text-anchor="start" x="0" y="-10" dy=".35em"></text>
<text class="focus-text" text-anchor="end" ng-attr-x="{{ canvasSize.width - focusTextCloseSpace }}" y="-10" dy=".35em"></text>
<text class="focus-text" text-anchor="start" ng-attr-x="0" y="-10" dy=".35em"></text>
<text class="focus-text-close close" text-anchor="end" ng-attr-x="{{ canvasSize.width }}" y="-10" dy=".35em">&times;</text>
<text class="main-title" ng-attr-x="{{ titleCenter }}" ng-attr-y="{{ -margin.top / 2 }}"></text>
<text class="sub-title" ng-attr-x="{{ subTitleCenter }}" y="0" dy="-.5em"></text>
<text class="main-title" ng-attr-x="{{ (canvasSize.width + rightPanelWidth - margin.right) / 2 }}" ng-attr-y="{{ -margin.top / 2 }}"></text>
<text class="sub-title" ng-attr-x="{{ (canvasSize.width + rightPanelWidth - margin.right) / 2 }}" y="0" dy="-.5em"></text>
<g class="y axis grid"></g>
<defs>
<clippath id="{{ modelName }}-bottomclip">
Expand Down Expand Up @@ -59,7 +59,8 @@
<text class="y-axis-label" ng-attr-x="{{ - canvasSize.height / 2 }}" ng-attr-y="{{ rightPanelWidth - 15 }}" transform="rotate(270)"></text>
<text class="y-base" text-anchor="end" ng-attr-x="{{ rightPanelWidth - 2 * pad }}" ng-attr-y="-14"></text>
</g>
<text class="z-axis-label" ng-attr-x="{{ canvasSize.width + rightPanelWidth / 2 }}" ng-attr-y="{{ canvasSize.height + margin.top + 10 }}"></text>
<text class="z-axis-label" ng-attr-x="{{ canvasSize.width + rightPanelWidth / 2 }}" ng-attr-y="{{ canvasSize.height + 48 }}"></text>
<text class="z-axis-footer" ng-attr-x="{{ canvasSize.width + rightPanelWidth }}" ng-attr-y="{{ canvasSize.height + pad + bottomPanelHeight + 18 }}"></text>
<rect class="mouse-rect-xy mouse-zoom" ng-attr-width="{{ canvasSize.width }}" ng-attr-height="{{ canvasSize.height }}" style="pointer-events: all; fill: none;"></rect>
<rect class="mouse-rect-y mouse-zoom" data-interactive-overlay="" data-report-id="reportId" data-focus-points="[focusPointY]" ng-attr-x="{{ canvasSize.width }}" ng-attr-width="{{ rightPanelWidth }}" ng-attr-height="{{ canvasSize.height }}" style="pointer-events: all; fill: none;"></rect>
<rect class="mouse-rect-x mouse-zoom" data-interactive-overlay="" data-report-id="reportId" data-focus-points="[focusPointX]" ng-attr-y="{{ canvasSize.height }}" ng-attr-width="{{ canvasSize.width }}" ng-attr-height="{{ bottomPanelHeight }}" style="pointer-events: all; fill: none;"></rect>
Expand Down
2 changes: 1 addition & 1 deletion sirepo/package_data/static/html/srw-source.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div data-ng-if="source.srwService.isIdealizedUndulator()" class="sr-panel-item">
<div data-report-panel="2d" data-request-priority="3" data-model-name="fluxReport" data-panel-title="{{ source.srwService.getFluxTitle('fluxReport') }}"></div>
</div>
<div data-ng-if="source.srwService.isTabulatedUndulator()" class="sr-panel-item">
<div data-ng-if="source.srwService.isTabulatedUndulator() || source.srwService.isArbitraryMagField()" class="sr-panel-item">
<div data-report-panel="2d" data-request-priority="3" data-model-name="fluxAnimation" data-panel-title="{{ source.srwService.getFluxTitle('fluxAnimation') }}"><div data-simulation-status-panel="fluxAnimation"></div></div>
</div>
<div data-ng-if="source.srwService.isElectronBeam()" class="sr-panel-item">
Expand Down
14 changes: 7 additions & 7 deletions sirepo/package_data/static/js/sirepo-beamline.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,31 @@ SIREPO.app.factory('beamlineService', function(appState, panelState, validationS
for (var i = 0; i < savedModelValues.beamline.length; i += 1) {
if (savedModelValues.beamline[i].id == itemId) {
return 'Intensity ' + savedModelValues.beamline[i].title + ', '
+ savedModelValues.beamline[i].position + 'm';
+ savedModelValues.beamline[i].position + ' m';
}
}
}
var model = savedModelValues[modelName];
var distance = '';
if (model && 'distanceFromSource' in model) {
distance = ', ' + model.distanceFromSource + 'm';
distance = ', ' + model.distanceFromSource + ' m';
}
else if (appState.isAnimationModelName(modelName)) {
if (savedModelValues.beamline.length) {
var item = model.watchpointId ? self.getItemById(model.watchpointId) : savedModelValues.beamline[savedModelValues.beamline.length - 1];
distance = ', ' + item.position + 'm';
distance = ', ' + item.position + ' m';
}
}
else if (modelName == 'initialIntensityReport' || (modelName == 'watchpointReport' && itemId == 0)) {
if (savedModelValues.beamline && savedModelValues.beamline.length) {
distance = ', ' + savedModelValues.beamline[0].position + 'm';
distance = ', ' + savedModelValues.beamline[0].position + ' m';
}
else {
if ('models' in appState && 'simulation' in appState.models && 'distanceFromSource' in appState.models.simulation) {
distance = ', ' + appState.models.simulation.distanceFromSource + 'm';
distance = ', ' + appState.models.simulation.distanceFromSource + ' m';
}
else {
distance = ', ' + DEFAULT_INTENSITY_DISTANCE + 'm';
distance = ', ' + DEFAULT_INTENSITY_DISTANCE + ' m';
}
}
modelName = 'initialIntensityReport';
Expand Down Expand Up @@ -522,7 +522,7 @@ SIREPO.app.directive('beamlineItem', function(beamlineService, $timeout, $rootSc
setWatchpointActive: '&',
},
template: `
<span class="srw-beamline-badge badge">{{ item.position ? item.position + 'm' : (item.position === 0 ? '0m' : '⚠ ') }}</span>
<span class="srw-beamline-badge badge">{{ item.position ? item.position + ' m' : (item.position === 0 ? '0 m' : '⚠ ') }}</span>
<span data-ng-if="showItemButtons()" data-ng-click="beamlineService.removeElement(item)" class="srw-beamline-close-icon srw-beamline-toggle glyphicon glyphicon-remove-circle" title="Delete Element"></span>
<span data-ng-if="showItemButtons()" data-ng-click="beamlineService.copyElement(item)" class="srw-beamline-copy-icon srw-beamline-toggle glyphicon glyphicon-duplicate" title="Copy Element"></span>
<span data-ng-if="showItemButtons() && showActiveIcon(item)" data-ng-click="setWatchpointActive(item)" class="srw-beamline-report-icon srw-beamline-toggle glyphicon glyphicon-ok" data-ng-class="{'srw-beamline-report-icon-active': isWatchpointActive(item)}" title="{{ activeWatchpointTitle }}"></span>
Expand Down
61 changes: 13 additions & 48 deletions sirepo/package_data/static/js/sirepo-plotting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2622,11 +2622,8 @@ SIREPO.app.directive('plot3d', function(appState, focusPointService, layoutServi
width: 0,
height: 0,
};
$scope.titleCenter = 0;
$scope.subTitleCenter = 0;
$scope.rightPanelWidth = $scope.bottomPanelHeight = 55;
$scope.dataCleared = true;
$scope.focusTextCloseSpace = 18;
$scope.focusPoints = [];

var canvas, ctx, fullDomain, heatmap, lineOuts, prevDomain, scaleFunction, xyZoom;
Expand Down Expand Up @@ -2669,30 +2666,6 @@ SIREPO.app.directive('plot3d', function(appState, focusPointService, layoutServi
}
}

function centerNode(node, defaultCtr) {
// center the node over the image; if node is too large, center it over whole plot
if (node && ! (node.style && node.style.display == 'none')) {
var width = node.getBBox().width;
var ctr = $scope.canvasSize.width / 2;
if (width > $scope.canvasSize.width) {
ctr += $scope.rightPanelWidth / 2;
}
return ctr;
}
if (defaultCtr) {
return defaultCtr;
}
return 0;
}

function centerSubTitle() {
$scope.subTitleCenter = centerNode(select('text.sub-title').node(), $scope.subTitleCenter);
}

function centerTitle() {
$scope.titleCenter = centerNode(select('text.main-title').node(), $scope.titleCenter);
}

function clipDomain(scale, axisName) {
var domain = fullDomain[axisName == 'x' ? 0 : 1];
var domainSize = domain[1] - domain[0];
Expand Down Expand Up @@ -2792,6 +2765,12 @@ SIREPO.app.directive('plot3d', function(appState, focusPointService, layoutServi
return pixels < MIN_PIXEL_RESOLUTION;
}

function layoutFocusPointText() {
select('.focus-text-close').node().setAttribute(
'x', select('.focus-text').node().getComputedTextLength() + 16,
);
}

function refresh() {
if (! fullDomain) {
return;
Expand Down Expand Up @@ -2865,8 +2844,6 @@ SIREPO.app.directive('plot3d', function(appState, focusPointService, layoutServi
axes.x.scale.domain(),
axes.y.scale.domain(),
];
centerTitle();
centerSubTitle();
if (appState.deepEquals(fullDomain, prevDomain)) {
adjustZoomToCenter(axes.x.scale);
adjustZoomToCenter(axes.y.scale);
Expand All @@ -2879,24 +2856,6 @@ SIREPO.app.directive('plot3d', function(appState, focusPointService, layoutServi
axes.y.zoom = axes.y.createZoom($scope);
}

function resizefocusPointText() {
var maxSize = 14;
var minSize = 9;
var focusText = select('.focus-text');
var fs = focusText.style('font-size');

var currentFontSize = utilities.fontSizeFromString(fs);
var newFontSize = currentFontSize;

var textWidth = focusText.node().getComputedTextLength();
var pct = ($scope.canvasSize.width - $scope.focusTextCloseSpace) / textWidth;

newFontSize *= pct;
newFontSize = Math.max(minSize, newFontSize);
newFontSize = Math.min(maxSize, newFontSize);
focusText.style('font-size', newFontSize + 'px');
}

function restoreDomain(scale, oldValue) {
var d = scale.domain();
d[0] = oldValue[0];
Expand Down Expand Up @@ -3022,6 +2981,9 @@ SIREPO.app.directive('plot3d', function(appState, focusPointService, layoutServi
axes.x.updateLabel(json.x_label, select);
axes.y.updateLabel(json.y_label, select);
select('.z-axis-label').text(json.z_label);
if (json.z_footer) {
select('.z-axis-footer').text(json.z_footer);
}
var zmin = plotting.min2d(heatmap);
var zmax = plotting.max2d(heatmap);
if ('z_range' in json) { zmin = json.z_range[0]; zmax = json.z_range[1]; }
Expand Down Expand Up @@ -3068,7 +3030,7 @@ SIREPO.app.directive('plot3d', function(appState, focusPointService, layoutServi
}
select('.sub-title').style('display', 'none');
focusText.text(xyfText);
resizefocusPointText();
layoutFocusPointText();
};

$scope.showPlotSize = () => {
Expand Down Expand Up @@ -3988,6 +3950,9 @@ SIREPO.app.directive('parameterPlot', function(appState, focusPointService, layo
const limit = appState.applicationState()[$scope.modelName][`${v}Limit`];
if (limit && ydom[i][1] > limit) {
ydom[i][1] = limit;
if (ydom[i][0] > ydom[i][1]) {
ydom[i][0] = ydom[i][1];
}
}
}
});
Expand Down
23 changes: 18 additions & 5 deletions sirepo/package_data/static/js/srw.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ SIREPO.app.controller('BeamlineController', function (activeSection, appState, b
var d = parseFloat(beamline[i + 1].position) - parseFloat(beamline[i].position);
if (d > 0) {
self.propagations.push({
title: 'Drift ' + srwService.formatFloat4(d) + 'm',
title: 'Drift ' + srwService.formatFloat4(d) + ' m',
params: p[1],
defaultparams: [p[1][12], p[1][13], p[1][14], p[1][15], p[1][16] ],
});
Expand Down Expand Up @@ -1331,12 +1331,19 @@ SIREPO.viewLogic('exportRsOptView', function(appState, panelState, persistentSim

SIREPO.viewLogic('fluxAnimationView', function(appState, panelState, srwService, $scope) {

// sm_meth fluxAnimation.method "Flux Computation Method" 1: auto-undulator 2: auto-wiggler -1: use approximate
// sm_mag fluxAnimation.magneticField "Magnetic Field Treatment" 1: approximate 2: accurate (tabulated)

function updateFluxAnimation() {
// ["-1", "Use Approximate Method"]
var approxMethodKey = '-1';
var isApproximateMethod = appState.models.fluxAnimation.method == approxMethodKey;
panelState.enableField('fluxAnimation', 'magneticField', srwService.isTabulatedUndulatorWithMagenticFile());
if (srwService.isTabulatedUndulatorWithMagenticFile()) {
if (srwService.isArbitraryMagField()) {
appState.models.fluxAnimation.magneticField = '2';
}
panelState.enableField(
'fluxAnimation', 'magneticField',
srwService.isTabulatedUndulatorWithMagenticFile());
if (srwService.isTabulatedUndulatorWithMagenticFile() || srwService.isArbitraryMagField()) {
if (appState.models.fluxAnimation.magneticField == '2' && isApproximateMethod) {
appState.models.fluxAnimation.method = '1';
}
Expand All @@ -1357,6 +1364,9 @@ SIREPO.viewLogic('fluxAnimationView', function(appState, panelState, srwService,
}

$scope.whenSelected = updateFluxAnimation;
$scope.watchFields = [
['fluxAnimation.magneticField'], updateFluxAnimation,
];
});

SIREPO.viewLogic('gaussianBeamView', function(appState, panelState, srwService, $scope) {
Expand Down Expand Up @@ -2135,6 +2145,9 @@ SIREPO.app.directive('modelSelectionList', function(appState, srwService) {
}

function updateListFromModel(model) {
if (! $scope.userModelList) {
return;
}
$scope.userModelList.some(function(m) {
if (m.id == model.id) {
$.extend(m, appState.clone(model));
Expand Down Expand Up @@ -3037,7 +3050,7 @@ SIREPO.app.directive('beamline3d', function(appState, plotting, plotToPNG, srwSe
if (item.name) {
var res = item.name;
if (options().showPosition == '1' && item.position) {
res += ', ' + srwService.formatFloat(item.position, 1) + 'm';
res += ', ' + srwService.formatFloat(item.position, 1) + ' m';
}
return res;
}
Expand Down
15 changes: 0 additions & 15 deletions sirepo/package_data/static/json/impactt-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,31 +105,19 @@
["Ez", "Ez"],
["loadbalance_max_n_particle", "loadbalance_max_n_particle"],
["loadbalance_min_n_particle", "loadbalance_min_n_particle"],
["max_amplitude_px", "max_amplitude_px"],
["max_amplitude_py", "max_amplitude_py"],
["max_amplitude_pz", "max_amplitude_pz"],
["max_amplitude_x", "max_amplitude_x"],
["max_amplitude_y", "max_amplitude_y"],
["max_amplitude_z", "max_amplitude_z"],
["max_r", "max_r"],
["mean_beta", "mean_beta"],
["mean_gamma", "mean_gamma"],
["mean_kinetic_energy", "mean_kinetic_energy"],
["mean_px", "mean_px"],
["mean_py", "mean_py"],
["mean_pz", "mean_pz"],
["mean_x", "mean_x"],
["mean_y", "mean_y"],
["mean_z", "mean_z"],
["moment3_px", "moment3_px"],
["moment3_py", "moment3_py"],
["moment3_pz", "moment3_pz"],
["moment3_x", "moment3_x"],
["moment3_y", "moment3_y"],
["moment3_z", "moment3_z"],
["moment4_px", "moment4_px"],
["moment4_py", "moment4_py"],
["moment4_pz", "moment4_pz"],
["moment4_x", "moment4_x"],
["moment4_y", "moment4_y"],
["moment4_z", "moment4_z"],
Expand All @@ -138,9 +126,6 @@
["norm_emit_y", "norm_emit_y"],
["norm_emit_z", "norm_emit_z"],
["sigma_gamma", "sigma_gamma"],
["sigma_px", "sigma_px"],
["sigma_py", "sigma_py"],
["sigma_pz", "sigma_pz"],
["sigma_x", "sigma_x"],
["sigma_y", "sigma_y"],
["sigma_z", "sigma_z"],
Expand Down
8 changes: 7 additions & 1 deletion sirepo/package_data/static/json/srw-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,13 @@
"plotScale": ["Plot Scale", "PlotScale", "linear"],
"numberOfMacroElectronsAvg": ["Number of macro-electrons to average on each node", "Integer", 5],
"savingPeriodicity": ["Saving periodicity (in terms of macro-electrons)", "Integer", 5],
"notes": ["Notes", "Text", ""]
"notes": ["Notes", "Text", ""],
"jobRunMode": ["Execution Mode", "JobRunMode", "parallel"],
"sbatchCores": ["Cores", "Integer", 128],
"tasksPerNode": ["Processes per node", "Integer", 128],
"sbatchHours": ["Hours", "Float", 0.4],
"sbatchQueue": ["Queue", "NERSCQueue", "debug"],
"sbatchProject": ["Project", "OptionalString", ""]
},
"fluxReport": {
"distanceFromSource": ["Distance From Source [m]", "Float", 20],
Expand Down
Loading

0 comments on commit e201175

Please sign in to comment.