diffcalc.hkl.constraints

Module handling constraint information for diffractometer calculations.

Classes

Constraints([constraints, indegrees])

Collection of angle constraints for diffractometer calculations.

class diffcalc.hkl.constraints.Constraints(constraints: Optional[Collection[Union[Tuple[str, float], str]]] = None, indegrees: bool = True)[source]

Collection of angle constraints for diffractometer calculations.

Three constraints are required for calculations of miller indices and the corresponding diffractometer positions. Allowed configurations include at most one of the reference and the detector type constraint and up to three of the sample type constraints.

List of the available constraint combinations:

1 x samp, 1 x ref and 1 x det: all

2 x samp and 1 x ref: chi & phi

chi & eta chi & mu mu & eta mu & phi eta & phi

2 x samp and 1 x det: chi & phi

mu & eta mu & phi mu & chi eta & phi eta & chi bisect & mu bisect & eta bisect & omega

3 x samp: eta, chi & phi

mu, chi & phi mu, eta & phi mu, eta & chi

Attributes
a_eq_b

Constraint for setting alpha = beta.

all

Get all angle names and values.

alpha

Constraint for alpha angle.

asdict

Get all constrained angle names and values.

astuple

Get all constrained angle names and values.

beta

Constraint for beta angle.

betain

Constraint for betain angle.

betaout

Constraint for betaout angle.

bin_eq_bout

Constraint for betain = betaout.

bisect

Constraint for bisect mode.

chi

Constraint for chi angle.

delta

Constraint for delta angle.

eta

Constraint for eta angle.

mu

Constraint for mu angle.

naz

Constraint for naz angle.

nu

Constraint for nu angle.

omega

Constraint for omega angle.

phi

Constraint for phi angle.

psi

Constraint for psi angle.

qaz

Constraint for qaz angle.

Methods

asdegrees(constraints)

Create new Constraints object with angles in degrees.

asradians(constraints)

Create new Constraints object with angles in radians.

clear()

Remove all constraints.

is_current_mode_implemented()

Check if current constraint set is implemented.

is_fully_constrained([con])

Check if configuration is fully constrained.

Object for setting diffractometer angle constraints.

Attributes
a_eq_b

Constraint for setting alpha = beta.

all

Get all angle names and values.

alpha

Constraint for alpha angle.

asdict

Get all constrained angle names and values.

astuple

Get all constrained angle names and values.

beta

Constraint for beta angle.

betain

Constraint for betain angle.

betaout

Constraint for betaout angle.

bin_eq_bout

Constraint for betain = betaout.

bisect

Constraint for bisect mode.

chi

Constraint for chi angle.

delta

Constraint for delta angle.

eta

Constraint for eta angle.

mu

Constraint for mu angle.

naz

Constraint for naz angle.

nu

Constraint for nu angle.

omega

Constraint for omega angle.

phi

Constraint for phi angle.

psi

Constraint for psi angle.

qaz

Constraint for qaz angle.

Methods

asdegrees(constraints)

Create new Constraints object with angles in degrees.

asradians(constraints)

Create new Constraints object with angles in radians.

clear()

Remove all constraints.

is_current_mode_implemented()

Check if current constraint set is implemented.

is_fully_constrained([con])

Check if configuration is fully constrained.

property all: Dict[str, Optional[Union[float, bool]]]

Get all angle names and values.

Returns

Dictionary with all angle names and values.

Return type

Dict[str, Union[float, bool, None]]

property asdict: Dict[str, Union[float, bool]]

Get all constrained angle names and values.

Returns

Dictionary with all constrained angle names and values.

Return type

Dict[str, Union[float, bool]]

property astuple: Tuple[Union[Tuple[str, float], str], ...]

Get all constrained angle names and values.

Returns

Tuple with all constrained angle names and values.

Return type

Tuple[Union[Tuple[str, float], str], …]

property delta: Optional[float]

Constraint for delta angle.

property nu

Constraint for nu angle.

property qaz

Constraint for qaz angle.

property naz

Constraint for naz angle.

property a_eq_b

Constraint for setting alpha = beta.

property alpha

Constraint for alpha angle.

property beta

Constraint for beta angle.

property psi

Constraint for psi angle.

property bin_eq_bout

Constraint for betain = betaout.

property betain

Constraint for betain angle.

property betaout

Constraint for betaout angle.

property mu

Constraint for mu angle.

property eta

Constraint for eta angle.

property chi

Constraint for chi angle.

property phi

Constraint for phi angle.

property bisect

Constraint for bisect mode.

property omega

Constraint for omega angle.

classmethod asdegrees(constraints: Constraints) Constraints[source]

Create new Constraints object with angles in degrees.

Parameters

constraints (Constraints) – Input Constraints object

Returns

New Constraints object with angles in degrees.

Return type

Constraints

classmethod asradians(constraints: Constraints) Constraints[source]

Create new Constraints object with angles in radians.

Parameters

constraints (Constraints) – Input Position object

Returns

New Constraints object with angles in radians.

Return type

Constraints

is_fully_constrained(con: Optional[_Constraint] = None) bool[source]

Check if configuration is fully constrained.

Parameters

con (_Constraint, default = None) – Check if there are available constraints is the same category as the input constraint. If parameter is None, check for all constraint categories.

Returns

True if there aren’t any constraints available either in the input constraint category or no constraints are available.

Return type

bool

is_current_mode_implemented() bool[source]

Check if current constraint set is implemented.

Configuration needs to be fully constraint for this method to work.

Returns

True if current constraint set is supported.

Return type

bool

clear() None[source]

Remove all constraints.