MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
mkdtf.h File Reference

Data Structures

struct  dtf_t
struct  etf_t

Macros

#define dtf_free(dtfs)
#define etf_free(etfs)

Functions

void dtf_otf (dmat **nominal, long notfx, long notfy, real pdthetax, real pdthetay, real pixrot, real pixblur, int treat)
dtf_t * mkdtf (const dmat *wvls, real dxsa, real embfac, long notfx, long notfy, long pixpsax, long pixpsay, real pixthetax, real pixthetay, const dmat *pixoffx, const dmat *pixoffy, real pixblur, const dcell *pixrot)
etf_t * mketf (const dtf_t *dtfs, const_anyarray sodium, int icol, const dcell *srot, const dcell *srsa, real hs, real htel, real za_rad, int no_interp)
void dtf_free_do (dtf_t *dtfs)
void etf_free_do (etf_t *etfs)
dmat * smooth (const dmat *profile, real dxnew)
dcell * smooth_cell (const dcell *profile, real dxnew)

Detailed Description

Routine to generate detector transfer function and elongation transfer function due to sodium layer.


Data Structure Documentation

◆ dtf_t

struct dtf_t

contains the data associated with a detector transfer function for a subaperture. The PSF is computed as \(\textrm{PSF}=\frac{1}{N^2\sum(\textrm{amp}^2)}|\textrm{fftshift}\mathcal{F}[A \exp(-\frac{2\pi}{\lambda}\textrm{opd})]|^2\). The subaperture image is computed as \(I=\textrm{si}*\mathcal{F}^{-1}[\mathcal{F}[\textrm{PSF}\times\textrm{nominal}]]\)

Collaboration diagram for dtf_t:
Data Fields
dcell * nominal

The FFT of the pixel functions, don't apply if etf exists .

dspcell * si

The pixel selection

real wvl

Wavelength

real dtheta

Sampling of PSF

cmat * Ux

Special frequency vector along x

cmat * Uy

Special frequency vector along y

real dxsa

Subaperture size

real pixthetax

Pixel size along x (radial)

real pixthetay

