dfreproject.lanczos

Functions

lanczos_kernel(x[, a])

Lanczos kernel function with parameter a (number of lobes).

lanczos_grid_sample(source_image, grid[, ...])

Memory-efficient vectorized LANCZOS-3 interpolation for large astronomical images.

Module Contents

dfreproject.lanczos.lanczos_kernel(x, a=3)[source]

Lanczos kernel function with parameter a (number of lobes).

Parameters:
  • x – Distance from center

  • a – Number of lobes (typically 3 for Lanczos-3)

Returns:

Kernel weights

dfreproject.lanczos.lanczos_grid_sample(source_image, grid, padding_mode='zeros', chunk_size=1024)[source]

Memory-efficient vectorized LANCZOS-3 interpolation for large astronomical images.

Parameters:
  • source_image – Input tensor of shape (N, C, H, W)

  • grid – Grid tensor of shape (N, H_out, W_out, 2) with values in [-1, 1]

  • padding_mode – Only “zeros” supported for now

  • chunk_size – Size of chunks to process at once (for memory management)

Returns:

Interpolated tensor of shape (N, C, H_out, W_out)