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.
[in] | loc | The loc |
[in] | amp | The amplitude |
[in] | wvl | The wavelength |
[in] | fftsize | The suggested size for FFT, nwvl values |
[in] | oversize | Factor of oversize. 2 fot FFT |
[in] | fieldstop | Size of field stop (radian) if used |
void locfft_free | ( | locfft_t * | locfft | ) |
Frees the struct
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.
Apply a field stop to the OPD.
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. Notice that at near field when dp is smaller than dx, the output of angular spectrum method 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.
pout | Output complex field. Sampling depends on method. Should not be empty if method is 0. |
pdxout | Sampling of output, can be supplied if method=0, use dp if not supplied. |
in | Input complex field, , Amp*exp(-i*k*opd) |
dxin | Spatial sampling of in |
wvl | Wavelength |
z | Propagation distance |
scale | Scaling to be applied to out to preserve energy. 0: determine from input |
method | Propagation method, 0: brutal force, 1: FFT, 2: angular spectrum, -1: auto between 1 and 2. |