Git Product home page Git Product logo

optsys's Introduction

OptSys -- Optical systems simulator

About

Simulate ray-tracing of optical system with first order approximation. This will be a handy tool to get an intial estimate for various components for your optical system.

Components

The following components can be used:

  • Lens: Convex/concave lens with finite aperture. Uses lens maker's formula for computing output ray

  • Mirror: Flat mirror with finite aperture.

  • Grating: Diffraction grating with set number of groves and finite aperture. As of now, only fixed order is supported.

  • DMD: Digital Micromirror device with zero pitch size and finite aperture.

  • Sensor: Image sensor which halts all ray propagation. Use it as image plane.

Extra functions

Apart from placement and viewing of optical elements and rays, you can also:

  1. Compute the light throughput of the system

  2. Compute vingetting for the scene for a given system

  3. Simulate system for different wavelengths

Usage

Broadly, simulation consists of two parts

  • Components: A (python) list of various optical components with component specific paramenter, position, aperture and angle w.r.t y-axis. An example:
import raytracing as rt

components = []
components.append(rt.Lens(f=100,
			  aperture=25.4,
			  pos=[0,0],
			  theta=0))
  • Rays: A (python) list of 3-tuple of rays with x-coordinate, y-coordinate and angle w.r.t x-axis. An example:
import raytracing as rt

rays = []
rays.append([-10, 0, -np.pi/6])

Once you configure your system with components and rays, you can propagate the rays using the following command:

ray_bundles = propagate_rays(components, rays)

In order to view the output, you create a canvas and draw the components and rays.

import visualize as vis

# Color for the rays
colors = 'r'

# Create a new canvas
canvas = vis.Canvas([-200, 600], [-100, 100])

# Draw the components
canvas.draw_components(components)

# Draw the rays
canvas.draw_rays(ray_bundles, colors)

# Show the system
canvas.show()

# Save a copy
canvas.save('example.png')

See examples folder for more information.

Other modules

lf_2d.py : Includes several functions for simulation of 2D lightfields

lf_4d.py: Includes several functions for manipulating 4D lightfields

TODO

  1. Implement convex/concave mirror
  2. Implement image plane computation
  3. Implement field lens optimization

Authors:

  • Vishwanath Saragadam (PhD candidate, ECE, Carnegie Mellon University)

  • Aswin Sankaranarayanan (Asst. Prof., ECE, Carnegie Mellon University)

optsys's People

Contributors

hawaiii avatar vishwa91 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.