Skip to content

Commit

Permalink
Merge pull request #398 from BCDA-APS/397-wh
Browse files Browse the repository at this point in the history
DiffractometerMixin: add wh() method
  • Loading branch information
prjemian committed Aug 7, 2020
2 parents b05a873 + 757d6e8 commit 2fdd584
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions apstools/diffractometer.py
Expand Up @@ -46,6 +46,7 @@ class DiffractometerMixin(Device):
~resetConstraints
~showConstraints
~undoLastConstraints
~wh
"""

h = Component(PseudoSingle, '', labels=("hkl",), kind="hinted")
Expand Down Expand Up @@ -134,3 +135,36 @@ def forwardSolutionsTable(self, reflections, full=False):
if not full:
break # only show the first (default) solution
return _table

def wh(self, printing=True):
"""
report the diffractometer settings
SPEC compatibility::
1117.KAPPA> wh
H K L = 0 0 1.7345
Alpha = 20 Beta = 20 Azimuth = 90
Omega = 32.952 Lambda = 1.54
Two Theta Theta Chi Phi K_Theta Kappa K_Phi
40.000000 20.000000 90.000000 57.048500 77.044988 134.755995 114.093455
"""
table = pyRestTable.Table()
table.labels = "term value".split()
table.addRow(("diffractometer", self.name))
table.addRow(("mode", self.calc.engine.mode))
table.addRow(("wavelength (angstrom)", self.calc.wavelength))

for k, v in self.calc.pseudo_axes.items():
table.addRow((k, v))

for item in self.real_positioners:
table.addRow((item.attr_name, item.position))

# TODO: show constraints?

if printing:
print(table)

return table

0 comments on commit 2fdd584

Please sign in to comment.