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

Functions

powfs_t * setup_powfs_init (const parms_t *parms, map_t *aper)
void setup_powfs_misreg_tel (powfs_t *powfs, const parms_t *parms, int ipowfs)
void setup_powfs_amp (powfs_t *powfs, const parms_t *parms, const map_t *aper, const dmat *misreg, int ipowfs)
void setup_powfs_misreg_dm (powfs_t *powfs, const parms_t *parms, int ipowfs)
void setup_shwfs_phy (const parms_t *parms, powfs_t *powfs)
void setup_powfs_neasim (const parms_t *parms, powfs_t *powfs)
void setup_powfs_calib (const parms_t *parms, powfs_t *powfs)
void free_powfs_unused (const parms_t *parms, powfs_t *powfs)
void free_powfs (const parms_t *parms, powfs_t *powfs)
void setup_shwfs_etf (powfs_t *powfs, const parms_t *parms, int ipowfs, int mode, int icol, real deltah, real thresh)
void wfspupmask (const parms_t *parms, loc_t *loc, dmat *amp, int iwfs)
void setup_pywfs (const pywfs_cfg_t *pycfg, powfs_t *powfs, const parms_t *parms, map_t *aper, int ipowfs)

Detailed Description

Setting up WFS geometry. like the subaperture location, subaperture grid points, physical optics detection transfer function, LGS elongation transfer function, etc.

Todo
isolate DTF, ETF, routines, make then generic interface and relocate to the lib folder.

Do not use sparse interpolation to replace ray tracing for fine sampled destination grid, especially cubic splines. The interpolation marix takes too much space.

TODO: This routine and powfs_t should only contain information about the simulation, not about any model used during reconstruction (RTC) to avoid leaking information from the "real world (simulation)" to our knowledge (RTC).

Function Documentation

◆ setup_powfs_init()

powfs_t * setup_powfs_init ( const parms_t * parms,
map_t * aper )

Setup the powfs struct based on parms and aper. Everything about wfs are setup here.

Parameters
[in]parmsThe parameter struct.
[in]aperThe telescope aperture amplitude map.
Returns
The powfs struct array of length npowfs. Newly allocated; free it with free_powfs().

◆ setup_powfs_misreg_tel()

void setup_powfs_misreg_tel ( powfs_t * powfs,
const parms_t * parms,
int ipowfs )

Setup telescope to WFS pupil misregistration.

It is tricky to implement the misregistration of the deformable mirror and the WFS.

Misregistration of the deformable mirror.

Denote the grid of actuators as saloc, and with misregistration, it becomes salocm.

  • We should use saloc for DM fitting and pseudo open loop gradient computations because we are not aware of the misregistration.
  • We should use salocm for raytracing to WFS and performance evaluation because this is what happens in the system, no matter whether we know the misregistration or not.

Misregistration of the WFS.

Denote the grid of the WFS entry pupil as loc, and with misregistration, it becomes locm. Project the telescope amplitude map onto loc, we get amp, which is what we know. Project the telescope amplitude map onto locm, we get ampm, which is what happens but we don't know.

  • We should use loc and amp to compute the reconstructor.
  • We should use locm and ampm for tracing to WFS and performance evaluation.
  • We should use loc and ampm for matched filter, averaging gradient, or zernike tip/tilt operator computation, since this is the process that happens in the system, and the matched filter is updated through dithering to the true amplitude map. We use loc because it is our model within the WFS.
  • We should use ptsm->area (real area) to select subapertures for use in reconstruction, because in real system, the subapertures are selected by their illumination level, and is affected by the real amplitude.
Parameters
[in,out]powfsThe powfs struct array. loc_tel is set if telescope to WFS distortion is present.
[in]parmsThe parameter struct.
[in]ipowfsIndex of the powfs.

◆ setup_powfs_amp()

void setup_powfs_amp ( powfs_t * powfs,
const parms_t * parms,
const map_t * aper,
const dmat * amisreg,
int ipowfs )

Setup the WFS pupil amplitude map powfs[ipowfs].amp by sampling aper on the WFS grid, accounting for WFS misregistration and the aperture misregistration amisreg. One per WFS if misregistration or loc_tel is present, otherwise shared.

