Skip to content

Commit

Permalink
Merge pull request #1013 from BCDA-APS/990-listdevice-RuntimeError
Browse files Browse the repository at this point in the history
resolve RuntimeError from listdevice() with an area detector object
  • Loading branch information
prjemian authored Sep 18, 2024
2 parents a95846c + ddf8dea commit 5ccc37d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ describe future plans.
* Add ad_creator() and ad_class_factory() -- Easy to create area detector objects.
* Add SpecWriterCallback2 (writes point-by-point to file).

Fixes
-----

* Area detector image shape of (0, 0, 0) caused listdevice() to fail.

Maintenance
-----------

Expand Down
34 changes: 33 additions & 1 deletion apstools/utils/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,34 @@ def listdevice(
shown. Components that are disconnected will be skipped and a
warning logged.
EXAMPLE::
>>> listdevice(m1)
======================= ======= ==========================
data name value timestamp
======================= ======= ==========================
m1 0.0 2024-08-28 09:41:08.364137
m1_user_setpoint 0.0 2024-08-28 09:41:08.364137
m1_user_offset 0.0 2024-08-28 11:46:56.116048
m1_user_offset_dir 0 2024-08-28 09:41:08.364137
m1_offset_freeze_switch 0 2024-08-28 09:41:08.364137
m1_set_use_switch 0 2024-08-28 09:41:08.364137
m1_velocity 1.0 2024-08-28 09:41:08.364137
m1_acceleration 0.2 2024-08-28 09:41:08.364137
m1_motor_egu degrees 2024-08-28 09:41:08.364137
m1_motor_is_moving 0 2024-08-28 09:41:08.364137
m1_motor_done_move 1 2024-08-28 11:46:56.116057
m1_high_limit_switch 0 2024-08-28 09:41:08.364137
m1_low_limit_switch 0 2024-08-28 09:41:08.364137
m1_high_limit_travel 1000.0 2024-08-28 11:46:56.116048
m1_low_limit_travel -1000.0 2024-08-28 11:46:56.116048
m1_direction_of_travel 0 2024-08-28 09:41:08.364137
m1_motor_stop 0 2024-08-28 09:41:08.364137
m1_home_forward 0 2024-08-28 09:41:08.364137
m1_home_reverse 0 2024-08-28 09:41:08.364137
m1_steps_per_revolution 2000 2024-08-28 09:41:08.364137
======================= ======= ==========================
PARAMETERS
obj
Expand Down Expand Up @@ -169,6 +197,7 @@ def listdevice(
.. note:: ``pandas.DataFrame`` wll truncate long text
to at most 50 characters.
.. seealso:: ``listdevice()`` in :doc:`/examples/ho_list_control_objects`
"""
if max_column_width is not None:
if table_style != TableStyle.pyRestTable:
Expand Down Expand Up @@ -228,7 +257,10 @@ def listdevice(
# If the signal is not connected now, provide informative text
# and move along.
if signal.connected:
v = signal.get()
try:
v = signal.get()
except Exception as reason:
v = str(reason)
else:
v = NOT_CONNECTED_VALUE
dd["value"].append(v)
Expand Down

0 comments on commit 5ccc37d

Please sign in to comment.