hexrd.material.crystallography module

hexrd.material.crystallography.LoadFormFactorData()[source]

Script to read in a csv file containing information relating the magnitude of Q (sin(th)/lambda) to atomic form factor Notes: Atomic form factor data gathered from the International Tables of Crystallography:

    1. Brown, A. G. Fox, E. N. Maslen, M. A. O’Keefec and B. T. M. Willis,

“Chapter 6.1. Intensity of diffracted intensities”, International Tables

for Crystallography (2006). Vol. C, ch. 6.1, pp. 554-595

class hexrd.material.crystallography.PlaneData(hkls: ndarray | None, *args, **kwargs)[source]

Bases: object

Careful with ordering: Outputs are ordered by the 2-theta for the hkl unless you get self._hkls directly, and this order can change with changes in lattice parameters (lparms); setting and getting exclusions works on the current hkl ordering, not the original ordering (in self._hkls), but exclusions are stored in the original ordering in case the hkl ordering does change with lattice parameters

if not None, tThWidth takes priority over strainMag in setting two-theta ranges; changing strainMag automatically turns off tThWidth

calcStructFactor(atominfo)[source]

Calculates unit cell structure factors as a function of hkl USAGE: FSquared = calcStructFactor(atominfo,hkls,B) INPUTS: 1) atominfo (m x 1 float ndarray) the first threee columns of the matrix contain fractional atom positions [uvw] of atoms in the unit cell. The last column contains the number of electrons for a given atom 2) hkls (3 x n float ndarray) is the array of Miller indices for the planes of interest. The vectors are assumed to be concatenated along the 1-axis (horizontal) 3) B (3 x 3 float ndarray) is a matrix of reciprocal lattice basis vectors,where each column contains a reciprocal lattice basis vector ({g}=[B]*{hkl}) OUTPUTS: 1) FSquared (n x 1 float ndarray) array of structure factors, one for each hkl passed into the function

exclude(dmin: float | None = None, dmax: float | None = None, tthmin: float | None = None, tthmax: float | None = None, sfacmin: float | None = None, sfacmax: float | None = None, pintmin: float | None = None, pintmax: float | None = None) None[source]

Set exclusions according to various parameters

Any hkl with a value below any min or above any max will be excluded. So to be included, an hkl needs to have values between the min and max for all of the conditions given.

Note that method resets the tThMax attribute to None.

PARAMETERS

dmin: float > 0

minimum lattice spacing (angstroms)

dmax: float > 0

maximum lattice spacing (angstroms)

tthmin: float > 0

minimum two theta (radians)

tthmax: float > 0

maximum two theta (radians)

sfacmin: float > 0

minimum structure factor as a proportion of maximum

sfacmax: float > 0

maximum structure factor as a proportion of maximum

pintmin: float > 0

minimum powder intensity as a proportion of maximum

pintmax: float > 0

maximum powder intensity as a proportion of maximum

property exclusions: ndarray

Excluded HKL’s the plane data.

Set as type np.ndarray, as a mask of length getNhklRef(), a list of

indices to be excluded, or a list of ranges of indices.

Read as a mask of length getNhklRef().

getHKLID(hkl: int | Tuple[int, int, int] | ndarray, master: bool | None = False) List[int] | int[source]

Return the unique ID of a list of hkls.

Parameters

hklint | tuple | list | numpy.ndarray

The input hkl. If an int, or a list of ints, it just passes through (FIXME). If a tuple, treated as a single (h, k, l). If a list of lists/tuples, each is treated as an (h, k, l). If an numpy.ndarray, it is assumed to have shape (3, N) with the N (h, k, l) vectors stacked column-wise

masterbool, optional

If True, return the master hklID, else return the index from the external (sorted and reduced) list.

Returns

hkl_idslist

The list of requested hklID values associate with the input.

Notes

TODO: revisit this weird API???

Changes:

