Skip to content

Commit

Permalink
MNT #303 use a symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Dec 18, 2023
1 parent 1c04667 commit 334de5d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions hkl/tests/test_diffract.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,21 +368,22 @@ def test_i303_forward_solution_original_problem(e4cv):

e4cv.calc.engine.mode = "constant_phi"
assert e4cv.calc.engine.mode == "constant_phi"
CONSTANT_PHI = 23.4567

e4cv.apply_constraints({"phi": Constraint(-180, 180, 21.3456, True)})
assert pytest.approx(e4cv.calc["phi"].value, abs=1e-4) == 21.3456
e4cv.apply_constraints({"phi": Constraint(-180, 180, CONSTANT_PHI, True)})
assert pytest.approx(e4cv.calc["phi"].value, abs=1e-4) == CONSTANT_PHI

# Check that phi is held constant in forward_solutions_table()
# Returns a pyRestTable.Table object.
table = e4cv.forward_solutions_table([refl], full=True, digits=4)
assert len(table.rows) == 2
assert table.labels[4] == "phi"
assert pytest.approx(table.rows[0][4], abs=1e-4) == 21.3456
assert pytest.approx(table.rows[1][4], abs=1e-4) == 21.3456
assert pytest.approx(table.rows[0][4], abs=1e-4) == CONSTANT_PHI
assert pytest.approx(table.rows[1][4], abs=1e-4) == CONSTANT_PHI

# Check that phi is held constant in forward()
# Returns a position namedtuple.
position = e4cv.forward(refl)
assert pytest.approx(position.phi, abs=1e-4) == 21.3456
assert pytest.approx(position.phi, abs=1e-4) == CONSTANT_PHI

e4cv.reset_constraints()

0 comments on commit 334de5d

Please sign in to comment.