# Understanding the Detector Polar

Summary:

The Detector Polar object stores the intensity data from NSC source rays that strike it. The Detector Polar is spherical in shape but the resulting data distributions in the angular domains are displayed in 2D. And this point can cause confusion.

The aim of this article is to explain clearly how OpticStudio maps rays striking 3D sphere onto a 2D intensity plot. It also gives some details on the conventions used in OpticStudio.

The aim of this article is to explain clearly how OpticStudio maps rays striking 3D sphere onto a 2D intensity plot. It also gives some details on the conventions used in OpticStudio.

**CONTENTS:**- Description
- Detector viewer
- Detector polar pixels

Authored By:

Sandrine Auriol

Published On:

01/10/2017

Sample File:

Applies to:

OpticStudio

Non Sequential Ray Tracing

Non Sequential Ray Tracing

Article:

# Description of the detector

The Detector Polar shape is a faceted approximation to a portion of a sphere centered on the object coordinates.The Detector Polar uses polar coordinates where:

**The polar angle is the theta /****θ angle**. The polar angle represents the latitude, the height. The zero-polar angle is centered on the object local Z axis. The polar angle may span any angle between 1 and 180 degrees (which would form a complete sphere).**The azimuthal angle is the phi /****φ angle**. The azimuth angle represents the longitude. The azimuthal angle is defined by: φ = atan(y/x) where the zero angle is along the +x axis and the angle increases in a__counter-clockwise__(anti-clockwise) direction all the way to 360 degrees. The azimuthal angle always spans 360 degrees.

r is the radial size of the Detector Polar

A ray starting at the center of the Detector Polar with direction cosines l, m and n will hit the Detector Polar at:

x = r x l / sqrt(l^2+m^2+n^2)

y = r x m / sqrt(l^2+m^2+n^2)

z = r x n / sqrt(l^2+m^2+n^2)

And the spherical coordinates will be:

Polar angle = θ = acos (n/ sqrt(l^2+m^2+n^2))

Azimuthal angle = φ = atan(y/x)

The mapping from spherical coordinates to three-dimensional Cartesian coordinates is:

x = r sin (θ) cos (φ)

y = r sin (θ) sin (φ)

z = r cos (θ)

# Detector viewer

When you open the Detector Viewer for the Detector Polar, different views are available. We are going to look at the “False Color” and “Directivity” views:The following images are taken from the sample file Zemax\Samples\Non-sequential\Sources\led_model.ZMX that comes with the installation of OpticStudio. That file shows a LED encircled by a Detector Polar.

# “False Color” view

The False Color view shows a 2D view with polar and azimuthal angles. The display can be thought as made up of concentric circles.- Each circle represents a polar angle. For example, the red circle below represents the 60-degree polar angle.
- For that polar angle, the circle scans on all the azimuth angles from 0 to 180 degrees and from 0 to -180 degrees.

The Shaded Model below illustrates rays hitting the Detector Polar. The Detector Polar is represented by a Sphere object (we ticked “Object is A Detector) under the Properties > Type).

Another way of viewing the 60-degree polar angle (red circle above) is to describe it as a circle which is the intersection between a XY plane and the Detector Polar at Z equal to the radial size of the detector multiplied by the cosine of the polar angle.

The Detector Polar has a radial size of 10mm. The Z coordinate of the orange plane is at 5mm = 10 x cos (60 degrees).

The “polar” circle has a radius of 8.66mm (10 x sin (60 degrees)). On that circle, we can see different azimuthal angles. Let’s say the azimuthal angle is 43 degrees.

- polar angle = 60 degree
- azimuthal angle = 43 degree
- XY plane intercepts at Z=5mm ((10 x cos (60 degrees)).
- X is equal to 8.66 x cos (43 degree) = 6.3mm
- Y is equal to 8.66 x sin (43 degree) = 5.9mm

# The Directivity (Full and Half) view

The Directivity view shows cross-sections of normalized radiant intensity for different azimuthal angles. The graph plots the radiant intensity against the polar angle for a given azimuthal angle.In the sample file, the half directivity views are shown for azimuthal angles of 0°, 30°, 60° and 90°.

The half directivity view may be seen as a plane intercepting the Detector Polar at a given azimuthal angle. That plane is represented by a Slide Object on the Shaded Models below. A Slide Object is a transparent image defined by a BMP or JPG file here.

Here are the Shaded Models with the plane for these 4 azimuthal angles:

# Detector Polar Pixel numbering

The help file explains the pixel numbering:*The Setup Tab > Editors Group (setup tab) > Non-Sequential Component Editor > Non-Sequential Detectors > Detector Polar Object*

The general way to calculate a bin number is: [bin_number] =

*floor*(.5 + [value] / [bin size])

The function

*floor(value)*here means that the value will be rounded to the nearest integer which is less than or equal to that value (this is not a proper OpticStudio function!).

For example let’s say there are 12 angular pixels. The angular bin size is 30 degrees (=360/12).

A ray coming in at an azimuthal angle of 10 degrees will be in angular bin : floor(.5 + 10/30) = floor(0.83) = 0

A ray coming in at an azimuthal angle of 130 degrees will be in angular bin : floor(.5 + 130/30) = floor(4.83) = 4

# Center of the bin

Azimuthal angles between -15 degree and +15 degree will be in bin 0.Azimuthal angles between +15 degree and +45 degree will be in bin 1.

Etc….

__Comment:__To read the correct values of each bin, the Pixel Interpolation and the Fast Ray Trace have to be unticked in the Type tab of the properties of the Detector Polar.

# Pixel / Bin size

Because the Detector Polar is a faceted portion of a sphere, the pixel sizes are going to vary depending on the polar angle of the pixel.For example, the pixel size at a polar angle of 0 degree will be much smaller than the pixel size at a polar angle of 90 degree as we can see on the graph below:

__Comments about the first radial bin:__

In the first radial bin (green circle on the NSC Shaded model above), the detector Viewer for Detector Polar averages all power across all pixels. At small polar angles, it is unphysical for there to be any azimuthal asymmetry in the data: the azimuthal variation is only an artifact of the finite pixel size (for infinitely small pixels, there is no change in azimuth at a polar angle of 0 degrees). Thus, to remove this unphysical artifact from the data the azimuthal data is averaged in the first radial bin and all of the azimuthal data are set equal to the average.

In terms of solid angle, those central pixels are also the smallest so they tend to be the noisiest as relatively few rays hit them. If a uniform angle source is placed inside a Detector Polar, the center will be very noisy compared to the outer zones because of the undersampling. That is why the center zone is treated as a single pixel. For relatively small radial angles the azimuthal angle has no real meaning.

We can note that every inner zone pixel shares the center of the plot, whereas in all other zones the pixels only touch one neighbor on either azimuthal side.

## The Text Tab > Full Listing

The Text Tab in the Detector Viewer can show the values recorded for different polar and azimuthal angles.Let’s select the Full Listing:

The polar pixels are the columns. The start index is 1.

The azimuthal pixels are the lines. The start index is 0.

__Remark! In version prior to 16.5 SP2__: The azimuthal pixels were listed in the Text Tab of the Detector Viewer in descending order rather than ascending order.

# Reading the pixels

The file called source_ray.ZMX (attached at the top of the article) contains a source ray and a Detector Polar. That file has 6 configurations which are 6 different direction cosines of the source ray.The Detector Polar has 181 radial pixels and 180 angular pixels. It means that the radial bin size is 1 degree and the angular bin size is 2 degrees.

The merit function is set up to read a specific pixel of the Detector Polar for each configuration:

Let’s know trace some rays and check the pixels to understand how it works.

## 1^{st} configuration : Source ray along Z

The source starts at X,Y,Z=(0,0,0) with direction cosines equal to l, m, n=(0,0,1). That ray comes from the center of the Detector Polar and is parallel to Z.On the Detector Viewer, I click on the Text Tab of the window and select Full Listing. The only values are for the first radial bin. As we have seen earlier, the data is averaged on the azimuthal data at this polar angle.

## 2^{nd} configuration: Source ray with 45 degree in YZ plane

The source ray now starts from X, Y, Z= (0,0,0) with a direction cosine of l, m, n= (0,1,1). That ray comes from the center of the Detector Polar and has a 45-degree polar angle (in blue below) and a 90-degree azimuthal angle (in green). The source ray is in bright blue.On the Text Tab, only one pixel has some power. That pixel has a radial coordinate of 46 and an azimuthal coordinate of 45.

Radial bin = floor(.5 + 45/1 degree increment) + 1 = 46 (+1 because it starts at 1)

Angular bin = floor(.5 + 90/2 degree increment) = 45

On the Text Tab, I can read the value at these lines:

To read the pixel using the NSDP operand:

pixel number = angular bin x number of radial pixels + radial bin

Bin 0: φ = 0° 1 1 x 181

Bin 1: φ = 2° 1 x 181 + 1 2 x 181

Bin 2: φ = 4° 2 x 181 + 1 3 x 181

…..

Bin 45: φ = 90° 45x181+1

**45*181+46=8191**46x181

# Summary of the different configurations

The table below summarizes the 6 different configurations of the source ray file:181 radial pixels

180 angular pixels

Radial bin size = 181 / 181 = 1 degree

Angular bin size = 360 / 180 = 2 degrees

__Remark about the edge of the bin:__

The angle values are double precision values that undergo conversion between degrees and radians, as well as Cartesian to polar coordinates. Because of this rounding, when a ray hits the edge of a bin, there can be a slight difference between the bin calculated by OpticStudio and the bin calculated by "hand".

# Summary

This article has described the Detector Polar; the sign conventions, the different views to display radiant intensity data on a polar plot and the pixel numbering.2 things can be remembered about the pixel numbering:

- To find the radial/angular bin from the azimuthal/polar angle, the bin number can be found [bin_number] = floor(.5 + [value] / [bin size])
- The pixel number is equal to angular bin x number of radial pixels + radial bin