2020-05-21 (JVB) – modified to handle all symmetric equavlent reprs.

getHKLs(*hkl_ids: int, **kwargs) List[str] | ndarray[source]

Returns the powder HKLs subject to specified options.

Parameters

*hkl_idsint

Optional list of specific master hklIDs.

**kwargsdict
One or more of the following keyword arguments:
asStrbool

If True, return a list of strings. The default is False.

thisTThscalar | None

If not None, only return hkls overlapping the specified 2-theta (in radians). The default is None.

allHKLsbool

If True, then ignore exlcusions. The default is False.

Raises

TypeError

If an unknown kwarg is passed.

RuntimeError

If an invalid hklID is passed.

Returns

hklslist | numpy.ndarray

Either a list of hkls as strings (if asStr=True) or a vstacked array of hkls.

Notes

!!! the shape of the return value when asStr=False is the _transpose_

of the typical return value for self.get_hkls() and self.hkls! This _may_ change to avoid confusion, but going to leave it for now so as not to break anything.

2022/08/05 JVB:
  • Added functionality to handle optional hklID args

  • Updated docstring

getLatticeType()[source]
getMergedRanges(cullDupl: bool | None = False) Tuple[List[List[int]], List[List[float]]][source]

Return indices and ranges for specified planeData, merging where there is overlap based on the tThWidth and line positions

Parameters:

cullDupl(optional) bool

If True, cull duplicate 2-theta values (within sqrt_epsf). Defaults to False.

Returns:

List[List[int]]

List of indices for each merged range

List[List[float]]

List of merged ranges, (n x 2)

getMultiplicity(allHKLs: bool | None = False) ndarray[source]

Get the multiplicity for each hkl (number of symHKLs).

Paramters:

allHKLs(optional) bool

If True, return all multiplicities, even if they are excluded in the current planeData. Defaults to false.

Returns

np.ndarray

Array of multiplicities for each hkl

getNHKLs()[source]
getNhklRef() int[source]

Get the total number of hkl’s in the plane data, not ignoring ones that are excluded in exclusions.

Returns

int

The total number of hkl’s in the plane data.

getParams()[source]

Getter for the parameters of the plane data.

Returns

tuple

The parameters of the plane data. In the order of _lparams, _laueGroup, _wavelength, _strainMag, tThWidth

getPlaneSpacings() List[float][source]

Plane spacings for each hkl.

Returns:

List[float]

List of plane spacings for each hkl

getQSym()[source]
getSymHKLs(asStr: bool | None = False, withID: bool | None = False, indices: List[int] | None = None) List[List[str]] | List[ndarray][source]

Return all symmetry HKLs.

Parameters

asStrbool, optional

If True, return the symmetry HKLs as strings. The default is False.

withIDbool, optional

If True, return the symmetry HKLs with the hklID. The default is False. Does nothing if asStr is True.

indiceslist[inr], optional

Optional list of indices of hkls to include.

Returns

sym_hklslist list of strings, or list of numpy.ndarray

List of symmetry HKLs for each HKL, either as strings or as a vstacked array.

getTTh(allHKLs: bool | None = False) ndarray[source]

Get the 2-theta values for each hkl.

Parameters:

allHKLs(optional) bool

If True, return all 2-theta values, even if they are excluded in the current planeData. Default is False.

Returns:

np.ndarray

Array of 2-theta values for each hkl

getTThRanges(strainMag: float | None = None) ndarray[source]

Get the 2-theta ranges for included hkls

Parameters:

strainMagOptional[float]

Optional swag of strain magnitude

Returns:

np.ndarray:

hstacked array of hstacked tThLo and tThHi for each hkl (n x 2)

get_exclusions()[source]
property hedm_intensity: ndarray

HEDM (high energy x-ray diffraction microscopy) intensity for each hkl.

property hkls: ndarray

hStacked Hkls of the plane data (Miller indices).

invalidate_structure_factor(ucell: unitcell) None[source]

