Core Operations#
A diffractometer’s .core
provides most of its functionality.
The core
conducts transactions with the Solver on behalf of the
diffractometer. These transactions include the forward()
and inverse()
coordinate transformations, at the core of scientific measurements using
a diffractometer.
Python class |
Purpose |
---|---|
ophyd PseudoPositioner |
|
|
The class for a diffractometer’s |
Code for diffractometer geometries and capabilities. |
In addition to Solver transactions, the .core
manages all
details involving the set of samples and their lattices & reflections.
Here, we use the creator()
to create a simulated 4-circle
diffractometer with the E4CV geometry.
EXAMPLE:
>>> from hklpy2 import creator
>>> e4cv = creator(name="e4cv")
>>> e4cv.core.sample
Sample(name='cubic', lattice=Lattice(a=1, b=1, c=1, alpha=90.0, beta=90.0, gamma=90.0))
>>> e4cv.core.solver
HklSolver(name='hkl_soleil', version='v5.0.0.3434', geometry='E4CV', engine='hkl', mode='bissector')
>>> e4cv.core.sample.reflections
{}
>>> e4cv.add_reflection((1, 0, 0), (10, 0, 0, 20), name="r1")
Reflection(name='r1', geometry='E4CV', pseudos={'h': 1, 'k': 0, 'l': 0}, reals={'omega': 10, 'chi': 0, 'phi': 0, 'tth': 20}, wavelength=1.0)
>>> e4cv.add_reflection((0, 1, 0), (10, -90, 0, 20), name="r2")
Reflection(name='r2', geometry='E4CV', pseudos={'h': 0, 'k': 1, 'l': 0}, reals={'omega': 10, 'chi': -90, 'phi': 0, 'tth': 20}, wavelength=1.0)
>>> e4cv.core.sample.reflections
{'r1': {'name': 'r1', 'geometry': 'E4CV', 'pseudos': {'h': 1, 'k': 0, 'l': 0}, 'reals': {'omega': 10, 'chi': 0, 'phi': 0, 'tth': 20}, 'wavelength': 1.0, 'order': 0}, 'r2': {'name': 'r2', 'geometry': 'E4CV', 'pseudos': {'h': 0, 'k': 1, 'l': 0}, 'reals': {'omega': 10, 'chi': -90, 'phi': 0, 'tth': 20}, 'wavelength': 1.0, 'order': 1}}
Note
The Core
class provides
key diffractometer features as Python properties. This enables their
inclusion in the DiffractometerBase
class
using ophyd AttributeSignal.
One such example is the Solver geometry name:
geometry = Cpt(
AttributeSignal,
attr="core.geometry",
doc="Name of backend |solver| geometry.",
write_access=False,
kind="config",
)
"""Name of backend |solver| geometry."""
Using the e4cv
simulator, the property is:
>>> e4cv.core.geometry
'E4CV'
From the ophyd diffractometer object reports this:
>>> e4cv.geometry.get()
'E4CV'