Skip to content

Commit

Permalink
Merge pull request #894 from BCDA-APS/892-landscape-or-portrait
Browse files Browse the repository at this point in the history
Write tables of plot statistics in most compact form
  • Loading branch information
prjemian authored Dec 1, 2023
2 parents 2b8ba83 + bd130bc commit d957808
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Maintenance
-----------

* Move ``.OVAL`` field from ``EpicsRecordOutputFields to new ``EpicsRecordAnalogOutputFields``
* Write tables of plot statistics in most compact form.

1.6.17
******
Expand Down
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 d957808

Please sign in to comment.