ImageD11.unitcell module#

ImageD11.unitcell.A(h, k, l)#
ImageD11.unitcell.B(h, k, l)#
ImageD11.unitcell.BTmat(h1, h2, B, BI)#

used for computing orientations

ImageD11.unitcell.C(h, k, l)#
ImageD11.unitcell.F(h, k, l)#
ImageD11.unitcell.I(h, k, l)#
ImageD11.unitcell.P(h, k, l)#
class ImageD11.unitcell.Phases(filename=None)#

Bases: AnalysisSchema

Phases class - extends AnalysisSchema from xfab.parameters Reads analysis parameters from file Contains self.unitcells which is a dict of unitcell objects

add_phase_from_unitcell(phase_name, unitcell)#

Add phase from unitcell object

phase_name: the name of the phase unitcell: the unitcell object

get_unitcells()#
ImageD11.unitcell.R(h, k, l)#
ImageD11.unitcell.cellfromstring(s)#
ImageD11.unitcell.cosangles_many(ha, hb, gi)#

Finds the cosines of angles between two lists of hkls in reciprocal metric gi

ImageD11.unitcell.cross(a, b)#

a x b has length |a||b|sin(theta)

ImageD11.unitcell.degrees(x)#
ImageD11.unitcell.filter_pairs(h1, h2, c2a, B, BI, tol=1e-05)#

remove duplicate pairs for orientation searches h1 = reflections of ring1, N1 peaks h2 = reflections of ring2, N2 peaks c2a = cos angle between them, N1xN2 B = B matrix in reciprocal space BI = inverse in real space

ImageD11.unitcell.laue_misfit(g, spacegroup, cell_choice='standard')#

Largest change of the real space metric tensor g under the Laue class rotations of spacegroup, relative to g. Zero when the cell has the symmetry.

ImageD11.unitcell.norm2(a)#

Compute the unit 2 norm

ImageD11.unitcell.orient_BL(B, h1, h2, g1, g2)#

Algorithm was intended to follow this one using 2 indexed reflections. W. R. Busing and H. A. Levy. 457. Acta Cryst. (1967). 22, 457

ImageD11.unitcell.radians(x)#
ImageD11.unitcell.ubi_equiv(ubilist, ublist, tol=1e-08)#

Two ubi are considered equivalent if they both index the peaks in the HKL0 array exactly

ImageD11.unitcell.unit(a)#

Normalise vector a to unit length

class ImageD11.unitcell.unitcell(lattice_parameters, symmetry='P', verbose=0, name=None, sgname=None)#

Bases: object

anglehkls(h1, h2)#

Compute the angle between reciprocal lattice vectors h1, h2

ds(h)#

computes 1/d for this hkl = hgh

classmethod from_cif(filename, name=None)#

Import a unitcell object from a CIF file

classmethod from_par_file(filename)#

Produce a unitcell from a .par file

classmethod from_pars(pars)#

Produce a unitcell from a parameter dict/object

get_ipf_colour(UBs, axis=array([0., 0., 1.]), key='tsl', view='default', backend='rgb_colors')#

IPF colour(s) in the laboratory frame for a list of UB matrices, see get_ipf_colour_from_ubi axis is an axis vector in the laboratory frame backend “orix”: see get_ipf_colour_from_orix_orien

get_ipf_colour_fast(Us, axis=array([0., 0., 1.]), key='tsl', view='default', backend='rgb_colors')#

IPF colour(s) in the laboratory frame for a list of U matrices, with the metric of this unitcell, see get_ipf_colour_from_ubi axis is an axis vector in the laboratory frame backend “orix”: see get_ipf_colour_from_orix_orien

get_ipf_colour_from_orix_orien(orix_orien, axis=array([0., 0., 1.]), key='tsl', view='default', backend='rgb_colors')#

IPF colour(s) (n, 3) in the laboratory frame from an orix orientation made with self.orix_phase, see get_ipf_colour_from_ubi axis is an axis vector in the laboratory frame backend “orix”: orix IPFColorKeyTSL (Nolze, 2016) 10.1107/S1600576716012942, key “tsl” only

get_ipf_colour_from_ubi(ubis, axis=array([0., 0., 1.]), key='tsl', view='default')#

IPF colours (n, 3) in the laboratory frame of ubi matrices (n, 3, 3) with the point group of this unitcell: ImageD11.rgb_colors.ubi_to_rgb (MTEX 7.2 keys, Nolze and Hielscher 2016, 10.1107/S1600576716012942). Each ubi uses its own metric. axis is an axis vector in the laboratory frame key is “tsl” or “hsv”, view an MTEX how2plot (“default” or e.g. “+c*|+a”)

get_orix_orien(UBs)#

Get an Orix orientation (containing one or more orientations) using self.orix_phase from an array of ImageD11 UB matrices

get_orix_orien_fast(Umats)#

NOTE - Supply U not UB! Get an Orix orientation (containing one or more orientations) using self.orix_phase from an array of ImageD11 U matrices.

get_ubi_from_orix_orien(orix_orien)#

The ImageD11 ubi matrices (…, 3, 3) of an orix orientation made with self.orix_phase (the inverse of get_orix_orien_fast)

getanglehkls(ring1, ring2)#

Cache the previous pairs called for sorted by cos2angle

getcoses(ring1, ring2, tol=1e-05)#

Distinct cosines between hkls of ring1 and ring2, descending, with 180 degree pairs removed and near-duplicates collapsed.

Cached per ring pair – indexer.find rebuilt this on every call, and it depends only on the rings and the cell.

gethkls(dsmax)#

Generate hkl list Argument dsmax is the d* limit (eg 1/d) Default of zero gives only the (000) reflection

assumes [h|k|l] < 200

gethkls_xfab(dsmax, spg=None)#

Generate hkl list Argument dsmax is the d* limit (eg 1/d) Argument spg is the space group name, e.g. ‘R3-c’

property ipf_group#

The point group of the space group, as a name for ImageD11.rgb_colors

makerings(limit, tol=0.001)#

Makes a list of computed powder rings The tolerance is the difference in d* to decide if two peaks overlap

orient(ring1, g1, ring2, g2, verbose=0, crange=-1.0)#

Compute an orientation matrix using cell parameters and the indexing of two reflections

Orientation matrix: A matrix such that h = A^1 g define 3 vectors t1,t2,t3 t1 is parallel to first peak (unit vector along g1) t2 is in the plane of both (unit vector along g1x(g1xg2)) t3 is perpendicular to both (unit vector along g1xg2)

property orix_phase#

Get this unitcell as an Orix Phase object. Useful for pole figures / IPF colours

ringtths(wavelength)#

Computes the two theta values of powder rings, given a wavelength. makerings must be called beforehand.

to_par_dict()#

Return a parameter dict

to_par_file(filename)#

Write lattice parameters to file as an ImageD11 .par

to_par_obj()#

Return an ImageD11.parameters.parameters object

tostring()#

Write out a line containing unit cell information

ImageD11.unitcell.unitcell_from_parameters(pars)#