sample#

Import: hklpy2.blocks.sample

A Crystalline Sample.

Sample(core, name, lattice)

A crystalline sample mounted on a diffractometer.

Module Contents#

class hklpy2.blocks.sample.Sample(core: object, name: str, lattice: Lattice)[source]#

Import: hklpy2.blocks.sample.Sample

A crystalline sample mounted on a diffractometer.

Note

Internal use only.

It is expected this class is called from a method of Core, not directly by the user.

Python Methods

refine_lattice()

Refine the lattice parameters from 3 or more reflections.

_validate_matrices(value, name)

(internal) Validate U & UB matrices.

Python Properties

_asdict()

Describe the sample as a dictionary.

lattice

Sample crystal lattice.

name

Sample name.

reflections

Ordered dictionary of orientation reflections.

remove_reflection(name)

Remove the named reflection.

U

Return the matrix, U, crystal orientation on the diffractometer.

UB

Return the crystal orientation matrix, UB.

UB_is_stale

True iff the orientation reflections have changed since the last successful calc_UB for this sample.

property U: Matrix3x3[source]#

Return the matrix, U, crystal orientation on the diffractometer.

property UB: Matrix3x3[source]#

Return the crystal orientation matrix, UB.

  • \(UB\) - orientation matrix

  • \(B\) - crystal lattice on the diffractometer

  • \(U\) - rotation matrix, relative orientation of crystal on diffractometer

property UB_is_stale: bool[source]#

True iff the orientation reflections have changed since the last successful calc_UB for this sample.

Returns False in any of these cases:

  • calc_UB has not been called for this sample (no snapshot to compare against),

  • the user has assigned U or UB directly (they have explicitly taken ownership of the matrix; the snapshot is cleared),

  • the orientation reflections (reflections.order[:2] and their physics-relevant contents) are unchanged since the last calc_UB.

Returns True when order[:2] itself changes (reorder, prepend a new orienting reflection, remove an orienting one) or when an in-place mutation of one of the orienting reflections changes its pseudos, reals, wavelength, or unit fields. Reflections outside order[:2] do not affect staleness.

core[source]#
property digits: int[source]#

Sample crystal lattice.

property lattice: Lattice[source]#

Sample crystal lattice.

property name: str[source]#

Sample name.

refine_lattice() None[source]#

Refine the lattice parameters from 3 or more reflections.

property reflections: ReflectionsDict[source]#

Ordered dictionary of orientation reflections.

remove_reflection(name: str) None[source]#

Remove the named reflection.

hklpy2.blocks.sample.SampleDictType[source]#