// YAO parameter file
//-------------------------------
tel.diam            = 2.5;
tel.cobs            = 0.;

sim.name            = "2.5 metre telescope w/ Pyramid WFS"
sim.pupildiam       = 64;
sim.debug           = 0;
sim.verbose         = 1;

//-------------------------------
nwfs                = 1; // number of WFSs (>1 if e.g. mcao)
wfs = array(wfss,nwfs);

n = 1;
wfs(n).type         = "pyramid";
wfs(n).fstop        = "round";
wfs(n).fssize       = 2.0;
wfs(n).lambda       = 0.65;
wfs(n).shnxsub      = 8;
wfs(n).npixpersub   = sim.pupildiam/wfs(n).shnxsub;

wfs(n).gspos        = [0.,0.];
wfs(n).gsalt        = 0.;
wfs(n).gsmag        = 8;
wfs(n).skymag       = 15.;
wfs(n).noise        = 1;
wfs(n).ron          = 3.;
wfs(n).darkcurrent  = 0.;

wfs(n).pyr_mod_npts = 16;
wfs(n).pyr_mod_ampl = 0.25;
wfs(n).pyr_padding  = 1;
wfs(n).pyr_mod_loc  = "after";

//-------------------------------
ndm = 1;
dm = array(dms,ndm);

n = 1;

dm(n).type          = "stackarray";
dm(n).iffile        = "";
dm(n).nxact         = wfs(n).shnxsub+1;
dm(n).pitch         = wfs(n).npixpersub;
dm(n).alt           = 0.;
dm(n).unitpervolt   = 1.;
dm(n).push4imat     = 0.05;
dm(n).elt           = 1;
dm(n).gain          = 1.;
dm(n).regtype       = "laplacian";

if (wfs(1).type == "hartmann"){
   dm(1).regparam     = 1e-2;
} else {dm(1).regparam     = 1e-2;}
//-------------------------------
mat.method          = "mmse";

//-------------------------------
target.lambda       = &([2.2]);
target.xposition    = &([0.]);
target.yposition    = &([0]);
target.dispzoom     = &([1.]);

//-------------------------------
r0 = 0.10;
atm.dr0at05mic     = tel.diam/r0;  // this is r0=0.2 at 500 nm
atm.screen         = &(Y_USER+"data/screen1.fits");
atm.layerfrac      = &([1.0]);
atm.layerspeed     = &([12.]);
atm.layeralt       = &([0.]);
atm.winddir        = &([0.]);

//-------------------------------
gs.zeropoint       = 1.2e11;

//-------------------------------
loop.gain          = 0.3;
loop.framedelay    = 2;
loop.niter         = 100000;
loop.startskip     = 30;
loop.ittime        = 0.001;
