Miscellaneous Support#

Source Code Documentation#

Miscellaneous Support.

check_value_in_list(title, value, examples)

Raise ValueError exception if value is not in the list of examples.

compare_float_dicts(a1, a2[, tol])

Compare two dictionaries.

get_solver(solver_name)

Load a Solver class from a named entry point.

load_yaml(text)

Load YAML from text.

load_yaml_file(file)

roundoff(value[, digits])

Round a number to specified precision.

solver_factory(solver_name, geometry, **kwargs)

Create a Solver object with geometry and axes.

solvers()

Dictionary of available Solver classes, mapped by entry point name.

unique_name([prefix, length])

Short, unique name, first 7 (at most) characters of a unique, random uuid.

SOLVER_ENTRYPOINT_GROUP

Name by which hklpy2 backend Solver classes are grouped.

ConfigurationError

Custom exceptions from hklpy2.operations.configure.

ConstraintsError

Custom exceptions from hklpy2.operations.constraints.

DiffractometerError

Custom exceptions from DiffractometerBase.

LatticeError

Custom exceptions from hklpy2.operations.lattice.

OperationsError

Custom exceptions from Operations.

ReflectionError

Custom exceptions from hklpy2.operations.reflection.

SampleError

Custom exceptions from hklpy2.operations.sample.

SolverError

Custom exceptions from a Solver.

WavelengthError

Custom exceptions from hklpy2.wavelength_support.

exception hklpy2.operations.misc.ConfigurationError[source]#

Bases: Hklpy2Error

Custom exceptions from hklpy2.operations.configure.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hklpy2.operations.misc.ConstraintsError[source]#

Bases: Hklpy2Error

Custom exceptions from hklpy2.operations.constraints.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hklpy2.operations.misc.DiffractometerError[source]#

Bases: Hklpy2Error

Custom exceptions from DiffractometerBase.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hklpy2.operations.misc.LatticeError[source]#

Bases: Hklpy2Error

Custom exceptions from hklpy2.operations.lattice.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hklpy2.operations.misc.OperationsError[source]#

Bases: Hklpy2Error

Custom exceptions from Operations.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hklpy2.operations.misc.ReflectionError[source]#

Bases: Hklpy2Error

Custom exceptions from hklpy2.operations.reflection.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

hklpy2.operations.misc.SOLVER_ENTRYPOINT_GROUP = 'hklpy2.solver'#

Name by which hklpy2 backend Solver classes are grouped.

exception hklpy2.operations.misc.SampleError[source]#

Bases: Hklpy2Error

Custom exceptions from hklpy2.operations.sample.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hklpy2.operations.misc.SolverError[source]#

Bases: Hklpy2Error

Custom exceptions from a Solver.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hklpy2.operations.misc.WavelengthError[source]#

Bases: Hklpy2Error

Custom exceptions from hklpy2.wavelength_support.

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

hklpy2.operations.misc.check_value_in_list(title, value, examples, blank_ok=False)[source]#

Raise ValueError exception if value is not in the list of examples.

hklpy2.operations.misc.compare_float_dicts(a1, a2, tol=0.0001)[source]#

Compare two dictionaries. Values are all floats.

hklpy2.operations.misc.get_solver(solver_name)[source]#

Load a Solver class from a named entry point.

import hklpy2
SolverClass = hklpy2.get_solver("hkl_soleil")
libhkl_solver = SolverClass()
hklpy2.operations.misc.load_yaml(text: str)[source]#

Load YAML from text.

hklpy2.operations.misc.roundoff(value, digits=4)[source]#

Round a number to specified precision.

hklpy2.operations.misc.solver_factory(solver_name: str, geometry: str, **kwargs)[source]#

Create a Solver object with geometry and axes.

hklpy2.operations.misc.solvers()[source]#

Dictionary of available Solver classes, mapped by entry point name.

import hklpy2
print(hklpy2.solvers())
hklpy2.operations.misc.unique_name(prefix='', length=7)[source]#

Short, unique name, first 7 (at most) characters of a unique, random uuid.