def test_saving(self): m = Motor() m.position = 1 * q.mm m.stash().wait() m.position = 2 * q.mm m.stash().wait() m.position = 0.123 * q.mm m.position = 1.234 * q.mm m.restore().wait() self.assertEqual(m.position, 2 * q.mm) m.restore().wait() self.assertEqual(m.position, 1 * q.mm)
def test_different_calibration_unit(): calibration = LinearCalibration(q.count / q.deg, 0 * q.deg) motor = DummyMotor(calibration) motor.position = 0 * q.deg motor.move(1 * q.deg).wait() assert motor.position == 1 * q.deg
def test_focusing(): motor = Motor(hard_limits=(MIN_POSITION.magnitude, MAX_POSITION.magnitude)) motor.position = 85. * q.mm camera = BlurringCamera(motor) focus(camera, motor).wait() assert_almost_equal(motor.position, FOCUS_POSITION, 1e-2)