This article aims to provide a comprehensive guide to obtain the necessary data from a Ansys Speos project for later MTF calculation using an external tool of the user’s choice. We will demonstrate how to use the Reduced Order Model transfer lens system design from Zemax Opticstudio to Speos, where we will set up a simulation based on the slanted edge method. Additionally, we will show how to import the generated Speos data into an external tool of your choice for complete MTF analysis.
Overview
MTF analysis is one of the essential metrics when evaluating the performance of an optical system. It describes the sharpness of the resulting image by looking at contrast as a function of spatial frequency.
Zemax OpticStudio allows the calculation of the MTF for evaluating optical systems (more information about MTF calculation in Zemax OpticStudio in Methods for analyzing MTF in OpticStudio – Knowledgebase). This is not a direct analysis we can perform in Speos. However, there are several steps that can be followed to obtain the necessary data to analyze Speos system performance with MTF.
MTF definition
MTF or Modulation Transfer Function is a reference metric that quantifies the performance in terms of resolution of an optical system. This function describes the contrast (in a [0,1] interval) in the image of a spatial frequency (resolution) shown in the scene being observed.
Since the maximum resolution of an optical system is defined by the diffraction limit, we can evaluate how close a system's performance is to the ideal (diffraction-limited) performance by comparing the system's MTF with the MTF of the diffraction limit. Similarly, the performance of two different optical systems can be compared by evaluating their respective system MTFs. The closer the MTF is to the diffraction limit, the better the system’s performance.
Description of the steps:
1. [Optional] Exporting data in Zemax OpticStudio: the starting point for the workflow described in this article will be a lens system design in Zemax OpticStudio. This optical system will be exported as Reduced Order Model (ROM). The *.OPTDistortion file is already included in the downloadable data of this article, so this is an optional step.
2. Speos project for MTF: description of the actions based on the slanted edge method that needs to be taken to obtain the necessary data to perform MTF analysis for our system.
3. [External to Ansys] MTF visualization tool: the final image generated in Speos using the slanted edge method can be imported into an external tool of the user’s choice to perform the final MTF system analysis.
Note: software prerequisites
To complete this workflow the following software needs to be installed:
- [Optional] Zemax OpticStudio 2025R1
- Speos 2025 R1
MTF calculation workflow in Speos
Exporting data in Zemax OpticStudio [Optional]
When we first open the Zemax OpticStudio file named Lens710.zda available in the ZOS folder of the downloadable data, this is what we visualize. As it was mentioned, Zemax OpticStudio offers the possibility to perform MTF analysis for the optical system (right bottom window of the image below).
By exporting the optical system from Zemax, we will be able to perform the MTF analysis in Speos and compare the results between both software if needed. Among the export options available in OpticStudio, we will select Reduced Order Model, generating an .OPTDistortion file that will be later imported into the camera sensor definition in Speos. When doing this exporting action, it’s important to make sure that we adapt the wavelength selection in OpticStudio to the wavelength range of performance in Speos, to be able to simulate the same conditions in both software allowing us to compare both MTF.
In the System Explorer>Wavelengths, we can see that our system is defined in the visible spectrum, with three wavelengths defined: 486 nm, 588 nm and 656 nm. . Therefore, to reproduce this selection in Speos, we will define three different sources corresponding to the ones in Zemax OpticStudio.
Reduced Order Model export
With the wavelength range already defined, we can then export our system as a Reduced Order Model:
- In the File tab, click on Export Reduced Order Model to Speos.
- A window will pop up. We are going to set the sensor sampling to 30. The rest of the parameters will be left as default, as is shown in the image below.
This ROM file can be found in the downloadable data of the article.
Speos project for MTF
For the Speos part of this workflow for MTF, we will open the Speos project “MTF_workflow_start.scdocx”, appearing the geometry that is shown in the image below. In this Speos project we have already defined a chessboard 5o slanted in reference to the coordinate system. This chessboard is going to be the source for our system simulation and is going to allow us to have as an output result an image where we will apply the slanted edge method to obtain MTF for our optical system.
[Optional] Spectrum file definition
First, we need to define our chessboard geometry as a surface source to use it in the simulation. As was mentioned, we want to have simulations results for the three wavelengths defined in OpticStudio, so we will define three different sources. For this purpose, it is necessary to generate one spectrum file for each wavelength to complete the source definition after. This step is optional as the *.spectrum files can be found in the Speos input files folder of the downloadable data.
- In the Light Simulation tab> Tools>Editors, click on Spectrum. Then, click on Spectrum generation icon and define the exact same three wavelengths as the ones defined for the ROM file export.
- Define four more wavelengths with a 0% value to be able to better visualize the spectrum emission.
- Save the file as Gaussian_486nm.spectrum.
Repeat the file generation for the other two wavelengths: 588 nm and 656 nm.
Source definition
With the spectrum files defined we will create three different surface sources.
- In the Light Simulation tab>Sources, click on surface. Then, rename the surface source created as 486nm.
- 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 Gaussian_486nm previously defined.
- Finally, we need to select the emissive faces for our source. In our case, we will select all the chessboard faces, available in the structure tree as Resolution geometry, with a total of 196 emissive faces. You need to be sure that the source is emitting in the direction where the camera is going to be located.
We will repeat the process for the other two waveleghts.
Camera definition
The next step in our MTF workflow in Speos is defining the camera we want to perform the MTF analysis for. We will create a camera sensor, that will be defined by the corresponding ROM file previously exported from Zemax OpticStudio.
- In the Light Simulation tab>Sensors, click on Camera. A new icon should appear in the simulation panel.
- For the position of the camera, we are going to select the default origin (see the image below), making sure that the reverse direction for the X axis is set as true, so the Camera is located correctly.
- For the distortion file, we are going to select the Lens710.OPTDistortion file inside the Speos input files folders.
- For the Spectrum, we are going to browse again and select the Transmission.spectrum file inside the Speos input files folder. The rest of the camera sensor parameters will be set as shown in the image below.
- See that once the ROM file is imported in the camera sensor, the wavelength range will be automatically recalculated.
For more detailed information about camera sensor in Ansys Speos we recommend Getting started with Speos Camera Sensor and running an example – Ansys Optics.
Inverse simulation definition
For the final MTF measurement results, define an inverse simulation including the corresponding source and camera sensor for each of the predefined wavelength configurations.
- In the Light Simulation tab>Simulations, click on Inverse simulation. Then, rename it after Inverse_MTF_486nm.
- We are going to set the simulation parameters as shown in the image below, changing the number of passes to false and establishing a duration limit of 10 minutes.
- Next step is selecting geometries, sources and sensors. For the geometries, we select the resolution chart available in the structure tree. For the sources, we select the corresponding to the 486 nm wavelength. Finally, we need to add the camera sensor.
We create other two simulations, one for 588 nm and the other for 656 nm.
With all the simulations defined, we can click on compute and wait for the results for the three of them. We recommend to compute this simulation on GPU, since we will obtain results faster and so with less noise. For simulation time, we recommend 7-10 minutes for each simulation, finding the balance between long computation time and noise in the results.
Simulation results: image export
Once the simulation files are generated, we are going to open the Inverse_MTF_486nm.Camera:486nm.Irradiance.xmp file, since this is going to be the image we are going to use for the generation of the MTF for our system. But to be able to import it into an external MTF tool, first we need to export it as *.png format. The *.png file format uses a compressed but not destructive algorithm so that can image is preserved.
Some steps need to be followed to export the image correctly.
- First, we need to change the color map of our result to Black to White (custom color) option. For the wavelength selection, we can keep “All wavelengths” layer.
- Then, click on filtering and ensure that no filter is applied to the image.
- Finally, in file, we can click on export and save the *.xmp irradiance map as an *.png image.
Repeat the process with the other irradiance map results for the other two wavelengths.
[External to Ansys] MTF visualization tool
The rest of the workflow for MTF visualization using Speos simulation results will be followed in an Ansys external tool. In this example we will perform the analysis in MTF mapper, a free and open external tool, but this analysis can be followed in any external tool for MTF visualization of the user’s preference.
In the next following steps, we will describe the settings that need to be selected in the tool to make the MTF with Speos results as similar as possible to the Zemax Opticstudio one to be able to compare both:
- Before loading the image, in the settings>preferences, it is necessary to verify the linear gamma options. Addionally, introduce the same pixel size you are using in Speos camera definition. For this example, 0.5 μm.
- When loading the image, click on open manual edge selection. Then, load the desired image (of the ones exported from Speos) and select some edges as shown.
- After calculating, we will obtain the MTF50 value for each one of the selected edges, as well as MTF graphic that can be compared with the OpticStudio one.
Comparison between MTF results: Zemax vs Speos
For the geometric MTF calculation in Zemax OpticStudio we have two types of MTF: sagittal (or radial) and tangential (or meridional). The tangential MTF is calculated in the tangential plane, defined in OpticStudio as the YZ plane. Sagittal MTF is computed in the plane orthogonal to the tangential plane, the x axis in object space. For MTF Speos results, vertical MTF is equivalent to sagittal, and horizontal to tangential, and the opposite in the horizontal axis (User's guide: Sagittal and Tangential).
In OpticStudio, MTF is calculated for different fields. For the example of this article, we will focus on on-axis MTF, where 0º field corresponds to the center of the sensor. On Speos side, MTF is calculated using an image where the edge positions (different fields) are expressed in millimeters. Therefore, to adjust the Speos MTF to match the OpticStudio one for a more accurate comparison, a correspondence between field angle and sensor position in mm can be calculated.
In the section we are going to compare MTF results for the 0º field with the MTF for the center area of the sensor. For the MTF settings in OpticStudio, uncheck the “Multiply by diffraction limit” option to make the MTF graphic as similar as possible to the Speos one. Additionally, select only the wavelength you want to study, along with the field. Please note that while the MTF in OpticStudio is drawn for a maximum spatial frequency of 690 cycles/mm, the Speos one is in cycles/pixel units, so we must apply a unit conversion before comparing both results.
It is important to highlight that, for most systems, the best MTF will be on-axis or at the center of the image, as MTF changes radially with the field. MTF is not constant across the entire image plane and may sometimes be defined or measured differently depending on the system.
Another relevant factor to have in mind when comparing MTF results is that, on Zemax side, MTF is only relative to optics without taking sensor resolution into account. On the other hand, Speos data are saved in a matrix of pixel with limited spatial resolution. Even if the slanted edge method helps reduce the effect of limited resolution, it is not perfect and can cause small differences between Zemax and Speos results. This is especially true for lens designs with very low aberration level and in the high frequency domain of the MTF.
Another parameter that impact MTF is noise. For reducing the noise in the results, the sensor size can be reduced as we increase the number of passes or the simulation time.
Updating the model with your parameters
The workflow described in this article can be applied to any model of the user’s choice. Some key points to consider when doing this are described in this section.
- It is necessary to make sure that both Zemax OpticStudio and Speos wavelength definition match to be able to compare both MTF results.
- In this article, we recommend running the defined simulations using GPU. However, if CPU is selected as the computing option, please note that the simulation time required to obtain equivalent results will increase considerably.
- For the last step of the workflow, we propose MTF mapper as an external tool, but this process can be followed with any software for MTF calculation and visualization. Just make sure that the settings for the MTF calculation in the tool of your choice match the OpticStudio ones to make the comparison as accurate as possible.
- Due to Montecarlo algorithm used in Speos simulation, results are affected by statistical noise. Although the slanted edge method significantly reduces the noise impact, simulation results will never be perfect. This means that small differences can affect the correlation between Zemax and Speos MTF results.
If it is necessary to determine whether the difference between results is due to noise, one possibility is to compute two additional simulations with half and twice simulation time and compare three Speos results together. If a difference is observed, it would indicate that the noise in the result is too significant to be completely removed by the slanted edge method.
Taking the model further
Compatibility with Zemax Black Box
The workflow for MTF calculation explored in this article is compatible with Zemax Black Box. This means that, even if a lens system is encapsulated as a Black Box, we can still export the model to Speos as a Reduced Order Model. The simulation results will not be affected by the Black Box Lens.
In the image below, we see the same OpticStudio file used to showcase this workflow, but now most of the lens system is inside a Black Box. We can see that the system’s performance has not been modified, as the ESF and the MTF graphics remain unchanged.
After exporting this system as a ROM to Speos and importing it into the camera sensor, as described in this article, we observed that the simulation results, and therefore the MTF obtained, are similar as those previously analyzed.