MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
zernike.h File Reference

Functions

dmatzernike (const loc_t *loc, real D, int rmin, int rmax, int flag)
 
dmatzernike_cov_kolmogorov (int nr)
 
dmatcov_vonkarman (const loc_t *loc, const dmat *modz, real L0)
 
dcellcov_diagnolize (const dmat *mz, const dmat *cov)
 
dcellKL_vonkarman_full (const loc_t *loc, int ttr, real iac, real L0)
 
dmatKL_vonkarman (const loc_t *loc, int ttr, real L0)
 
dmatfft_mode (const loc_t *loc, real D, real px, real py)
 

Function Documentation

◆ zernike()

dmat * zernike ( const loc_t loc,
real  D,
int  rmin,
int  rmax,
int  flag 
)

Create Zernike modes on loc with diameter D and radial order from rmin to rmax r=0 is piston r=1 is tip/tilt r=2 is quadratic modes if nopiston is set, skip piston mode. if flag is >0, only radial mode is used. if flag is 0, all modes between rmin and rmax. if flag is <0, only generate mode -flag. rmin and rmax is irrelevant set D to -|D| to avoid clipping points outside of D.

◆ zernike_cov_kolmogorov()

dmat * zernike_cov_kolmogorov ( int  nr)

Covariance of zernike modes in Kolmogorov Turbulence. Only modes with the same m have non-zero covariance.

Based on Eq 3.14 in Adaptive Optics in Astronomy (Roddier 1999). Verified against values in J.Y.Wang 1978, table II(a,b).

Notice that (D/r0)^(5/3) has been factored out.

2015-06-05: This is not longer being used. It is inaccurate for annular pupil. Analytic calculation using the power spectrum is used instead.

◆ cov_vonkarman()

dmat * cov_vonkarman ( const loc_t loc,
const dmat modz,
real  L0 
)

Compute covariance matrix of modes in von Karman turbulence.

Parameters
locThe location grid
modzThe modal matrix (zernike or zonal)
L0The outer scale
Returns
The mode coefficient covariance matrix

The turbulence OPD y can be expressed as \(y=M*x\) where \(x\) is the modal coefficient and \(M\) is the modal matrix (parameter modz). The OPD covariance \(<yy'>\) can be expressed as followes: \(<yy'>=M*<xx'>*M'\) where \(<xx'>\) is the modal coefficient covariance matrix. We have \(M'<yy'>M=(M'M)<xx'>(M'M)=CC<xx'>CC\) where \(CC=(M'M)\). Therefore \(<xx'>=CC^{-1} M'<yy'>M CC^{-1}\)

The function first computes \(DD=M'<yy'>M\) with \(DD[i,j]=\sum_{k,m} M[k,i]*yy[k,m]*M[m,j]\) which can be expressed in Fourier domain as \(DD=\sum_{k',m'} Mhat[k',i] Mhat[m',j] \Phi[k',m']\) where \(\Phi\) is the turbulence power spectrum.

For modes \(M\) defined on the DM, its influence function should be includes. \(<yy'>=H*M*<xx'>*M'H'\).

◆ cov_diagnolize()

dcell * cov_diagnolize ( const dmat mod,
const dmat cov 
)

Diagnolize the covariance matrix and transform the mode. Random vector is expressed as y=mod*x. Its covariance is <yy'>=mod*<x*x'>mod=mod*cov*mod'; The covariance of the coefficient x can be decomposed with svd: cov=U*S*V'. So we have <yy'>=mod<x*x'>*mod=mod*U*S*v'*mod'; Refine the bases with KL=mod*U, we have <yy'>=KL*S*KL' where the covariance of coefficient is diagonal S. returns the diagnolized mode and the covariance of each modal coefficient.

Parameters
modInput mode
covCovariance of modes

◆ KL_vonkarman_full()

dcell * KL_vonkarman_full ( const loc_t loc,
int  ttr,
real  iac,
real  L0 
)

Create Karhunen-Loeve modes for which each mode coefficient is statistically independent in von Karman spectrum.

The original method is to compute covariance of zernike modes in von Karman spectrum and diagnolize the covariance matrix. But this methods suffers for higher order systems because high order zernike modes are hard to generate on account of limited resolution of real precision floating point numbers. To make matters worse, to generate m KL modes, around 2*m Zernike modes are needed because each KL mode is a linear combination of all Zernike modes with same azimuthal (m) but higher radial (r) order. A work around of the precisiosn issue is to limit the absolute value of the zernike modes to within 100 to avoid excessive norm due to round off errors.

The new method is to use zonal modes (identity matrix). The advantage is that the zonal modes spans the whole range of possible modes and are straightforward to generate.

In theory, the KL modes computes should be independent on the starting mode, as long as the modes are independent and span the whole vector space for the coordinate.

◆ fft_mode()

dmat * fft_mode ( const loc_t loc,
real  D,
real  px,
real  py 
)

Generate FFT mode with period.