MAOS
Multithreaded Adaptive Optics Simulator
misc.h File Reference

Functions

void addnoise (dmat *A, rand_t *rstat, const real bkgrnd, const real bkgrndc, const dmat *bkgrnd2, const dmat *bkgrnd2c, const dmat *qe, real rne, real excess)
 
void addnoise_grad (dmat *grad, const dmat *neal, rand_t *srand)
 
dmatpoly2fit (const dmat *in, const dmat *out, int maxorder)
 
dmatloc_calib (const dsp *GA, const loc_t *aloc, const loc_t *saloc, real dispx, real dispy, real scale, int maxorder)
 
dmatpolyfit (const dmat *x, const dmat *y, int maxorder)
 
dmatpolyval (const dmat *x, const dmat *coeff, int separate)
 
real calc_dither_amp (dmat **res, const dmat *signal, long dtrat, long npoint, int detrend, int combine)
 

Function Documentation

◆ addnoise()

void addnoise ( dmat A,
rand_t rstat,
const real  bkgrnd,
const real  bkgrndc,
const dmat bkgrnd2,
const dmat bkgrnd2c,
const dmat qe,
const real  rne,
real  excess 
)

Miscellaneous routines. add photon and read out noise. pcalib part of bkgrnd is calibrated out. pcalib2 part of bkgrnd2 is calibrated out.

Parameters
[in,out]AThe pixel intensity array
[in]rstatThe random stream
[in]bkgrndReal background in PDEs per pixel per frame
[in]bkgrndcRemoved background in PDEs per pixel per frame
[in]bkgrnd2Real background in PDEs of each pixel per frame.
[in]bkgrnd2cRemoved background in PDEs of each pixel per frame.
[in]qePixel dependent Quantum Efficiency
[in]rneRead out noise per pixel per read
[in]excessExcess noise factor

◆ addnoise_grad()

void addnoise_grad ( dmat grad,
const dmat neal,
rand_t srand 
)

Add noise to gradients according to neal, which is LL' decomposition of the sanea

◆ poly2fit()

dmat* poly2fit ( const dmat in,
const dmat out,
int  maxorder 
)

Determine the polynomial coefficients that transforms 2-d coordinate (of a grid) in to out.

Parameters
[in]ininput grid. n*2
[in]outdistorted grid, n*2
[in]maxorderMaximum order

◆ loc_calib()

dmat* loc_calib ( const dsp GA,
const loc_t aloc,
const loc_t saloc,
real  dispx,
real  dispy,
real  scale,
int  maxorder 
)

Calibrate the distortion as measured using interaction matrix.

Parameters
[in]GAMeasured interaction matrix
[in]alocActuator grid
[in]salocSubaperture grid
[in]dispxBeam displacement along x
[in]dispyBeam displacement along y
[in]scaleBeam cone effect
[in]maxorderMaximum power of x/y. Negative to limit total power

◆ polyfit()

dmat* polyfit ( const dmat x,
const dmat y,
const int  maxorder 
)

Determine the polynomial coefficients that transforms vector in to out. Both column and row vectors are allowed.

Parameters
[in]xinput vector
[in]youtput
[in]maxordermaximum order to fit

◆ polyval()

dmat* polyval ( const dmat x,
const dmat coeff,
int  separate 
)
Parameters
[in]xinput vector
[in]coeffthe coefficient from polyfit
[in]separateif set, separately for each order

◆ calc_dither_amp()

real calc_dither_amp ( dmat **  res,
const dmat signal,
long  dtrat,
long  npoint,
int  detrend,
int  combine 
)

Demodulate the dithering signal to determine the amplitude. Remove trend (detrending) if detrend is set.

Parameters
resresult. nmod*1 if not combine.
signalarray of data. nmod*nsim
dtratskip columns due to wfs/sim dt ratio
npointnumber of points during dithering
detrendflag for detrending (remove linear signal)
combineflag for combining modes. for tip/tilt only