示例#1
0
 def testSwapReflection(self):
     self.reflist.swap_reflections(1, 2)
     pos = Pos(0.11, 0.22, 0.33, 0.44, 0.55, 0.66)
     assert (self.reflist.getReflection(1) == ([1.1, 2.2, 3.3], pos, 1100,
                                               "ref2", self.time))
     pos = Pos(0.1, 0.2, 0.3, 0.4, 0.5, 0.6)
     assert (self.reflist.getReflection(2) == ([1, 2, 3], pos, 1000, "ref1",
                                               self.time))
示例#2
0
 def test_with_squarely_mounted(self):
     href = ((1, 0, 0),
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=0, phi=0))
     lref = ((0, 0, 1),
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=90, phi=0))
     pairs = (("hl", href, lref, I), ("lh", lref, href, I))
     for testname, ref1, ref2, u in pairs:
         yield self.check, testname, ref1, ref2, u
示例#3
0
 def test_with_y_mismount(self):
     U = y_rotation(ROT)
     href = ((1, 0, 0),
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=0 - ROT, phi=0))
     lref = ((0, 0, 1),
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=90 - ROT, phi=0))
     pairs = (("hl", href, lref, U), ("lh", lref, href, U))
     for testname, ref1, ref2, u in pairs:
         yield self.check, testname, ref1, ref2, u
示例#4
0
 def testedit_reflection(self):
     ps = Pos(0.1, 0.2, 0.3, 0.4, 0.5, 0.6)
     self.reflist.edit_reflection(1, 10, 20, 30, ps, 1000, "new1",
                                  self.time)
     assert (self.reflist.getReflection(1) == ([10, 20, 30], ps, 1000,
                                               "new1", self.time))
     pos = Pos(0.11, 0.22, 0.33, 0.44, 0.55, 0.66)
     assert (self.reflist.getReflection(2) == ([1.1, 2.2, 3.3], pos, 1100,
                                               "ref2", self.time))
示例#5
0
 def setup_method(self):
     self._geometry = SixCircleGammaOnArmGeometry()
     self.reflist = ReflectionList(self._geometry,
                                   ['a', 'd', 'g', 'o', 'c', 'p'])
     self.time = datetime.now()
     pos = Pos(0.1, 0.2, 0.3, 0.4, 0.5, 0.6)
     self.reflist.add_reflection(1, 2, 3, pos, 1000, "ref1", self.time)
     pos = Pos(0.11, 0.22, 0.33, 0.44, 0.55, 0.66)
     self.reflist.add_reflection(1.1, 2.2, 3.3, pos, 1100, "ref2",
                                 self.time)
示例#6
0
 def test_with_z_mismount(self):
     U = z_rotation(ROT)
     href = ((1, 0, 0),
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=0, phi=0 + ROT))
     lref = ((0, 0, 1),  # phi degenerate
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=90, phi=67))
     pairs = (("hl", href, lref, U),
              ("lh", lref, href, U))
     for testname, ref1, ref2, u in pairs:
         yield self.check, testname, ref1, ref2, u
    def testMapDefaultSector(self):

        eq_(self.map(Pos(1, 2, 3, 4, 5, 6)), (1, 2, 3, 4, 5, 6))

        eq_(self.map(Pos(-180, -179, 0, 179, 180, 359)),
            (-180, -179, 0, 179, 180, 359))

        eq_(self.map(Pos(0, 0, 0, 0, 0, 0)), (0, 0, 0, 0, 0, 0))

        eq_(self.map(Pos(-270, 270, 0, 0, 0, -90)), (90, -90, 0, 0, 0, 270))
示例#8
0
 def test_with_squarely_mounted(self):
     href = ((1, 0, 0),
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=0, phi=0))
     href_b = ((1, 0, 0),
               Pos(alpha=0, delta=60, gamma=0, omega=30 + 90, chi=90,
                   phi=-90))
     lref = ((0, 0, 1),  # degenerate in phi
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=90, phi=67))
     pairs = (("h", href, I),
              ("hb", href_b, I),
              ("l", lref, I))
     for testname, ref, u in pairs:
         yield self.check, testname, ref, u
    def testMapSector1(self):
        self.transform_commands._sectorSelector.setSector(1)

        eq_(self.map(Pos(1, 2, 3, 4, 5, 6)),
            (1, 2, 3, 4 - 180, -5, (6 - 180) + 360))

        eq_(self.map(Pos(-180, -179, 0, 179, 180, 359)),
            (-180, -179, 0, 179 - 180, -180, 359 - 180))

        eq_(self.map(Pos(0, 0, 0, 0, 0, 0)),
            (0, 0, 0, 0 - 180, 0, (0 - 180) + 360))

        eq_(self.map(Pos(-270, 270, 0, 0, 0, -90)),
            (90, -90, 0, 0 - 180, 0, 270 - 180))
    def testMapAutoSector(self):
        self.transform_commands._sectorSelector.addAutoTransorm(1)
        self.hardware.set_lower_limit('c', 0)

        eq_(self.map(Pos(1, 2, 3, 4, -5, 6)),
            (1, 2, 3, 4 - 180, 5, (6 - 180) + 360))

        eq_(self.map(Pos(-180, -179, 0, 179, -180, 359)),
            (-180, -179, 0, 179 - 180, 180, 359 - 180))

        eq_(self.map(Pos(0, 0, 0, 0, -5, 0)),
            (0, 0, 0, 0 - 180, 5, (0 - 180) + 360))

        eq_(self.map(Pos(-270, 270, 0, 0, -5, -90)),
            (90, -90, 0, 0 - 180, 5, 270 - 180))
示例#11
0
 def test_with_z_mismount_k(self):
     U = z_rotation(ROT)
     kref = ((0, 1, 0),
             Pos(alpha=0,
                 delta=60,
                 gamma=0,
                 omega=30 + 90,
                 chi=0,
                 phi=0 + ROT))
     self.check("k", kref, U),
示例#12
0
 def test_with_z_mismount_l(self):
     U = z_rotation(ROT)
     lref = ((0, 0, 1),  # phi degenerate
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=90, phi=67))
     self.check("l", lref, I)  # TODO: can't pass - word instructions
示例#13
0
    def test_with_z_mismount_h(self):
        U = z_rotation(ROT)

        href = ((1, 0, 0),
                Pos(alpha=0, delta=60, gamma=0, omega=30, chi=0, phi=0 + ROT))
        self.check("h", href, U)
示例#14
0
 def test_with_y_mismount_l(self):
     U = y_rotation(ROT)
     lref = ((0, 0, 1),
             Pos(alpha=0, delta=60, gamma=0, omega=30, chi=90 - ROT, phi=0))
     self.check("l", lref, U)
示例#15
0
 def test_with_y_mismount_k(self):
     U = y_rotation(ROT)
     kref = ((0, 1, 0),
             Pos(alpha=0, delta=60, gamma=0, omega=30 + 90, chi=90, phi=0))
     self.check("k", kref, I)  # TODO: can't pass - word instructions
示例#16
0
 def testGetReflection(self):
     answered = self.reflist.getReflection(1)
     pos = Pos(0.1, 0.2, 0.3, 0.4, 0.5, 0.6)
     desired = ([1, 2, 3], pos, 1000, "ref1", self.time)
     assert answered == desired
示例#17
0
 def testRemoveReflection(self):
     self.reflist.removeReflection(1)
     answered = self.reflist.getReflection(1)
     pos = Pos(0.11, 0.22, 0.33, 0.44, 0.55, 0.66)
     desired = ([1.1, 2.2, 3.3], pos, 1100, "ref2", self.time)
     assert answered == desired