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()

NoOpSolver(geometry, **kwargs)

"no_op" (any OS) no transformations.

Module Contents#

class hklpy2.backends.no_op.NoOpSolver(geometry: str, **kwargs)[source]#

Import: hklpy2.backends.no_op.NoOpSolver

Bases: 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.

extra_axis_names

Ordered list of any extra axis names (such as x, y, z).

forward(pseudos)

Compute list of solutions(reals) from pseudos (hkl -> [angles]).

geometries()

Ordered list of the geometry names supported by this solver.

inverse(reals)

Compute dict of pseudos from reals (angles -> hkl).

pseudo_axis_names

Ordered list of the pseudo axis names (such as h, k, l).

real_axis_names

Ordered list of the real axis names (such as th, tth).

refineLattice(reflections)

No refinement.

removeAllReflections()

Remove all reflections.

Python Properties

geometry

Name of selected diffractometer geometry.

lattice

Crystal lattice parameters.

mode

Diffractometer geometry operation mode for forward().

modes

List of the geometry operating modes.

sample

Crystalline 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_UB is the authoritative installer of its own orientation pair. Every conformant implementation must execute these steps, in order:

  1. removeAllReflections() – discard any reflections previously stored in the solver-side sample state.

  2. addReflection(r1) – install the first orientation reflection from the supplied dict.

  3. addReflection(r2) – install the second orientation reflection from the supplied dict.

  4. Invoke the backend library’s Busing & Levy routine on the freshly-installed pair to compute UB.

  5. Return UB as a 3x3 list[list[float]].

The implementation must not assume that the solver’s reflection list already contains r1 and r2. The Core layer pushes the python-side sample state via update_solver() before invoking calculate_UB, but calculate_UB itself 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 Core layer iterates over the returned list, applies constraint filtering, and passes the survivors to a solution picker (see pick_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:

list[NamedFloatDict]

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_registry should return sorted(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 modes: List[str][source]#

List of the geometry operating modes.

name = 'no_op'[source]#

Name of this Solver.

property pseudo_axis_names: List[str][source]#

Ordered list of the pseudo axis names (such as h, k, l).

property real_axis_names: List[str][source]#

Ordered list of the real axis names (such as th, tth).

refineLattice(reflections: List[ReflectionDict]) NamedFloatDict | None[source]#

No refinement.

removeAllReflections() None[source]#

Remove all reflections.

version[source]#

Version of this Solver.