It can be expensive to compute the structure factor This method just invalidates it, providing a unit cell, so that it can be lazily computed from the unit cell.

Parameters:

unitcellunitcell

The unit cell to be used to compute the structure factor

property latVecOps: Dict[str, ndarray | float]

gets lattice vector operators as a new (deepcopy)

Returns:

Dict[str, np.ndarray | float]

Dictionary containing lattice vector operators

property laueGroup: str

This is the Schoenflies tag, describing symmetry group of the lattice. Note that setting this with incompatible lattice parameters will cause an error. If changing both, use set_laue_and_lparms.

str

property lparms: List[float]

Lattice parameters of the plane data.

Can be set as a List[float | valWUnit], but will be converted to List[float].

static makePlaneData(hkls: ndarray, lparms: ndarray, qsym: ndarray, symmGroup, strainMag, wavelength) Tuple[Dict[str, ndarray], Dict[str, ndarray | float], List[Dict]][source]

Generate lattice plane data from inputs.

Parameters:

hkls: np.ndarray

Miller indices, as in crystallography.latticePlanes

lparms: np.ndarray

Lattice parameters, as in crystallography.latticePlanes

qsym: np.ndarray

(4, n) containing quaternions of symmetry

symmGroup: str

Tag for the symmetry (Laue) group of the lattice. Can generate from ltypeOfLaueGroup

strainMag: float

Swag of strain magnitudes

wavelength: float

Wavelength

Returns:

dict:

Dictionary containing lattice plane data

dict:

Dictionary containing lattice vector operators

list:

List of dictionaries, each containing the data for one hkl

static makeScatteringVectors(hkls: ndarray, rMat_c: ndarray, bMat: ndarray, wavelength: float, chiTilt: float | None = None) Tuple[ndarray, ndarray, ndarray][source]

Static method for calculating g-vectors and scattering vector angles for specified hkls, subject to the bragg conditions specified by lattice vectors, orientation matrix, and wavelength

Parameters

hklsnp.ndarray

(3, n) array of hkls.

rMat_cnp.ndarray

(3, 3) rotation matrix from the crystal to the sample frame.

bMatnp.ndarray, optional

(3, 3) COB from reciprocal lattice frame to the crystal frame.

wavelengthfloat

xray wavelength in Angstroms.

chiTiltfloat, optional

0 <= chiTilt <= 90 degrees, defaults to 0

Returns

gVec_snp.ndarray

(3, n) array of g-vectors (reciprocal lattice) in the sample frame.

oangs0np.ndarray

(3, n) array containing the feasible (2-theta, eta, ome) triplets for each input hkl (first solution)

oangs1np.ndarray

(3, n) array containing the feasible (2-theta, eta, ome) triplets for each input hkl (second solution)

FIXME: must do testing on strained bMat

property powder_intensity: ndarray

Powder intensity for each hkl.

property q_sym: ndarray

Quaternions of symmetry for each hkl, generated from the Laue group

np.ndarray((4, n))

set_exclusions(exclusions)[source]
set_laue_and_lparms(laueGroup: str, lparms: List[valWUnit | float]) None[source]

Set the Laue group and lattice parameters simultaneously

When the Laue group changes, the lattice parameters may be incompatible, and cause an error in self._calc(). This function allows us to update both the Laue group and lattice parameters simultaneously to avoid this issue.

Parameters:

laueGroupstr

The symmetry (Laue) group to be set

lparmsList[valunits.valWUnit | float]

Lattice parameters to be set

property strainMag: float | None

Strain magnitude of the plane data.

float or None

property structFact: ndarray

Structure factors for each hkl.

np.ndarray

property tThMax: float | None

Maximum 2-theta value of the plane data.

float or None

property wavelength: float

Wavelength of the plane data.

Set as float or valWUnit.

Read as float

hexrd.material.crystallography.RetrieveAtomicFormFactor(elecNum, magG, sinThOverLamdaList, ffDataList)[source]

