Miscellaneous Support#
Source Code Documentation#
Miscellaneous Support.
|
Raise ValueError exception if value is not in the list of examples. |
|
Compare two dictionaries. |
|
Create a DictionaryDevice class using the supplied dictionary. |
|
Convert nested lists into single list. |
|
Load a Solver class from a named entry point. |
|
Load YAML from text. |
|
Return contents of a YAML file as a Python object. |
|
Round a number to specified precision. |
|
Create a Solver object with geometry and axes. |
|
Dictionary of available Solver classes, mapped by entry point name. |
|
Short, unique name, first 7 (at most) characters of a unique, random uuid. |
Identity matrix, 2-D, 3 rows, 3 columns. |
|
Name by which hklpy2 backend Solver classes are grouped. |
|
Write configuration of supported device(s) to a bluesky run. |
Custom exceptions from |
|
Custom exceptions from |
|
Custom exceptions from |
|
Custom exceptions from |
|
Custom exceptions from |
|
Custom exceptions from |
|
Custom exceptions from |
|
Custom exceptions from a Solver. |
|
Custom exceptions from |
- 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.
- class hklpy2.operations.misc.ConfigurationRunWrapper(*devices, knowns=None)[source]#
Bases:
object
Write configuration of supported device(s) to a bluesky run.
EXAMPLE:
crw = ConfigurationRunWrapper(sim4c2) RE.preprocessors.append(crw.wrapper) RE(bp.rel_scan([noisy], m1, -1.2, 1.2, 11))
Disable the preprocessor:
crw.enable = False # 'True' to enable
Remove the last preprocessor:
RE.preprocessors.pop()
Add another diffractometer:
crw.devices.append(e4cv)
Return list of configured device names.
List of devices to be reported.
Is it permitted to write device configuration?
Known device base classes.
Top-level key in run's metadata dictionary.
validate
(devices)Verify all are recognized objects.
wrapper
(plan)Bluesky plan wrapper (preprocessor).
- property device_names: [<class 'str'>]#
Return list of configured device names.
- devices = []#
List of devices to be reported.
- known_bases = []#
Known device base classes.
Any device (base class) that reports its configuration dictionary in the .read_configuration() method can be added to this tuple.
- start_key = 'diffractometers'#
Top-level key in run’s metadata dictionary.
- 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.
- hklpy2.operations.misc.IDENTITY_MATRIX_3X3 = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]#
Identity matrix, 2-D, 3 rows, 3 columns.
- 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.dict_device_factory(data: dict, **kwargs)[source]#
Create a DictionaryDevice class using the supplied dictionary.
- 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_file(file)[source]#
Return contents of a YAML file as a Python object.
- hklpy2.operations.misc.solver_factory(solver_name: str, geometry: str, **kwargs)[source]#
Create a Solver object with geometry and axes.