yao
Links
Main pageInstallation
Examples and Scripts
Performance
Data structures and parfiles
Controlling Features
Screenshots
Algorithms
Yao tk dynamic control
News/Weblog
Algorithms
This page contains the algorithmic for the 2 main yao functions: aoread, aoinit and aoloop. For each of these functions, I list the main tasks and the calls to subroutines/functions. For some of these calls, the actual subroutine is also described (underline links). Click on the function name to expand the content.func aoread(){ Reads out parfile and check wfs pixel size }func aoinit(disp=,forcemat=){ Parameter checks. Sets some defaults, check logic Set array geometry Initialize WFS, per sensor: if curvature WFS { make_curv_wfs_subs,n,size,sim.pupildiam curv_wfs,pupil,pupil*0.0f,,n,init=1 } else if Shack-Hartmann WFS { sh_wfs,ipupil,ipupil*0.0f,n,init=1 } Initialize phase screens: get_turb_phase_init()func get_turb_phase_init(void) { Define a number of extern variables Compute phase screens normalization factor = f(r0) Read the phase screens from disk Extend the phase screen length for safe wrapping Apply normalization factor to each phase screens Build the position vector vs iteration by phase screen Pre-compute the XY intersect positions for each WFS GS as a function(altitude, GS position), for each phase screens and each DMs. Pre-compute the XY intersect positions for each target as a function(altitude, target position), for each phase screens and each DMs. Modify xposvec and yposvec to make sure no indices stay within the phase screen arrays. }Initialize DM influence functions, per DM: if Influence Function file exist { read it } else { compute influence functions if bimorph make_curvature_dm() if stackarray make_pzt_dm() if zernike make_zernike_dm() if tiptilt make_tiptilt_dm() write on disk } Do interaction matrix with all actuators if iMat file not on disk or force flag set { do_imat()func do_imat(disp=) { Get reference vector: refmes = mult_wfs_int_mat() Get WFSs response for each DM and each actuators: fill mircube() iMat(...) = mult_wfs_int_mat()-refmes Display iMat if requested }select valid actuators by their response: re-write on disk influence function file filter iMat } Set modal gains if modal gain file exists { read it } else { create modal gain vector == 1 } Command matrix if iMat file on disk and force flag not set { read iMat and cMat from disk } else { prep_svd()func prep_svd(disp=) { Decompose to prepare inversion: eigenvalues = SVdec(iMat,u,vt); Store u and vt for future use in build_cmat Some debug display if requested }build_cmat,all=1;func build_cmat(all=,nomodalgain=,disp=) { Compute matrix of 1/eigenvalues Multiply by modal gain if option is set The last eigenvalue is filtered except if the keyword "all" is set Compute the Command matrix from the stored u, vt and the just-computed 1/eigenvalue matrix Display some stuff if requested }write iMat and cMat on disk } create aosimul.res if none on disk plot system configuration graphic }