8000 GitHub - HarrisonKramer/optiland: Comprehensive optical design, optimization, and analysis in Python, including GPU-accelerated and differentiable ray tracing via PyTorch.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Comprehensive optical design, optimization, and analysis in Python, including GPU-accelerated and differentiable ray tracing via PyTorch.

License

Notifications You must be signed in to change notification settings

HarrisonKramer/optiland

Repository files navigation

Tests Documentation Status codecov Maintainability Stars License: MIT DOI Python Versions

Table of Contents
  1. Introduction
  2. Documentation
  3. Installation
  4. Functionalities
  5. Learning Guide
  6. Roadmap
  7. License
  8. Contact and Support

Introduction

Optiland provides a flexible Python interface for optical system design—whether you're tracing rays through traditional lenses or training differentiable models with PyTorch. It supports both classical engineering workflows and cutting-edge research needs.

It lets you:

  • ⚙️ Build lens and mirror systems with a clean, object-oriented API
  • 🔍 Trace rays through multi-surface optical assemblies, including aspherics and freeforms
  • 📊 Analyze paraxial properties, wavefront errors, PSFs/MTFs, and scatter behavior
  • 🧠 Optimize via traditional merit functions or autograd-enabled differentiable backends
  • 🎨 Visualize interactively in 2D (Matplotlib) and 3D (VTK)

Under the hood, Optiland uses NumPy for fast CPU calculations and PyTorch for GPU acceleration and automatic differentiation. Switch between engines depending on your use case—with the same interface.

U.S. patent 2959100

Python code to generate this 3D visualization:

from optiland.samples.objectives import ReverseTelephoto
lens = ReverseTelephoto()
lens.draw3D()

🚀 Quickstart

  1. 🌟 Quickstart Tutorial – build your first lens in 5 minutes
  2. 📚 Full Learning Guide – in-depth guide to mastering Optiland
  3. 🖼️ Example Gallery – visual showcase of designs and core features

Documentation

The full documentation for Optiland is hosted on Read the Docs.

Explore the Example Gallery for a wide range of lens designs and analyses created with Optiland.

See the Developer's Guide for an extensive overview of the architecture and design of Optiland and the API Reference for detailed documentation of all public classes, methods, and functions.

Installation

  • Core only

    pip install optiland
  • With CPU‑only PyTorch

    pip install optiland[torch]
  • GPU‑enabled PyTorch

    • After installing Optiland, install a CUDA build of PyTorch manually:
    pip install optiland
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

For more details, see the installation guide in the docs.

Key Features

  • Differentiable & Configurable Backends
    Swap seamlessly between NumPy (CPU) and PyTorch (GPU + autograd). Enables integration of optical simulations into ML/DL pipelines.

  • Flexible Lens Construction
    Easily define optical systems, with support for spherical, aspheric, and freeform geometries.

  • 2D and 3D Visualization
    Visualize optical layouts with matplotlib and VTK.

  • Ray Tracing (Paraxial and Real)
    Supports paraxial approximations and full real-ray tracing, with accurate handling of aspheric and freeform surfaces.

  • Polarization Ray Tracing
    Track polarization effects using vectorial ray tracing, including birefringence and coating interactions.

  • Aberration and Paraxial Analysis
    Tools for classical paraxial analysis and low-order aberration extraction, including chief and marginal ray tracing.

  • Full Real Analysis Suite
    Compute spot diagrams, OPD and ray aberration fans, PSF, MTF, and Zernike coefficients across fields and wavelengths.

  • Material and Glass Catalogues
    Built-in access to refractiveindex.info data, plus support for custom material models.

  • Design Optimization
    Local gradient-based and global stochastic optimization, with customizable merit functions and constraint handling.

  • Tolerancing Framework
    Monte Carlo and sensiti 8000 vity analyses for evaluating robustness under manufacturing and alignment variations.

  • Coating and Scattering Support
    Evaluate BSDF-based surface scatter and multilayer coatings using both built-in and user-defined models.

  • Zemax File Import
    Convert legacy designs from Zemax files into Optiland’s internal representation for further simulation or analysis.

The code itself is in constant flux and new functionalities are always being added.

Learning Guide

This guide gives a step-by-step approach to learning how to use Optiland.

  1. Introduction to Optiland
  2. Real Raytracing & Analysis
  3. Aberrations
  4. Optical Path Difference (OPD), Point Spread Functions (PSF) & Modulation Transfer Function (MTF)
  5. Optimization
  6. Coatings & Polarization
  7. Advanced Optical Design
  8. Tolerancing
  9. Lens Catalogue Integration
  10. Extending Optiland
  11. Machine Learning in Optical Design - note that these notebooks are hosted in the LensAI repository

Roadmap

Optiland is continually evolving to provide new functionalities for optical design and analysis. Below are some of the planned features and enhancements we aim to implement in future versions:

  • GUI (PySide6-based)
  • Multi-Path Sequential Ray Tracing
  • Multiple Configurations (Zoom Lenses)
  • Thin Film Design and Optimization
  • Diffractive Optical Elements
  • Additional Backends: JAX, CuPy
  • Jones Pupils
  • Apodization Support
  • Additional Freeforms (Superconic, etc.)
  • Image Simulation
  • Huygens PSF & MTF
  • Interferogram Analysis
  • Additional Tutorials/Examples
  • Non-sequential ray tracing
  • Glass Expert
  • Insert your idea here...

Community Contributions

We welcome suggestions for additional features! If there's something you'd like to see in Optiland, feel free to open an issue or discussion.

License

Distributed under the MIT License. See LICENSE for more information.

Contact and Support

If you have questions, find a bug, have suggestions for new features, or need help, please open an issue in the GitHub repository. This ensures that your concern is visible to others, can be discussed collaboratively, and helps build a public archive of solutions for similar inquiries in the future.

While I prefer issues as the primary means of communication, you may also contact me via email if necessary.

Kramer Harrison - kdanielharrison@gmail.com

0