Skip to content

Commit

Permalink
Fix #6143: chirp
Browse files Browse the repository at this point in the history
  • Loading branch information
git-user committed Jul 21, 2023
1 parent 2393ae4 commit 5939fe4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 10 additions & 6 deletions sirepo/package_data/static/js/silas.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,13 @@ SIREPO.viewLogic('laserPulseView', function(appState, panelState, requestSender,
requestSender.sendStatelessCompute(
appState,
data => {
srdbg(data);
if (data.error) {
$scope.model.chirp = "n/a";
throw new Error(data.error);
}
$scope.model.chirp = data.chirp;
// $scope.model.chirp = data.chirp;
appState.models.laserPulse.chirp = data.chirp;
srdbg('chirp from server:', data.chirp);
srdbg('$scope.model.chirp:', $scope.model.chirp);
},
Expand Down Expand Up @@ -459,13 +462,14 @@ SIREPO.viewLogic('laserPulseView', function(appState, panelState, requestSender,
'laserPulse.distribution',
], updateEditor,
['laserPulse.nx_slice'], updateMeshPoints,
['laserPulse.tau_0', 'laserPulse.tau_fwhm'], computeChirp
];

$scope.$on(['laserPulse.changed'], (e, name) => {
srdbg('name:', name);
srdbg('event:', e);
computeChirp();
});
// $scope.$on(['laserPulse.changed'], (e, name) => {
// srdbg('name:', name);
// srdbg('event:', e);
// computeChirp();
// });
});

SIREPO.viewLogic('crystalCylinderView', function(appState, panelState, silasService, $scope) {
Expand Down
6 changes: 5 additions & 1 deletion sirepo/template/silas.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ def stateful_compute_mesh_dimensions(data, **kwargs):
def stateless_compute_calc_chirp(data, **kwargs):
from rslaser.pulse import pulse

try:
res = round(pulse.LaserPulse(params=data.model).initial_chirp, 7)
except Exception as e:
return PKDict(error=str(e))
return PKDict(
chirp=round(pulse.LaserPulse(params=data.model).initial_chirp, 7)
chirp=res
)


Expand Down

0 comments on commit 5939fe4

Please sign in to comment.