Interpolates between tabulated data to find the atomic form factor for an atom with elecNum electrons for a given magnitude of Q USAGE: ff = RetrieveAtomicFormFactor(elecNum,magG,sinThOverLamdaList,ffDataList) INPUTS: 1) elecNum, (1 x 1 float) number of electrons for atom of interest 2) magG (1 x 1 float) magnitude of G 3) sinThOverLamdaList (n x 1 float ndarray) form factor data is tabulated

in terms of sin(theta)/lambda (A^-1).

  1. ffDataList (n x m float ndarray) form factor data is tabulated in terms of sin(theta)/lambda (A^-1). Each column corresponds to a different number of electrons

OUTPUTS: 1) ff (n x 1 float) atomic form factor for atom and hkl of interest NOTES: Data should be calculated in terms of G at some point

hexrd.material.crystallography.convert_MillerBravias_direction_to_Miller(UVW)[source]

Converts 4-index hexagonal Miller-Bravais direction indices to 3-index Miller direction indices. Parameters ———- UVW : array_like

The (n, 3) array of non-redundant Miller-Bravais direction indices to convert.

Returns

numpy.ndarray

The (n, 3) array of Miller direction indices associated with the input Miller-Bravais indices.

Notes

  • NOT for plane normals!!!

hexrd.material.crystallography.convert_Miller_direction_to_MillerBravias(uvw, suppress_redundant=True)[source]

Converts 3-index hexagonal Miller direction indices to 4-index Miller-Bravais direction indices. Parameters ———- uvw : array_like

The (n, 3) array of 3-index hexagonal Miller indices to convert.

suppress_redundantbool, optional

Flag to suppress the redundant 3rd index. The default is True.

Returns

numpy.ndarray

The (n, 3) or (n, 4) array – depending on kwarg – of Miller-Bravis components associated with the input Miller direction indices.

Notes

  • NOT for plane normals!!!

hexrd.material.crystallography.convert_Miller_direction_to_cartesian(uvw, a=1.0, c=1.0, normalize=False)[source]

Converts 3-index hexagonal Miller direction indices to components in the crystal reference frame. Parameters ———- uvw : array_like

The (n, 3) array of 3-index hexagonal indices to convert.

ascalar, optional

The a lattice parameter. The default value is 1.

cscalar, optional

The c lattice parameter. The default value is 1.

normalizebool, optional

Flag for whether or not to normalize output vectors

Returns

numpy.ndarray

The (n, 3) array of cartesian components associated with the input direction indices.

Notes

  1. The [uv.w] the Miller-Bravais convention is in the hexagonal basis {a1, a2, a3, c}. The basis for the output, {o1, o2, o3}, is chosen such that o1 || a1 o3 || c o2 = o3 ^ o1

hexrd.material.crystallography.cosineXform(a: ndarray, b: ndarray, c: ndarray) tuple[numpy.ndarray, numpy.ndarray][source]

Spherical trig transform to take alpha, beta, gamma to expressions for cos(alpha*). See ref below.

[1] R. J. Neustadt, F. W. Cagle, Jr., and J. Waser, ``Vector algebra and

the relations between direct and reciprocal lattice quantities’’. Acta Cryst. (1968), A24, 247–248

Parameters

anp.ndarray

List of alpha angle values (radians).

bnp.ndarray

List of beta angle values (radians).

cnp.ndarray

List of gamma angle values (radians).

Returns

np.ndarray

List of cos(alpha*) values.

np.ndarray

List of sin(alpha*) values.

hexrd.material.crystallography.getDparms(lp: ndarray, lpTag: str, radians: bool | None = True) ndarray[source]

Utility routine for getting dparms, that is the lattice parameters without symmetry – ‘triclinic’

Parameters

lpnp.ndarray

Parsed lattice parameters

lpTagstr

