Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write tables of plot statistics in most compact form #894

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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