rayleigh_sommerfeld_as

dnois.optics.df.rayleigh_sommerfeld_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 the first Rayleigh-Sommerfeld diffraction integral using convolution :

\[\begin{split}U'(x,y)&=-\frac{1}{2\pi}\iint U(u,v)\pfrac{}{d}\frac{\e^{\i kr_d}}{r_d}\d u\d v\\ &=-\frac{1}{2\pi}U(x,y)\ast\pfrac{}{d}\frac{\e^{\i k\sqrt{x^2+y^2+d^2}}}{\sqrt{x^2+y^2+d^2}}\\ &=\ft^{-1}\left\{\ft\{U(x,y)\}\circfunc\left((\lambda f_X)^2+(\lambda f_Y)^2\right) \e^{\i kd\sqrt{1-(\lambda f_X)^2-(\lambda 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, \(k=2\pi/\lambda\) and \(r_d=\sqrt{(x-u)^2+(y-v)^2+d^2}\). Angular spectrum diffraction is equivalent to the first Rayleigh-Sommerfeld solution.

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 than pupil don’t change. This can be done by calling init_rayleigh_sommerfeld_as() and passing its return value as intermediate argument. In this case, wl, distance, dx and dy 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 as dx. Note that dy will be also ignored if dx is None even though dy is given.

  • intermediate (dict) – Cached intermediate results returned by init_rayleigh_sommerfeld_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