Skip to content

Fresnel Diffraction Sync Task

The Fresnel Diffraction sync task models near-field propagation of a complex wavefront by applying the single-FFT Fresnel transform on the GPU. For each frame, it multiplies the sampled input field \(U_0(x, y)\) by the quadratic phase factor \(\exp\!\left(i \frac{\pi}{\lambda z} (x^2 + y^2)\right)\) and performs a 2D forward FFT across the spatial axes:

\[ U_z(f_x, f_y) \propto \mathcal{F}\left\{ U_0(x, y) \cdot \exp\!\left(i \frac{\pi}{\lambda z} (x^2 + y^2)\right) \right\}. \]

By default, skip_phase_shift=true, so the output-plane quadratic phase factor is omitted to preserve the current behavior. When skip_phase_shift=false, the task multiplies the FFT result by

\[ \exp\!\left(i \frac{\pi}{\lambda z} (x^2 + y^2)\right) \]

after the FFT. The global prefactor from the analytical Fresnel integral is still omitted. Positive z propagates the field forward, negative z back-propagates it.

See Wikipedia for more details on the Fresnel diffraction integral.

Warning

Set the propagation distance z to a non-zero value. A zero distance would yield an infinite phase term during lens generation, producing NaN coefficients and undefined output values.

Inputs

This task expects a single complex tensor of shape (B, H, W):

  • B: batch size (number of frames)
  • H: number of rows
  • W: number of columns

The dtype must be complex32 (CF32) and the tensor must reside in device memory.

Outputs

One output tensor is produced with the same shape (B, H, W) and device memory location as the input. By default its dtype is complex32, and it contains the Fresnel-propagated field samples at distance z, with the optional output-plane quadratic phase term controlled by skip_phase_shift, up to a global complex scaling factor. When output_magnitude=true, a cuFFT store callback writes the modulus of each propagated sample directly and the output dtype is float32; the output-plane phase term is then omitted because it cannot change the modulus.

Inplace

This task has an inplace relationship between its input and output.

Ownership

This task does not own any inputs or outputs.


Settings

Example:

1
2
3
4
5
6
7
8
{
    "lambda": 5.32e-07,
    "dx": 3.45e-06,
    "dy": 3.45e-06,
    "z": 0.1,
    "skip_phase_shift": true,
    "output_magnitude": false
}
Property Pattern Type Deprecated Definition Title/Description
+ lambda No number No - Wavelength in meters. Must satisfy:
- lambda > 0
+ dx No number No - Pixel pitch in meters along X. Must satisfy:
- dx > 0
- dx = dy
+ dy No number No - Pixel pitch in meters along Y. Must satisfy:
- dy > 0
- dy = dx
+ z No number No - Propagation distance in meters. Can be positive or negative.
- skip_phase_shift No boolean No - When true, omit the output-plane quadratic phase factor after the FFT. When false, multiply the FFT result by exp(ipi(x^2+y^2)/(lambda*z)).
- output_magnitude No boolean No - When true, store the magnitude of each propagated complex sample directly from the FFT and return an F32 tensor.