Applying a field 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 field weighting function during optimization
Symptoms
You can apply a custom field 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 pupil and color/wavelength weighting functions will be the subject of separate Knowledge Base entries.
Solution
An example CCL routine for the field weighting function can be found inside the "asyst_tools1.ccl" file in your ".../public/ccl" folder. The command is called "field_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 Field weighting function: We will open a simple lens, and apply a typical error function both with and without a field weighting function applied. We will inspect the appropriate lens parameters before and after.
Load a typical lens such as the "TRIP.len" lens in your ".../private/len" folder.
Now we will inspect the default field point set for this lens.
Select the "Field Points" button from the opened "Surface Data Spreadsheet". This will open the "Field Points Set Data Editor".
In the Editor, note that the fractional Y height (FBY) of the three field points are 0.0, 0.7 and 1.0.
Now choose "Spreadsheet Style"="Advanced" in the Editor.
Note that the weights (WGT) of the three field points are uniform (all field points = 1)
Close the spreadsheet by clicking on the Red "X" in the upper left corner of the editor window.
Now we will apply a typical error function.
Choose "Optimize>>Generate Error Function>>OSLO Spot Size/Wavefront" from the OSLO menu.
In the resulting "Generate Error Function" dialog, choose "Field Sampling Method" = "Equal Heights". This will result in the three field points being equally spaced in fractional image height (0, 0.5 and 1.0) and having equal weights.
Keep everything else as the default values in the dialog and click the "OK" button at the bottom of the dialog.
Now you can inspect the changes to the field point set by following step #2 again. Note that the three field points are now equally spaced in fractional FBY height (FBY: 0.00, 0.50 and 1.00) but still have equal weights (WGT: 1.000, 1.000, 1.000).
Now we will evaluate the error function we have just created.
Click on the "OPE" icon from the "Standard" toolbar in the Text window. (If the Standard toolbar is not open, you can just type "OPE" (no quotes) on the command line and hit the key).
In the "*OPERANDS" evaluation that gets written to the text window, note that field point weights (WGT column) are uniform. Note that the on-axis field point is weighted =1, the X and Y rays of the 2 off-axis field points are each weighted 0.5 - which will each combine to 1.0 for each field point.
Now we will apply the field weighting function.
Choose "Optimize>>Optimization Conditions" from the OSLO menu.
In the resulting dialog, enter "field_wt" (no quotes) in the cell next to "Command for field 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: opfw field_wt;
Now we will re-apply the error function and inspect how the field weights have changed
Re-apply the error function you created in step #3 above. If you choose one of the weighted sampling options (Gaussian, Radau or Lobatto), your field weighting function will be applied in combination with the one chosen - this is NOT what you want to do for this example.
Inspect the field point set like you did in step #2. Note the fractional FBY height is still uniform spacing (FBY: 0.0, 0.5, 1.0), but the field point weights are lower for the off-axis field points (WGT: 1.000, 0.906, 0.250)
Inspect the operand (error function) summary like you did in step #4. Note that the weight of the operands sets is 1.0 on axis and lower off-axis (WGT: Yrms3+Xrms3 = 0.250).
Changing the Field weighting function: If you want to change the calculation of the Field weighting function, it is recommended that you copy the "field_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).
Copy the function lines from the file: double field_wt(double h) // hlp: Function given in Forbes, JOSA A Nov. 1988, Fig. 12. // kwd: field, weights // cat: general tools, math functions {tdouble hsqr;thsqr = h * h;treturn 1.0 - 0.25*hsqr - 0.5*hsqr*hsqr; }...from the "asyst_tools1.ccl" file to your new CCL file in your ".../private/ccl" folder.
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.
Now you can edit the contents of your new CCL file.
Note that "h" is the fractional field height that is passed to the function.
The result of the equation: hsqr = h * h; 1.0 - 0.25*hsqr - 0.5*hsqr*hsqr;...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 "field_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 field weighting function is only available in OSLO Premium