Giter VIP home page Giter VIP logo

optical_system_simulation's Introduction

Optical System Simulation

This is a toy simulation for an optical system. It is written in MATLAB. In order to run the test scripts, you need to add this folder to MATLAB's path.

NOTE: Some functions are based on my another project Color Science Utils. You'd better clone it and add it into your MATLAB's path before you run this repository.

Features

  • All spherical/conical surfaces system.
  • All 3rd order aberration.
  • All aberration plots (ray fan plot, spot plot, etc.) based on real ray tracing.
  • Optimization ability.
  • OOP programing style.

A screenshot of some charts.

Quick start

See examples/doublet_main.m for detail. Here are some brief introductions.

To get spectral lines, function get_fraunhofer_line is helpful.

d_line = util.get_fraunhofer_line('d');
F_line = util.get_fraunhofer_line('F');
C_line = util.get_fraunhofer_line('C');

Use class OpticalSystem to build up your system, with given surface curvatures and thicknesses.

c_array = [9.3730e-4, -1.2959e-3, -1.2959e-3, -2.4094e-4];
t_array = [18, 0.3, 10, 2000];
sys = OpticalSystem(c_array, t_array, {'N-BK7', 'AIR', 'F2', 'AIR'});

The system can solve height for every surface, according to given F-number and field angle. All heights are determined so that no surface stops light at its edge.

sys = sys.solveApertureHeight(f_number, field_angle);

Show some charts, including system profile, some aberration charts, etc.

sys.plotShapeProfile('ShowRays', false);

sys.plotLsa({'d', 'C', 'F', 'e', 'g', 'r'}, 'xlim', [-6, 6], 'ShowLegend', true);

sys.plotRayFan([d_line, C_line, F_line, e_line, g_line, r_line], ...
    [0, 0.5, 1] * field_angle, image_curvature);

sys.plotSpotDiagram([C_line, d_line, e_line, F_line], field_angle * [0, 0.3, 0.5, 1.0], ...
    'ImageCurv', image_curvature, 'WidthLength', 600e-3);

I'll write a tutorial when I have time.

Please feel free to cantact me if you have any question.

optical_system_simulation's People

Contributors

lovedaisy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

optical_system_simulation's Issues

Where do I start this program?

Teacher Zhang, where is the main program of your program, which program should I start with, and what parameters do I need to enter?

spec_to_rgb

Thank you for your work, but what is the purpose of the function spec_to_rgb()? I also did not find an implementation of this function.

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.