AdaptiveOpticsControl
AOsystSim.c File Reference

Adaptive Optics system simulator. More...

Functions

int_fast8_t AOsystSim_simpleAOfilter_cli ()
 
int_fast8_t AOsystSim_fitTelPup_cli ()
 
int_fast8_t AOsystSim_mkWF_cli ()
 
int_fast8_t AOsystSim_PyrWFS_cli ()
 
int_fast8_t AOsystSim_DM_cli ()
 
int_fast8_t AOsystSim_coroLOWFS_cli ()
 
int_fast8_t AOsystSim_run_cli ()
 
int_fast8_t AOsystSim_FPWFS_mkprobes_CLI ()
 
int_fast8_t AOsystSim_FPWFS_sensitivityAnalysis_cli ()
 
int init_AOsystSim ()
 Module initialization. More...
 
int AOsystSim_run (int syncmode, long DMindex, long delayus)
 Run AO system simulation. More...
 
int AOsystSim_simpleAOfilter (const char *IDin_name, const char *IDout_name)
 simple AO filtering model using Fourier analysis simulates WFS integration, delay, noise (as a function of spatial frequency) More...
 
int_fast8_t AOsystSim_extremeAO_contrast_sim ()
 
long AOsystSim_mkTelPupDM (const char *ID_name, long msize, double xc, double yc, double rin, double rout, double pupPA, double spiderPA, double spideroffset, double spiderthick, double stretchx)
 Make telescope pupil. More...
 
long AOsystSim_fitTelPup (const char *ID_name, const char *IDtelpup_name)
 Fit measured DM response to telescope pupil. More...
 
int AOsystSim_mkWF_mkCONF (const char *fname)
 
int AOsystSim_mkWF (const char *CONF_FNAME)
 
int AOsystSim_WFSsim_Pyramid (const char *inWFc_name, const char *outWFSim_name, double modampl, long modnbpts)
 
int AOsystSim_runWFS (long index, const char *IDout_name)
 
int AOsystSim_PyrWFS_mkCONF (const char *fname)
 
int AOsystSim_PyrWFS (const char *CONF_FNAME)
 
int AOsystSim_DMshape (const char *IDdmctrl_name, const char *IDdmifc_name, const char *IDdm_name)
 DM control signals to DMshape. More...
 
int AOsystSim_DM_mkCONF (const char *fname)
 
int AOsystSim_DM (const char *CONF_FNAME)
 
int AOsystSim_coroLOWFS_mkCONF (const char *fname)
 
int AOsystSim_coroLOWFS (const char *CONF_FNAME)
 
double f_eval (const gsl_vector *v, void *params)
 
long AOsystSim_FPWFS_imsimul (double probeamp, double sepx, double sepy, double contrast, double wferramp, double totFlux, double DMgainErr, double RON, double CnoiseFloor)
 
int AOsystSim_FPWFS_mkprobes (const char *IDprobeA_name, const char *IDprobeB_name, long dmxsize, long dmysize, double CPAmax, double CPArmin, double CPArmax, double RMSampl, long modegeom)
 
int AOsystSim_FPWFS_sensitivityAnalysis (int mapmode, int mode, int optmode, int NBprobes)
 

Variables

DATA data
 System includes. More...
 
static int AOSYSTSIM_logfunc_level = 0
 
static int AOSYSTSIM_logfunc_level_max = 2
 
static char AOSYSTSIM_logfunc_fname [] = "AOsystSim.fcall.log"
 
static char flogcomment [200]
 
static int WDIR_INIT = 0
 
int DMifpixarray_init = 0
 
float * DMifpixarray_val
 
long * DMifpixarray_index
 
long * DMifpixarray_pixindex
 
long DMifpixarray_NBpix
 
long DMifpixarray_NBpix0
 
long * dmifpixactarray
 
long * dmifpixactarray_dmact
 
long * dmifpixactarray_ii
 
long NBprobesG = 3
 
int CENTERprobe =1
 
long NBoptVar
 
long double probe_re [100]
 
long double probe_im [100]
 
long double nprobe_re [100]
 
long double nprobe_im [100]
 
long double probe_tflux [100]
 
long double Cflux = 1.0
 
long double probe_nmflux [100]
 
long double probe_nmnoise [100]
 
double tmpvalue1
 
double tmpvalue2
 
OPTSYSToptsystsim
 

Detailed Description

Adaptive Optics system simulator.

Optical simulation for AO system - useful for testing

Author
O. Guyon
Date
18 Jun 2017
Bug:
No known bugs.
See also
http://oguyon.github.io/AdaptiveOpticsControl/src/AOloopControl/doc/AOloopControl.html

Function Documentation

int AOsystSim_coroLOWFS ( const char *  CONF_FNAME)
int_fast8_t AOsystSim_coroLOWFS_cli ( )
int AOsystSim_coroLOWFS_mkCONF ( const char *  fname)
int AOsystSim_DM ( const char *  CONF_FNAME)
int_fast8_t AOsystSim_DM_cli ( )
int AOsystSim_DM_mkCONF ( const char *  fname)
int AOsystSim_DMshape ( const char *  IDdmctrl_name,
const char *  IDdmifc_name,
const char *  IDdm_name 
)

