no_op#
Import: hklpy2.backends.no_op
“no_op” solver for testing.
no reciprocal-space conversions
Example:
import hklpy2
SolverClass = hklpy2.get_solver("no_op")
noop_solver = SolverClass()
|
|
Module Contents#
- class hklpy2.backends.no_op.NoOpSolver(geometry: str, **kwargs)[source]#
Import:
hklpy2.backends.no_op.NoOpSolverBases:
hklpy2.backends.base.SolverBase"no_op"(any OS) no transformations.Solver that has no reciprocal space transformations.
Python Methods
addReflection(reflection)Add coordinates of a diffraction condition (a reflection).
calculate_UB(r1, r2)Calculate the UB (orientation) matrix with two reflections.
Ordered list of any extra axis names (such as x, y, z).
forward(pseudos)Compute list of solutions(reals) from pseudos (hkl -> [angles]).
Ordered list of the geometry names supported by this solver.
inverse(reals)Compute dict of pseudos from reals (angles -> hkl).
Ordered list of the pseudo axis names (such as h, k, l).
Ordered list of the real axis names (such as th, tth).
refineLattice(reflections)No refinement.
Remove all reflections.
Python Properties
geometryName of selected diffractometer geometry.
latticeCrystal lattice parameters.
modeDiffractometer geometry operation mode for
forward().List of the geometry operating modes.
sampleCrystalline sample.
- addReflection(reflection: ReflectionDict) None[source]#
Add coordinates of a diffraction condition (a reflection).
- calculate_UB(r1: ReflectionDict, r2: ReflectionDict) Matrix3x3[source]#
Calculate the UB (orientation) matrix with two reflections.
The method of Busing & Levy, Acta Cryst 22 (1967) 457.
Implementation contract
calculate_UBis the authoritative installer of its own orientation pair. Every conformant implementation must execute these steps, in order:removeAllReflections()– discard any reflections previously stored in the solver-side sample state.addReflection(r1)– install the first orientation reflection from the supplied dict.addReflection(r2)– install the second orientation reflection from the supplied dict.Invoke the backend library’s Busing & Levy routine on the freshly-installed pair to compute UB.
Return UB as a 3x3
list[list[float]].
The implementation must not assume that the solver’s reflection list already contains
r1andr2. TheCorelayer pushes the python-side sample state viaupdate_solver()before invokingcalculate_UB, butcalculate_UBitself is the authoritative installer of the orienting pair so that the result is reproducible from the supplied arguments alone.
- property extra_axis_names: List[str][source]#
Ordered list of any extra axis names (such as x, y, z).
- forward(pseudos: NamedFloatDict) List[NamedFloatDict][source]#
Compute list of solutions(reals) from pseudos (hkl -> [angles]).
Returns all valid real-axis solutions that the backend engine can find for the given pseudo-axis values, geometry, and mode. The number of solutions depends on the backend library’s capabilities: some engines enumerate all mathematically valid solutions while others return only one. A single-element list is a valid return value.
The
Corelayer iterates over the returned list, applies constraint filtering, and passes the survivors to a solution picker (seepick_first_solution(),pick_closest_solution()).- Parameters:
pseudos (NamedFloatDict) – Pseudo-axis values keyed by name (e.g.
{"h": 1.0, "k": 0.0, "l": 0.0}).- Returns:
Each element is a dictionary of real-axis values keyed by name (e.g.
{"omega": 10.0, "chi": 0.0, "phi": 0.0, "tth": 20.0}). An empty list signals no solutions; a single-element list is acceptable.- Return type:
- Raises:
NoForwardSolutions – If the backend cannot find any solution.
- classmethod geometries() List[str][source]#
Ordered list of the geometry names supported by this solver.
Implementations that use the
_geometry_registryshould returnsorted(cls._geometry_registry.keys()). Solvers backed by an external library (e.g.HklSolver) may query that library’s own registry instead.EXAMPLES:
>>> from hklpy2 import get_solver >>> Solver = get_solver("no_op") >>> Solver.geometries() [] >>> solver = Solver("TH TTH Q") >>> solver.geometries() []
- inverse(reals: NamedFloatDict) NamedFloatDict[source]#
Compute dict of pseudos from reals (angles -> hkl).
- property pseudo_axis_names: List[str][source]#
Ordered list of the pseudo axis names (such as h, k, l).
- refineLattice(reflections: List[ReflectionDict]) NamedFloatDict | None[source]#
No refinement.