Ejemplo n.º 1
0
 def set_miscut(self, xyz, angle, add_miscut=False):
     """Calculate U matrix using a miscut axis and an angle"""
     if xyz is None:
         rot_matrix = xyz_rotation([0, 1, 0], angle)
     else:
         rot_matrix = self._tobj.transform(xyz_rotation(xyz, angle))
     if self.is_ub_calculated() and add_miscut:
         new_U = rot_matrix * self._U
     else:
         new_U = rot_matrix
     self.set_U_manually(new_U, False)
     self.print_surface()
     self.save()
Ejemplo n.º 2
0
    def testSetub(self):
        self.ub.newub('testsetub_custom')
        self.ub.setlat('NaCl', 1.1)
        zrot = xyz_rotation([0, 0, 1], self.t_hand * 30. * TORAD)
        self.ub.setu(zrot.tolist())

        mneq_(self.ub.ubcalc.UB, self.xrot * self.ub.ubcalc._state.crystal.B)
Ejemplo n.º 3
0
 def setup_method(self):
     TestUBCommandsYou.setup_method(self)
     inv = matrix([[0, 0, 1], [0, 1, 0], [1, 0, 0]])
     self.xrot = xyz_rotation([1, 0, 0], 30. * TORAD)
     self.t_matrix = inv * self.xrot
     self.t_hand = -1
     settings.geometry = SixCircle(beamline_axes_transform=self.t_matrix.I)
Ejemplo n.º 4
0
 def calc_hkl_offset(self, h, k, l, pol, az):
     """
     Calculate hkl orientation values that are related to
     the input hkl values by rotation with a given polar
     and azimuthal angles
     """
     hkl_nphi = self._UB * matrix([[h], [k], [l]])
     y_axis = cross3(hkl_nphi, matrix('0; 1; 0'))
     if norm3(y_axis) < SMALL:
         y_axis = cross3(hkl_nphi, matrix('0; 0; 1'))
     rot_polar = xyz_rotation(y_axis.T.tolist()[0], pol)
     rot_azimuthal = xyz_rotation(hkl_nphi.T.tolist()[0], az)
     hklrot_nphi = rot_azimuthal * rot_polar * hkl_nphi
     hklrot = self._UB.I * hklrot_nphi
     hkl_list = hklrot.T.tolist()[0]
     return hkl_list
Ejemplo n.º 5
0
    def testSetub(self):
        self.ub.newub('testsetub_custom')
        self.ub.setlat('NaCl', 1.1)
        zrot = xyz_rotation([0, 0 , 1], 30. * TORAD)
        self.ub.setu(zrot.tolist())

        mneq_(self.ub.ubcalc.UB, self.conv.transform(self.zrot) * self.ub.ubcalc._state.crystal.B)
Ejemplo n.º 6
0
 def setup_method(self):
     settings.ubcalc_persister = UbCalculationNonPersister()
     inv = matrix([[0, 0, -1], [0, 1, 0], [1, 0, 0]])
     self.zrot = xyz_rotation([0, 0 ,1], 30. * TORAD)
     self.t_matrix = inv * self.zrot
     self.t_hand = 1
     settings.geometry = SixCircle(beamline_axes_transform=self.t_matrix)
     settings.ubcalc_strategy = YouUbCalcStrategy()
     settings.angles_to_hkl_function = youAnglesToHkl
     settings.Pos = YouPositionScenario
     _UBCommandsBase.setup_method(self)
Ejemplo n.º 7
0
 def set_miscut(self, xyz, angle, add_miscut=False):
     """Calculate U matrix using a miscut axis and an angle"""
     if xyz is None:
         rot_matrix = xyz_rotation([0, 1, 0], angle)
         if self.is_ub_calculated() and add_miscut:
             self._U = rot_matrix * self._U
         else:
             self._U = rot_matrix
     else:
         rot_matrix = xyz_rotation(xyz, angle)
         try:
             rot_matrix = self._ROT * rot_matrix * self._ROT.I
         except TypeError:
             pass
         if self.is_ub_calculated() and add_miscut:
             self._U = rot_matrix * self._U
         else:
             self._U = rot_matrix
     self._state.configure_calc_type(manual_U=self._U)
     self._UB = self._U * self._state.crystal.B
     self.print_reference()
     self.save()