示例#1
0
 def set_spec_G(self, G, preparsed=False):
     """
     Take the spec G array for the psic geometry
     and set all the relevant orientation info...
     """
     if not preparsed:
         (cell, or0, or1, n) = spec_psic_G(G)
     else:
         (cell, or0, or1, n) = G
     self.n = n
     self.or0 = or0
     self.or1 = or1
     self.lattice = Lattice(*cell)
     self._calc_UB()
示例#2
0
    def __init__(self,
                 a=10.,
                 b=10.,
                 c=10.,
                 alpha=90.,
                 beta=90.,
                 gamma=90.,
                 lam=1.0):
        """
        Initialize

        Parameters:
        -----------
        * a,b,c in angstroms 
        * alpha, beta, gamma in degrees,
        * lambda in angstroms
        """
        # set lattice and lambda
        self.lattice = Lattice(a, b, c, alpha, beta, gamma, lam)

        # hold gonio angles
        self.angles = {
            'phi': 0.0,
            'chi': 0.0,
            'eta': 0.0,
            'mu': 0.0,
            'nu': 0.0,
            'delta': 0.0
        }

        # hold psuedo angles
        self.pangles = {}
        self.calc_psuedo = True

        # hold n (reference) vector in HKL
        # eg surface normal vector for psuedo angles
        self.n = num.array([0., 0., 1.], dtype=float)

        # Z and calc h
        self.Z = []
        self.Q = []
        self.ki = []
        self.kr = []
        self.h = [0., 0., 0.]

        # dummy primary reflection
        tth = self.lattice.tth([0., 0., 1.], lam=lam)
        self.or0 = {
            'h': num.array([0., 0., 1.]),
            'phi': 0.0,
            'chi': 0.0,
            'eta': 0.0,
            'mu': tth / 2.,
            'nu': tth,
            'delta': 0.0,
            'lam': lam
        }

        # dummy secondary reflection
        tth = self.lattice.tth([0., 1., 0.], lam=lam)
        self.or1 = {
            'h': num.array([0., 1., 0.]),
            'phi': 0.0,
            'chi': 0.0,
            'eta': tth / 2.,
            'mu': 0.0,
            'nu': 0.0,
            'delta': tth,
            'lam': lam
        }

        # Compute OR matricies
        self.U = []
        self.B = []
        self.UB = []
        self._calc_UB()