MAOS
Multithreaded Adaptive Optics Simulator
utils.h File Reference

Functions

void plotloc (const char *fig, const parms_t *parms, loc_t *loc, real ht, const char *format,...)
 
void plotdir (const char *fig, const parms_t *parms, real totfov, const char *format,...)
 
void remove_lock (int *fdlock, char **fnlock, long *seeds, long nseed, long iseed, int success)
 Remove lock file and create Res_seed.done file when maos finishes a seed. More...
 
void maos_final (int sig)
 
int maos_signal_handler (int sig)
 
arg_tparse_args (int argc, const char *argv[])
 
void free_arg (arg_t **parg)
 
char * evl_keywords (const parms_t *parms, const aper_t *aper, int ievl, int iwvl, int isim)
 
void apply_fieldstop (dmat *opd, const dmat *amp, const lmat *embed, long nembed, const dmat *fieldstop, real wvl)
 
void display_server (int sock)
 
void plot_setup (const parms_t *parms, const powfs_t *powfs, const aper_t *aper, const recon_t *recon)
 
dmatmkamp (const loc_t *loc, const map_t *ampground, real misregx, real misregy, real D, real Din)
 
void maxapriori (real *g, const dmat *ints, const parms_t *parms, const powfs_t *powfs, int iwfs, int isa, int noisy, real bkgrnd, real rne)
 
void wfslinearity (const parms_t *parms, powfs_t *powfs, const int iwfs)
 
void lgs_wfs_sph_psd (const parms_t *parms, powfs_t *powfs, recon_t *recon, const int iwfs)
 
real wfsfocusadj (sim_t *simu, int iwfs)
 
void dither_position (real *cs, real *ss, int alfsm, int dtrat, int npoint, int isim, real deltam)
 
void shwfs_grad (dmat **pgrad, dmat *ints[], const parms_t *parms, const powfs_t *powfs, int iwfs, int phytype)
 
dcelldcellread_prefix (const char *file, const parms_t *parms, int ipowfs)
 
real average_powfs (dmat *A, lmat *wfsindex, int replace)
 
void wfsgrad_llt_tt (real *ttx, real *tty, sim_t *simu, int iwfs, int isim)
 

Function Documentation

◆ plotloc()

void plotloc ( const char *  fig,
const parms_t parms,
loc_t loc,
real  ht,
const char *  format,
  ... 
)

Plot the loc, together with all beams

◆ plotdir()

void plotdir ( const char *  fig,
const parms_t parms,
real  totfov,
const char *  format,
  ... 
)

ploted all the different beam directions as points.

◆ remove_lock()

void remove_lock ( int *  fdlock,
char **  fnlock,
long seeds,
long  nseed,
long  iseed,
int  success 
)

Remove lock file and create Res_seed.done file when maos finishes a seed.

Parameters
fdlock
fnlock
seeds
nseed
iseed
success

◆ maos_final()

void maos_final ( int  sig)

Rename the log files when simulation exits or when signal is caught.

◆ maos_signal_handler()

int maos_signal_handler ( int  sig)

Handles signals.

◆ parse_args()

arg_t* parse_args ( int  argc,
const char *  argv[] 
)

Parse command line arguments argc, argv

◆ evl_keywords()

char* evl_keywords ( const parms_t parms,
const aper_t aper,
int  ievl,
int  iwvl,
int  isim 
)

Creates header for saving PSFs.

◆ plot_setup()

void plot_setup ( const parms_t parms,
const powfs_t powfs,
const aper_t aper,
const recon_t recon 
)

Plot grid points, amplitude maps and NCPA.

◆ mkamp()

dmat* mkamp ( const loc_t loc,
const map_t ampground,
real  misregx,
real  misregy,
real  D,
real  Din 
)

Create WFS amplitude map from coordinate, masked with annular defined by (D,Din).

◆ maxapriori()

void maxapriori ( real *  g,
const dmat ints,
const parms_t parms,
const powfs_t powfs,
int  iwfs,
int  isa,
int  noisy,
real  bkgrnd,
real  rne 
)

Implements MAP tracking algorithm. The polar coordinate is implicitly taken care of in mapfun

◆ wfslinearity()

void wfslinearity ( const parms_t parms,
powfs_t powfs,
const int  iwfs 
)

Test wfs linearity.

◆ lgs_wfs_sph_psd()

void lgs_wfs_sph_psd ( const parms_t parms,
powfs_t powfs,
recon_t recon,
const int  iwfs 
)

Compute spherical aberration in LGS WFS gradients for all sodium profile columns.

◆ wfsfocusadj()

real wfsfocusadj ( sim_t simu,
int  iwfs 
)

Compute the focus adjustment need to apply to OPD of wfs. Used in both CPU and GPU code.

◆ dither_position()

void dither_position ( real *  cs,
real *  ss,
int  alfsm,
int  dtrat,
int  npoint,
int  isim,
real  deltam 
)

Expected averaged position of dithering signal during WFS integration. Called when (isim+1)dtrat=0

◆ shwfs_grad()

void shwfs_grad ( dmat **  pgrad,
dmat ints[],
const parms_t parms,
const powfs_t powfs,
const int  iwfs,
const int  phytype 
)

Calculate gradients using current specified algorithm

◆ dcellread_prefix()

dcell* dcellread_prefix ( const char *  file,
const parms_t parms,
int  ipowfs 
)

Read cell array from file specified by whole name or prefix.

◆ average_powfs()

real average_powfs ( dmat A,
lmat wfsindex,
int  replace 
)

average per powfs. replace the content when replace is set.

◆ wfsgrad_llt_tt()

void wfsgrad_llt_tt ( real *  ttx,
real *  tty,
sim_t simu,
int  iwfs,
int  isim 
)

Compute tip/tilt for llt ray trace.