fresnel_as¶
- dnois.optics.df.fresnel_as(pupil: Tensor, wl: Real | Sequence[Real] | Tensor = None, distance: Real | Sequence[Real] | Tensor = None, dx: float | Tensor = None, dy: float | Tensor = None, intermediate: dict[str, Tensor] = None) Tensor ¶
Computes Fresnel diffraction integral using angular spectrum 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 \\ &=U(x,y)\ast\frac{\e^{\i kd}}{\i\lambda d}\e^{\i\frac{k}{2d}(x^2+y^2)}\\ &=\ft^{-1}\left\{\ft\{U(x,y)\}\e^{\i kd}\e^{-\i\pi\lambda d(f_X^2+f_Y^2)}\right\}\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, \(\ast\) represents convolution and \(k=2\pi/\lambda\).
Compared to
fresnel_ft()
, this function always computes the diffraction integral completely and exactly, including phase factor, scale factor and DFT scale.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_as()
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) – Pupil function \(U\). A tensor of shape \((\cdots,N_d,N_\lambda,H,W)\).
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.intermediate (dict) – Cached intermediate results returned by
init_fresnel_as()
. This can be used to speed up computation.
- Returns:
Diffracted complex amplitude \(U'\). A tensor of shape \((\cdots,N_d,N_\lambda,H,W)\).
- Return type:
Tensor