Tag for the symmetry group of the lattice (from Laue group)

radiansbool, optional

Whether or not to use radians for angles, default is True

Returns

np.ndarray

The lattice parameters without symmetry.

hexrd.material.crystallography.getFriedelPair(tth0, eta0, *ome0, **kwargs)[source]

Get the diffractometer angular coordinates in degrees for the Friedel pair of a given reflection (min angular distance).

AUTHORS:

    1. Bernier – 10 Nov 2009

USAGE:

ome1, eta1 = getFriedelPair(tth0, eta0, *ome0,

display=False, units=’degrees’, convention=’hexrd’)

INPUTS:

  1. tth0 is a list (or ndarray) of 1 or n the bragg angles (2theta) for the n reflections (tiled to match eta0 if only 1 is given).

  2. eta0 is a list (or ndarray) of 1 or n azimuthal coordinates for the n reflections (tiled to match tth0 if only 1 is given).

  3. ome0 is a list (or ndarray) of 1 or n reference oscillation angles for the n reflections (denoted omega in [1]). This argument is optional.

  4. Keyword arguments may be one of the following:

Keyword Values|{default} Action ————– ————– ————– ‘display’ True|{False} toggles display to cmd line ‘units’ ‘radians’|{‘degrees’} sets units for input angles ‘convention’ ‘fable’|{‘hexrd’} sets conventions defining

the angles (see below)

‘chiTilt’ None the inclination (about Xlab) of

the oscillation axis

OUTPUTS:

  1. ome1 contains the oscialltion angle coordinates of the Friedel pairs associated with the n input reflections, relative to ome0 (i.e. ome1 = <result> + ome0). Output is in DEGREES!

  2. eta1 contains the azimuthal coordinates of the Friedel pairs associated with the n input reflections. Output units are controlled via the module variable ‘outputDegrees’

NOTES:

!!!: The ouputs ome1, eta1 are written using the selected convention, but

the units are alway degrees. May change this to work with Nathan’s global…

!!!: In the ‘fable’ convention [1], {XYZ} form a RHON basis where X is

downstream, Z is vertical, and eta is CCW with +Z defining eta = 0.

!!!: In the ‘hexrd’ convention [2], {XYZ} form a RHON basis where Z is

upstream, Y is vertical, and eta is CCW with +X defining eta = 0.

REFERENCES:

[1] E. M. Lauridsen, S. Schmidt, R. M. Suter, and H. F. Poulsen,

``Tracking: a method for structural characterization of grains in powders or polycrystals’’. J. Appl. Cryst. (2001). 34, 744–750

[2] J. V. Bernier, M. P. Miller, J. -S. Park, and U. Lienert,

``Quantitative Stress Analysis of Recrystallized OFHC Cu Subject to Deformed In Situ’’, J. Eng. Mater. Technol. (2008). 130. DOI:10.1115/1.2870234

hexrd.material.crystallography.hexagonalIndicesFromRhombohedral(hkl)[source]

converts rhombohedral hkl to hexagonal indices

hexrd.material.crystallography.hklToStr(hkl: ndarray) str[source]

Converts hkl representation to a string.

Parameters

hklnp.ndarray

3 element list of h, k, and l values (Miller indices).

Returns

str

Space-separated string representation of h, k, and l values.

hexrd.material.crystallography.latticeParameters(lvec)[source]

Generates direct and reciprocal lattice vector components in a crystal-relative RHON basis, X. The convention for fixing X to the lattice is such that a || x1 and c* || x3, where a and c* are direct and reciprocal lattice vectors, respectively.

hexrd.material.crystallography.latticePlanes(hkls: ndarray, lparms: ndarray, ltype: str | None = 'cubic', wavelength: float | None = 1.54059292, strainMag: float | None = None) Dict[str, ndarray][source]

Generates lattice plane data in the direct lattice for a given set of Miller indices. Vector components are written in the crystal-relative RHON basis, X. The convention for fixing X to the lattice is such that a || x1 and c* || x3, where a and c* are direct and reciprocal lattice vectors, respectively.

