Skip to content

Commit

Permalink
MNT #892
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Dec 1, 2023
1 parent 2b8ba83 commit d9fc082
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions apstools/callbacks/scan_signal_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,30 @@ def report(self):
return
keys = "n centroid sigma x_at_max_y max_y min_y mean_y stddev_y".split()
table = pyRestTable.Table()
table.labels = ["detector"] + keys
for yname, stats in self._registers.items():
row = [yname]
if len(keys) <= len(self._registers):
# statistics in the column labels
table.labels = ["detector"] + keys
for yname, stats in self._registers.items():
row = [yname]
for k in keys:
try:
v = getattr(stats, k)
except ZeroDivisionError:
v = 0
row.append(v)
table.addRow(row)
else:
# signals in the column labels
table.labels = ["statistic"] + list(self._registers)
for k in keys:
try:
v = getattr(stats, k)
except ZeroDivisionError:
v = 0
row.append(v)
table.addRow(row)
row = [k]
for stats in self._registers.values():
try:
v = getattr(stats, k)
except ZeroDivisionError:
v = 0
row.append(v)
table.addRow(row)
print(f"Motor: {self._x_name}")
print(table)

Expand Down

0 comments on commit d9fc082

Please sign in to comment.