Ejemplo n.º 1
0
def create_beamline():
    perp_to_floor = 90.0
    beam_start = PositionAndAngle(y=0, z=0, angle=-2.5)
    s0 = Component("s0", movement_strategy=LinearMovement(0, 0, perp_to_floor))
    s1 = Component("s1", movement_strategy=LinearMovement(0, 1, perp_to_floor))
    frame_overlap_mirror = ReflectingComponent(
        "FOM", movement_strategy=LinearMovement(0, 2, perp_to_floor))
    frame_overlap_mirror.enabled = False
    polarising_mirror = ReflectingComponent("Polarising mirror",
                                            movement_strategy=LinearMovement(
                                                0, 3, perp_to_floor))
    polarising_mirror.enabled = False
    s2 = Component("s2", movement_strategy=LinearMovement(0, 4, perp_to_floor))
    ideal_sample_point = ReflectingComponent("Ideal Sample Point",
                                             movement_strategy=LinearMovement(
                                                 0, 5, perp_to_floor))
    s3 = Component("s3", movement_strategy=LinearMovement(0, 6, perp_to_floor))
    analyser = ReflectingComponent("analyser",
                                   movement_strategy=LinearMovement(
                                       0, 7, perp_to_floor))
    analyser.enabled = False
    s4 = Component("s4", movement_strategy=LinearMovement(0, 8, perp_to_floor))
    detector = Component("detector",
                         movement_strategy=LinearMovement(
                             0, 10, perp_to_floor))

    theta = Theta("theta", ideal_sample_point)
    beamline = Beamline([
        s0, s1, frame_overlap_mirror, polarising_mirror, s2,
        ideal_sample_point, s3, analyser, s4, detector
    ], [theta], [])
    beamline.set_incoming_beam(beam_start)
    beamline.active_mode = BeamlineMode("NR", ["theta"])

    return beamline
Ejemplo n.º 2
0
    def test_GIVEN_component_parameter_disabled_in_mode_WHEN_parameter_moved_to_THEN_component_is_disabled(self):
        super_mirror = ReflectingComponent("super mirror", LinearMovement(z_position=10, y_position=0, angle=90))
        super_mirror.enabled = True
        sm_enabled = ComponentEnabled("smenabled", super_mirror)
        enabled_sp = False

        sm_enabled.sp_no_move = enabled_sp
        sm_enabled.move = 1

        assert_that(sm_enabled.sp_rbv, is_(enabled_sp))
        assert_that(super_mirror.enabled, is_(enabled_sp))
    def setUp(self):
        beam_start = PositionAndAngle(y=0, z=0, angle=2.5)
        s0 = Component("s0", movement_strategy=LinearMovement(0, 0, 90))
        s1 = Component("s1", movement_strategy=LinearMovement(0, 1, 90))
        frame_overlap_mirror = ReflectingComponent(
            "FOM", movement_strategy=LinearMovement(0, 2, 90))
        frame_overlap_mirror.enabled = False
        self.polarising_mirror = ReflectingComponent(
            "Polariser", movement_strategy=LinearMovement(0, 3, 90))
        self.polarising_mirror.enabled = False
        self.polarising_mirror.angle = 0
        s2 = Component("s2", movement_strategy=LinearMovement(0, 4, 90))
        self.ideal_sample_point = ReflectingComponent(
            "ideal sample point", movement_strategy=LinearMovement(0, 5, 90))
        s3 = Component("s3", movement_strategy=LinearMovement(0, 6, 90))
        analyser = ReflectingComponent("analyser",
                                       movement_strategy=LinearMovement(
                                           0, 7, 90))
        analyser.enabled = False
        s4 = Component("s4", movement_strategy=LinearMovement(0, 8, 90))
        detector = Component("detector",
                             movement_strategy=LinearMovement(0, 10, 90))

        theta = Theta("theta", self.ideal_sample_point)
        theta.sp_no_move = 0
        smangle = ReflectionAngle("smangle", self.polarising_mirror)
        smangle.sp_no_move = 0

        self.nr_mode = BeamlineMode("NR Mode", [theta.name])
        self.polarised_mode = BeamlineMode("NR Mode",
                                           [smangle.name, theta.name])

        self.beamline = Beamline([
            s0, s1, frame_overlap_mirror, self.polarising_mirror, s2,
            self.ideal_sample_point, s3, analyser, s4, detector
        ], [smangle, theta], [], [self.nr_mode, self.polarised_mode])
        self.beamline.set_incoming_beam(beam_start)
Ejemplo n.º 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)))