DM control signals to DMshape.

int_fast8_t AOsystSim_extremeAO_contrast_sim ( )
long AOsystSim_fitTelPup ( const char *  ID_name,
const char *  IDtelpup_name 
)

Fit measured DM response to telescope pupil.

fits DM illumination to pupil geometry

compensate for illumination gradient

set percentiles

compensate for image gradient

int_fast8_t AOsystSim_fitTelPup_cli ( )
long AOsystSim_FPWFS_imsimul ( double  probeamp,
double  sepx,
double  sepy,
double  contrast,
double  wferramp,
double  totFlux,
double  DMgainErr,
double  RON,
double  CnoiseFloor 
)
int AOsystSim_FPWFS_mkprobes ( const char *  IDprobeA_name,
const char *  IDprobeB_name,
long  dmxsize,
long  dmysize,
double  CPAmax,
double  CPArmin,
double  CPArmax,
double  RMSampl,
long  modegeom 
)
int_fast8_t AOsystSim_FPWFS_mkprobes_CLI ( )
int AOsystSim_FPWFS_sensitivityAnalysis ( int  mapmode,
int  mode,
int  optmode,
int  NBprobes 
)
int_fast8_t AOsystSim_FPWFS_sensitivityAnalysis_cli ( )
long AOsystSim_mkTelPupDM ( const char *  ID_name,
long  msize,
double  xc,
double  xy,
double  rin,
double  rout,
double  pupPA,
double  spiderPA,
double  spideroffset,
double  spiderthick,
double  stretchx 
)

Make telescope pupil.

int AOsystSim_mkWF ( const char *  CONF_FNAME)
int_fast8_t AOsystSim_mkWF_cli ( )
int AOsystSim_mkWF_mkCONF ( const char *  fname)
int AOsystSim_PyrWFS ( const char *  CONF_FNAME)

< WFS wavelength

< WFS flux [ph/frame]

< WFS camera RON [e-]

int_fast8_t AOsystSim_PyrWFS_cli ( )
int AOsystSim_PyrWFS_mkCONF ( const char *  fname)
int AOsystSim_run ( int  syncmode,
long  DMindex,
long  delayus 
)

Run AO system simulation.

Parameters
syncmode
DMindex
delayussimplifiedAO system simulator (DM command -> WFS image part)

Creates a DM map(s) and a WF error input When either DM map or WF error input changes, compute intensity outputs (images)

Parameters
syncmodeSynchronization mode. 0: sync to turbulence. 1: sync to DM. 2: sync to both, >2, use delayus
DMindexDM used for simulation
delayusDelay between loop iterations if syncmode>2
int_fast8_t AOsystSim_run_cli ( )
int AOsystSim_runWFS ( long  index,
const char *  IDout_name 
)
int AOsystSim_simpleAOfilter ( const char *  IDin_name,
const char *  IDout_name 
)

simple AO filtering model using Fourier analysis simulates WFS integration, delay, noise (as a function of spatial frequency)

Open loop model

AO simple filter is modeled by several 2D maps in spatial frequency: aosf_noise : noise per spatial frequency aosf_mult : signal throughput per spatial frequency aosf_gain : loop gain to be applied per spatial frequency

< WFS exposure time

< time delay between wavefront sensor measurement (end of exposure) and DM correction [sec]

wavefront correction buffer to implement time delay

< time it takes for DM to move

< turbulence channel

start of WFS exposure

input masking

Wavefront correction & measurement

Wavefront estimation

write entries in buffer

update DM shape

int_fast8_t AOsystSim_simpleAOfilter_cli ( )
int AOsystSim_WFSsim_Pyramid ( const char *  inWFc_name,
const char *  outWFSim_name,
double  modampl,
long  modnbpts 
)
double f_eval ( const gsl_vector *  v,
void *  params 
)
int init_AOsystSim ( )

Module initialization.

Registers command line interface commands

Variable Documentation

char AOSYSTSIM_logfunc_fname[] = "AOsystSim.fcall.log"
static
int AOSYSTSIM_logfunc_level = 0
static
int AOSYSTSIM_logfunc_level_max = 2
static
int CENTERprobe =1
long double Cflux = 1.0
DATA data

System includes.

External libraries

long* dmifpixactarray
long* dmifpixactarray_dmact
long* dmifpixactarray_ii
long* DMifpixarray_index
int DMifpixarray_init = 0
long DMifpixarray_NBpix
long DMifpixarray_NBpix0
long* DMifpixarray_pixindex
float* DMifpixarray_val
char flogcomment[200]
static
long NBoptVar
long NBprobesG = 3
long double nprobe_im[100]
long double nprobe_re[100]
OPTSYST* optsystsim
long double probe_im[100]
long double probe_nmflux[100]
long double probe_nmnoise[100]
long double probe_re[100]
long double probe_tflux[100]
double tmpvalue1
double tmpvalue2
int WDIR_INIT = 0
static