Pixel size along y (radial

long notfx

FFT size along x

long notfy

FFT size along y

long pixpsax

Number of pixels along x

long pixpsay

Number of pixels along y

int radpix

1: Pixels are along radial/azimuthal direction

int nwvl

Number of dtf_t

◆ etf_t

struct etf_t
Collaboration diagram for etf_t:
Data Fields
ccell * etf

Store the 2D ETF. nominal is fused in always.

real hs

Guide star height

int icol

Store the column index

int nwvl

Number of dtf_t

Macro Definition Documentation

◆ dtf_free

#define dtf_free ( dtfs)
Value:
if(dtfs){dtf_free_do(dtfs); dtfs=NULL;}

frees dtf_t

◆ etf_free

#define etf_free ( etfs)
Value:
if(etfs){etf_free_do(etfs); etfs=NULL;}

frees etf_t

Function Documentation

◆ dtf_otf()

void dtf_otf ( dmat ** nominal,
long notfx,
long notfy,
real pdthetax,
real pdthetay,
real pixrot,
real pixblur,
int treat )

Create a OTF for pix blur and pixel binning effect

Parameters
[out]nominalThe result. Allocated or resized as needed.
[in]notfxSize of FFT along x.
[in]notfySize of FFT along y.
[in]pdthetaxRatio of pixel size vs PSF sampling along x. 0 to disable pixel binning.
[in]pdthetayRatio of pixel size vs PSF sampling along y.
[in]pixrotRotation of pixel array against PSF (radian, polar coordinate).
[in]pixblurPixel blur sigma (fraction of pixel).
[in]treat1: embed a FFT shift in nominal with dotf_treat(). 2: apply dfftshift. 0: none.

◆ mkdtf()

dtf_t * mkdtf ( const dmat * wvls,
real dxsa,
real embfac,
long notfx,
long notfy,
long pixpsax,
long pixpsay,
real pixthetax,
real pixthetay,
const dmat * pixoffx,
const dmat * pixoffy,
const real pixblur,
const dcell * pixrot )

mkdtf() computes the parameters used to sample PSFs onto detectors in the Fourier domain. It incorporates size of the detector pixels, and charge diffusion. For polar coordinate detectors, it also rotates the pixels and pixel coordinates so that they are aranged along the radial and azimuthal direction.

Parameters
[in]wvlsList of wavelength (m).
[in]dxsaSubaperture size (m).
[in]embfacEmbedding factor (2).
[in]notfxFFT size along x.
[in]notfyFFT size along y.
[in]pixpsaxNumber of pixels along x(r).
[in]pixpsayNumber of pixels along y(a).
[in]pixthetaxPixel size along x (r) (radian).
[in]pixthetayPixel size along y (a) (radian).
[in]pixoffxOffset of image center from center of pixel array, along x or radial, in unit of pixel. Can be NULL.
[in]pixoffyOffset of image center from center of pixel array, along y or azimuthal, in unit of pixel. Can be NULL.
[in]pixblurPixel blur sigma (fraction of pixel).
[in]pixrotRotation angle of pixels islands in each subaperture. For polar coordinate only. Can be NULL.
Returns
Newly allocated array of nwvl dtf_t; free with dtf_free().
Parameters
wvlsList of wavelength
dxsaSubaperture size
embfacEmbedding factor (2)
notfxFFT size along x
notfyFFT size along y
pixpsaxNumber of pixels along x(r)
pixpsayNumber of pixels along y(a)
pixthetaxPixel size along x (r)
pixthetayPixel size along y (a)
pixoffxoffset of image center from center of pixel array, along x or radial
pixoffyoffset of image center from center of pixel array, along y or azimuthal
pixblurPixel blur sigma(fraction of pixel)
pixrotRotation angle of pixels islands in each subaperture. for polar coordinate only

◆ mketf()

etf_t * mketf ( const dtf_t * dtfs,
const_anyarray sodium_,
int icol,
const dcell * srot,
const dcell * srsa,
real hs,
real htel,
real za_rad,
int no_interp )

Compute the elongation transfer function (ETF) for LGS WFS subapertures from the sodium profile. The DTF nominal is fused into the ETF.

Parameters
[in]dtfsThe dtfs, one per wavelength.
[in]sodium_The sodium profile. In each cell first column is coordinate (m). Different cells must have the same coordinate. Can also be a dmat.
[in]icolWhich sodium profile column to use (wrapped).
[in]srotRotation angle of each subaperture (radian). Required.
[in]srsaSubaperture to LLT distance (m).
[in]hsLGS WFS focus altitude (m).
[in]htelTelescope altitude (m).
[in]za_radZenith angle (radian).
[in]no_interpUse direct sum instead of interpolation + FFT. Slower.
Returns
Newly allocated array of nwvl etf_t; free with etf_free().
Parameters
dtfsThe dtfs
sodium_The sodium profile. First column is coordinate.
icolWhich sodium profile to use
srotRotation angle of each subaperture. NULL for NGS WFS
srsaSubaperture to LLT distance
hsGuide star focus range
htelTelescope altitude
za_radTelescope zenith angle in radian
no_interpUse direct sum instead of interpolation + FFT. Slower

◆ dtf_free_do()

void dtf_free_do ( dtf_t * dtfs)

Free the array of dtf_t (one per wavelength). Use the dtf_free() macro.

Parameters
[in]dtfsThe array to free. Can be NULL.

◆ etf_free_do()

void etf_free_do ( etf_t * etfs)

Free the array of etf_t (one per wavelength). Use the etf_free() macro.

Parameters
[in]etfsThe array to free. Can be NULL.

◆ smooth()

dmat * smooth ( const dmat * prof,
real dxnew )

profile is nxm array with m>=2. First column is coordinate and the remaining is function of coordinate. This routine smoothes the profile on new coordinate with spacing of dxnew.

Parameters
[in]profThe profile.
[in]dxnewThe new coordinate spacing.
Returns
Newly allocated smoothed profile, or a reference to prof if no smoothing is needed. The caller frees it.

◆ smooth_cell()

dcell * smooth_cell ( const dcell * profs,
real dxnew )

Apply smooth() to each sodium profile in profs.

Parameters
[in]profsThe profiles.
[in]dxnewThe new coordinate spacing.
Returns
Newly allocated dcell; the caller frees it.