Esempio n. 1
0
import numpy as np
import matplotlib.pyplot as plt

import raytracing as rt
import visualize as vis

if __name__ == '__main__':
    # Create simple system to reimage using lens with scheimpflug
    components = []
    rays = []
    image_plane1 = -150
    image_plane2 = -140
    image_plane3 = -130

    # System contains just of one lens
    components.append(rt.Lens(f=100, aperture=100, pos=[0, 0], theta=0))

    # Create three points and three rays from each point
    rays.append([image_plane1, 10, -np.pi / 20])
    rays.append([image_plane1, 10, 0])
    rays.append([image_plane1, 10, np.pi / 20])

    rays.append([image_plane2, 0, -np.pi / 20])
    rays.append([image_plane2, 0, 0])
    rays.append([image_plane2, 0, np.pi / 20])

    rays.append([image_plane3, -10, -np.pi / 20])
    rays.append([image_plane3, -10, 0])
    rays.append([image_plane3, -10, np.pi / 20])

    colors = 'rrrgggbbb'
Esempio n. 2
0
import numpy as np
import matplotlib.pyplot as plt

import raytracing as rt
import visualize as vis
import ray_utilities

if __name__ == '__main__':
    # Create a relay lens system
    components = []
    rays = []
    image_plane = -300
    nrays = 10

    # Objective is simulated using two lenses
    components.append(rt.Lens(f=30, aperture=100, pos=[0, 0], theta=0))

    # Second lens creates the flange focal distance
    components.append(rt.Lens(f=-13, aperture=50, pos=[20, 0], theta=0))

    # Create three points and three rays from each point
    rays += ray_utilities.ray_fan([image_plane, 200], [-np.pi / 5, -np.pi / 6],
                                  nrays)
    rays += ray_utilities.ray_fan([image_plane, 0], [-np.pi / 30, np.pi / 30],
                                  nrays)
    rays += ray_utilities.ray_fan([image_plane, -200], [np.pi / 6, np.pi / 5],
                                  nrays)

    colors = 'r' * nrays + 'g' * nrays + 'b' * nrays

    # Propagate the rays
Esempio n. 3
0
    # Create simple system to test diffraction grating
    components = []
    rays = []
    image_plane = -200
    nrays = 20

    # Create three scene points
    scene = np.zeros((2, 3))
    scene[0, :] = image_plane
    scene[1, 0] = 20
    scene[1, 1] = 0
    scene[1, 2] = -20

    # Imaging lens
    components.append(rt.Lens(f=100,
                              aperture=10,
                              pos=[0,0],
                              theta=0))
    # Grating
    components.append(rt.Grating(ngroves=600,
                                 aperture=100,
                                 pos=[200, 0],
                                 theta=0))
    # Reimaging lens
    components.append(rt.Lens(f=50,
                              aperture=100,
                              pos=[300, -25],
                              theta=np.pi/12))

    # Get the initial rays
    [rays, ptdict, colors] = ray_utilities.initial_rays(scene,
                                                        components[0],
Esempio n. 4
0
    aperture = 100      # Aperture of each lens.
    nrays = 20          # Number of rays per scene point
    npoints = 5         # Number of scene points
    image_plane = -300  # Position of image plane
    ymax = 200          # Limit of image plane
    ymin = -200

    # Create a scene. Hehe
    scene = np.zeros((2, npoints))
    scene[0, :] = image_plane
    scene[1, :] = np.linspace(ymin, ymax, npoints)

    # Create an objective lens
    components = []
    components.append(rt.Lens(f=-image_plane,
                              aperture=aperture,
                              pos=[-20,0],
                              theta=0))
    components.append(rt.Lens(f=ffl,
                              aperture=aperture,
                              pos=[0,0],
                              theta=0))

    # Add a field lens
    components.append(rt.Lens(f=f_field,
                              aperture=aperture,
                              pos=[ffl,0],
                              theta=0))

    # Get initial rays
    [rays, ptdict, colors] = ray_utilities.initial_rays(scene,
                                                        components[0],
Esempio n. 5
0
    aperture = 25.4  # Aperture of each lens
    nrays = 20  # Number of rays per scene point
    npoints = 5  # Number of scene points
    image_plane = -300  # Position of image plane
    ymax = 50  # Limit of image plane
    ymin = -50

    # Create a scene. Hehe
    scene = np.zeros((2, npoints))
    scene[0, :] = image_plane
    scene[1, :] = np.linspace(ymin, ymax, npoints)

    # Create an objective lens
    components = []
    components.append(
        rt.Lens(f=-image_plane, aperture=aperture, pos=[-20, 0], theta=0))
    components.append(rt.Lens(f=ffl, aperture=aperture, pos=[0, 0], theta=0))

    # Add a field lens
    components.append(
        rt.Lens(f=f_field, aperture=aperture, pos=[ffl, 0], theta=0))

    # Reimage using a relay pair
    components.append(
        rt.Lens(f=100, aperture=aperture, pos=[ffl + 100, 0], theta=0))
    components.append(
        rt.Lens(f=100, aperture=aperture, pos=[ffl + 110, 0], theta=0))

    # DMD field lens
    components.append(
        rt.Lens(f=100, aperture=aperture, pos=[ffl + 210, 0], theta=0))