![]() |
MAOS
Multithreaded Adaptive Optics Simulator
|
Data Structures | |
| struct | pywfs_cfg_t |
| struct | pywfs_t |
Macros | |
| #define | pywfs_ng(pycfg) |
Functions | |
| pywfs_t * | pywfs_new (pywfs_cfg_t *pycfg, loc_t *loc, const dmat *amp) |
| void | pywfs_free (pywfs_t *pywfs) |
| void | pycfg_free (pywfs_cfg_t *pycfg) |
| void | pywfs_grad (dmat **pgrad, const pywfs_t *pywfs, const dmat *ints) |
| void | pywfs_ints (dmat **ints, const pywfs_t *pywfs, const dmat *opd, real siglev) |
| dmat * | pywfs_mkg (pywfs_t *pywfs, const loc_t *ploc, const char *distortion, const dmat *mod, const dmat *opdadd, real displacex, real displacey) |
| dmat * | pywfs_tt (const pywfs_t *pywfs) |
| void | pywfs_simu (dmat **ints, dmat **grad, pywfs_cfg_t *pycfg, int order, dmat *wvl, real siglev, loc_t *loc, const dmat *amp, const dmat *opd) |
| void | pywfs_gain_calibrate (pywfs_t *pywfs, const dmat *grad, real r0) |
| void | pywfs_test (pywfs_t *pywfs) |
Setup pyramid WFS and do simulation.
| struct pywfs_cfg_t |
| Data Fields | ||
|---|---|---|
| int | order |
Number of pixels per pupil in each dimension. |
| real | siglev |
Nominal siglev per subaperture |
| dmat * | wvl |
wavelength |
| real | dx |
OPD sampling. Use loc->dx if not present |
| real | D |
Aperture diameter. Use loc_diam if not present |
| int | nside |
Number of sides. can be 4 (default) or 3. 4-side is traditional pyramid while 3-side is much easier to make. |
| int | raw |
1: use normalized ints of each sub-pupil as gradient. 0 (default): use difference between sub-pupils |
| real | dsa |
Subaperture size (default is D/order) |
| real | saat |
drop subapertures below this fraction (default is 0) |
| real | hs |
Height of guide star (default is inf) |
| real | hc |
Conjugation height of WFS pupil (default is 0) |
| real | modulate |
Amount of modulation in radian (default is 5 lambda/D) |
| int | modulpos |
Number of positions per modulation cycle per ring(default is 32) |
| int | modulring |
Number of rings within the maximum radius to modulate (default is 1, use more to simulate extended object) |
| int | sigmatch |
Scale gradients by matching intensity (1: locally, 2 (default): globally). |
| real | poke |
How much to poke for mkg. (default is 1e-7 m) |
| dmat * | wvlwts |
Wavelength weights |
| real | pixblur |
pixel blur (default is 0.3) |
| real | fieldstop |
size of field stop in arcsec (default is none). |
| int | modulpos_i |
For testing: Index of modulate position to use between 0 and modulpos |
| dmat * | psx |
pyramid WFS pupil shift along x (in pixel). pupil ordering: -x+y, +x+y, -x-y, +x-y. |
| dmat * | psy |
pyramid WFS pupil shift along y (in pixel). |
| real | flate |
pyramid flat edge angular width (in arcsec) |
| real | flatv |
pyramid flat vertex angular width (in arcsec) |
| real | pupelong |
pyramid pupil (detector) elongation ratio (long axis / short axis - 1). |
| struct pywfs_t |
Parameters used by Pyramid WFS.
| Data Fields | ||
|---|---|---|
| const pywfs_cfg_t * | cfg |
Configuration. do not try to free. |
| int | iwfs0 |
First iwfs for this powfs |
| int | gpu |
Whether GPU can be used |
| loc_t * | loc |
Pupil plane grid |
| dmat * | amp |
Pupil plane amplitude map |
| loc_t * | saloc |
powfs.saloc |
| locfft_t * | locfft |
First fft to form PSF |
| ccell * | pyramid |
OPD of pyramid. Angular size of clear aperture is different |
| cmat * | nominal |
For sampling results onto detector |
| dspcell * | si |
For sampling results onto detector |
| dmat * | sioff |
Offset for si |
| dmat * | saa |
Subaperture area. Average is one |
| dmat * | gradoff |
Gradient of a flat wavefront |
| dmat * | GTT |
Response of TT mode. |
| dmat * | pupilshift |
Pupil shift. 4x2. |
| loccell * | msaloc |
Mishaped saloc of each sub-pupil due to optical effects |
| dmat * | opdadd |
Aberrations along the WFS path (on locfft grid) |
| real | gain |
Optical gain of PYWFS |
| #define pywfs_ng | ( | pycfg | ) |
| pywfs_t * pywfs_new | ( | pywfs_cfg_t * | pycfg, |
| loc_t * | loc, | ||
| const dmat * | amp ) |
Create and initialize a pyramid WFS from configuration pycfg. Optional parameters in pycfg are filled with defaults. loc is the pupil OPD grid (created from pycfg->D and dx if NULL); amp is the amplitude on loc (uniform if NULL). Computes subaperture illumination, gradient offset and optical gain. pycfg is referenced, not copied, and must outlive the returned struct. Free with pywfs_free().
| [in,out] | pycfg | The configuration. Unset optional parameters are filled with defaults. |
| [in] | loc | The pupil OPD grid (referenced). If NULL, an annular grid is created from pycfg->D and pycfg->dx. |
| [in] | amp | The amplitude on loc (referenced). Uniform if NULL. |
| void pywfs_free | ( | pywfs_t * | pywfs | ) |
frees pywfs_t
| [in] | pywfs | The PYWFS struct to free. Can be NULL. pywfs->cfg is not freed. |
| void pycfg_free | ( | pywfs_cfg_t * | pycfg | ) |
Free pywfs_cfg_t and its arrays.
| [in] | pycfg | The configuration to free. Can be NULL. |
Compute gradients. It replaces the result, not accumulate.
| [out] | pgrad | The gradients (nsa*ng). Allocated if NULL. |
| [in] | pywfs | PYWFS parameters. |
| [in] | ints | The subaperture intensity (nsa*nside). |
Perform FFT over the complex PSF with additional phases caused by the pyramid. FFT on each quadrant of the PSF creates diffraction effects.
| [in,out] | ints | The intensity (nsa*nside), accumulated into. Allocated if NULL. |
| [in] | pywfs | PYWFS parameters. |
| [in] | opd | The OPD on pywfs->locfft->loc (m). |
| [in] | siglev | The signal level per subaperture. |
| dmat * pywfs_mkg | ( | pywfs_t * | pywfs, |
| const loc_t * | locin, | ||
| const char * | distortion, | ||
| const dmat * | mod, | ||
| const dmat * | opdadd, | ||
| real | displacex, | ||
| real | displacey ) |
Compute the PYWFS interaction matrix with caching. locin is on pupil.
| [in,out] | pywfs | PYWFS parameters. pywfs->opdadd is replaced if opdadd is set. |
| [in] | locin | The grid of the input OPD, on pupil. |
| [in] | distortion | The pupil distortion transform string for loctransform(). Can be NULL. |
| [in] | mod | The modes defined on locin. If NULL, use zonal poke. |
| [in] | opdadd | Additional OPD on pywfs->loc as the operating point. Can be NULL. |
| [in] | displacex | Displacement along x of locin from pupil (m). |
| [in] | displacey | Displacement along y of locin from pupil (m). |
Return measurement of T/T mode, normalized for 1 unit of input.
| [in] | pywfs | PYWFS parameters. |
| void pywfs_simu | ( | dmat ** | ints, |
| dmat ** | grad, | ||
| pywfs_cfg_t * | pycfg, | ||
| int | order, | ||
| dmat * | wvl, | ||
| real | siglev, | ||
| loc_t * | loc, | ||
| const dmat * | amp, | ||
| const dmat * | opd ) |
A convenient wrapper to simulate pywfs from Python.
| [in,out] | ints | Subaperture images, accumulated into. Allocated if NULL. Can be NULL. |
| [out] | grad | Subaperture gradients. Allocated if NULL. |
| [in,out] | pycfg | Configuration struct. Unset parameters are filled. Optional if order, wvl, siglev are all set. |
| [in] | order | PWFS order. Optional if pycfg is set. |
| [in] | wvl | Wavelength (m). Optional if pycfg is set. |
| [in] | siglev | Signal level of each subaperture. Optional if pycfg is set. |
| [in] | loc | OPD loc. Can be NULL. |
| [in] | amp | OPD amplitude map. Can be NULL. |
| [in] | opd | OPD (m). |
PYWFS gain calibrate using measurements. The idea is as follows. With a given input OPD, the PWFS measures OPDR. Feed OPDR to PWFS, it measures OPDR2. Optionally add a fitting error to the input. Scale OPDR by alpha, it measures OPDR3. Iterate the alpha until OPDR3 has the same magnitude as OPDR. The final alpha is the gain adjustment. This does not quite work because the original input OPD and OPDR has different spatial frequency content. Most of OPD is not measurable.
| [in,out] | pywfs | PYWFS parameters. pywfs->gain is updated. |
| [in] | grad | The measured gradients. |
| [in] | r0 | Fried parameter (m) used to add fitting error. 0 to disable. |
| void pywfs_test | ( | pywfs_t * | pywfs | ) |
Test PYWFS implementation when env MAOS_PYWFS_DEBUG is set. 1 (or -1 with petal modes): linearity with zernike (petal) modes; 2: linearity with noise and dithering; 3: NCPA calibration; 4: automatic gain calibration. Results are saved to files and the program exits afterwards.
| [in,out] | pywfs | PYWFS parameters. Can be NULL. pywfs->gain may be changed by the gain calibration test. |