Parameters
[in,out]powfsThe powfs struct array. amp is set.
[in]parmsThe parameter struct.
[in]aperThe telescope aperture amplitude map.
[in]amisregAperture misregistration (m) along x and y. May be NULL.
[in]ipowfsIndex of the powfs.

◆ setup_powfs_misreg_dm()

void setup_powfs_misreg_dm ( powfs_t * powfs,
const parms_t * parms,
int ipowfs )

setup DM to WFS misregistration.

Parameters
[in,out]powfsThe powfs struct array. loc_dm is set if DM to WFS distortion is present.
[in]parmsThe parameter struct.
[in]ipowfsIndex of the powfs.

◆ setup_shwfs_phy()

void setup_shwfs_phy ( const parms_t * parms,
powfs_t * powfs )

Setup physical optics parameters for SHWFS, such as DTF, ETF, LLT, pixel processing.

Parameters
[in]parmsThe parameter struct.
[in,out]powfsThe powfs struct array.

◆ setup_powfs_neasim()

void setup_powfs_neasim ( const parms_t * parms,
powfs_t * powfs )

Setup powfs[].neasim, the Cholesky factor of NEA used in simulations, from sanea, a file, or powfs.neasim.

Parameters
[in]parmsThe parameter struct.
[in,out]powfsThe powfs struct array.

◆ setup_powfs_calib()

void setup_powfs_calib ( const parms_t * parms,
powfs_t * powfs )

Setup gradient offset for calibration. opdadd is the wavefront aberration in WFS due to optics, without DM correction. opdbias is the wavefront aberration in WFS after DM system flat is applied.

Parameters
[in]parmsThe parameter struct.
[in,out]powfsThe powfs struct array. gradoff is computed or added to.

◆ free_powfs_unused()

void free_powfs_unused ( const parms_t * parms,
powfs_t * powfs )

free unused parameters before simulation starts

Parameters
[in]parmsThe parameter struct.
[in,out]powfsThe powfs struct array.

◆ free_powfs()

void free_powfs ( const parms_t * parms,
powfs_t * powfs )

Free all parameters of powfs at the end of simulation.

Parameters
[in]parmsThe parameter struct.
[in]powfsThe powfs struct array to free, including the array itself.

◆ setup_shwfs_etf()

void setup_shwfs_etf ( powfs_t * powfs,
const parms_t * parms,
int ipowfs,
int mode,
int icol,
real deltah,
real thresh )

Compute Elongation Transfer function. An existing ETF is reused if it matches.

Parameters
[in,out]powfsThe powfs struct array. etfprep, etfsim, or etfsim2 is updated.
[in]parmsThe parameter struct.
[in]ipowfsIndex of the powfs.
[in]mode0: for preparation of matched filter (etfprep). 1: for simulation (etfsim). 2: for simulation, next profile for linear interpolation (etfsim2).
[in]icolColumn of the sodium profile to use.
[in]deltahOffset of the sodium layer range (m).
[in]threshTolerance of the range (m) to reuse an existing ETF.

◆ wfspupmask()

void wfspupmask ( const parms_t * parms,
loc_t * loc,
dmat * amp,
int iwfs )

Creates WFS pupil mask that is composed of the meta pupil of high order WFS at height hmax*0.7. Not used.

Parameters
[in]parmsThe parameter struct.
[in]locThe WFS grid.
[in,out]ampAmplitude map on loc. Points outside of the mask are set to 0.
[in]iwfsIndex of the WFS.

◆ setup_pywfs()

void setup_pywfs ( const pywfs_cfg_t * pycfg,
powfs_t * powfs,
const parms_t * parms,
map_t * aper,
int ipowfs )

Setup pyramid WFS based on configuration.

Todo: In order to move the implementation to lib/ the following changes are needed

  • Generate loc/amp externally and supply here.
  • Handle misregistration externally. Different misregisration is used in simulation and reconstruction.
  • ...
Parameters
[in]pycfgPyramid WFS configuration.
[in,out]powfsThe powfs struct array. pywfs, saloc, saa, and sanea are set.
[in]parmsThe parameter struct.
[in]aperThe telescope aperture amplitude map.
[in]ipowfsIndex of the powfs.