Diffraction

class dnois.optics.df.Diffraction(grid_size: int | tuple[int, int], wl: Real | Sequence[Real] | Tensor = None, d: Real | Sequence[Real] | Tensor = None)

Base class for all diffraction modules. Its subclasses implement the computation of various diffraction integral. One advantage of using module API rather than functional API is that intermediate results are handled automatically.

Parameters:
  • grid_size (int or tuple[int, int]) – Size of spatial dimensions \((H, W)\).

  • wl (float, Sequence[float] or Tensor) – Wavelengths \(\lambda\). A scalar or a tensor of shape \((N_\lambda,)\). Default: ignored temporarily.

  • d (float, Sequence[float] or Tensor) – Propagation distance \(d\). A scalar or a tensor of shape \((N_d,)\). Default: ignored temporarily.

property d: Tensor

Diffraction distances \(z\). It can be assigned with a float, sequence of float, 0D or 1D tensor. This property returns a 0D tensor if assigned with a float or 0D tensor, or a 1D tensor otherwise.

property device: device

Device of this object.

Type:

torch.device

property dtype: dtype

Data type of this object.

Type:

torch.dtype

property du: Tensor

Grid spacing for \(u\) coordinate. See corresponding functional API reference for allowed values. Note that this property depends on dx, vice versa.

property dv: Tensor

Grid spacing for \(v\) coordinate. See corresponding functional API reference for allowed values. Note that this property depends on dy, vice versa.

property dx: Tensor

Grid spacing for \(x\) coordinate. See corresponding functional API reference for allowed values. Note that this property depends on du, vice versa.

property dy: Tensor

Grid spacing for \(y\) coordinate. See corresponding functional API reference for allowed values. Note that this property depends on dv, vice versa.

u: Tensor

One of coordinates on source plane.

u_range: tuple[Tensor, Tensor]

Range of u. A pair of 0D tensor.

u_size: Tensor

Span of u, i.e. u_range[1] - u_range[0].

v: Tensor

One of coordinates on source plane.

v_range: tuple[Tensor, Tensor]

Range of v. A pair of 0D tensor.

v_size: Tensor

Span of v, i.e. v_range[1] - v_range[0].

property wl: Tensor

Wavelengths \(\lambda\). It can be assigned with a float, sequence of float, 0D or 1D tensor. This property returns a 0D tensor if assigned with a float or 0D tensor, or a 1D tensor otherwise.

x: Tensor

One of coordinates on target plane.

x_range: tuple[Tensor, Tensor]

Range of x. A pair of 0D tensor.

x_size: Tensor

Span of x, i.e. x_range[1] - x_range[0].

y: Tensor

One of coordinates on target plane.

y_range: tuple[Tensor, Tensor]

Range of y. A pair of 0D tensor.

y_size: Tensor

Span of y, i.e. y_range[1] - y_range[0].