ImageD11.lattice_reduction module#

exception ImageD11.lattice_reduction.BadVectors#

Bases: Exception

Raised by lattice class when vectors are coplanar or colinear

ImageD11.lattice_reduction.checkvol(v1, v2, v3, min_vec2=1e-18)#

Check whether vectors are singular

ImageD11.lattice_reduction.cosangle_vec(ubi, v)#

Angle between v in real and reciprocal space eg, is a* parallel to a or not?

ImageD11.lattice_reduction.find_lattice(vecs, min_vec2=1, n_try=None, test_vecs=None, tol=0.1, fraction_indexed=0.9, noisy=False)#

vecs - vectors to use to generate the lattice min_vec2 - squared length of min_vec (units as vec) n_try - max number of vecs to test (clips vecs for generating) test_vecs - vectors to index with the unit cell (else use vecs) fraction_indexed - whether or not to return cells

ImageD11.lattice_reduction.fparl(x, y)#

fraction of x parallel to y

ImageD11.lattice_reduction.get_options(parser)#
ImageD11.lattice_reduction.iter3d(n)#

Generate all possible unordered combinations of vectors i,j,k for i,j,k < n

This looping was rewritten thanks to: TAOCP V4 fascicle 3, section 7.2.1.3.

It gives much nicer ordering than previously, as is gradually expands down the list, instead of hammering the start

ImageD11.lattice_reduction.iter3d_old(n)#

Generate all possible unordered combinations of vectors i,j,k for i,j,k < n

class ImageD11.lattice_reduction.lattice(v1, v2, v3, direction=None, min_vec2=1e-18)#

Bases: object

Represents a 3D crystal lattice built from 3 vectors

flip(v)#

See also __init__.__doc__

matrix(direction)#
nearest(vecs)#

Give back the nearest lattice point indices, in the same direction

remainders(vecs)#

Difference between vecs and closest lattice points

score(vecs, tol=0.1, debug=False)#

How many peaks have integer error less than tol?

withvec(x, direction='col')#

Try to fit x into the lattice Make the remainder together with current vectors Index it as hkl indices whichever vector has the biggest projection is replaced remake the lattice with these 3 vectors

ImageD11.lattice_reduction.mod(x, y)#

Returns the part of x with integer multiples of y removed assert that ||mod(x,y)|| <= ||x|| for all y

ImageD11.lattice_reduction.reduce(v1, v2, v3, min_vec2=1e-18)#

Try to find a reduced lattice basis of v1, v2, v3

ImageD11.lattice_reduction.rsweep(vl)#

One sweep subtracting each from other two This idea comes from Knuth TAOCP sec 3.3.4C

ImageD11.lattice_reduction.search_2folds(ubi)#

Inspired by the Yvon Lepage’s method for finding lattice symmetry Check for 2 fold axes by measuring the directions between real and reciprocal vectors with the same indices. In the case of 2 fold axes they should be parallel

ImageD11.lattice_reduction.sortvec_len(vl)#

Sorts according to length (d-s-u)

ImageD11.lattice_reduction.sortvec_xyz(vl)#

For each choose between x, -x Sorts according to x then y then z components