fresnel_ft¶
- dnois.optics.df.fresnel_ft(pupil: Tensor | tuple[Tensor, Tensor], wl: Real | Sequence[Real] | Tensor = None, distance: Real | Sequence[Real] | Tensor = None, dx: float | Tensor = None, dy: float | Tensor = None, **kwargs) Tensor ¶
Computes Fresnel diffraction integral using Fourier transform method:
\[\begin{split}U'(x,y)&=\frac{\e^{\i kd}}{\i\lambda d}\iint U(u,v) \e^{\i\frac{k}{2d}\left((x-u)^2+(y-v)^2\right)}\d u\d v \\ &=\frac{\e^{\i kd}\e^{\i\frac{k}{2d}(x^2+y^2)}}{\i\lambda d} \ft\left\{U(u,v)\e^{\i\frac{k}{2d}(u^2+v^2)}\right\}_ {f_u=\frac{x}{\lambda d},f_v=\frac{y}{\lambda d}}\end{split}\]where \(U\) and \(U'\) are the complex amplitude on source and target plane, respectively, \(d\) is the distance between two planes, \(\lambda\) is wavelength, \(\ft\) represents Fourier transform and \(k=2\pi/\lambda\).
Note that some intermediate computational steps don’t depend on
pupil
and pre-computing their results can avoid repeated computation if this function is expected to be called multiple times, as long as the arguments other thanpupil
don’t change. This can be done by callinginit_fresnel_ft()
and passing its return value asintermediate
argument. In this case,wl
,distance
,dx
anddy
cannot be passed. If all of them are given,intermediate
will be ignored anyway.- Parameters:
pupil (Tensor or tuple[Tensor, Tensor]) – Pupil function \(U\). A tensor of shape \((\cdots,N_d,N_\lambda,H,W)\). If a single tensor, it serves as complex \(U\). If a tuple of tensors, they will be interpreted as the amplitude and phase of \(U\) and must be real. The latter is more efficient if amplitude and phase are available (i.e. need not be computed from real and imaginary part).
wl (float, Sequence[float] or Tensor) – Wavelengths \(\lambda\). A scalar or a tensor of shape \((N_\lambda,)\).
distance (float, Sequence[float] or Tensor) – Propagation distance \(d\). A scalar or a tensor of shape \((N_d,)\).
dx (float or Tensor) – Grid spacing in horizontal direction to ensure correct scale for DFT. A scalar or a tensor of shape \((\cdots,N_d,N_\lambda)\). Default: ignored.
dy (float or Tensor) – Grid spacing in vertical direction, similar to
dx
. Default: same asdx
. Note thatdy
will be also ignored ifdx
isNone
even thoughdy
is given.kwargs –
Optional keyword arguments:
Parameter
Type
Description
delta_mode
str
On which plane
dx
anddy
are defined, source plane (forward
) or target plane (backward
). Default:backward
.phase_factor
bool
Whether to multiply \(\e^{\i kd}\e^{\i\frac{k}{2d}(x^2+y^2)}/\i\). It can be omitted to reduce computation if only amplitude matters. Default:
True
.scale_factor
bool
Whether to multiply the factor \(1/(\lambda d)\). It can be omitted to reduce computation if relative scales across different \(d\) and \(\lambda\) do not matter. Default:
True
.dft_scale
bool
Whether to apply DFT-scale. See Fourier transform. Default:
True
.intermediate
dict
Cached intermediate results returned by
init_fresnel_ft()
. This can be used to speed up computation. Default: omitted.
- Returns:
Diffracted complex amplitude \(U'\). A tensor of shape \((\cdots,N_d,N_\lambda,H,W)\).
- Return type:
Tensor