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

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 remove_mode (dcell *x, const dcell *M, const dcell *PM)
 Remove projection x = x - M * (PM * x)
 
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)
 
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)
 
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)
 

Detailed Description

Reusable utilities for wavefront reconstruction and DM fitting, supporting recon.c

Function Documentation

◆ apply_L2()

void apply_L2 ( dcell **  xout,
const dspcell *  L2,
const dcell *  xin,
real  alpha 
)

Apply Laplacian2 to xin and accumulates to xout.

◆ apply_invpsd()

void apply_invpsd ( dcell **  xout,
const void *  A,
const dcell *  xin,
real  alpha,
int  xb,
int  yb 
)

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.

Todo:
: this is not thread safe.

◆ apply_fractal()

void apply_fractal ( dcell **  xout,
const void *  A,
const dcell *  xin,
real  alpha,
int  xb,
int  yb 
)

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.

Todo:
: this is not thread safe.

◆ remove_mode()

void remove_mode ( dcell *  x,
const dcell *  M,
const dcell *  PM 
)

Remove projection x = x - M * (PM * x)

Parameters
xThe vector
MThe mode
PMThe mode projection matrix

◆ applyW()

void applyW ( dcell *  xin,
const dsp *  W0,
const dmat *  W1,
const real *  wt 
)

apply weighting W0/W1 with weighting wt for each block. \(xin<-(W0-W1*W1')*xin;\)

◆ calcWmcc()

dcell * calcWmcc ( const dcell *  A,
const dcell *  B,
const dsp *  W0,
const dmat *  W1,
const dmat *  wt 
)

Compute W0/W1 weighted dot product: \(A'*(W0-W1*W1')*B\)

◆ nea2sp()

dsp * nea2sp ( dmat *  nea,
int  ll,
int  ur,
int  ng 
)

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)

◆ nea_chol()

void nea_chol ( dmat **  pout,
const dmat *  in,
const int  ng 
)

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

◆ nea_inv()

void nea_inv ( dmat **  pout,
const dmat *  in,
int  ng,
real  scale 
)

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.

◆ nea_mm()

void nea_mm ( dmat **  pout,
const dmat *  in,
const int  ng 
)

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

◆ nea_check()

void nea_check ( dmat *  nea,
int  nsa,
int  ng 
)

Check the dimension of NEA and fix if possible

◆ psfr_calc()

void psfr_calc ( sim_t *  simu,
dcell *  opdr,
dcell *  dmpsol,
dcell *  dmerr,
dcell *  dmerr_lo 
)

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.

◆ cn2est_prepare()

cn2est_t * cn2est_prepare ( const parms_t *  parms,
const powfs_t *  powfs 
)

Prepare arrays for cn2 estimation. Multiple pairs can be used to do Cn2 Estimation. The result will be an average of them.

◆ cn2est_isim()

void cn2est_isim ( dcell *  cn2res,
recon_t *  recon,
const parms_t *  parms,
const dcell *  grad,
int *  tomo_update 
)

Wrapper of Cn2 Estimation operations in recon.c