USAGE:

planeInfo = latticePlanes(hkls, lparms, **kwargs)

INPUTS:

  1. hkls (3 x n float ndarray) is the array of Miller indices for the planes of interest. The vectors are assumed to be concatenated along the 1-axis (horizontal).

  2. lparms (1 x m float list) is the array of lattice parameters, where m depends on the symmetry group (see below).

The following optional arguments are recognized:

  1. ltype=(string) is a string representing the symmetry type of the implied Laue group. The 11 available choices are shown below. The default value is ‘cubic’. Note that each group expects a lattice parameter array of the indicated length and order.

    latticeType lparms ———– ———— ‘cubic’ a ‘hexagonal’ a, c ‘trigonal’ a, c ‘rhombohedral’ a, alpha (in degrees) ‘tetragonal’ a, c ‘orthorhombic’ a, b, c ‘monoclinic’ a, b, c, beta (in degrees) ‘triclinic’ a, b, c, alpha, beta, gamma (in degrees)

  2. wavelength=<float> is a value represented the wavelength in Angstroms to calculate bragg angles for. The default value is for Cu K-alpha radiation (1.54059292 Angstrom)

  3. strainMag=None

OUTPUTS:

  1. planeInfo is a dictionary containing the following keys/items:

    normals (3, n) double array array of the components to the

    unit normals for each {hkl} in X (horizontally concatenated)

    dspacings (n, ) double array array of the d-spacings for

    each {hkl}

    tThetas (n, ) double array array of the Bragg angles for

    each {hkl} relative to the specified wavelength

NOTES:

*) This function is effectively a wrapper to ‘latticeVectors’.

See ‘help(latticeVectors)’ for additional info.

*) Lattice plane d-spacings are calculated from the reciprocal

lattice vectors specified by {hkl} as shown in Appendix 1 of [1].

REFERENCES:

[1] B. D. Cullity, ``Elements of X-Ray Diffraction, 2

ed.’’. Addison-Wesley Publishing Company, Inc., 1978. ISBN 0-201-01174-3

hexrd.material.crystallography.latticeVectors(lparms: ndarray, tag: str | None = 'cubic', radians: bool | None = False) Dict[str, ndarray | float][source]

Generates direct and reciprocal lattice vector components in a crystal-relative RHON basis, X. The convention for fixing X to the lattice is such that a || x1 and c* || x3, where a and c* are direct and reciprocal lattice vectors, respectively.

USAGE:

lattice = LatticeVectors(lparms, <symmTag>)

INPUTS:

  1. lparms (1 x n float list) is the array of lattice parameters, where n depends on the symmetry group (see below).

  2. tag (string) is a case-insensitive string representing the symmetry type of the implied Laue group. The 11 available choices are shown below. The default value is ‘cubic’. Note that each group expects a lattice parameter array of the indicated length and order.

    latticeType lparms ———– ———— ‘cubic’ a ‘hexagonal’ a, c ‘trigonal’ a, c ‘rhombohedral’ a, alpha (in degrees) ‘tetragonal’ a, c ‘orthorhombic’ a, b, c ‘monoclinic’ a, b, c, beta (in degrees) ‘triclinic’ a, b, c, alpha, beta, gamma (in degrees)

The following optional arguments are recognized:

  1. radians=<bool> is a boolean flag indicating usage of radians rather than degrees, defaults to false.

OUTPUTS:

  1. lattice is a dictionary containing the following keys/items:

    F (3, 3) double array transformation matrix taking

    componenents in the direct lattice (i.e. {uvw}) to the reference, X

    B (3, 3) double array transformation matrix taking

    componenents in the reciprocal lattice (i.e. {hkl}) to X

    BR (3, 3) double array transformation matrix taking

    componenents in the reciprocal lattice to the Fable reference frame (see notes)

    U0 (3, 3) double array transformation matrix

    (orthogonal) taking componenents in the Fable reference frame to X

    vol double the unit cell volume

    dparms (6, ) double list the direct lattice parameters:

    [a b c alpha beta gamma]

    rparms (6, ) double list the reciprocal lattice

    parameters: [a* b* c* alpha* beta* gamma*]

