MAOS
Multithreaded Adaptive Optics Simulator
|
Functions | |
void | apply_L2 (dcell **xout, const dspcell *L2, const dcell *xin, real alpha) |
void | apply_invpsd (dcell **xout, const void *extra, const dcell *xin, real alpha, int xb, int yb) |
void | apply_fractal (dcell **xout, const void *extra, const dcell *xin, real alpha, int xb, int yb) |
void | TTFR (dcell *x, const dcell *TTF, const dcell *PTTF) |
void | applyW (dcell *xin, const dsp *W0, const dmat *W1, const real *wt) |
dcell * | calcWmcc (const dcell *A, const dcell *B, const dsp *W0, const dmat *W1, const dmat *wt) |
void | TomoR (dcell **xout, const void *A, const dcell *xin, const real alpha) |
void | TomoRt (dcell **gout, const void *A, const dcell *xin, const real alpha) |
void | TomoL (dcell **xout, const void *A, const dcell *xin, const real alpha) |
void | FitL (dcell **xout, const void *A, const dcell *xin, const real alpha) |
void | FitR (dcell **xout, const void *A, const dcell *xin, const real alpha) |
dsp * | nea2sp (dmat *nea, int ll, int ur, int ng) |
void | nea_chol (dmat **pout, const dmat *in, int ng) |
void | nea_inv (dmat **pout, const dmat *in, int ng, real scale) |
void | nea_mm (dmat **pout, const dmat *in, int ng) |
void | nea_check (dmat *nea, int nsa, int ng) |
void | psfr_calc (sim_t *simu, dcell *opdr, dcell *dmpsol, dcell *dmerr, dcell *dmerr_lo) |
void | shift_grad (sim_t *simu) |
lmat * | loc_coord2ind (loc_t *aloc, dmat *dead) |
cn2est_t * | cn2est_prepare (const parms_t *parms, const powfs_t *powfs) |
void | cn2est_isim (dcell *cn2res, recon_t *recon, const parms_t *parms, const dcell *grad, int *tomo_update) |
Reusable utilities for wavefront reconstruction and DM fitting, supporting recon.c
Apply Laplacian2 to xin and accumulates to xout.
Apply turbulence invpsd to xin in Fourier space, scaled by alpha and add to xout. do nothing if xb != yb, since we apply to diagonal only. if xb==-1, do all blocks.
Apply fractal regularization to x, scaled by alpha. do nothing if xb != yb, since we apply to diagonal only. if xb==-1, do all blocks.
Removing Tip/Tilt/Focus from LGS grads. TTF is the Tip/tilt/focus modes, and PTTF is the pseudo inverse of it, weighted by subaperture noise. It is not diagonal if differential focus is removed. So cannot be in Tomo_nea_gpt
apply weighting W0/W1 with weighting wt for each block. W0*xin-W1*(W1'*xin);
dcell* calcWmcc | ( | const dcell * | A, |
const dcell * | B, | ||
const dsp * | W0, | ||
const dmat * | W1, | ||
const dmat * | wt | ||
) |
Compute W0/W1 weighted dot product: \(A^T(W0 B-W1 (W1^T B))\)
Apply tomography right hand operator without using assembled matrix. Fast and saves memory. The operation is the same as the Tomo_nea_gpt and Tomo_iprop in TomoL, so merge the implemenations.
xout=HXW'GP'*NEAI(1-TTF*PTTF)*gin.
Transpose operation of TomoRt. From xout -> gin
Apply tomography left hand side operator without using assembled matrix. Fast and saves memory. Only useful in CG. Accumulates to xout;
Some timing information: Generated in T410s with Intel Core i5 520 M @ 2.4 GHz (1 T is 1 thread, 2 T is 2 thread) and Poweredge with dual Xeon X5355 2.66Ghz (1 P is 1 thread, 8 P is 8 thread) Time 1 T 2 T 1 P 8 P HXW: 7.8 5.4 7.7 5.0 GP: 4.3 2.6 3.6 1.4 TTFR: 0.3 0.3 0.4 0.6 neai: 0.5 0.3 0.5 0.4 GP': 3.2 2.1 3.4 1.0 HXW': 5.5 4.7 7.4 4.9 cxx: 3.2 2.5 3.5 2.7
Apply fit left hand side matrix in CG mode without using assembled matrix. Slow. don't use. Assembled matrix is faster because of multiple directions.
Apply fit right hand side matrix in CG mode without using assembled matrix. Slow. don't use. Assembled matrix is faster because of multiple directions.
Convert column vector nsax2 or nsax3 to sparse matrix. The third column of nea is coupling. ll: controls lower left ur: controls upper right if ng>2, treat as diagonal matrix (for raw PWFS)
Apply cholesky in a 2x2 symmetric matrix packed in [a[0,0],a[1,1],a[0,1]] as row vector. Input and output may be the same. if ng>2, treat as diagonal matrix
Apply matrix inversion in a 2x2 symmetrisa matrix packed in row vector [a[0,0],a[1,1],a[0,1]] Input and output may be the same.
Apply LL' to lower diagonal matrix packed in [a[0,0],a[1,1],a[0,1]] as row vector. Input and output may be the same. if ng>2, treat as diagonal matrix
void nea_check | ( | dmat * | nea, |
int | nsa, | ||
int | ng | ||
) |
Check the dimension of NEA and fix if possible
Compute and save PSF reconstruction telemetry. For pseudo open loop estimations, like high order loop, we add opdr to, and subtract dmpsol from the OPD. For closed loop estimations, like ahst low order or lsr, we add dmerr_lo, and dmerr to the OPD.
void shift_grad | ( | sim_t * | simu | ) |
Shift gradient when new gradients are ready (in the end of parallel section in sim in CL or wfsgrad in OL). Do not execute in parallel with other routines. In GLAO mode, also averaged gradients from the same type of powfs.
Parse the input dead actuator location to actuator indices based on aloc. 2015-03-30: build a mask for dead actuators based on coordinate.
[in] | aloc | Aloc |
[in] | dead | File containing dead actuators |
Prepare arrays for cn2 estimation. Multiple pairs can be used to do Cn2 Estimation. The result will be an average of them.