Table Of Contents

Previous topic

iplt module: General classes for crystallographic processing

Next topic

Spatial and Reciprocal Unit Cells


Encapsulates a lattice defined by two lattice vectors \vec{a} and \vec{b}, an origin \vec{o}, a barrel distortion K_{b} and a spiral distortion K_{s}. The vector \vec{l} of a lattice point at index (h,k) is given by the following formula:

\vec{l}=\vec{o}+\left(\begin{array}{cc} 1+K_{b}\left|h\vec{a}+k\vec{b}\right|^{2} & K_{s}\left|h\vec{a}+k\vec{b}\right|^{2}\\ -K_{s}\left|h\vec{a}+k\vec{b}\right|^{2} & 1+K_{b}\left|h\vec{a}+k\vec{b}\right|^{2} \end{array}\right)\left(h\vec{a}+k\vec{b}\right)

For zero distortion constants, this simplifies to \vec{l}=\vec{o}+h\vec{a}+k\vec{b}. All values are dimensionless, but since a lattice is usually determined and/or used for an image, it’s units should be considered to be pixels.


import iplt
lat=iplt.Lattice(Vec2(10,0), Vec2(0,15), Vec2(50,50))
print lat.CalcPosition(Point(10,10))
print lat.CalcPosition(Point(10,10))

Python interface

class iplt.Lattice((object)self)

A lattice consists of two non-parallel vectors and a specific offset. Since it is usually associated with an image, its units are meant to be pixels!

CalcComponents((Lattice)self, (Vec2)v) → Vec2 :
returns the lattice components of a point
CalcComponents( (Lattice)self, (Point)p) -> Vec2 :
returns the lattice components of a point
CalcPosition((Lattice)self, (Vec2)hk) → Vec2 :
returns position based on index
CalcPosition( (Lattice)self, (Point)hk) -> Vec2 :
returns position based on index
DistanceTo((Lattice)self, (Vec2)v) → float :
calc distance of a point to nearest lattice point
DistanceTo( (Lattice)self, (Point)p) -> float :
calc distance of a point to nearest lattice pointt
GetBarrelDistortion((Lattice)self) → float :

returns barrel distortion

GetFirst((Lattice)self) → Vec2 :

returns first vector

GetOffset((Lattice)self) → Vec2 :

returns offset vector

GetSecond((Lattice)self) → Vec2 :

returns second vector

GetSpiralDistortion((Lattice)self) → float :

returns spiral distortion

SetBarrelDistortion((Lattice)self, (float)k3) → None :

sets barrel distortion

SetFirst((Lattice)self, (Vec2)v) → None :

sets first vector

SetOffset((Lattice)self, (Vec2)v) → None :

sets offset vector

SetSecond((Lattice)self, (Vec2)v) → None :

sets second vector

SetSpiralDistortion((Lattice)self, (float)s3) → None :

sets spiral distortion

__init__((object)self) → None :
default is {1,0} {0,1} {0,0}
__init__( (object)self, (Vec2)v1, (Vec2)v2 [, (Vec2)offset=geom.Vec2(0, 0)]) -> None :
initialization with two non-parallel vectors and optional offset
__init__( (object)self, (Vec2)v1, (Vec2)v2, (Vec2)offset, (float)k3, (float)s3) -> None :
initialization with two non-parallel vectors, offset, barrel- and spiral distortion
__init__( (object)self, (Vec2)v1, (Point)p1, (Vec2)v2, (Point)p2, (Vec2)v3, (Point)p3, (float)k3 [, (float)s3=0]) -> None :
initialization based on three positions, their lattice indices and barrel- and spiral-distortion
iplt.InvertLattice((Lattice)arg1) → Lattice :

invert domain of lattice spatial <-> reciprocal

The inversion is defined by:

P_{inv}=\frac{1}{D}\left(\begin{array}{cc} -q_y \\ q_x \end{array}\right),Q_{inv}=\frac{1}{D}\left(\begin{array}{cc} p_y \\ -p_x \end{array}\right), D=p_yq_x-p_xq_y

C++ Interface