Skip to content

Commit

Permalink
fix #6144 and fix #6165 add telescope and splitter optical elements (#…
Browse files Browse the repository at this point in the history
…6168)

* fix #6144 fix #6165 silas beamsplitter, telescope element and new mirror icon

* hide crystal summary on reused crystals

* guard against null equation text
  • Loading branch information
moellep authored Jul 26, 2023
1 parent a338aa3 commit 40e3f83
Show file tree
Hide file tree
Showing 10 changed files with 200 additions and 12 deletions.
4 changes: 2 additions & 2 deletions sirepo/package_data/static/css/srw.css
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ img.srw-beamline-item-icon {
}

.srw-toolbar-button img.srw-beamline-item-icon {
width: 70px;
height: 55px;
width: 50px;
height: 35px;
}

.srw-propagation-button {
Expand Down
5 changes: 3 additions & 2 deletions sirepo/package_data/static/js/silas.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ SIREPO.app.controller('BeamlineController', function (appState, beamlineService,
self.beamlineService = beamlineService;
self.prepareToSave = () => {};
self.toolbarItemNames = [
['Optics', ['crystal', 'lens', 'mirror']],
['Optics', ['crystal', 'lens', 'mirror2', 'splitter', 'telescope']],
'watch',
];

Expand Down Expand Up @@ -358,6 +358,7 @@ SIREPO.beamlineItemLogic('crystalView', function(panelState, silasService, $scop
panelState.enableField(item.type, 'pump_wavelength', false);
panelState.showTab(item.type, 2, item.origin === 'new');
panelState.showTab(item.type, 3, item.origin === 'new');
panelState.showTab(item.type, 4, item.origin === 'new');
}

$scope.whenSelected = updateCrystalFields;
Expand Down Expand Up @@ -766,7 +767,7 @@ SIREPO.app.directive('equationText', function() {
`,
controller: function($scope) {
$scope.equation = () => {
return SIREPO.APP_SCHEMA.strings.pumpPulseProfileEquation[$scope.selectedPumpProfile];
return SIREPO.APP_SCHEMA.strings.pumpPulseProfileEquation[$scope.selectedPumpProfile] || '';
};
},
};
Expand Down
11 changes: 8 additions & 3 deletions sirepo/package_data/static/js/sirepo-beamline.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,9 @@ SIREPO.app.directive('beamlineIcon', function() {
<div data-ng-if="::isSVG">
<data-ng-include src="::iconUrl" data-onload="iconLoaded()"/>
</div>
<img class="srw-beamline-item-icon" data-ng-if="::! isSVG" data-ng-attr-src="{{ ::iconUrl }}"/>
<div data-ng-if="::! isSVG">
<img class="srw-beamline-item-icon" data-ng-attr-src="{{ ::iconUrl }}"/>
</div>
`,
controller: function($scope, $element) {
var adjustmentsByType = {
Expand All @@ -466,9 +468,12 @@ SIREPO.app.directive('beamlineIcon', function() {
lens: [5],
mask: [5, 0, 5],
mirror: [15, 5, 12],
mirror2: [15],
obstacle: [-15, 10, -2],
sample: [20, -10, 10],
sphericalMirror: [10, 10, 7],
splitter: [-10, 5, 0],
telescope: [5],
toroidalMirror: [15, 0, 7],
watch: [0, 15, 10],
zonePlate: [20, -10, -5],
Expand Down Expand Up @@ -722,11 +727,11 @@ SIREPO.app.directive('beamlineToolbar', function(appState) {
<div class="sr-toolbar-section" data-ng-repeat="section in ::sectionItems">
<div class="sr-toolbar-section-header"><span class="sr-toolbar-section-title">{{ ::section[0] }}</span></div>
<span data-ng-repeat="item in ::section[1]" class="srw-toolbar-button srw-beamline-image" data-ng-drag="true" data-ng-drag-data="item">
<span data-beamline-icon="" data-item="item"></span><br>{{ ::item.title }}
<span data-beamline-icon="" data-item="item"></span>{{ ::item.title }}
</span>
</div>
<span data-ng-repeat="item in ::standaloneItems" class="srw-toolbar-button srw-beamline-image" data-ng-drag="true" data-ng-drag-data="item">
<span data-beamline-icon="" data-item="item"></span><br>{{ ::item.title }}
<span data-beamline-icon="" data-item="item"></span>{{ ::item.title }}
</span>
</div>
</div>
Expand Down
42 changes: 39 additions & 3 deletions sirepo/package_data/static/json/silas-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"focalLength": ["Focal Length [m]", "Float", 2.0],
"title": ["Element Name", "String", "Lens"]
},
"mirror": {
"mirror2": {
"_super": ["_", "model", "beamElement"],
"title": ["Element Name", "String", "Mirror"]
},
Expand All @@ -208,6 +208,20 @@
"simulation": {
"distanceFromSource": ["", "Float", 0.0 , "", 0.0]
},
"splitter": {
"_super": ["_", "model", "beamElement"],
"title": ["Element Name", "String", "Splitter"],
"transmitted_fraction": ["Transmitted Fraction", "Float", 0.4]
},
"telescope": {
"_super": ["_", "model", "beamElement"],
"focal_length_1": ["Focal Length 1 [m]", "Float", -0.1],
"focal_length_2": ["Focal Length 2 [m]", "Float", 0.2],
"drift_length_1": ["Drift Length 1 [m]", "Float", 1.9],
"drift_length_2": ["Drift Length 2 [m]", "Float", 0.1],
"drift_length_3": ["Drift Length 3 [m]", "Float", 0.54],
"title": ["Element Name", "String", "Telescope"]
},
"watch": {
"_super": ["_", "model", "beamElement"],
"title": ["Element Name", "SafePath", "Watchpoint"]
Expand Down Expand Up @@ -306,8 +320,9 @@
"title": "Crystal 3D Mesh",
"advanced": []
},
"mirror": {
"title": "Ideal Mirror",
"mirror2": {
"title": "Two Mirrors",
"description": "The pulse is reflected off of two mirrors, resulting in a flip of the electric fields. Since 1D amplifier geometry is assumed, the mirrors' small, off-axis angles are ignored.",
"basic": [],
"advanced": [
"title",
Expand Down Expand Up @@ -386,6 +401,27 @@
"title": "Simulation Status",
"advanced": []
},
"splitter": {
"title": "Beam Splitter",
"basic": [],
"advanced": [
"title",
"position",
"transmitted_fraction"
]
},
"telescope": {
"title": "Telescope LCT",
"advanced": [
"title",
"position",
"focal_length_1",
"focal_length_2",
"drift_length_1",
"drift_length_2",
"drift_length_3"
]
},
"watch": {
"title": "Watchpoint",
"basic": [],
Expand Down
54 changes: 54 additions & 0 deletions sirepo/package_data/static/svg/mirror2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions sirepo/package_data/static/svg/splitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions sirepo/package_data/static/svg/telescope.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sirepo/package_data/template/silas/parameters.py.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pykern.pkcollections import PKDict
from rslaser.optics.crystal import Crystal
from rslaser.optics.lens import Lens_srw, Drift_srw
from rslaser.optics.lens import Lens_srw, Drift_srw, Telescope_lct, Beamsplitter
from rslaser.pulse.pulse import LaserPulse
from rslaser.utils import srwl_uti_data
from sirepo.template import template_common
Expand Down
2 changes: 2 additions & 0 deletions sirepo/sim_data/silas.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def fixup_old_data(cls, data, qcall, **kwargs):
del m["n0"]
if "n2" in m:
del m["n2"]
if m.type == "mirror":
m.type = "mirror2"
cls.update_model_defaults(m, m.type)
cls.__fixup_laser_pulse(dm.laserPulse)

Expand Down
6 changes: 5 additions & 1 deletion sirepo/template/silas.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,16 @@ def _callback(state, element, dz):
return
if element.type == "lens":
state.res += f'(Lens_srw({element.focalLength}), ["default"]),\n'
elif element.type == "mirror":
elif element.type == "mirror2":
state.res += "(Mirror(), []),\n"
elif element.type == "crystal":
if element.origin == "reuse":
return
state.res += _generate_crystal(element)
elif element.type == "telescope":
state.res += f"(Telescope_lct({element.focal_length_1}, {element.focal_length_2}, {element.drift_length_1}, {element.drift_length_2}, {element.drift_length_3}, l_scale=numpy.sqrt(2) * pulse.sigx_waist), []),\n"
elif element.type == "splitter":
state.res += f"(Beamsplitter({element.transmitted_fraction}), []),\n"
else:
raise AssertionError("unknown element type={}".format(element.type))

Expand Down

0 comments on commit 40e3f83

Please sign in to comment.