Skip to content

Applying a pupil weighting function during optimization

Question

I notice in the Optimization Conditions dialog box (see the menu item "Optimize>>Optimization Conditions"), that I can apply field, pupil and color weighting functions. How can I do this?

Synopsis

Applying a pupil weighting function during optimization

Symptoms

You can apply a custom pupil weighting function (written in CCL) that will be implemented when you automatically generate the "OSLO Spot Size/Wavefront" error function. This Knowledge Base item will address the specifics of how to apply and customize this field weighting function. Implementing field and color/wavelength weighting functions will be the subject of separate Knowledge Base entries.

Solution

An example CCL routine for the pupil weighting function can be found inside the "asyst_tools1.ccl" file in your ".../public/ccl" folder. The command is called "pupil_wt" and can be found with a text search of the CCL file. This command already contains an equation defining a default weighting function. For demonstration purposes, we will use this default weighting function without altering the file. A brief description of how to alter the weighting function will be identified below. Demonstrating the Pupil weighting function: We will open a simple lens, and apply a typical error function both with and without a pupil weighting function applied. We will inspect the appropriate lens parameters before and after.
  1. Load a typical lens such as the "TRIP.len" lens in your ".../private/len" folder.
  2. We need to apply some error function in order to see an example of pupil weighting.
    • Choose "Optimize>>Generate Error Function>>OSLO Spot Size/Wavefront" from the OSLO menu.
    • In the resulting "Generate Error Function" dialog, note that the "Pupil Sampling Method" = "Lobatto". Leave this as it is.
    • Keep everything else as the default values in the dialog and click the "OK" button at the bottom of the dialog.
  3. Now we can inspect the pupil weights we generated when we applied the default error function.
    • Choose "Optimize>>Error Function Tables>>Ray Set" from the OSLO menu.
    • Note that rays 1 and 7 are centered in the pupil (FY=FX=0), while rays 6 and 16 are at the top of the pupil (FY=FX=1). Rays 1 through 6 will be used for the on-axis field point, and rays 7 through 19 will be used for the off-axis field points. Note that in each group, the center pupil ray has the same weight as the edge pupil rays (WGT: rays 1 & 6 = 0.016667) (WGT: rays 7 & 16 = 0.041667).
    • Note that changing these weights now does not affect the error function. The weights that are shown demonstrate the pupil weighting when the error function was created.
    • Close the Ray Set Data Editor by clicking on the Red "X" in the upper left corner of the editor window.
  4. Now we will apply the pupil weighting function.
    • Choose "Optimize>>Optimization Conditions" from the OSLO menu.
    • In the resulting dialog, enter "pupil_wt" (no quotes) in the cell next to "Command for pupil weighting:"
    • Click on the Green "check" in the upper left corner of the window to accept the changes you have made.
    • As an alternative to using the "Optimization Conditions" dialog, you can issue the following command on the command line: oppw pupil_wt;
  5. Now we will re-apply the error function and inspect how the pupil weights have changed
    • Re-apply the error function you created in step #2 above.
    • Inspect the pupil weights like you did in step #3. Note that the rays at the edge of the pupil are weighted significantly less than the rays in the center of the pupil (WGT: ray1 = 0.015685 & ray 6 = 0.005363)(WGT: ray7 = 0.037967 & ray 16 = 0.015562).
    • Again, Note that changing these weights now does not affect the error function. The weights that are shown demonstrate the pupil weighting when the error function was created.
Changing the Pupil weighting function: If you want to change the calculation of the Pupil weighting function, it is recommended that you copy the "pupil_wt" function from the "asyst_tools1.ccl" file in your ".../public/ccl" folder, into a new CCL file in your ".../private/ccl/" folder (the files in your private folder will not be overwritten in a future release of OSLO).
  1. Copy the section of the file from line 84 to line 96: double pupil_wt(double rho) // hlp: Function given in Forbes, JOSA A Nov. 1988, Fig. 12. // kwd: pupil, weights // cat: general tools, math functions {tdouble rhosqr; trhosqr = rho * rho; treturn 1.0 - 0.25*rhosqr - 0.5*rhosqr*rhosqr; }...from the "asyst_tools1.ccl" file to your new CCL file in your ".../private/ccl" folder.
  2. Once you have created your new CCL file, save it and make sure that your private CCLs are compiled ("Tools>>Compile CCL" in the OSLO menu). The message: *CCL COMPILATION MESSAGES: No errors detected ...in the text window indicates that the new CCL file was created properly.
  3. Now you can edit the contents of your new CCL file.
    • Note that "rho" is the fractional pupil height [rho = sqrt(FY*FY+FX*FX)] that is passed to the function.
    • The result of the equation: rhosqr = rho * rho; 1.0 - 0.25*rhosqr - 0.5*rhosqr*rhosqr;...is the weighting factor that is passed back to OSLO and used.
    • Make sure that the new CCL file name ends with the *.CCL delimiter
    • You can name the new CCL file that same name if you like ("asyst_tools1.ccl"), or you can change it. It is the names of the commands inside the file that are important.
    • You can even change the name of the command from "pupil_wt". Just make sure that the name is changed in both the CCL file as well as the cell in the Optimization Conditions dialog.
    • You can place more than one CCL command in each CCL file. So you can combine multiple weighting functions in the same CCL file.
    The pupil weighting function is only available in OSLO Premium