Coder Social home page Coder Social logo

alexpiti / paraxial-optics Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 44 KB

A paraxial/Gaussian optics MATLAB toolkit for sequential 2D meridional plane ray-tracing. Intended for educational analysis of optical systems with arbitrary lenses and stops.

License: GNU General Public License v3.0

MATLAB 100.00%
matrix-methods meridional optics raytracing sequential dioptric-systems paraxial

paraxial-optics's Introduction

Paraxial-Optics

A MATLAB toolkit for paraxial (Gaussian) optics and refractive sequential ray-tracing with matrix methods in the meridian plane. Includes arbitrary number of optical surfaces (lenses) and apertures, and calculates cardinal points, image formation, and entrance/exit pupils & windows.

Mostly meant for education purposes, e.g., for undergraduate physics or engineering courses.

Brief description

Paraxial or Gaussian optics deal with ray-tracing within the geometric optics (high-frequency) approximation, where rays are refracted (or reflected) by shapes (called optical surfaces) with dimensions much greater than the wavelength. Optical surfaces are defined by their optical power (or curvature and refractive index), i.e., how much they "bend" the light rays hitting on them, and their aperture size, i.e., how big (in diameter) a lens is. Clear apertures (those of zero optical power) can be used, for more complex compound systems, e.g., to define a variable F-number iris or an image plane, controlling depth of focus or the sensor-size in a camera.

The present 2D implementation considers only rays within the meridional plane, i.e., the plane defined by the optical axis and an off-axis point-object. Also, frequency and polarization are irrelevant here, but one can implement chromatic dispersion (via wavelength-dependent optical power) and/or Fresnel transmission coefficients assuming a given linear polarization. Finally, note that this presently supports only sequential ray-tracing in refractive (dioptric) optical systems, i.e., composed of glass lens; development for reflective (catoptric) or catadioptric systems is straightforward, but non-sequential ray tracing and/or 3D is much more complicated.

Examples

Consider the following includes example scripts to understand the syntax, use and visualization offered by this code-pack. I am also giving the figures that MATLAB should produce.

0.myScript0_OneLens_OneRay.m

  • See how an OS and a ray are defined.
  • See how how ray-tracing is done and plotted
  • Change the parameters of the OS or the ray, and see what changes
  • Add mores lenses (rows in "OS" matrix) or rays (rows in "rays" matrix), and see what change

myScript0_OneLens_OneRay_MATLAB Fig. 0: One lens system, with a single ray. Marked also are the focal points (F1/2), principal planes (H1/2), and nodal points (N1/2).

1.myScript1_Magnifier.m

  • Describes how to define an optical system (as ABCD or as "optical surface" [OS] matrix)
  • Defines a couple of test-case optical systems and point objects
    • TestCase = 1 is a diverging thin-lens and a virtual object.
    • TestCase = 2 is the converging ABCD system used as a magnifier
  • Calls top-level image-formation/visualization function "ImageFormation_with_CardinalRayTracing"
  • Observe the cardinal points and three cardinal rays traced to form a real (or virtual object)
  • Change the parameters of the system (e.g. the optical power C=-P, converging or diverging) and/or position of object, and observe how it affects image formation

myScript1_Magnifier_MATLAB Fig. 1: Three main rays in two more complicated optical systems. In the left, a diverging lens and a virtual object. In the right, a magnifier (a close-by real object producing an erect magnified virtual image)

2.myScript2_TelescopeMicroscope.m

  • Defines "custom" ray tracing for a Keplerian astronomical Telescope and a Compound Microscope

  • Produces two figures for the corresponding systems -

  • See how custom ray-sets (bundles) can be defined and simulated

  • Microscope: Calculate microscope magnification; check how object-plane position (objS) affects image-plane position (we want VIRTUAL image!) and magnification

  • Telescope : Measure width and angle of outgoing ray-bundles, and compare them to the corresponding incoming ray-bundle parameters (width, angle); how does this compare to the telescope magnification?

myScript2_TelescopeMicroscope_Octave Fig. 2: Two two-lens systems, with multiple rays traced. In the left, a Kepler telescope, with on-axis (red) and off-axis (cyan) pencil beams. In the right, a compound microscope (magnified inverted virtual image).

3.myScript3_Apertures.m

  • Produces three figures
    • One test figure with image-formation rays,
    • A figure with test rays for Aperture-Stop (AS) and Pupils calculations
    • A figure with test rays for Field-Stop (FS) and Windows calculations
  • Read through the script comments/guidelines to understand how these are defined and simulated

myScript3_Apertures_MATLAB Fig. 3: Study of a complex optical system with mulitple surfaces/lenses and two apertures. In the left, image formation from an object in infinity (black pencil beam) or a close-by point object. In the middle, a diverging cone of rays from an on-axis object to identify the aperture-stop and the pupils of the system. In the right, a converging cone of rays to identify the windows and field-stop of the system.

List of all functions (core and utility) included:

  • Convert_ABCD2OS.m (converts ABCD to optical surface matrix)
  • DoParaxialAnalysis.m (calculates ABCD from optical surfaces, cardinals points etc)
  • DoParaxialImageFormation.m (calculates position & magnification of image)
  • DoParaxialRayTracing.m (traces given set of rays from entrance to exit)
  • ImageFormation_with_CardinalRayTracing.m (top-level image-formation/visualization function)
  • PlotParaxialOS.m (plots the optical system)
  • calculateVisibleSpectrumColor.m (colors from wavelength)

paraxial-optics's People

Contributors

alexpiti avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.