torchbp.ops.ffbp module

torchbp.ops.ffbp.compute_subaperture_illumination(pos, att, g, g_extent, grid, decimation=1)[source]

Compute illumination weight maps (sum of gains and sum of squared gains) for a subaperture.

This computes both W1 (sum of gains) and W2 (sum of squared gains) for each pixel, which are used to correctly weight subaperture contributions during FFBP merge.

Needed for antenna pattern weighted FFBP.

Parameters:
  • pos (Tensor) – Platform positions for the subaperture. Shape: [nsweeps, 3].

  • att (Tensor) – Antenna pointing for each sweep. Shape: [nsweeps, 3] with [roll, pitch, yaw].

  • g (Tensor) – Antenna gain pattern. Shape: [g_nel, g_naz].

  • g_extent (list) – Pattern extent: [g_el0, g_az0, g_el1, g_az1] in radians.

  • grid (PolarGrid or dict) – Polar grid for output weight map.

  • decimation (int) – Decimation factor for output (1 = full resolution, 4 = 1/16 size).

Returns:

(w1_map, w2_map) where: - w1_map: Sum of gains. Shape: [nr // decimation, ntheta // decimation]. - w2_map: Sum of squared gains. Shape: [nr // decimation, ntheta // decimation].

Return type:

tuple[Tensor, Tensor]

torchbp.ops.ffbp.ffbp(data, grid, fc, r_res, pos, stages, divisions=2, d0=0.0, interp_method=('knab', 6, 1.5), oversample_r=1.4, oversample_theta=1.4, grid_oversample=1, dealias=False, data_fmod=0, alias_fmod=None, use_poly=True, att=None, g=None, g_extent=None, weight_map_downsample=4)[source]

Fast factorized backprojection.

Parameters:
  • data (Tensor) – Range compressed input data. Shape should be [nsweeps, samples].

  • grid (PolarGrid or dict) –

    Polar grid definition. Can be:

    • PolarGrid object (recommended): PolarGrid(r_range=(50, 100), theta_range=(-1, 1), nr=200, ntheta=400)

    • dict (legacy): {"r": (r0, r1), "theta": (theta0, theta1), "nr": nr, "ntheta": ntheta}

    where theta represents sin of angle (-1, 1 for 180 degree view).

  • fc (float) – RF center frequency in Hz.

  • r_res (float) – Range bin resolution in data (meters). For FMCW radar: c/(2*bw*oversample), where c is speed of light, bw is sweep bandwidth, and oversample is FFT oversampling factor.

  • pos (Tensor) – Position of the platform at each data point. Shape should be [nsweeps, 3] or [nbatch, nsweeps, 3].

  • stages (int) – Number of recursions.

  • divisions (int) – Number of subapertures divisions per stage. Default is 2.

  • d0 (float) – Zero range correction.

  • interp_method (tuple) – Interpolation method: (“knab”, order, oversample) where order is the number of samples used and oversample is the oversampling factor.

  • oversample_r (float) – Internally oversample range by this amount to avoid aliasing.

  • oversample_theta (float) – Internally oversample theta by this amount to avoid aliasing.

  • grid_oversample (float) – Oversample ratio of the output grid. Used only for calculating the alias_fmod when alias_fmod is None. 1 for critically sampled grid, 2 for twice oversampled grid, etc.

  • dealias (bool) – If True removes the range spectrum aliasing. Equivalent to applying torchbp.util.bp_polar_range_dealias on the SAR image. Default is False.

  • data_fmod (float) – Range modulation frequency applied to input data.

  • alias_fmod (float or None) –

    Range modulation frequency applied to SAR image. If None, the alias frequency is calculated automatically assuming that the image spectrum is at positive frequencies. grid_oversample should be given when automatic calculation is used.

    Note that when dealias is True and the alias_fmod is calculated automatically, the output will not have alias_fmod modulation and alias_fmod is used only internally to decrease interpolation errors.

  • use_poly (bool) – Use polynomial approximation for interpolation.

  • att (Tensor or None) – Antenna pointing for each sweep. Shape: [nsweeps, 3] with [roll, pitch, yaw]. Required when g is provided for antenna pattern weighting.

  • g (Tensor or None) – Antenna gain pattern. Shape: [g_nel, g_naz]. When provided, applies SNR-optimal weighted combination of subapertures.

  • g_extent (list or None) – Antenna pattern extent: [g_el0, g_az0, g_el1, g_az1] in radians. Required when g is provided.

  • weight_map_downsample (int) – Downsample factor for weight maps relative to image grid. Default 4. Lower values give more accurate weights but use more memory.

Returns:

img – SAR image.

Return type:

Tensor