diff --git a/hkl/diffract.py b/hkl/diffract.py index dfeed1e2..5ae8108c 100644 --- a/hkl/diffract.py +++ b/hkl/diffract.py @@ -42,11 +42,11 @@ class Diffractometer(PseudoPositioner): ~engine ~forward ~inverse - ~forwardSolutionsTable - ~applyConstraints - ~resetConstraints - ~showConstraints - ~undoLastConstraints + ~forward_solutions_table + ~apply_constraints + ~reset_constraints + ~show_constraints + ~undo_last_constraints ~pa ~wh ~_energy_changed @@ -395,7 +395,7 @@ def check_value(self, pos): pos = [pos.get(p.attr_name, p.position) for p in self.pseudo_positioners] super().check_value(pos) - def applyConstraints(self, constraints): + def apply_constraints(self, constraints): """ Constrain the diffractometer's motions. @@ -405,13 +405,13 @@ def applyConstraints(self, constraints): self._push_current_constraints() self._set_constraints(constraints) - def resetConstraints(self): + def reset_constraints(self): """Set constraints back to initial settings.""" if len(self._constraints_stack) > 0: self._set_constraints(self._constraints_stack[0]) self._constraints_stack = [] - def showConstraints(self, fmt="simple", printing=True): + def show_constraints(self, fmt="simple", printing=True): """Print the current constraints in a table.""" tbl = pyRestTable.Table() tbl.labels = "axis low_limit high_limit value fit".split() @@ -432,7 +432,7 @@ def showConstraints(self, fmt="simple", printing=True): return tbl - def undoLastConstraints(self): + def undo_last_constraints(self): """ Remove the current constraints additions, restore previous. """ @@ -458,7 +458,7 @@ def _set_constraints(self, constraints): self.calc[axis].value = constraint.value self.calc[axis].fit = constraint.fit - def forwardSolutionsTable(self, reflections, full=False): + def forward_solutions_table(self, reflections, full=False): """ Return table of computed solutions for each (hkl) in the supplied reflections list. @@ -561,7 +561,7 @@ def Package(**kwargs): pt.addRow(row) table.addRow(("positions", addTable(pt))) - t = self.showConstraints(printing=False) + t = self.show_constraints(printing=False) table.addRow(("constraints", addTable(t))) if all_samples: diff --git a/hkl/tests/test_diffract.py b/hkl/tests/test_diffract.py index 83e2a183..ff2c327c 100644 --- a/hkl/tests/test_diffract.py +++ b/hkl/tests/test_diffract.py @@ -145,7 +145,7 @@ def test_names(fourc): assert fourc.class_name.get() == "Fourc" -def test_forwardSolutionsTable(fourc): +def test_forward_solutions_table(fourc): fourc.energy.put(A_KEV / 1.54) # (100) has chi ~ 0 which poses occasional roundoff errors @@ -156,7 +156,7 @@ def test_forwardSolutionsTable(fourc): assert pytest.approx(sol.phi, 1e-5) == -90 assert pytest.approx(sol.tth, 1e-5) == -60 - tbl = fourc.forwardSolutionsTable( + tbl = fourc.forward_solutions_table( # fmt: off [ [1, 1, 0], @@ -261,8 +261,8 @@ def test_wh(fourc, capsys): assert out == expected -def test_showConstraints(fourc, capsys): - fourc.showConstraints() +def test_show_constraints(fourc, capsys): + fourc.show_constraints() out, err = capsys.readouterr() assert len(out) > 0 assert err == "" @@ -281,10 +281,10 @@ def test_showConstraints(fourc, capsys): assert r.rstrip() == e.rstrip() -def test_applyConstraints(fourc): +def test_apply_constraints(fourc): fourc.energy.put(A_KEV / 1.54) # fmt: off - fourc.applyConstraints( + fourc.apply_constraints( { "tth": Constraint(0, 180, 0, True), "chi": Constraint(0, 180, 0, True),