Example #1
0
    def test_hard_limit_throws_off_fsm(self):
        m = LinearMotor()

        with self.assertRaises(HardLimitError):
            m.position = 5 * q.m

        m.position = 2 * q.mm
Example #2
0
    def test_hard_limit_throws_off_fsm(self):
        m = LinearMotor(upper_hard_limit=3 * q.mm)

        with self.assertRaises(HardLimitError):
            m.position = 5 * q.m

        m.position = 2 * q.mm
Example #3
0
class TestMotor(TestCase):

    def setUp(self):
        super(TestMotor, self).setUp()
        self.motor = LinearMotor()

    def test_set_position(self):
        position = 1 * q.mm
        self.motor.position = position
        self.assertEqual(position, self.motor.position)

    def test_move(self):
        position = 1 * q.mm
        delta = 0.5 * q.mm
        self.motor.position = position
        self.motor.move(delta).join()
        self.assertEqual(position + delta, self.motor.position)
Example #4
0
 def setUp(self):
     self.source = None
     self.exp = None
     self.flatfield_axis = LinearMotor()
     self.flatfield_axis.motion_velocity = 10000 * q.mm / q.s
     self.camera = LoggingCamera(flat_axis=self.flatfield_axis)
     self._data_dir = tempfile.mkdtemp()
     self.walker = DirectoryWalker(root=self._data_dir)
Example #5
0
 async def run():
     other = LinearMotor()
     scanned = []
     async for pair in scan((self.motor['position'], other['position']),
                            (values_0, values_1),
                            self.feedback):
         vec, res = pair
         scanned.append((vec[0], vec[1], res))
     return scanned
Example #6
0
def get_axes():
    """Get all the dummy axes."""
    x_lin = LinearMotor()
    y_lin = LinearMotor()
    z_lin = LinearMotor()
    x_rot = RotationMotor()
    y_rot = RotationMotor()
    z_rot = RotationMotor()

    x_lin_axis = base.Axis('x', x_lin)
    y_lin_axis = base.Axis('y', y_lin, direction=-1)
    z_lin_axis = base.Axis('z', z_lin)
    x_rot_axis = base.Axis('x', x_rot)
    y_rot_axis = base.Axis('y', y_rot)
    z_rot_axis = base.Axis('z', z_rot, direction=-1)

    return (x_lin_axis, y_lin_axis, z_lin_axis, x_rot_axis, y_rot_axis,
            z_rot_axis)
Example #7
0
    def setUp(self):
        Radiography.setUp(self)
        self.tomo_motor = RotationMotor()
        self.tomo_motor.motion_velocity = 20000 * q.deg / q.s
        self.vertical_motor = LinearMotor()
        self.vertical_motor.motion_velocity = 10000 * q.mm / q.s

        self.camera.tomo_axis = self.tomo_motor
        self.camera.vertical_axis = self.vertical_motor
Example #8
0
 def setUp(self):
     super(TestDummyFocusingWithSoftLimits, self).setUp()
     self.motor = LinearMotor(position=50 * q.mm)
     self.motor['position'].lower = 25 * q.mm
     self.motor['position'].upper = 75 * q.mm
     self.halver_kwargs = {
         "initial_step": 10 * q.mm,
         "max_iterations": 1000
     }
Example #9
0
 def setUp(self):
     super(TestOptimizers, self).setUp()
     self.algorithms = [optimization.halver, optimization.down_hill,
                        optimization.powell,
                        optimization.nonlinear_conjugate,
                        optimization.bfgs,
                        optimization.least_squares]
     self.center = 1.0 * q.mm
     self.motor = LinearMotor(position=0 * q.mm)
     self.motor.lower = -float('Inf') * q.mm
     self.motor.upper = float('Inf') * q.mm
Example #10
0
 def setUp(self):
     super(TestDummyFocusing, self).setUp()
     self.motor = LinearMotor(upper_hard_limit=2000 * q.mm,
                              lower_hard_limit=-2000 * q.mm)
     self.motor.position = 0 * q.mm
     self.feedback = DummyGradientMeasure(self.motor['position'],
                                          18.75 * q.mm,
                                          negative=True)
     self.epsilon = 1 * q.um
     self.position_eps = 1e-1 * q.mm
     self.gradient_cmp_eps = 1e-1
     self.halver_kwargs = {
         "initial_step": 10 * q.mm,
         "max_iterations": 3000
     }
Example #11
0
 def setUp(self):
     self.seq = list(range(10))
     self.camera = Camera()
     self.linear_motor = LinearMotor()
     self.linear_motor2 = LinearMotor()
     self.rotation_motor = RotationMotor()
Example #12
0
 def setUp(self):
     super(TestScan, self).setUp()
     self.motor = LinearMotor()
Example #13
0
 def setUp(self):
     self.motor = LinearMotor()
     self.camera = Camera()
     self.shutter = Shutter()
Example #14
0
 def setUp(self):
     super(TestAxis, self).setUp()
     self.motor = LinearMotor()
     self.motor.position = 0 * q.mm
Example #15
0
 def setUp(self):
     super(TestMotor, self).setUp()
     self.motor = LinearMotor()