bluesky / hklpy

Diffractometer computation library with ophyd pseudopositioner support
https://blueskyproject.io/hklpy
BSD 3-Clause "New" or "Revised" License
2 stars 11 forks source link

ENH: preview samples that would be restored #288

Closed prjemian closed 7 months ago

prjemian commented 8 months ago

@strempfer asks:

[Could there] be a function like restore_sample_list(), which just lists the available samples in the respective file or PV. Otherwise one may not know which ones are available, especially if there are many different ones.

prjemian commented 8 months ago

@strempfer: Is something like this what you had in mind?

Simple output

Given a pathlib object (or other configuration data source):

print(agent.preview(path))

here is the output:

name: e4c
date: 2023-11-01 16:40
geometry: E4CV

Table of Samples
= ========= ========= ========= ========= ===== ==== ===== =====
# sample    a         b         c         alpha beta gamma #refl
= ========= ========= ========= ========= ===== ==== ===== =====
1 main      1.54      1.54      1.54      90.0  90.0 90.0  0    
2 vibranium 6.2831853 6.2831853 6.2831853 90.0  90.0 90.0  3    
= ========= ========= ========= ========= ===== ==== ===== =====

More details (using kwargs)

Could get more details (constraints & reflections):

print(agent.preview(path, show_constraints=True, show_reflections=True))

here is the output:

name: e4c
date: 2023-11-01 16:40
geometry: E4CV

Table of Samples
= ========= ========= ========= ========= ===== ==== ===== =====
# sample    a         b         c         alpha beta gamma #refl
= ========= ========= ========= ========= ===== ==== ===== =====
1 main      1.54      1.54      1.54      90.0  90.0 90.0  0    
2 vibranium 6.2831853 6.2831853 6.2831853 90.0  90.0 90.0  3    
= ========= ========= ========= ========= ===== ==== ===== =====

Table of Reflections for Sample: vibranium
= === === === ======== ==== ==== ======= ======= ==========
# h   k   l   omega    chi  phi  tth     orient? wavelength
= === === === ======== ==== ==== ======= ======= ==========
1 4.0 0.0 0.0 -145.451 0.0  0.0  69.0966 1.54    False     
2 0.0 4.0 0.0 -145.451 0.0  90.0 69.0966 1.54    True      
3 0.0 0.0 4.0 -145.451 90.0 0.0  69.0966 1.54    True      
= === === === ======== ==== ==== ======= ======= ==========

Table of Axis Constraints
===== ========= ========== ===== ====
axis  low_limit high_limit value fit?
===== ========= ========== ===== ====
omega -100.0    100.0      0.0   True
chi   -100.0    100.0      0.0   True
phi   -100.0    100.0      0.0   True
tth   -100.0    100.0      0.0   True
===== ========= ========== ===== ====
prjemian commented 8 months ago

oops, swapped orient? and wavelength column titles