Ejemplo n.º 1
0
    def setUp(self):
        surface1 = Surface(HemisphereGM(2.),
                           opt.perfect_mirror,
                           rotation=general_axis_rotation(
                               N.r_[1, 0, 0], N.pi / 2.))
        surface2 = Surface(HemisphereGM(2.),
                           opt.perfect_mirror,
                           location=N.array([0, -2, 0]),
                           rotation=general_axis_rotation(
                               N.r_[1, 0, 0], -N.pi / 2.))

        self._bund = RayBundle()
        self._bund.set_directions(N.c_[[0, 1, 0]])
        self._bund.set_vertices(N.c_[[0, -1, 0]])
        self._bund.set_energy(N.r_[[1]])
        self._bund.set_ref_index(N.r_[[1]])

        assembly = Assembly()
        object1 = AssembledObject()
        object2 = AssembledObject()
        object1.add_surface(surface1)
        object2.add_surface(surface2)
        assembly.add_object(object1)
        assembly.add_object(object2)

        self.engine = TracerEngine(assembly)
Ejemplo n.º 2
0
    def setUp(self):
        self.num_rays = 10
        dir = N.tile(N.c_[[0, 0, -1]], (1, self.num_rays))
        theta = N.linspace(0, 2 * N.pi, self.num_rays, endpoint=False)
        position = N.vstack(
            (N.cos(theta), N.sin(theta), N.ones(self.num_rays)))
        self._bund = RayBundle(position, dir)

        self.gm = HemisphereGM(radius=2.)
        self.prm = self.gm.find_intersections(N.eye(4), self._bund)
Ejemplo n.º 3
0
    def setUp(self):
        self.assembly = Assembly()
        surface1 = Surface(HemisphereGM(3.),
                           optics_callables.perfect_mirror,
                           location=N.array([0, 0, -1.]),
                           rotation=general_axis_rotation(N.r_[1, 0, 0], N.pi))
        surface2 = Surface(HemisphereGM(3.),
                           optics_callables.perfect_mirror,
                           location=N.array([0, 0, 1.]))

        self.object = AssembledObject()
        self.object.add_surface(surface1)
        self.object.add_surface(surface2)
        self.assembly.add_object(self.object)

        dir = N.c_[[0, 0, 1.], [0, 0, 1.]]
        position = N.c_[[0, 0, -3.], [0, 0, -1.]]

        self._bund = RayBundle(position, dir, energy=N.ones(2))
Ejemplo n.º 4
0
    def setUp(self):
        """
        Prepare an assembly with two subassemblies: one assembly representing
        a spherical lens behind a flat screen, and one asssembly representing a
        perfect mirror.
        The mirror will be placed at the two subassemblies' focus, so a paraxial
        ray will come back on the other side of the optical axis.
        
        Reference:
        In [1], the lensmaker equation
        """
        # focal length = 1, thickness = 1/6
        R = 1. / 6.
        back_surf = Surface(HemisphereGM(R),
                            opt.RefractiveHomogenous(1., 1.5),
                            location=N.r_[0., 0., -R / 2.])
        front_surf = Surface(HemisphereGM(R),
                             opt.RefractiveHomogenous(1., 1.5),
                             location=N.r_[0., 0., R / 2.],
                             rotation=rotx(N.pi / 2.)[:3, :3])

        front_lens = AssembledObject(surfs=[back_surf, front_surf])

        back_surf = Surface(RoundPlateGM(R),
                            opt.RefractiveHomogenous(1., 1.5),
                            location=N.r_[0., 0., -0.01])
        front_surf = Surface(RoundPlateGM(R),
                             opt.RefractiveHomogenous(1., 1.5),
                             location=N.r_[0., 0., 0.01])

        glass_screen = AssembledObject(surfs=[back_surf, front_surf],
                                       transform=translate(0., 0., 0.5))

        lens_assembly = Assembly(objects=[glass_screen, front_lens])
        lens_assembly.set_transform(translate(0., 0., 1.))
        full_assembly = Assembly(objects=[rect_one_sided_mirror(1., 1., 0.)],
                                 subassemblies=[lens_assembly])

        self.engine = TracerEngine(full_assembly)
Ejemplo n.º 5
0
    def setUp(self):
        surface = Surface(HemisphereGM(1.),
                          opt.perfect_mirror,
                          rotation=general_axis_rotation(N.r_[1, 0, 0], N.pi))
        self._bund = RayBundle(energy=N.ones(3))
        self._bund.set_directions(N.c_[[0, 1, 0], [0, 1, 0], [0, -1, 0]])
        self._bund.set_vertices(N.c_[[0, -2., 0.001], [0, 0, 0.001],
                                     [0, 2, 0.001]])

        assembly = Assembly()
        object = AssembledObject()
        object.add_surface(surface)
        assembly.add_object(object)

        self.engine = TracerEngine(assembly)