Introduction to pyOpTools

What is pyOpTools

The pyOpTools package is composed by a set of python modules that allow to simulate the behavior of optical systems. Initially it was only oriented to the ray tracing, but currently in the development version it has some tools which can be used to simulate optical fields and their propagation.

This tutorial will introduce the simulation of optical systems by ray tracing in a Jupiter notebook.

In the following video there is a small demo of an old version of pyOpTools

from IPython.lib.display import YouTubeVideo

Some basic characteristics of pyOpTools

  1. It is an open source development
  2. It is being developed by the technological development group of Combustión Ingenieros S.A.S, and the applied optics group of the Universidad Nacional de Colombia.
  3. It is written in python y cython.
  4. It is written using the object oriented programming paradigm
  5. It can perform non-sequential ray-tracing of complex 3D systems.
  6. It can be used as a module to develop programs to simulate optical systems.
  7. It can be used in a Jupyter Notebook to perform interactive simulation tasks
  8. There is a FreeCAD workbench under development, to simplify its applications to optical design tasks. This development is being hosted in

A basic introduction

Importing pyoptools

The fist step to simulate an optical system in pyOpTools, is to import the package. The most simple way to perform this task is to import the pyoptools.all subpackage:

from pyoptools.all import *

After the module is imported, a simulation can be performed. In the following example we will create a simple system composer by a lens, a detector, and a light source.

As a first step we will create a lens from the Edmund Scientific catalog (reference 32475), we will create a CCD-like sensor with 20 mm X 20 mm size, and a parallel ray source with cartesian beam distribution.

Note: In pyOpTools (unless noted) the units are in millimeters.
R=parallel_beam_c(origin=(0.0, 0.0, 0.0), direction=(0.0, 0.0, 0.0),
                  size=(10, 10), num_rays=(5, 5), wavelength=0.58929)
/home/docs/checkouts/ DeprecationWarning: This method is deprecated, you can use dictionary-style accessinstead

with this components created, we will create a system, where the lens is placed at the position (0,0,50) , and the CCD is placed at the position (0,0,150). At the end the Plot3D command will be used to show the resulting system.

Note: The plot obtained with the Plot3D command is interactive. Meaning you can rotate it (left click), zoom it (scroll wheel), and drag it (right click), by clicking on it and moving the mouse.

/home/docs/checkouts/ DeprecationWarning: Passing unrecognized arguments to super(MeshPhongMaterial).__init__(ambient='#050505').
object.__init__() takes exactly one argument (the instance to initialize)
This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.

After the system is created, we can add the raysource and propagate the system.