NOTES:

*) The conventions used for assigning a RHON basis,

X -> {x1, x2, x3}, to each point group are consistent with those published in Appendix B of [1]. Namely: a || x1 and c* || x3. This differs from the convention chosen by the Fable group, where a* || x1 and c || x3 [2].

*) The unit cell angles are defined as follows:

alpha=acos(b’*c/|b||c|), beta=acos(c’*a/|c||a|), and gamma=acos(a’*b/|a||b|).

*) The reciprocal lattice vectors are calculated using the

crystallographic convention, where the prefactor of 2*pi is omitted. In this convention, the reciprocal lattice volume is 1/V.

*) Several relations from [3] were employed in the component

calculations.

REFERENCES:

[1] J. F. Nye, ``Physical Properties of Crystals: Their

Representation by Tensors and Matrices’’. Oxford University Press, 1985. ISBN 0198511655

[2] E. M. Lauridsen, S. Schmidt, R. M. Suter, and H. F. Poulsen,

``Tracking: a method for structural characterization of grains in powders or polycrystals’’. J. Appl. Cryst. (2001). 34, 744–750

[3] R. J. Neustadt, F. W. Cagle, Jr., and J. Waser, ``Vector

algebra and the relations between direct and reciprocal lattice quantities’’. Acta Cryst. (1968), A24, 247–248

hexrd.material.crystallography.lorentz_factor(tth: ndarray) ndarray[source]

05/26/2022 SS adding lorentz factor computation to the detector so that it can be compenstated for in the intensity correction

Parameters

tth: np.ndarray

2-theta of every pixel in radians

Returns

np.ndarray

Lorentz factor for each pixel

hexrd.material.crystallography.polarization_factor(tth: ndarray, unpolarized: bool | None = True, eta: ndarray | None = None, f_hor: float | None = None, f_vert: float | None = None) ndarray[source]

06/14/2021 SS adding lorentz polarization factor computation to the detector so that it can be compenstated for in the intensity correction

05/26/2022 decoupling lorentz factor from polarization factor

parameters: tth two theta of every pixel in radians

if unpolarized is True, all subsequent arguments are optional eta azimuthal angle of every pixel f_hor fraction of horizontal polarization (~1 for XFELs) f_vert fraction of vertical polarization (~0 for XFELs)

notice f_hor + f_vert = 1

FIXME, called without parameters like eta, f_hor, f_vert, but they default to none in the current implementation, which will throw an error.

hexrd.material.crystallography.processWavelength(arg: valWUnit | float) float[source]

Convert an energy value to a wavelength. If argument has units of length or energy, will convert to globally specified unit type for wavelength (dUnit). If argument is a scalar, assumed input units are keV.

hexrd.material.crystallography.revertOutputDegrees() None[source]

Revert the effect of tempSetOutputDegrees(), resetting the outputDegrees flag to its previous value (True to output in degrees, False for radians).

Returns

None

hexrd.material.crystallography.rhombohedralIndicesFromHexagonal(HKL)[source]

converts hexagonal hkl to rhombohedral indices

hexrd.material.crystallography.rhombohedralParametersFromHexagonal(a_h, c_h)[source]

converts hexagonal lattice parameters (a, c) to rhombohedral lattice parameters (a, alpha)

hexrd.material.crystallography.tempSetOutputDegrees(val: bool) None[source]

Set the global outputDegrees flag temporarily. Can be reverted with revertOutputDegrees().

Parameters

valbool

True to output angles in degrees, False to output angles in radians.

Returns

None