FFT Vectorial MTF
This example demonstrates how to use the VectorialFFTMTF class to calculate and visualize the MTF of an optical system. This accounts for the full vectorial nature of the electric field at the exit pupil.
```{note} Vectorial MTF calculations are automatically performed when polarization is enabled in the optical system. This is triggered by setting a polarization state on the optical system.
[1]:
from optiland.mtf import FFTMTF
from optiland.samples.objectives import TessarLens
from optiland.rays import create_polarization
[2]:
# Load a sample lens
lens = TessarLens()
# Create and set a polarization state (e.g., horizontal linear polarization)
pol_state_H = create_polarization("H")
lens.set_polarization(pol_state_H)
lens.draw()
C:\Users\kdani\AppData\Local\Temp\ipykernel_12700\2678956876.py:6: DeprecationWarning: Optic.set_polarization() is deprecated; use optic.updater.set_polarization() instead.
lens.set_polarization(pol_state_H)
[2]:
(<Figure size 1000x400 with 1 Axes>, <Axes: xlabel='Z [mm]', ylabel='Y [mm]'>)
[3]:
# Compute the FFT-based MTF.
# Since the lens has polarization enabled, FFTMTF factory will return a VectorialFFTMTF instance.
mtf = FFTMTF(lens)
# Visualize the MTF for all fields
fig, ax = mtf.view(add_reference=True)