Note: This guide is currently under construction.

### Introduction

This calculator will create and analyze simple lens systems using ray-tracing techniques. This is generally useful for imaging systems where diffraction effects aren't important, and the aim is to create an image at a particular magnification, while reducing unwanted aberrations.

### Coordinates and Units

Everything happens more or less along the z-axis. Lens positions, the evaluation position, the object position, etc. are all specified in absolute terms, relative to z=0. The origin (z=0) has no special significance; the first optic may be placed at z=0, or the object may be placed there, whichever seems most reasonable to you. Light always propagates in the +z direction.

The units are intended to be millimeters. However, ray optic calculations are scale-invariant, so if the whole system is rescaled by a constant, you would get the same answer. So at present, the units can be anything. The only place it matters is the diffraction-limited spot calculation, shown in the 'Plot' tab.

### Objects

An object is an arrow, starting somewhere on the z-axis (specified by 'Object Position') with a given height, pointing in the y-direction. An Object is shown below, showing the relevant parameters.

### Some Tips

• Light always passes through the lenses in the order of the lens list. If the 2nd lens is after the 3rd lens, an error will result.
• The aperture stop is calculated as the first lens that would block light at the smallest angle emitted from the optical axis.  Consider using a lens of thickness=0, flat/flat, to specify an aperture stop.
• When optimizing, several rays are generated from each point on the object at various angles such that the central ray goes through the center of the entrance pupil. If the entrance pupil moves during optimization (ie. some lenses before the aperture stop surface are changed), this may give inconsistent results, especially if the 'Fill Aperture' option is selected.  Consider placing a fixed aperture stop as the first optical element to avoid this.
• Repeatedly hit optimize until the situation stops improving (merit function stops decreasing).
• Optimization works best if you start fairly near the 'correct' layout. If you have a layout with a magnification of M=-2, and you want M=-20, optimize first for M=-5, then starting from that layout, optimize for M=-10, and then M=-20.
• Virtual images work; you can place the evaluation plane before the last lens. This will typically give a positive magnification. In the diagram, light appears to be reflected from the last lens and travel to the evaluation plane, but the angle is determined as though it were transmitted light, and it is not affected by lenses it appears to pass.
• Virtual objects also work; you can place the object after the first lens. The diagram will show rays travelling from the object to the front of the first lens unaffected by any lenses it passes.

### Some Examples

#### Example #1: A best-form lens

Suppose you want to image an object that's far away using a 50mm focal length lens. What's the best lens shape?

Here's a premade example. Just hit optimize 1-3 times to get a progressively better shape. With the 'Diagram' tab open, you can see the lens change shape slightly with each iteration, or with the 'Plot' tab open, you can see how the rays get closer to their desired spot with each iteration.

After several iterations of optimization, the lens should look similar to a LBF254-050, the best-form lens with these parameters from Thorlabs; compare using the front and back radius shown in the 'Lens 1' tab to those in the Thorlabs design.

#### Example #2: An achromatic doublet

Suppose you want to image an object that's far away, using a -40mm focal length lens, while trying to avoid chromatic aberration. What's the best design using a doublet (2 lenses of different material stuck together)? Note that in this case the evaluation plane is before the lenses to show a virtual image, and the second lens shape is locked to the first lens.

Here's a premade example. Just hit optimize 2-3 times and watch the diagram and ray plot as the lenses take on the ideal shapes. The end result should be similar to the ACN254-040-B from Thorlabs.

#### Example #3: Testing an unknown thing

The 87-185 from edmund optics looks like a useful optical component, but without reading the description, it's impossible to tell what it does or what it's made of. It can be loaded directly into the calculator as shown here. Hit optimize to move the unknown thing and the evaluation plane to get the best focus at 1/1 magnification. Note that the object point sources generate spots of about 50 microns (ray statistics / object output / STD)

Is the result any worse with a simple bi-convex lens? Here's a premade one with the focal length set to be the same as the unknown thing above. Hit optimize. The spot sizes here are now around 280 microns. Clearly the thing from Edmund optics is much better in a 1:1 imaging application.

#### Example #4: A Galilean telescope

Here's a telescope design. The object height is 0.002 radians, roughly the separation of Jupiter's moons, and the magnification is x50. The objective lens is an achromatic doublet to reduce chromatic aberration.

#### Example #5: Focussing collimated light

Suppose you want to focus collimated light to as small an area as possible with a single bi-convex lens. Here is that (hit optimize). All the light is focused into a circle of radius about 50 microns (see the output/plot tab). A ray bundle is used here as the light source.

Another option is to use a conic asphere / flat. Here is that. Hit optimize. Now the focal spot is much smaller.

#### Example #6: Collimating focussed light

Suppose you have a point-like source that you want to collimate into a large-diameter beam. Here is that (hit optimize). Note that the output rays have a range of angles (ray statistics / object) of about 0.076 microradians. This can be visualized in the plot tab.

Now suppose you want to make the collimation super good. This can be done with a corrector plate. Here is that. Optimize it. The calculated angular range is now less than the diffraction limit, meaning that the largest gaussian beam that can fit through the system would have a larger range of angles. The Zernike elements have magnitudes of 1-2 microns, which is roughly the peak-to-valley of the surface profile. This shape cannot be made using conventional processes, but we can make bizarre surfaces like that.