MTFs

prysm models often include analysis of Modulation Transfer Function (MTF) data. The MTF is formally defined as:

the normalized magnitude of the Fourier transform of the Point Spread Function

It is nothing more and nothing less. It may not be negative, complex-valued, or equal to any value other than unity at the origin.

Initializing an MTF model should feel similar to a PSF,

[1]:
import numpy as np
from prysm import MTF
x = y = 1/np.linspace(-1,1,128)
z = np.random.random((128,128))
mt = MTF(data=z, unit_x=x, unit_y=y)

MTFs are usually created from a PSF instance

[2]:
from prysm import Pupil, PSF
pu = Pupil(dia=10, wavelength=0.5)
ps = PSF.from_pupil(pu, efl=20)
mt = MTF.from_psf(ps)

If modeling the MTF directly from a pupil plane, the intermediate PSF plane may be skipped;

[3]:
mt = MTF.from_pupil(pu, Q=2, efl=20)  # Q, efl same as PSF.from_pupil

Much like a PSF or other Convolvable, MTFs have quick-access slices

[4]:
mt.tan, mt.sag
[4]:
((array([   0.        ,    7.87401575,   15.7480315 ,   23.62204724,
           31.49606299,   39.37007874,   47.24409449,   55.11811024,
           62.99212598,   70.86614173,   78.74015748,   86.61417323,
           94.48818898,  102.36220472,  110.23622047,  118.11023622,
          125.98425197,  133.85826772,  141.73228346,  149.60629921,
          157.48031496,  165.35433071,  173.22834646,  181.1023622 ,
          188.97637795,  196.8503937 ,  204.72440945,  212.5984252 ,
          220.47244094,  228.34645669,  236.22047244,  244.09448819,
          251.96850394,  259.84251969,  267.71653543,  275.59055118,
          283.46456693,  291.33858268,  299.21259843,  307.08661417,
          314.96062992,  322.83464567,  330.70866142,  338.58267717,
          346.45669291,  354.33070866,  362.20472441,  370.07874016,
          377.95275591,  385.82677165,  393.7007874 ,  401.57480315,
          409.4488189 ,  417.32283465,  425.19685039,  433.07086614,
          440.94488189,  448.81889764,  456.69291339,  464.56692913,
          472.44094488,  480.31496063,  488.18897638,  496.06299213,
          503.93700787,  511.81102362,  519.68503937,  527.55905512,
          535.43307087,  543.30708661,  551.18110236,  559.05511811,
          566.92913386,  574.80314961,  582.67716535,  590.5511811 ,
          598.42519685,  606.2992126 ,  614.17322835,  622.04724409,
          629.92125984,  637.79527559,  645.66929134,  653.54330709,
          661.41732283,  669.29133858,  677.16535433,  685.03937008,
          692.91338583,  700.78740157,  708.66141732,  716.53543307,
          724.40944882,  732.28346457,  740.15748031,  748.03149606,
          755.90551181,  763.77952756,  771.65354331,  779.52755906,
          787.4015748 ,  795.27559055,  803.1496063 ,  811.02362205,
          818.8976378 ,  826.77165354,  834.64566929,  842.51968504,
          850.39370079,  858.26771654,  866.14173228,  874.01574803,
          881.88976378,  889.76377953,  897.63779528,  905.51181102,
          913.38582677,  921.25984252,  929.13385827,  937.00787402,
          944.88188976,  952.75590551,  960.62992126,  968.50393701,
          976.37795276,  984.2519685 ,  992.12598425, 1000.        ]),
  array([1.00000000e+00, 9.90034799e-01, 9.80069598e-01, 9.70104397e-01,
         9.60139196e-01, 9.50173996e-01, 9.40208795e-01, 9.30243594e-01,
         9.20278393e-01, 9.10313192e-01, 9.00347991e-01, 8.90382790e-01,
         8.80417589e-01, 8.70452388e-01, 8.60487188e-01, 8.50521987e-01,
         8.40556786e-01, 8.30591585e-01, 8.20626384e-01, 8.10661183e-01,
         8.00695982e-01, 7.90730781e-01, 7.80765581e-01, 7.70958557e-01,
         7.61151534e-01, 7.51344511e-01, 7.41537488e-01, 7.31730465e-01,
         7.21923442e-01, 7.12116419e-01, 7.02309396e-01, 6.92502373e-01,
         6.82695350e-01, 6.73046504e-01, 6.63397659e-01, 6.53748814e-01,
         6.44099968e-01, 6.34451123e-01, 6.24802278e-01, 6.15311610e-01,
         6.05820943e-01, 5.96330275e-01, 5.86839608e-01, 5.77348940e-01,
         5.67858273e-01, 5.58525783e-01, 5.49193293e-01, 5.39860804e-01,
         5.30528314e-01, 5.21195824e-01, 5.11863334e-01, 5.02689022e-01,
         4.93514711e-01, 4.84340399e-01, 4.75166087e-01, 4.66149953e-01,
         4.57133818e-01, 4.48117684e-01, 4.39101550e-01, 4.30243594e-01,
         4.21385637e-01, 4.12527681e-01, 4.03669725e-01, 3.94969946e-01,
         3.86270168e-01, 3.77570389e-01, 3.68870611e-01, 3.60329010e-01,
         3.51787409e-01, 3.43403986e-01, 3.35020563e-01, 3.26637140e-01,
         3.18253717e-01, 3.10028472e-01, 3.01803227e-01, 2.93736159e-01,
         2.85669092e-01, 2.77760202e-01, 2.69851313e-01, 2.61942423e-01,
         2.54033534e-01, 2.46282822e-01, 2.38532110e-01, 2.30939576e-01,
         2.23347042e-01, 2.15912686e-01, 2.08478330e-01, 2.01202151e-01,
         1.93925973e-01, 1.86807972e-01, 1.79689972e-01, 1.72730149e-01,
         1.65770326e-01, 1.58968681e-01, 1.52167036e-01, 1.45523568e-01,
         1.38880101e-01, 1.32394812e-01, 1.25909522e-01, 1.19582411e-01,
         1.13255299e-01, 1.07244543e-01, 1.01233787e-01, 9.53812085e-02,
         8.95286302e-02, 8.38342297e-02, 7.81398292e-02, 7.27617842e-02,
         6.73837393e-02, 6.21638722e-02, 5.69440051e-02, 5.20404935e-02,
         4.71369820e-02, 4.25498260e-02, 3.79626700e-02, 3.36918697e-02,
         2.94210693e-02, 2.54666245e-02, 2.15121797e-02, 1.80322683e-02,
         1.45523568e-02, 1.15469788e-02, 8.54160076e-03, 6.01075609e-03,
         3.47991142e-03, 1.73995571e-03, 5.95103509e-17, 4.58025254e-17])),
 (array([   0.        ,    7.87401575,   15.7480315 ,   23.62204724,
           31.49606299,   39.37007874,   47.24409449,   55.11811024,
           62.99212598,   70.86614173,   78.74015748,   86.61417323,
           94.48818898,  102.36220472,  110.23622047,  118.11023622,
          125.98425197,  133.85826772,  141.73228346,  149.60629921,
          157.48031496,  165.35433071,  173.22834646,  181.1023622 ,
          188.97637795,  196.8503937 ,  204.72440945,  212.5984252 ,
          220.47244094,  228.34645669,  236.22047244,  244.09448819,
          251.96850394,  259.84251969,  267.71653543,  275.59055118,
          283.46456693,  291.33858268,  299.21259843,  307.08661417,
          314.96062992,  322.83464567,  330.70866142,  338.58267717,
          346.45669291,  354.33070866,  362.20472441,  370.07874016,
          377.95275591,  385.82677165,  393.7007874 ,  401.57480315,
          409.4488189 ,  417.32283465,  425.19685039,  433.07086614,
          440.94488189,  448.81889764,  456.69291339,  464.56692913,
          472.44094488,  480.31496063,  488.18897638,  496.06299213,
          503.93700787,  511.81102362,  519.68503937,  527.55905512,
          535.43307087,  543.30708661,  551.18110236,  559.05511811,
          566.92913386,  574.80314961,  582.67716535,  590.5511811 ,
          598.42519685,  606.2992126 ,  614.17322835,  622.04724409,
          629.92125984,  637.79527559,  645.66929134,  653.54330709,
          661.41732283,  669.29133858,  677.16535433,  685.03937008,
          692.91338583,  700.78740157,  708.66141732,  716.53543307,
          724.40944882,  732.28346457,  740.15748031,  748.03149606,
          755.90551181,  763.77952756,  771.65354331,  779.52755906,
          787.4015748 ,  795.27559055,  803.1496063 ,  811.02362205,
          818.8976378 ,  826.77165354,  834.64566929,  842.51968504,
          850.39370079,  858.26771654,  866.14173228,  874.01574803,
          881.88976378,  889.76377953,  897.63779528,  905.51181102,
          913.38582677,  921.25984252,  929.13385827,  937.00787402,
          944.88188976,  952.75590551,  960.62992126,  968.50393701,
          976.37795276,  984.2519685 ,  992.12598425, 1000.        ]),
  array([1.00000000e+00, 9.90034799e-01, 9.80069598e-01, 9.70104397e-01,
         9.60139196e-01, 9.50173996e-01, 9.40208795e-01, 9.30243594e-01,
         9.20278393e-01, 9.10313192e-01, 9.00347991e-01, 8.90382790e-01,
         8.80417589e-01, 8.70452388e-01, 8.60487188e-01, 8.50521987e-01,
         8.40556786e-01, 8.30591585e-01, 8.20626384e-01, 8.10661183e-01,
         8.00695982e-01, 7.90730781e-01, 7.80765581e-01, 7.70958557e-01,
         7.61151534e-01, 7.51344511e-01, 7.41537488e-01, 7.31730465e-01,
         7.21923442e-01, 7.12116419e-01, 7.02309396e-01, 6.92502373e-01,
         6.82695350e-01, 6.73046504e-01, 6.63397659e-01, 6.53748814e-01,
         6.44099968e-01, 6.34451123e-01, 6.24802278e-01, 6.15311610e-01,
         6.05820943e-01, 5.96330275e-01, 5.86839608e-01, 5.77348940e-01,
         5.67858273e-01, 5.58525783e-01, 5.49193293e-01, 5.39860804e-01,
         5.30528314e-01, 5.21195824e-01, 5.11863334e-01, 5.02689022e-01,
         4.93514711e-01, 4.84340399e-01, 4.75166087e-01, 4.66149953e-01,
         4.57133818e-01, 4.48117684e-01, 4.39101550e-01, 4.30243594e-01,
         4.21385637e-01, 4.12527681e-01, 4.03669725e-01, 3.94969946e-01,
         3.86270168e-01, 3.77570389e-01, 3.68870611e-01, 3.60329010e-01,
         3.51787409e-01, 3.43403986e-01, 3.35020563e-01, 3.26637140e-01,
         3.18253717e-01, 3.10028472e-01, 3.01803227e-01, 2.93736159e-01,
         2.85669092e-01, 2.77760202e-01, 2.69851313e-01, 2.61942423e-01,
         2.54033534e-01, 2.46282822e-01, 2.38532110e-01, 2.30939576e-01,
         2.23347042e-01, 2.15912686e-01, 2.08478330e-01, 2.01202151e-01,
         1.93925973e-01, 1.86807972e-01, 1.79689972e-01, 1.72730149e-01,
         1.65770326e-01, 1.58968681e-01, 1.52167036e-01, 1.45523568e-01,
         1.38880101e-01, 1.32394812e-01, 1.25909522e-01, 1.19582411e-01,
         1.13255299e-01, 1.07244543e-01, 1.01233787e-01, 9.53812085e-02,
         8.95286302e-02, 8.38342297e-02, 7.81398292e-02, 7.27617842e-02,
         6.73837393e-02, 6.21638722e-02, 5.69440051e-02, 5.20404935e-02,
         4.71369820e-02, 4.25498260e-02, 3.79626700e-02, 3.36918697e-02,
         2.94210693e-02, 2.54666245e-02, 2.15121797e-02, 1.80322683e-02,
         1.45523568e-02, 1.15469788e-02, 8.54160076e-03, 6.01075609e-03,
         3.47991142e-03, 1.73995571e-03, 1.09720259e-17, 6.67479670e-17])))

The tangential MTF is a slice through the x=0 axis, and assumes the usual optics sign convention of an object extended in y. The sagittal MTF is a slice through the y=0 axis.

The MTF at exact frequencies may be queried through any of the following methods: exact_polar, takes arguments of freqs and azimuths. If there is a single frequency and multiple azimuths, the MTF at each azimuth and and the specified radial spatial frequency will be returned. The reverse is true for a single azimuth and multiple frequencies. exact_xy follows the same semantics, but with Cartesian coordinates instead of polar. exact_tan and exact_sag both take a single argument of freq, which may be an int, float, or ndarray.

Finally, MTFs may be plotted:

[5]:
mt.plot_tan_sag(max_freq=1000, fig=None, ax=None, labels=('Tangential', 'Sagittal'))
mt.plot2d(max_freq=1000, power=2, fig=None, ax=None)
[5]:
(<Figure size 640x480 with 2 Axes>,
 <matplotlib.axes._subplots.AxesSubplot at 0x7f004ce12c88>)

all arguments have these default values. The axes of plot2d will span (-max_freq, max_freq) on both x and y.

This example should be familiar as the diffraction limited MTF of a circular aperture.

[ ]: