Skip to content

Commit

Permalink
Fix #6143: determinant delta error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
git-user committed Jul 20, 2023
1 parent db20cd5 commit a2f7a38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions sirepo/package_data/static/js/silas.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ SIREPO.app.directive('n0n2Plot', function(appState, panelState, requestSender, $
controller: function($scope) {
$scope.isLoading = true;
$scope.imageClass = null;
$scope.errorMessage = null;
const abcd = ['A', 'B', 'C', 'D'];

const showABCD = () => {
Expand All @@ -306,6 +307,10 @@ SIREPO.app.directive('n0n2Plot', function(appState, panelState, requestSender, $
if (! $scope.model) {
return;
}
if (response.error) {
$scope.errorMessage = response.error;
return;
}
if ($('.' + $scope.imageClass).length) {
$('.' + $scope.imageClass)[0].src = response.uri;
}
Expand Down
5 changes: 2 additions & 3 deletions sirepo/template/silas.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ def _determinant(matrix):
).calc_n0n2(set_n=True, mesh_density=data.model.mesh_density)
d = _determinant(n)
if abs(d - 1) > _ABCD_DELTA:
# TODO (gurhar1133): test this
raise AssertionError(
f"The determinant of ABCD matrix should be 1, got determinant={d}"
return PKDict(
error=f"ERROR: The determinant of ABCD matrix should be 1, got determinant={d}"
)
p = pkio.py_path("n0n2_plot.png")
plt.clf()
Expand Down

0 comments on commit a2f7a38

Please sign in to comment.