ophyd
ophyd copied to clipboard
Bring Status Terminal Pretty-print "ASCII GUI"s Upstream
At LCLS, there were requests for terminal ascii guis, e.g. you return your device name in the ipython terminal and you get a quick overview of the normal/hinted signals. In the data pilot call today, Dan Allen asked if this could be upstreamed into ophyd.
This has a "default" implementation that shows signals by kind
, and is often overridden per-subclass for more specific behavior.
Some references for the code used at LCLS that could be cleaned up and migrated to Device
:
https://github.com/pcdshub/pcdsdevices/blob/3b3041da26bcf89ae050ead6c9d06bda6b3e6b8a/pcdsdevices/interface.py#L225-L355
https://github.com/pcdshub/pcdsdevices/blob/3b3041da26bcf89ae050ead6c9d06bda6b3e6b8a/pcdsdevices/interface.py#L396-L487
Here's what a random device looks like with default rendering:
In [5]: xpp_ccm
Out[5]:
xpp_ccm
-------
position: Unknown
calc
----
position: CCMCalcPseudoPos(energy=9.870012245709834, wavelength=1.2561706805773398, theta=11.554958393593653, energy_with_vernier=9.870012245709834)
energy
------
position: 9.87001326200638
notepad_setpoint: 0.0
notepad_readback: 9.87001326200638
wavelength
----------
position: 1.2561705512318273
notepad_setpoint: 0.0
notepad_readback: 1.2561705512318273
theta
-----
position: 11.554957187404435
notepad_setpoint: 0.0
notepad_readback: 11.554957187404435
alio
----
position: -13.8344677734375
done: 1
setpoint: -13.834404055851259 [mm]
energy_request
--------------
position: 0.0
done: 0
setpoint: 0.0
theta2fine
----------
position: 4.0011
done: 0
setpoint: 4.6364 [um]
Here's an example of what our scientists are often really after when they say "ascii gui" that might explain the motivation a bit:
In [2]: att
Out[2]:
filter # |0|1|2|3|4|5|6|7|8|9|
OUT |X|X|X|X|X|X| |X|X|X|
IN | | | | | | |X| | | |
Transmission for 1st harmonic (E=13.000 keV): 1.2070E-02
Transmission for 3rd harmonic (E=39.000 keV): 6.8040E-01