MAOS
Multithreaded Adaptive Optics Simulator
|
Data Structures | |
struct | pywfs_cfg_t |
struct | pywfs_t |
Macros | |
#define | pywfs_ng(pycfg) ((pycfg && (pycfg->raw||pycfg->nside<3))?pycfg->nside:2) |
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) |
Test PYWFS implementation. | |
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 |
Compute gradients. It replaces the result, not accumulate.
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. Accumulate. | |
[in] | pywfs | PYWFS parameters |
[in] | opd | The OPD |
[in] | siglev | The signal level. |
dmat* pywfs_mkg | ( | pywfs_t * | pywfs, |
const loc_t * | locin, | ||
const char * | distortion, | ||
const dmat * | mod, | ||
const dmat * | opdadd, | ||
real | displacex, | ||
real | displacey | ||
) |
locin is on pupil.
Return measurement of T/T mode, normalized for 1 unit of input.
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.
[out] | ints | Subaperture images |
[out] | grad | Subaperture gradients |
[in] | pycfg | Configuration struct. Optional if order, wvl, siglev are all set |
[in] | order | PWFS order. optional if pycfg is set |
[in] | wvl | Wavelength. optional if pycfg is set |
[in] | siglev | Signal level of each subaperture. optional if pycfg is set |
[in] | loc | OPD loc. |
[in] | amp | OPD amplitude map. |
[in] | opd | OPD. |
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.