Contents:
Module for various Adaptive Optics (AO) simulations.
A key reference (among many) is Guyon (2005)
To compute Guyon’s C0C6 terms, use the following functions:
A quick test is just to run run_example(); look under the hood at its source code to see more details.
DEPENDENCIES:  nsdata.nAir() – refractive index of air (for contrast_chromaticity()) PyLab – for plotting the figure in run_example() 

TO DO:  Add functions for beta_p (wavefront sensor sensitivity) for various sensor technologies: ShackHartmann, Curvature, etc. 
NOTE:  Note that the coefficient “0.484” in Eqs. 16 and 17 of Guyon 2005 has been corrected here to its intended value of 0.22*0.22=0.0484 (O. Guyon, private communication, Jan 2013). 
Calculate X and Y of (Eq. 14 of Guyon 2005)
INPUTS: 


OUTPUTS:  X, Y (if lam_wfs is None) X, Y, dX, dY (otherwise) 
Compute PSF contrast from chromaticity of phase and amplitude errors (C4 and C5)
INPUTS: 


OUTPUTS: 

Compute PSF contrast from residual atmospheric phase and amplitude errors (C2 and C3, of Guyon 2005)
INPUTS: 


OUTPUTS: 

Compute PSF contrast from uncorrected atmospheric phase and amplitude errors (C0 and C1)
INPUTS: 


OUTPUTS: 

NOTE:  Note that the coefficient “0.484” in Eqs. 16 and 17 of Guyon 2005 has been corrected here to its intended value of 0.22*0.22=0.0484 (O. Guyon, private communication, Jan 2013). 
Reproduce the C_n^2 profile used in Guyon 2005 (Table 4).
OUTPUTS: 


EXAMPLE:  import ao z, dz, cn2 = ao.makecn2() # Compute various moments mu0 = (dz * cn2).sum() mu2 = (dz * cn2 * z**2).sum() mu53 = (dz * cn2 * z**(5/3.)).sum() z2 = (mu2/mu0)**0.5 hbar = (mu53/mu0)**0.6 # Verify z_2 and hbar, in Table 4 of Guyon 2005: print ‘z_2 is: %1.1f km’ % (z2/1000.) print ‘hbar is: %1.1f km’ % (hbar/1000.) 
Run an example simulation, and reproduce Fig. 12 of Guyon 2005.
See the source code of this function for details.
Note that as published, the coefficients in Guyon 2005 Eqs. 1617 are incorrect (they should be 0.0484, not 0.484). This function uses the correct coefficient, and so differs from the published version of Fig. 12.