# Understanding the Detector Polar

The Detector Polar object can record and reoport the raiandt intensity data from non-sequentual rays that hit it. This article provides guidance on how to correctly understand and interpret the output of this powerful tool.

Authored By Sandrine Auriol

Article Attachments

## Introduction

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.

## Description of the detector

The Detector Polar shape is a faceted approximation of a portion of a sphere centered on the object coordinates.

The Detector Polar uses polar coordinates. In the image below, we find:

• The polar angle is the θ angle. The polar angle represents the height/latitude. A polar angle of zero means the detector is centered on the object's 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 φ angle and represents the longitude. The azimuthal angle is defined by: φ = arctan(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.
• The radial size of the Detector Polar is given by r. A ray starting at the center of the Detector Polar with direction cosines l, m and n will hit the Detector Polar at: And the spherical coordinates will be: The mapping from spherical coordinates to three-dimensional Cartesian coordinates is: ## 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 of 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

Those coordinates can be read on a detector rectangle positioned at Z = 5mm.

### 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

Information on pixel numbering can be found in the Help System at: The Setup Tab...Editors Group (setup tab)...Non-Sequential Component Editor...Non-Sequential Detectors...Detector Polar Object

“For the Detector Polar, the pixel numbers start at 1 in the polar center at an azimuthal angle of zero. The pixel numbers increase along the polar direction until pixel np, where np is the number of polar pixels. The pixel np+1 is at zero polar angle at the first azimuthal increment counter-clockwise from 0 degrees, and the pixel number increase along the azimuthal arm until 2*np. The next pixel number is 2*np+1, which start again at a polar angle of zero and proceeds along the next azimuthal arm. Another way of stating the pixel numbering is that the polar index changes the fastest, and then the azimuthal index.”

 Polar angles Radial bin 1 Radial bin 2 ... Radial bin np Azimuthal angles Angular bin 0 1 2 ... np Angular bin 1 np+1 ... ... 2np Angular bin 2 2np+1 ... ... 3np ... ... ... ... ... Angular bin 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…. Note: 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 their polar angle. 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: Notes on 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 since 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 since 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.

Notes on 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".

### The Text tab

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. In versions of OpticStudio 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.

The file called source_ray.ZMX (attached) 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 now trace some rays and check the pixels to understand how it works.

### Configuration 1: 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.  ### Configuration 2: 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:

We know that pixel number = angular bin x number of radial pixels + radial bin. So, with the information from above, we find that pixel number = 46*181+46 = 8191. ### Summary of the different configurations

The table below summarizes the 6 different configurations of the source ray file: KA-01622