refactor reflection printout
This commit is contained in:
@@ -242,16 +242,7 @@ def orientShow():
|
||||
|
||||
reflections = diffract.get_reflections()
|
||||
if reflections:
|
||||
print('The defined reflections are:')
|
||||
header = ['h', 'k', 'l'] + diffract.real_position['fields'][:-1]
|
||||
table = PrettyTable(header, padding=12)
|
||||
print(' ', table.get_header())
|
||||
|
||||
for reflection in reflections:
|
||||
h, k, l, angles = reflection
|
||||
text = [f'{h:9.4f}', f'{k:9.4f}', f'{l:9.4f}'] + [f'{x:9.4f}' for x in angles]
|
||||
print(' ', table.get_row(*text))
|
||||
|
||||
_showReflections(reflections)
|
||||
print("\n------------------------------------------------\n")
|
||||
|
||||
_showUB()
|
||||
@@ -380,3 +371,14 @@ def _currentPosition():
|
||||
# which gets serialized to a dictionary by the device server.
|
||||
angles = RealPosition(*(response['values'][axis] for axis in response['fields']))
|
||||
return angles
|
||||
|
||||
def _showReflections(reflections):
|
||||
print('The defined reflections are:')
|
||||
header = ['h', 'k', 'l'] + diffract.real_position['fields'][:-1]
|
||||
table = PrettyTable(header, padding=12)
|
||||
print(' ', table.get_header())
|
||||
|
||||
for reflection in reflections:
|
||||
h, k, l, angles = reflection
|
||||
text = [f'{h:9.4f}', f'{k:9.4f}', f'{l:9.4f}'] + [f'{x:9.4f}' for x in angles]
|
||||
print(' ', table.get_row(*text))
|
||||
|
||||
Reference in New Issue
Block a user