bluesky / hklpy

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

restore_reflections(orientation, fourc) cannot find renamed positioner #215

Closed prjemian closed 1 year ago

prjemian commented 2 years ago

As reported by @gfabbris, restore_reflections(orientation, fourc) could not find theta in the reflection dict:

  {'reflection': {'h': 1.0, 'k': -3.0, 'l': -1.0},
   'flag': 1,
   'wavelength': 1.1169734383241103,
   'position': {'omega': -8.208399999999983,
    'chi': -47.47651999999994,
    'phi': -5.684341886080802e-14,
    'tth': 25.09473789610388},
   'orientation_reflection': False},

when the positioners were renamed such as

fourc.calc.physical_axis_names = {'omega': 'theta',
                                  'chi': 'chi',
                                  'phi': 'phi',
                                  'tth': 'tth'}
prjemian commented 2 years ago

Need to store this remap with the other orientation information so it will be available for later use, such as:

orientation = run_orientation_info(cat[63])["fourc"]
prjemian commented 1 year ago

Confirmed the reflections are stored in the databroker by their canonical names rather than the local renames. The hkl.util.restore_reflections() code appears to use the local renames. The local renames are available in orientation["_reals"].

prjemian commented 1 year ago

This dictionary: https://github.com/bluesky/hklpy/blob/dd2cf5a0d32e73f04d8ec5a223faff7e6f9593a2/hkl/calc.py#L198 is empty if the axes are not renamed. If there are renames, the dict provides the mapping.

It's an all-or-nothing proposition; if the dict is empty, then no renames, otherwise, the dict has conversions for all the names.