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

Describe geometry engines, modes, and axes #306

Merged
merged 12 commits into from
Dec 15, 2023
Merged

Conversation

prjemian
Copy link
Contributor

@prjemian prjemian commented Nov 29, 2023

(Re)build tables of diffractometer geometry, engines, and modes from libhkl API.

@prjemian
Copy link
Contributor Author

@mrakitin @padraic-shafer @strempfer - This is ready for review. Here is an example of a table from the console UI:

(bluesky_2024_1) prjemian@arf:~/.../Bluesky/hklpy$ ipython
Python 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:40:35) [GCC 12.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.17.2 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from hkl import SimulatedK4CV

In [2]: sim4k = SimulatedK4CV("", name="sim4k")

In [3]: sim4k.geometry_table()
Geometry: K4CV
  real axes: komega, kappa, kphi, tth
  pseudo axes: depends on the engine

========= ================== ================== ======================== ======================== ================
engine    pseudo axes        mode               axes read                axes written             extra parameters
========= ================== ================== ======================== ======================== ================
emergence emergence, azimuth emergence          komega, kappa, kphi, tth                          x, y, z         
eulerians omega, chi, phi    eulerians          komega, kappa, kphi      komega, kappa, kphi      solutions       
hkl       h, k, l            bissector          komega, kappa, kphi, tth komega, kappa, kphi, tth                 
hkl       h, k, l            constant_chi       komega, kappa, kphi, tth komega, kappa, kphi, tth chi             
hkl       h, k, l            constant_omega     komega, kappa, kphi, tth komega, kappa, kphi, tth omega           
hkl       h, k, l            constant_phi       komega, kappa, kphi, tth komega, kappa, kphi, tth phi             
hkl       h, k, l            double_diffraction komega, kappa, kphi, tth komega, kappa, kphi, tth h2, k2, l2      
hkl       h, k, l            psi_constant       komega, kappa, kphi, tth komega, kappa, kphi, tth h2, k2, l2, psi 
incidence incidence, azimuth incidence          komega, kappa, kphi                               x, y, z         
psi       psi                psi                komega, kappa, kphi, tth komega, kappa, kphi, tth h2, k2, l2      
q         q                  q                  tth                      tth                                      
========= ================== ================== ======================== ======================== ================

Copy link
Contributor

@padraic-shafer padraic-shafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition!

hkl/calc.py Show resolved Hide resolved
hkl/calc.py Show resolved Hide resolved
@prjemian
Copy link
Contributor Author

Note that the real axes names are the canonical names defined by the lower-level support library (libhkl), as access through the calc module. For a diffractometer with redefined axis names, the rename map comes from the Diffractometer in the diffract module. This is a user-level module. The Diffractometer.geometry_table() could be modified to supply the rename map. The lower-level CalcRecip.geometry_table() would need this additional dictionary to build the actual table.

But, let's not complicate this PR with this additional change.

@prjemian
Copy link
Contributor Author

@rodolakis Added you as a reviewer.

@prjemian
Copy link
Contributor Author

prjemian commented Dec 8, 2023

Could add properties for axes_r (real-space axes as defined by libhkl that are used to calculate forward reflection) and axes_w (the axes to be updated by forward calculation). The axes in axes_r that are missing from axes_w are the ones held constant (a question posed recently by @strempfer), a new property called axes_c.

If the engine module has these properties, they would use the canonical names. Then, the calc module could also define the same properties and replace canonical with renamed axes. Makes it easier for the user to understand a given mode and engine.

Copy link
Member

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

docs/make_geometry_tables.py Show resolved Hide resolved
docs/make_geometry_tables.py Outdated Show resolved Hide resolved
@prjemian prjemian merged commit 863dd70 into main Dec 15, 2023
8 checks passed
@prjemian prjemian deleted the 305-geometries-engines-modes branch December 15, 2023 14:14
@prjemian
Copy link
Contributor Author

@padraic-shafer , @mrakitin Thanks for the reviews!

@strempfer , @jwkim-anl : Thanks for the suggestion!

@@ -79,7 +79,7 @@ def format_name_list(names):
db = {
gonio.geometry_name: {
"real_axes": gonio.physical_axis_names,
"cname": gonio.__class__.__name__[4:],
"cname": gonio.__class__.__name__[4:], # 4 = len("Calc") as in "CalcE4CV"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"cname": gonio.__class__.__name__[4:], # 4 = len("Calc") as in "CalcE4CV"
"cname": gonio.__class__.__name__[len("Calc"):],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

geometry mode updates which axes?
3 participants