![]() |
MAOS
Multithreaded Adaptive Optics Simulator
|
Data Structures | |
| struct | locfft_t |
Functions | |
| locfft_t * | locfft_init (loc_t *loc, const dmat *amp, const dmat *wvl, const lmat *fftsize, real oversize, real fieldstop) |
| void | locfft_free (locfft_t *locfft) |
| void | locfft_psf (ccell **psfs, const locfft_t *locfft, const dmat *opd, const lmat *psfsize, int sum2one) |
| void | locfft_fieldstop (const locfft_t *locfft, dmat *opd, const dmat *wvlwts) |
| void | fresnel_prop (cmat **out, real *dxout, const cmat *in, real dxin, real wvl, real z, real scale, int method) |
Routines used to embed OPDs defined on loc_t to square array with embeding factor and compute PSF using FFT.
| struct locfft_t |
| locfft_t * locfft_init | ( | loc_t * | loc, |
| const dmat * | amp, | ||
| const dmat * | wvl, | ||
| const lmat * | fftsize, | ||
| const real | oversize, | ||
| real | fieldstop ) |
For routines that embed OPDs defined on loc to square(rectangular) array and do fft on it. Initialize the locfft_t struct that embeds OPD on loc into square arrays for FFT.
| [in] | loc | The loc (referenced, not copied). |
| [in] | amp | The amplitude (referenced, not copied). |
| [in] | wvl | The wavelength (m). |
| [in] | fftsize | The suggested size for FFT, nwvl values. Can be NULL. |
| [in] | oversize | Factor of oversize. 2 for Nyquist sampling. |
| [in] | fieldstop | Size of field stop (radian) if used. 0 to disable. |
| void locfft_free | ( | locfft_t * | locfft | ) |
Frees the struct
| [in] | locfft | The struct to free. Can be NULL. |
| void locfft_psf | ( | ccell ** | psf2sp, |
| const locfft_t * | locfft, | ||
| const dmat * | opd, | ||
| const lmat * | psfsize, | ||
| int | sum2one ) |
Computes PSF from OPD by FFT. The PSF is computed as
\(\textrm{PSF}=\mathcal{F}[A\times exp[\frac{2\pi i}{\lambda}*\textrm{OPD}]]\)
The peak value (center) in the computed PSF is normalized by the peak value in the differaction limited PSF. In other words, the peak value in the computed PSF is the Strehl. Keep this in mind when you compute enclosed energy.
Extract center part of psfsize.
| [in,out] | psf2sp | The complex PSF for each wavelength. Allocated if NULL, otherwise overwritten. |
| [in] | locfft | The locfft struct. |
| [in] | opd | The OPD defined on locfft->loc (m). |
| [in] | psfsize | Size of PSF to extract for each wavelength. NULL for full size. 1 for Strehl only. |
| [in] | sum2one | If set, normalize PSF to sum to 1; otherwise peak is Strehl. |
Apply a field stop to the OPD.
| [in] | locfft | The locfft struct with fieldmask set. |
| [in,out] | opd | The OPD (m), replaced by the field stop filtered OPD. |
| [in] | wvlwts | Weights of each wavelength. |
| void fresnel_prop | ( | cmat ** | pout, |
| real * | pdxout, | ||
| const cmat * | in, | ||
| real | dxin, | ||
| real | wvl, | ||
| real | z, | ||
| real | scale, | ||
| int | method ) |
Fresnel propagation using either FFT or angular spectrum method.
For FFT method, the output sampling is z*wvl/(dxin*nxin). For angular spectrum method, the output sampling equals to the input sampling. When the output sampling equals, the two methods agree. The angular spectrum method is unitary (propagating by -z reverses it) and its output is periodic.
The output is normalized so that its squared sum equals to nx*ny*sum(abs(in)^2). Input argument scale should be supplied to cancel this scaling.
The brutal force method (method=0) has the exact solution without using fresnel approximation. It is however very slow. The results agrees with method=1 or 2 when the sampling agrees and the approximation holds.
| [in,out] | pout | Output complex field. Sampling depends on method. Allocated if NULL (32x32 for method 0, same size as in otherwise). |
| [in,out] | pdxout | Sampling of output. For method=0 it can be supplied, otherwise z*wvl/(dxin*nx) is used. Set on output. |
| [in] | in | Input complex field, Amp*exp(-i*k*opd). |
| [in] | dxin | Spatial sampling of in (m). |
| [in] | wvl | Wavelength (m). |
| [in] | z | Propagation distance (m). |
| [in] | scale | Scaling to be applied to out to preserve energy. 0: determine from input. |
| [in] | method | Propagation method, 0: brutal force, 1: FFT, 2: angular spectrum, -1: auto between 1 and 2. |