#File powfs_common.conf
#Gather options regarding WFS that are not specific to a certain telescope or AO implementation.
#powfs. prefix refers to a type of WFS that may have multiple copies (powfs.nwfs) whose properties are specified using wfs. prefix.
#Geometric WFS mode uses wavefront to determine gradients directly. Noises are added to gradients using powfs.neasim.
#Physicsl optics WFS mode forms subaperture images and using pixel processing to determine gradients. Noises are added as photon and read out noise. powfs.neasim is not used.
#Acronym list
#SA: subaperture
#SAA: Subaperture normalized area (max at 1)
#NEA: WFS noise equivalent angle.
#TWFS: truth wfs
#All entres defined in this file have only one number that will be used for all powfs types (LGS, NGS, LO order NGS, etc.)
#Options that are commented out or omitted here are specified in other powfs_*.conf files for each powfs individually.
#All units are in SI unless specified otherwise.
#Basic powfs parameters
#powfs.step = [] #time step to start using WFS. 0 for high order, >0 for low order that needs sharpening, >0 for truth wfs.
#powfs.type = [] #0: SHWFS, 1:Pyramid WFS
#powfs.pywfs=[] #include pywfs.conf if type is Pyramid WFS
#powfs.dsa = [] #size of subaperture in one dimension. <0: use (-dsa)*aper.d.
#powfs.dx = [] #sampling of opd in each subaperture.
#powfs.saat = [] #threshold of relative area to turn off subaperture.
#powfs.hs = [] #Guide star elevation above sea level. 90e3 for LGS. inf for NGS. Distance to telescope is ajusted by sim.htel and sim.zadeg.
#powfs.fnllt= [] #File for configuration of laser launch telescope.
#powfs.trs = [] #tilt remove flag. 1 for LGS. 0 for NGS
#powfs.lo = [] #low order flag. 1 for T/T or T/T/F WFS. 0 for LGS and high order NGS
#powfs.skip = [] # 1: do not use this WFS in reconstruction. 2: Use as truth WFS.
powfs.noisy = [1] #Turn on/off noise in wfs simulation (not in reconstructor).
powfs.dtrat = [1] #sampling period relative to 1/sim.dt. >=1. Must be integer.
powfs.moao = [-1] #index into moao config. -1 mean no moao.
#Used for wavefront reconstruction
#powfs.nearecon #Full SA NEA used for reconstruction in mas defined at sim.dtrat. Scaled by maos using SAA and dtrat.
powfs.neareconfile=[""] #file contains NEA for reconstruction for each SA in radian at sim.dt*powfs.dtrat. Will supersede powfs.nearecon if set. File name takes the same format as piinfile.
powfs.frs = [0] #Global focus removal flag. 1 for LGS, 0 for NGS. 1 requires recon.splitlrt=1 to perform well. default is 0
powfs.ncpa = [] #Additional NCPA opd for each powfs. 2xn; first row is rms in meter (randomized if negative), second row is zernike mode or negative for power law.
powfs.ncpa_method=[-1] #Method to correct ncpa; 0: do nothing. 1: apply gradient bias using bias OPD. 2: apply bias according to i0 (with bias OPD). -1: auto=>1 for cog, 2 for mtch.
#Geometric optics SHWFS options. Ignored for physical optics WFS mode.
#powfs.gtype_sim = [] #gradient mode for simulation. 0: averaging gradient, 1: zernike best fit tilt.
#powfs.gtype_recon = [] #gradient mode for reconstruction. 0: averaging gradient, 1: zernike best fit tilt.
#subaperture properties
powfs.saloc = [""] #for testing: load saloc from file for each powfs.
powfs.amp = [""] #for testing: load amp from file for each powfs.
powfs.misregx = [0] #if set, randomized and used for wfs.misregx. use MAOS_MISREG_SEQ to change the random sequence. 0 to disable randomization
powfs.misregy = [0] #if set, randomized and used for wfs.misregy
powfs.misregc = [0] #if set, randomized and used for wfs.misregc
powfs.neasim = [-1] # Full SA NEA for simulation in geometric wfs mode in mas defined at sim.dtrat. Scaled by maos using SAA and dtrat. -1 to match nearecon (not neareconfile) or neasimfile.
powfs.neasimfile= [""] # file contains NEA for simulation for each SA in radian at sim.dt*powfs.dtrat sampling rate. neasim must be -1 when neasimfile is set. File name takes the same format as piinfile.
powfs.neaphy = [0] # 1: use nea from matched filter in geometric simulations.
#The following only applies to physical optics and are automatically ignored for geometric WFS (mostly SHWFS)
#Detector options
#powfs.rne = [] #read out noise
#powfs.nwvl = [] #number of bands for each powfs.
#powfs.wvl = [] #concatenated list of bands for all powfs.
#powfs.wvlwts = [] #concatenated list of wavelength weighting for all powfs.
#powfs.pixpsa = [] #number of pixels per subaperture (1-d)
powfs.radpix = [0] #For radial coordinate detector only. >0: number of pixels along radial direction. 0: disable radial coordinate pixel arrangement.
powfs.radpixtheta=[0] # CCD Pixel size along radiual direction.
powfs.radgx = [1] #For radial coordinate detector only. Create gx, gy along radial/azimuthal direction.
#powfs.pixtheta = [] #CCD Pixel size in arcseconds. if negative, the size is abs(pixtheta)*max(wvl)/dsa.
powfs.pixblur = [0.3]# PSF blurring sigma in unit of pixel size (e.g., due to charge diffusion).
#powfs.phytype_recon =[] #physical optics wfs type. 1: matched filter (mtch) 2: center of gravity (cog)
#powfs.fieldstop= [] #field stop in arcsec.
#powfs.phystep = [] #time step to turn on physical optics. -1 to disable physical optics.
#powfs.sigmatch = [] #normalize gradient by flux of (1: per subaperture, 2: globally).
#powfs.mtchcr = [] #use constraint matched filter (0: disable, 1: both axis. 2: radial/x only, 3: az/y only)
#powfs.mtchstc = [] #shift peak in sepsf to center for matched filter.
powfs.neaextra= [0] # additional noise equivalent angle in mas to be added to matched filter estimation of nea (e.g., for speckle noise). (not used)
powfs.neamin = [0] #Limit minimum noise equivalent angle in mas for matched filter estimation of nea. (not used)
powfs.notf = [0] #specify FFT grid size in WFS imaging. 0: automatic.
powfs.pixoffx = [0] #offset of SA image from center of subaperture pixel array in unit of pixel.
powfs.pixoffy = [0] #offset of SA image from center of subaperture pixel array in unit of pixel.
powfs.i0scale = [0] #For testing: scaling sum of averaged image intensity generated using turbulence OTF to match normalized SAA. Do not enable.
powfs.i0save = [0] #save time avearged subaperture images.
powfs.i0load = [""] #load i0,gx,gy from this folder.
powfs.siglev = [960] #signal level at sim.dtref=1/600 (updated to 960 for LGS WFS 2021-11-02)
powfs.sigrecon= [0] #siglev used for NEA computation. 0: use siglev. Limited to 1200 maximum to avoid reconstruction degradation.
powfs.sigscale= [1] #scale factor from the wfs.siglev to wfs.siglevsim for simulation. to simulate signal variation/mismatch. obsolete. do not use.
powfs.bkgrnd = [0] #sky background in unit e/pixel/frame at sim.dtref.
powfs.bkgrndc = [1] #background calibration factor for powfs.bkgrnd. 1: DC component fully removed.
powfs.bkgrndfn= [""] #sky background/rayleigh backscatter image for each subaperture in each wfs. in unit e/pixel/frame at sim.dtref.
#The file contains a cell array of `nsa*nlgswfs` while each cell contains a `npixpisax*npixpsay` numerical array.
powfs.bkgrndfnc=[""] #background calibration factor for powfs.bkgrndfn. 1: DC component fully removed.
powfs.qe =[""] #Quantum efficiency scaling of pixels in each subaperture. Calibrated by flat fielding. Set maximum to 1.
powfs.embfac = [2] #embeding factor of complex pupil function to generate subaperture image using FFT method. keep at 2 to avoid aliasing.
powfs.psfout = [0] #output complex psf core for sky coverage. only valid in split tomography, do ideal compensation of NGS modes.
powfs.pistatout = [0] #output tip/tilt removed averaged psf for later #matched filter input
powfs.pistatstc = [0] #shift pistat to center using fft method before saving.
powfs.pistatstart=[20]#first time step to start output pistat.
powfs.piinfile = [""]#pixel intensities input file prefix. Mainly used for NGS. First run geometric mode with pistatout=[0 1 1], maos outputs pistat_seed1_wfs[678].bin. Then use powfs.piinfile=["" "pistat_seed1" "pistat_seed1"] to run physical optics NGS simulation. PSF must be centered.
powfs.sninfile = [""]#speckle noise. not yet implemented.
powfs.phytype_sim= ref:powfs.phytype_recon #physical optics type in simulation. -1 to match phytype_recon
powfs.phytype_sim2=[1] #physical optics type in simulation after dithering update. See powfs.phytype_recon
powfs.phyusenea = [-1] # 1: force use powfs.nearecon in reconstruction in physical optics mode. -1: auto, false for matched filter SHWFS, true for others.
#Advanced options for matched filter
powfs.r0 = [-1] #r0 used for initializing i0 for matched filter
powfs.L0 = [-1] #outerscale used for initializing i0 for matched filter
powfs.mtchcpl = [1] #use coupling between r/a measure error. 0: diagnalize. keep at 1.
powfs.mtchadp = [0] #Using adaptive matched filter. Use cr when FWHM>4 pix.
powfs.mtchfft = [0] #Compute gx, gy using FFT derivative of i0. Use for low order WFS where i0 is collected by time averaging (rather than built using turbulence model).
#For dithering
#powfs.dither =[] #Dithering to update centroid gain or matched filter. 1: with TT. >1: zernike mode. -1: use sodium profile fitting on i0 without actual dithering.
#powfs.dither_amp =[] #Dither amplitude of Zernike mode in RMS micron (zernike) or tip/tilt amplitude in arcsec.
#powfs.dither_npoint=[] #Number of WFS frames (a dithering point per frame) per dither cycle.
#powfs.dither_pllskip=[] #Number WFS frames to skip (for loop to be stable) before turning on phase locked loop (PLL) to determine the phase of dithering (used for tip/tilt dithering only).
#powfs.dither_pllrat=[] #Number of WFS frames for updating PLL estimates
#powfs.dither_gpll =[] #Gain of PLL update.
#powfs.dither_ogskip=[] #Number of PLL cycles to skip before computing optical gain update.
#powfs.dither_ograt =[] #Number of PLL cycles to average before updating optical gain.
#powfs.dither_gog =[] #Gain for updating optical gain in cog (not used for matched filter).
powfs.dither_ogsingle=[0] #All subapertures use the same gain update (when dither==1 for SHWFS)
powfs.dither_gdrift=[0]#Gain for drift control. 0.05 is good for dithering. 0 is good for Na profile fitting.
powfs.dither_glpf=[1] #LPF gain for i0,gx,gy update (matched filter). Keep at 1.
#Options for cneter of gravity
powfs.cogthres = [0] #tCoG threshold. -n: n*rne.
powfs.cogoff = [0] #tCoG offset to remove. -n: -n*rne.
#to model SHWFS subaperture aberration
powfs.safill2d =[1] #fill factor of lenslet, in 2-dimensions. Results in photon loss and larger spot.
powfs.saspherical=[0]#spherical aberration at best focus of each lenslet in nm RMS.
powfs.safocuspv =[0] #focus error for each subaperture in nm p/v.
powfs.gradscale =[1] #Scale CL gradients by additional optical gain.
powfs.hc =[0] #Conjugation height of WFS pupil (lenslet).
#Trombone zoom corrector for LGS. Ignored for other WFS.
powfs.zoomshare = [1] #All WFS in same powfs share the same zoom corrector
powfs.zoomgain = [0.5] #gain of zoom corrector for gradient based signal
powfs.zoomgain_drift = [0.5] #gain of zoom corrector for i0 based signal
powfs.zoomset = [1] #Set zoom position from the beginning. Auto skip when phytypesim==1
#FSM properties. Moved from sim. on 2023-08-14. It applies to LGS or PWFS
powfs.apfsm = [1] #FSM ap. see sim.aphi.
powfs.epfsm = [0.5] #integrator gain. 0: to disable. -1: auto set. see also sim.ephi
powfs.alfsm = [0] #Additional latency (sim.dt) of the FSM loop. End to end latency is (dtrat+1+alfsm)*sim.dt.
powfs.commonfsm = [0] #Make FSM for each powfs common (single FSM in LLT for LGS WFS). Do not use. Bad.
powfs.idealfsm = [0] #ideal correction on uplink (debugging)
powfs.zetafsm = [1] #Damping of FSM modeled as second harmonic oscillater (SHO).
powfs.f0fsm = [0] #Resonance frequency of FSM (SHO). 0: infinite.
powfs.astscale = [1] #scale the wfs.thetax and wfs.thetay for this power.
#powfs.nwfs=[] #number of wfs for each type
#signal level at 800 Hz for fully illuminated subaperture.
wfs.siglev = [] #Overrides powfs.siglev. Do not set both.
wfs.wvlwts = [] #Overrides powfs.wvlwts. Do not set both.
wfs.fitwt = [0] #if >0, include this wfs in fitting.
wfs.delta_hs = [0] #variation on top of powfs.hs
wfs.delta_hc = [0] #variation on top of powfs.hc
wfs.sabad = [""] #list of bad subaperture due to bad detector or lenslet array
#wfs.thetax=[] #x coordinate in arcsecond unit.
#wfs.thetay=[] #y coordinate in arcsecond unit.
#The following are used to compute powfs.siglev and wfs.siglev. They are not added to parms.
powfs.mag = [0]#>0: compute siglev from this magnitude. LGS magnitude is scaled by sim.za, while NGS magnitude is not. One value per wavelength. 0: use siglev.
powfs.telthruput= [0.307]#End to end througput of the telescope, WFS, detector. Excluding atmospheric throughput. One value per wavelength
powfs.atmthruput= [0.84]#One-way throughput of the atmosphere at the WFS wavelength at zenith. Scaled by zenith angle.
powfs.magbkgrnd = [0]#Guide star background magnitude per arcsec. 0: use bkgrnd.
#Specify if values are different per wfs in the same powfs
wfs.mag = []#>0: compute siglev from this magnitude. LGS magnitude is scaled by sim.za, while NGS magnitude is not. One value per wavelength. 0 or empty: use powfs.mag or siglev.
wfs.misregx = [0] #misregistration of lenslet array along x in unit of subaperture size. between -0.5 and 0.5
wfs.misregy = [0] #misregistration of lenslet array along x in unit of subaperture size. between -0.5 and 0.5
wfs.misregc = [0] #misregistration of lenslet array in clocking in degrees.