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

Functions

void ngsmod_prep (const parms_t *parms, recon_t *recon, const aper_t *aper)
void ngsmod_setup (const parms_t *parms, recon_t *recon)
void ngsmod_dot (real *pttr_out, real *pttrcoeff_out, real *ngsmod_out, const parms_t *parms, const ngsmod_t *ngsmod, const aper_t *aper, const real *opd, int ievl)
int ngsmod_dot_post (real *pttr_out, real *pttrcoeff_out, real *ngsmod_out, real tot, const real *coeff, const ngsmod_t *ngsmod, const aper_t *aper, real thetax, real thetay)
void ngsmod_free (ngsmod_t *ngsmod)
void ngsmod_split (dcell **Merr, sim_t *simu, dcell *dmerr)
void ngsmod_remove (sim_t *simu, dcell *dmerr)
void ngsmod_opd (dmat *iopd, const loc_t *loc, const ngsmod_t *ngsmod, real thetax, real thetay, const real *mod, real alpha)

Detailed Description

Contains functions to setup NGS modes and reconstructor using AHST for one or more DMs. Use parms->wfsr instead of parms->wfs for wfs information, which hands GLAO mode correctly.

Notice that update of this file may require GPU code update accordingly

Function Documentation

◆ ngsmod_prep()

void ngsmod_prep ( const parms_t * parms,
recon_t * recon,
const aper_t * aper )

AHST parameters that are related to the geometry only, and will not be updated when estimated WFS measurement noise changes.

Parameters
[in]parmsSimulation parameters.
[in,out]reconReconstructor. recon->ngsmod is allocated and set up.
[in]aperAperture of science evaluation.

◆ ngsmod_setup()

void ngsmod_setup ( const parms_t * parms,
recon_t * recon )

setup NGS modes reconstructor in ahst mode.

When tomo.ahst_wt=1:

\( Rngs=GM^\dagger=(GM'*W_N*GM)^{-1}*GM'*W_N \) where W_N is recon->saneai \( M^\dagger=Rngs*GA \) reconstruct mode from NGS measurements equals to original mode \( Pngs=M*M^\dagger=M*Rngs*GA \) satisfies Rngs*GA*Pngs=Rngs*GA In other words, \( M^\dagger=(M^T W_G M)^{-1}*M^T W_G with W_G=(GA^T*W_N*GA) \)

Projector has the properties: \( M*Pngs*(1-M*Pngs)=0 \)

Parameters
[in]parmsSimulation parameters.
[in,out]reconReconstructor. recon->ngsmod->Rngs (and Pngs if tomo.ahst_wt==1) are updated.

◆ ngsmod_dot()

void ngsmod_dot ( real * pttr_out,
real * pttrcoeff_out,
real * ngsmod_out,
const parms_t * parms,
const ngsmod_t * ngsmod,
const aper_t * aper,
const real * opd,
int ievl )

used in performance evaluation on science opds. The outputs are overwritten (not accumulated).

Parameters
[out]pttr_outVariance of piston removed, tip/tilt, and piston/tip/tilt removed OPD. May be NULL.
[out]pttrcoeff_outPiston, tip, and tilt coefficients. May be NULL.
[out]ngsmod_outNGS mode coefficients (nmod elements).
[in]parmsSimulation parameters.
[in]ngsmodNGS mode configuration.
[in]aperAperture of science evaluation.
[in]opdScience OPD defined on aper->locs.
[in]ievlIndex of the evaluation direction.

◆ ngsmod_dot_post()

int ngsmod_dot_post ( real * pttr_out,
real * pttrcoeff_out,
real * ngsmod_out,
real tot,
const real * coeff,
const ngsmod_t * ngsmod,
const aper_t * aper,
real thetax,
real thetay )

Separate post processing part so that GPU code can call it.

Parameters
[out]pttr_outVariance of piston removed, tip/tilt, and piston/tip/tilt removed OPD. May be NULL.
[out]pttrcoeff_outPiston, tip, and tilt coefficients. May be NULL.
[out]ngsmod_outNGS mode coefficients (nmod elements).
[in]totWeighted sum of OPD squared.
[in]coeffWeighted sum of OPD times 1, x, y, x*x, y*y, x*y.
[in]ngsmodNGS mode configuration.
[in]aperAperture of science evaluation.
[in]thetaxEvaluation direction along x (radian).
[in]thetayEvaluation direction along y (radian).
Returns
0 if succeeded, 1 if any computed variance is significantly negative.

◆ ngsmod_free()

void ngsmod_free ( ngsmod_t * ngsmod)

frees ngsmod_t

Parameters
[in]ngsmodThe struct to free. May be NULL.

◆ ngsmod_split()

void ngsmod_split ( dcell ** Merr,
sim_t * simu,
dcell * dmerr )

Split NGS mode error from dmerr

Parameters
[out]MerrNGS mode error. Allocated if NULL.
[in]simuSimulation data.
[in,out]dmerrDM error signal. NGS modes are removed in place.

◆ ngsmod_remove()

void ngsmod_remove ( sim_t * simu,
dcell * dmerr )

remove NGS modes from LGS DM commands.

Todo
handle 3 DM case.
Parameters
[in,out]simuSimulation data. The intermediate NGS mode vectors are updated.
[in,out]dmerrLGS DM error signal. NGS modes are removed in place.

◆ ngsmod_opd()

void ngsmod_opd ( dmat * iopd,
const loc_t * loc,
const ngsmod_t * ngsmod,
real thetax,
real thetay,
const real * mode,
real alpha )

Obtain OPD on loc for NGS mode vector.

Parameters
[in,out]iopdOPD to accumulate to.
[in]locGrid of iopd.
[in]ngsmodNGS mode configuration.
[in]thetaxDirection along x (radian).
[in]thetayDirection along y (radian).
[in]modeNGS mode vector (nmod elements).
[in]alphaScaling factor.