MAOS
Multithreaded Adaptive Optics Simulator
sim.h File Reference

Functions

void * perfevl_ievl (thread_t *info)
 
void * perfevl (sim_t *simu)
 
void prep_cachedm (sim_t *simu)
 
void calc_cachedm (sim_t *simu)
 
void filter_dm (sim_t *simu)
 
void update_dm (sim_t *simu)
 
void * wfsgrad (sim_t *simu)
 
void * wfsints (thread_t *thread_data)
 
void wfs_ideal_atm (sim_t *simu, dmat *opd, int iwfs, real alpha)
 
void * wfsgrad_iwfs (thread_t *info)
 
void * wfsgrad_post (thread_t *info)
 
void addlow2dm (dcell **dmval, const sim_t *simu, const dcell *low_val, real gain)
 
void filter_fsm (sim_t *simu)
 

Detailed Description

Contains main simulation blocks.

Function Documentation

◆ perfevl_ievl()

void* perfevl_ievl ( thread_t info)

Performance evaluation for each direction in parallel mode.

◆ perfevl()

void* perfevl ( sim_t simu)

Peformance evaluation on science FoV.

Evaluate performance by calling perfevl_ievl in parallel and then calls perfevl_mean to field average. Notice that the science FoV can be different from the DM fitting FoV, which is tuned to better sharpen the NGS

Todo:
Write a standalone routine that can plot results, using techniques developped in drawdaemon.

◆ prep_cachedm()

void prep_cachedm ( sim_t simu)

Prepares the DM caching structs that caches DM on fine sampled grid to speed up ray tracing with linear interpolation.

Because the DM has coarse sampling, and cubic influence functions, directly interpolate from the DM to the WFS and science OPD takes a lot of computation. We can speed up this process by first propagating the DM commands to a square grid that matches the sampling of the WFS or science OPD, and then propagate from the square grid to different WFS or science directions. For each sampling and each DM, we only need one fine sampled square grid that will cover all the different directions in the FoV of the WFSs or science. For the ground DM, we need a plane of 1/64m sampling that matches the WFS and science OPD. For the upper DM, we need to two planes, one at 1/64m for the LGS WFS and science OPD, and another one at 1/64 m (1-11.2/90) for the LGS due to cone effect. The square grid are on axis.

◆ calc_cachedm()

void calc_cachedm ( sim_t simu)

Partition the ray tracing by DM/Destination combinations, as well as segments in each combination to maximum efficiency.

◆ filter_dm()

void filter_dm ( sim_t simu)

Does the servo filtering by calling filter_cl() or filter_ol()

◆ update_dm()

void update_dm ( sim_t simu)

Update various quantities upon updating dmreal.

◆ wfsgrad()

void* wfsgrad ( sim_t simu)

Calls wfsgrad_iwfs() to computes WFS gradient in parallel. It also includes operations on Gradients before tomography.

◆ wfsints()

void* wfsints ( thread_t thread_data)

compute physical optics images and add to ints. be careful that fftw inverse fft doesn't have 1/n^2 scaling. this function lives inside the threading routine wfsgradx

Notice that the uplink have to have the same spatial sampling as the subaperture (dx). uplink psf has sampling lambda/(nlwvf*dx) subaperture has sampling lambda/(nwvf*dx) uplink otf has the sampling dx/lambda sampling as subaperture.

WHen notf is bigger than nwvf*embfac, the PSF is embeded which preserves the sampling. The uplink OTF need to be upsampled to dx/lambda *(nwvf/notf)

◆ wfs_ideal_atm()

void wfs_ideal_atm ( sim_t simu,
dmat opd,
int  iwfs,
real  alpha 
)

Propagate atm onto WFS subaperture grid, and then to fine lenslet grid.

◆ wfsgrad_iwfs()

void* wfsgrad_iwfs ( thread_t info)

computes close loop and pseudo open loop gradidents for both gometric and physical optics WFS. Calls wfsints() to accumulate WFS subapertures images in physical optics mode.

◆ wfsgrad_post()

void* wfsgrad_post ( thread_t info)

Every operation here should be in the Simulator not the Controller

◆ addlow2dm()

void addlow2dm ( dcell **  dmval,
const sim_t simu,
const dcell low_val,
real  gain 
)

Add low order NGS modes to DM actuator commands for AHST and MVST

◆ filter_fsm()

void filter_fsm ( sim_t simu)

Servo filter for FSM commands.