ImageD11.lattice_reduction
index
/sware/exp/fable/standalone/redhate4-a64/lib/python2.5/site-packages/ImageD11/lattice_reduction.py

 
Modules
       
logging

 
Classes
       
__builtin__.object
lattice
exceptions.Exception(exceptions.BaseException)
BadVectors

 
class BadVectors(exceptions.Exception)
    Raised by lattice class when vectors are coplanar or colinear
 
 
Method resolution order:
BadVectors
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x2a9578dec0>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class lattice(__builtin__.object)
    Represents a 3D crystal lattice built from 3 vectors
 
  Methods defined here:
__init__(self, v1, v2, v3, direction=None, min_vec2=1.0000000000000001e-18)
Make the lattice 
Currently v1, v2, v3 are vectors - which gives 3D
direction [ 'row' | 'col' ] - if none read from v1, v2, v3
... means they are row direction lattice vectors or measured scattering
    vectors from crystallography
It will attempt to find a primitive basis from the supplied vectors
 
These are put together in the following way:
 
   gv = [ [ g0x , g0y, g0z ],
          [ g1x , g1y, g1z ],     <-- g is a row vector
          [ g2x , g2y, g2z ],
          [ g3x , g3y, g3z ],
          [ g4x , g4y, g4z ] ]
 
[ h, k, l ]  = [ [ col0x  col0y  col0z ] ] [ gx ]
               |   -------------------   | [    ]
               | [ col1x  col1y  col1z ] | [ gy ]
               |   -------------------   | [    ]
               [ [ col2x  col2y  col2z ] ] [ gz ]
 
This matrix of column vectors is often called 
 
or ...  h.T  =  dot(r2c, g.T)
   ...  since h is column vector - appears here as a row vecot
   ...  Note that numpy.dot transposes its result
        eg:   s = (3,4) ; 
        assert dot(zeros( (3,3) ), zeros( s )).shape == s
        This is a double head screwing up error. 
                    
[ gx  gy  gz ]  = [  -------   -------   -------      [ hx ]
                  [ [ row0x ] [ row1y ] [ row2z ] ]   [    ]
                  [ | row0y | [ row1y ] [ row2z ] ]   [ hy ]
                  [ [ row0z ] [ row1y ] [ row2z ] ]   [    ]
                  [  -------   -------   -------      [ hz ]
 
... due to the double head screwing (dot transposes its result)
    we then have to transpose this too
flip(self, v)
See also __init__.__doc__
matrix(self, direction)
nearest(self, vecs)
Give back the nearest lattice point indices, 
in the same direction
remainders(self, vecs)
Difference between vecs and closest lattice points
score(self, vecs, tol=0.10000000000000001, debug=False)
How many peaks have integer error less than tol?
withvec(self, 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

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
array(...)
array(object, dtype=None, copy=1,order=None, subok=0,ndmin=0)
 
Return an array from object with the specified date-type.
 
Inputs:
  object - an array, any object exposing the array interface, any
            object whose __array__ method returns an array, or any
            (nested) sequence.
  dtype  - The desired data-type for the array.  If not given, then
            the type will be determined as the minimum type required
            to hold the objects in the sequence.  This argument can only
            be used to 'upcast' the array.  For downcasting, use the
            .astype(t) method.
  copy   - If true, then force a copy.  Otherwise a copy will only occur
            if __array__ returns a copy, obj is a nested sequence, or
            a copy is needed to satisfy any of the other requirements
  order  - Specify the order of the array.  If order is 'C', then the
            array will be in C-contiguous order (last-index varies the
            fastest).  If order is 'FORTRAN', then the returned array
            will be in Fortran-contiguous order (first-index varies the
            fastest).  If order is None, then the returned array may
            be in either C-, or Fortran-contiguous order or even
            discontiguous.
  subok  - If True, then sub-classes will be passed-through, otherwise
            the returned array will be forced to be a base-class array
  ndmin  - Specifies the minimum number of dimensions that the resulting
            array should have.  1's will be pre-pended to the shape as
            needed to meet this requirement.
checkvol(v1, v2, v3, min_vec2=1.0000000000000001e-18)
Check whether vectors are singular
dot(...)
find_lattice(vecs, min_vec2=1, n_try=None, test_vecs=None, tol=0.10000000000000001, fraction_indexed=0.90000000000000002, 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
fparl(x, y)
fraction of x parallel to y
get_options(parser)
iter3d(n)
Generate all possible unordered combinations of vectors i,j,k
for i,j,k < n
mod(x, y)
Returns the part of x with integer multiples of y removed
assert that ||mod(x,y)|| <= ||x|| for all y
reduce(v1, v2, v3, min_vec2=1.0000000000000001e-18)
Try to find a reduced lattice basis of v1, v2, v3
rsweep(vl)
One sweep subtracting each from other two 
This idea comes from Knuth TAOCP sec 3.3.4C
sortvec_len(vl)
Sorts according to length (d-s-u)
sortvec_xyz(vl)
For each choose between x, -x
Sorts according to x then y then z components
where(...)
where(condition, | x, y)
 
The result is shaped like condition and has elements of x and y where
condition is respectively true or false.  If x or y are not given,
then it is equivalent to condition.nonzero().
 
To group the indices by element, rather than dimension, use
 
    transpose(where(condition, | x, y))
 
instead. This always results in a 2d array, with a row of indices for
each element that satisfies the condition.
zeros(...)
zeros((d1,...,dn),dtype=float,order='C')
 
Return a new array of shape (d1,...,dn) and type typecode with all
it's entries initialized to zero.

 
Data
        DEBUG = False
MIN_VEC2 = 1.0000000000000001e-18
fabs = <ufunc 'fabs'>
sqrt = <ufunc 'sqrt'>