Beispiel #1
0
    def test_GIVEN_theta_and_a_set_and_move_WHEN_get_changed_THEN_changed_is_false(self):

        theta_set = 10.0
        sample = ReflectingComponent("sample", movement_strategy=LinearMovement(0, 0, 90))
        sample.set_incoming_beam(PositionAndAngle(0, 0, 0))
        theta = Theta("theta",sample)

        theta.sp_no_move = theta_set
        theta.move = 1
        result = theta.sp_changed

        assert_that(result, is_(False))
Beispiel #2
0
    def test_GIVEN_reflection_angle_WHEN_set_set_point_and_move_THEN_readback_is_as_set_and_sample_is_at_setpoint_postion(self):

        angle_set = 10.0
        expected_sample_angle = 10.0
        sample = ReflectingComponent("sample", movement_strategy=LinearMovement(0, 0, 90))
        sample.set_incoming_beam(PositionAndAngle(0, 0, 0))
        mirror_pos = -100
        sample.angle = mirror_pos
        reflection_angle = ReflectionAngle("theta", sample)

        reflection_angle.sp_no_move = angle_set
        reflection_angle.move = 1
        result = reflection_angle.sp_rbv

        assert_that(result, is_(angle_set))
        assert_that(sample.angle, is_(expected_sample_angle))
Beispiel #3
0
    def test_GIVEN_theta_set_WHEN_set_point_set_and_move_THEN_readback_is_as_original_value_but_setpoint_is_new_value(self):

        original_theta = 1.0
        theta_set = 10.0
        sample = ReflectingComponent("sample", movement_strategy=LinearMovement(0, 0, 90))
        sample.set_incoming_beam(PositionAndAngle(0, 0, 0))
        mirror_pos = -100
        sample.angle = mirror_pos
        theta = Theta("theta", sample)
        theta.sp = original_theta

        theta.sp_no_move = theta_set
        result = theta.sp_rbv

        assert_that(result, is_(original_theta))
        assert_that(theta.sp, is_(theta_set))
Beispiel #4
0
    def test_GIVEN_angled_mirror_is_disabled_WHEN_get_beam_out_THEN_outgoing_beam_is_incoming_beam(
            self):
        mirror_z_position = 10
        mirror_angle = 15
        beam_start = PositionAndAngle(y=0, z=0, angle=0)
        expected = beam_start

        mirror = ReflectingComponent("component",
                                     movement_strategy=LinearMovement(
                                         0, mirror_z_position, 90))
        mirror.angle = mirror_angle
        mirror.set_incoming_beam(beam_start)
        mirror.enabled = False

        result = mirror.get_outgoing_beam()

        assert_that(result, is_(position_and_angle(expected)))
Beispiel #5
0
    def test_GIVEN_mirror_with_input_beam_at_WHEN_get_beam_out_THEN_beam_output_correct(
            self, beam_angle, mirror_angle, outgoing_angle):
        beam_start = PositionAndAngle(y=0, z=0, angle=beam_angle)
        expected = PositionAndAngle(y=0, z=0, angle=outgoing_angle)

        mirror = ReflectingComponent("component",
                                     movement_strategy=LinearMovement(
                                         0, 0, 90))
        mirror.angle = mirror_angle
        mirror.set_incoming_beam(beam_start)

        result = mirror.get_outgoing_beam()

        assert_that(
            result, is_(position_and_angle(expected)),
            "beam_angle: {}, mirror_angle: {}".format(beam_angle,
                                                      mirror_angle))
Beispiel #6
0
    def test_GIVEN_mirror_with_input_beam_at_0_deg_and_z0_y0_WHEN_get_beam_out_THEN_beam_output_z_is_zmirror_y_is_ymirror_angle_is_input_angle_plus_device_angle(
            self):
        mirror_z_position = 10
        mirror_angle = 15
        beam_start = PositionAndAngle(y=0, z=0, angle=0)
        expected = PositionAndAngle(y=0,
                                    z=mirror_z_position,
                                    angle=2 * mirror_angle)

        mirror = ReflectingComponent("component",
                                     movement_strategy=LinearMovement(
                                         0, mirror_z_position, 90))
        mirror.angle = mirror_angle
        mirror.set_incoming_beam(beam_start)

        result = mirror.get_outgoing_beam()

        assert_that(result, is_(position_and_angle(expected)))