Skip to content

Commit

Permalink
slightly increase tolerance for single precision of two unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oskooi committed Jan 13, 2022
1 parent 39de82d commit 623a2d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/tests/test_adjoint_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def test_adjoint_solver_DFT_fields(self):
adj_scale = (dp[None,:]@adjsol_grad).flatten()
fd_grad = Ez2_perturbed-Ez2_unperturbed
print("Directional derivative -- adjoint solver: {}, FD: {}".format(adj_scale,fd_grad))
tol = 0.04 if mp.is_single_precision() else 0.006
tol = 0.07 if mp.is_single_precision() else 0.006
self.assertClose(adj_scale,fd_grad,epsilon=tol)


Expand Down Expand Up @@ -477,7 +477,7 @@ def test_complex_fields(self):
adj_scale = (dp[None,:]@adjsol_grad).flatten()
fd_grad = Ez2_perturbed-Ez2_unperturbed
print("Directional derivative -- adjoint solver: {}, FD: {}".format(adj_scale,fd_grad))
tol = 0.012 if mp.is_single_precision() else 0.002
tol = 0.018 if mp.is_single_precision() else 0.002
self.assertClose(adj_scale,fd_grad,epsilon=tol)

def test_damping(self):
Expand Down

0 comments on commit 623a2d4

Please sign in to comment.