The purpose of this article is to provide a step-by-step guide to calculate Edge Spread Function (ESF) using Speos simulation results. The lens system data will be exported from Zemax OpticStudio to Speos using Optical Design Exchange, which includes geometries, materials and coatings. For the ESF calculations we will explore two options in this article: the direct visualization of the graphic in Speos and the possibility of exporting the data to represent it in the numeric program of the user’s choice.
Overview
Spatial resolution is one of the essential parameters to evaluate when analyzing an optical system’s performance. There are several ways to assess this, but one of the most common and widely known methods is the calculation of ESF and MTF metrics for the system. Zemax OpticsStudio provides a direct way to calculate and analyze the ESF at the design level. In contrast, while Speos does not offer a built-in ESF calculation in the same manner, it enables the evaluation of ESF at the system level, considering the full product integration. This article outlines a method to achieve this analysis within Speos.
ESF definition
The Edge Spread Function (ESF) is used to describe how an optical system reproduces an edge in the target image. This function showcases the system’s performance during a transition from a low-intensity area to a high-intensity one, essentially representing the target edge.
ESF is directly related to Modulation Transfer Function (MTF) with the Line Spread Function (LSF), which corresponds to the first derivative of ESF.
Description of the steps:
- [Optional] Exporting data from Zemax OpticStudio: the optical system designed in Zemax OpticStudio will be exported to Speos as an *.ODX file, using the “Export Optical Design Exchange” option. This file is already included in the downloadable data of this article, so this is an optional step.
- Speos project for ESF calculation: description of the actions that needs to be taken to obtain the ESF graphic directly from Speos simulation results.
- Simulation results for ESF: possibility of exporting the necessary data to allow the visualization and post-processing of the ESF in other external numeric programs.
Note: software prerequisites
To complete this workflow the following software needs to be installed:
- [Optional] Zemax OpticStudio 2025R1
- Speos 2025 R1
ESF calculation workflow in Speos
Exporting data from Zemax OpticStudio [Optional]
The first step in our process for ESF calculation is exporting the data from OpticStudio to Speos. When opening the 710_ESF.zmx file, we will see our lens systems along with some analysis graphics: Line/Edge Spread function and MTF. This ESF graphic is the one we will compare with the Speos results.
For exchanging lens data between OpticStudio and Speos we need to click on File>Export Optical Design to Speos and an .ODX file will be automatically generated. This file includes information with respect to geometries (surface types, location and orientation), materials applied on lenses (chromatic dispersion, absorption and coatings) and imager (location and orientation).
Please note that if the distance between the object and the lens system is “Infinite”, it is recommended to replace it by a finite value in OpticStudio before doing the ODX export. This modification should not change the results. In our case, we will set this distance to 490015 mm.
Note: the data exchanged between Zemax OpticStudio and Speos is described in this article using the Optical Design Exchange Export feature. However, this full workflow for calculating ESF in Speos can be also performed using the Reduced Order Model export.
In addition, the lens design imported in Speos can be exported from other sources such as STEP files or being directly designed in Speos.
Speos workflow for calculating ESF
To obtain the necessary simulation results for calculating ESF for the Speos system, we first need to define all the elements of the simulation we want to perform, including geometries, sources and sensors. Additionally, we must import the lens design from OpticStudio and make sure of correctly positioning all the geometries within the simulation.
Importing data in Speos
In Speos, we can create an Optical Design Exchange feature (Light Simulation > Components > Optical Design Exchange) that will use the ODX file to generate:
- The geometries that correspond to the different lenses. The analytical formulas and associated parameters are used to perform this step.
- A component that links the geometrical information from the generated geometries with the information related to the optical properties (materials and coatings) stored in the ODX file.
Once the ODX file is imported, select the Origin ODX available in the structure tree as reference axis for the imported geometries. Note that the imported geometries are also appearing in the structure tree.
Note: Speos simulation uses the mesh of the different geometries during the light propagation whereas OpticStudio uses the analytical description of the different surfaces. For Speos simulation to be as accurate as possible, compared to OpticStudio simulation, we need to be aware of the meshing properties in Speos.
Please note the Optical Design Exchange feature will be used in simulation and not the individual lens geometries. Optical Design Exchange feature meshing parameters can be accessed via the options , which can be opened by right clicking on Optical Design exchange component.
We introduce as meshing parameters for the ODX file the following values:
These meshing parameters can be modified to adapt to every use case and geometry. In addition, local meshing can also be defined and applied to more complex geometries to avoid having excessively long initialization time in the simulation without compromising accuracy in the results.
More detailed information can be found in Speos Meshing Best Practices – Ansys Optics.
Application of Surface Optical Properties to the lens component
OpticStudio uses sequential propagation mode to calculate ESF. On the other hand, Speos propagation based on Monte Carlo algorithm would be the equivalent of a non sequential propagation. Therefore, we need to ensure to force the rays to be transmitted from one diopter to the other in order to be in the same conditions as in OpticStudio.
Speos allows to over define face optical properties of the Optical Design Exchange component, which has been transferred via optical design exchange from Zemax OpticStudio. As an example we define the equivalent of the perfect AR coating.
- Open the Simple Scattering editor available in Light Simulation > Tools > Editors > Simple Scattering Surface and introduce the values shown below. Save it and name it as AR coating.
- Then, create a new material by clicking in Light Simulation > Optical Properties > Materials. The type of this material must be set to “Face properties”. Then, the type of surface properties needs to be defined as library, with a reference to the perfect AR coating we just created. Rename it as Transmission.
We need to apply this material to all the diopters that will play a part in the light propagation: front and back surfaces of the lenses, 14 surfaces in total. For applying the material there are two possibilities: applying it directly selecting in the 3D view all the diopters’ surfaces or creating a group with all the surfaces. We will describe this second practice:
- Select all the front and back surfaces of the diopters.
- Keeping them all selected, click on to the Groups tab and then click on Create NS. A new group should appear containing all the selected diopters. Rename it as “Diopters”.
- Apply the material by selecting the Diopters group you have just created.
Next step is to make sure that all the surfaces of the different lenses that do not contribute to the light propagation (lens edges, mechanical diameter…) will absorb the rays. We need to create a second material for this which will be fully absorbent.
- In the Light Simulation > Optical Properties click on Material. The type of this material must be set to “Face properties”. Then the type of surface properties needs to be defined as mirror with a reflectance of 0%, that corresponds to an absorption of 100%.
- Then, we need to apply this material to all the remaining surfaces.
The last stage of this material application step of the workflow will be to create an absorbing envelop for our lens system. To ease the process, the envelop has been already created for this example and can be found in the structure tree under the name “Envelop”. We have applied to this surface an absorbent material, with type defined as volume & surface properties.
The creation of this case is necessary because we will use an inverse simulation to achieve the analysis, which means the rays will be propagated from each pixel of the imager sensor (irradiance sensor). Therefore, we need to make sure that rays follow the main optical path – propagating through the sequence of diopters – and are absorbed in case they don’t.
Source definition
Zemax OpticStudio project uses three different wavelengths: 486nm, 588nm and 656nm. Since three different sensors will be generated adapted to each one of these wavelengths, you can use a flat spectrum file defined between this range. For the example of this article, a *.spectrum file has already been provided and can be found in the Speos input folder under the name “E.spectrum”. However, different *.spectrum files could be generated to adapt different use cases.
Once the spectrum file is generated, it is necessary to create the surface where we are going to define the source. Since the purpose of the simulation is to obtain results for ESF calculation, we need to define the edge that is going to be our image.
We create one big plate that needs to cover the area where you want to evaluate the ESF. The distance between the plate and the optical system must correspond to the distance set in OpticStudio. Again, to ease this process, the plate has already been created in the position of the axis named “Origin”, available in the structure tree. This plate has a material assign that represents air.
Finally, once the plate is created, we need to define a surface source, that will include the spectrum file generated.
- In the Light Simulation tab > Sources, click on surface. Then, rename the surface source created as “Flat source”.
- For defining the source, we are going to introduce the parameters values shown in the picture below. For the spectrum file, we are going to select the library option and browse for the E.spectrum previously mentioned.
- Finally, we need to select emissive faces for the source. In this case, we will select the plate available in the structure tree. You need to be sure that the source is emitting in the direction where the optical system is located.
Sensor definition
Another key element for defining correctly our simulation is the sensor. In this case we will define three different irradiance sensors, one for each wavelength already defined in the Zemax OpticStudio project. Each of these sensors will be located at the imager sensor position, using the axis created in the structure tree named "Origin_sensor".
The sensor type will be spectral. Its surface corresponds to the analysis surface used in OpticStudio to calculate the ESF. The sampling (number of pixels) does not need to be high along X as we are only interested in the transition along Y, because the edge transition is in this direction. This also permits the pixels to integrate more rays.
Inverse simulation
With all the elements defined we need to create an inverse simulation, including the source and the three sensors created. Optical Design Exchange features and the geometry that corresponds to the geometrical envelope need to be selected as geometry. We will set the stop conditions for duration with a limit of 2 minutes. For the simulation options, we will set the following values:
In the inverse simulation specific tab, which can be accessed by right-clicking on the simulation icon (in the Simulation tab), don’t forget to check the dispersion option as well.
With the inverse simulation correctly defined, we can proceed to compute it. We recommend using GPU to reduce simulation time. However, if using CPU is preferred, the simulation duration must be increased.
Note: Speos is compatible with Nvidia GC.
The total simulation time will be of 6 minutes, 2 minutes for each sensor.
Simulation results for ESF
Analyzing simulation results
Inside the inverse simulation, an *.xmp map is generated for each sensor (wavelength). Double-click to open the file and visualize the irradiance maps shown below, which showcase the edge the optical system is capturing in the three selected wavelengths.
From these maps, we can calculate the ESF and obtain its profile. For each map, we create three different vertical measurements using the Measurement tool. The reason for having three different measurements within the same *.xmp map is to calculate the average, which provides a more accurate ESF representation for each wavelength.
For each measurement, we can display the 2D section to visualize the profile. In addition, we can export the data for each measurement and import it later in the numeric program of our preference, such as Excel. Do not forget to select illuminance as magnitude.
ESF comparison between Zemax OpticStudio and Speos
By exporting the ESF data from OpticStudio to Excel as well, we will be able to compare ESF results from OpticStudio and Speos for the three wavelengths. To export the data from OpticStudio, please ensure you first select the desired field and wavelength. Also, introduce a maximum radius value to match the sensor size in Speos. For this example, set the maximum value to 2.5 micrometers.
Another post-processing step required before comparing ESF is normalizing the ESF values for the Speos data to express them in terms of relative intensity. This normalization aligns with how ESF is calculated in OpticStudio, with values ranging between 0 and 1.
Speos results does not take into account diffraction effects in the optical system. This issue may explain the not perfect correlation between OpticStudio and Speos.
Note: the consideration of diffraction effects in Speos simulations is currently being developed.
Taking the model further
Speos Light Box
This workflow can be directly performed with the geometries of the Optical Design Exchange imported in Speos, but ODX feature can also be included in a Speos Light Box. This step is not mandatory, but it can provide some advantages. First, the Light Box can be black-boxed, including all the additional geometries and mechanical parts that were designed after the ODX. This ensures the protection of intellectual property if necessary. In addition, Speos Light Box geometries are stored with meshing definition, which could save time during the initialization of the simulation, especially when working with complex geometries or that required accurate mesh. Optical properties are also included in the exports.
To convert our ODX component into a Speos Light Box file, first we need to export the desired geometries as a Light Box, so we can import again as a Light Box component inside the Speos project.
The Speos Light Box is already created in the ESF_end.scdocx file of the downloadable data of this article.
- On Light Simulation > Component > Light Box, click on Export Speos Light Box.
- Select the ODX feature from the simulation panel, along with the solid created as an envelop for the lens system.
- Keep the rest of the settings as default and click on compute to generate the *.SPEOSLightBox file inside the output files.
Once the Light Box has been exported as a file, we can import it back in our project.
- Again, click on Light Simulation > Component > Light Box and select Import Speos Light Box this time.
- Browse for the .SPEOSLightBox file previously generated, located in the output files folder, keeping the settings as default.
After computing the component, the Speos Light Box will be ready to be use in the simulation.
For more detailed information about this exporting process between ODX and Speos Light Box we recommend the article: How to exchange a black box optical system between supplier and original equipment manufacturer – Ansys Optics.
Analysis of different fields
The workflow shown in this article focuses on the calculation of the ESF in Speos for a field of 0º. However, just as we can perform an analysis for our optical design for different fields in OpticStudio, we can also create geometries in Speos that allow us to obtain ESF results simulating different fields.