hyri.interface.gen_imaging_weights#
- hyri.interface.gen_imaging_weights(u: Tensor, v: Tensor, natural_weight: Tensor, im_size: tuple[int, int], weight_type: str = 'briggs', weight_gridsize: float = 2.0, weight_robustness: float = 0.0) Tensor#
Generate imaging weights from UV sampling density using PyTorch.
- Parameters:
u (torch.Tensor) – \(u\)-coordinates in Fourier radians.
v (torch.Tensor) – \(v\)-coordinates in Fourier radians.
natural_weight (torch.Tensor) – Natural weights (square root of inverse variance), either scalar-like or per-visibility.
im_size (Tuple[int, int]) – Image size used to construct the UV grid.
weight_type (str, optional) – Weighting mode. Supported values are
"uniform"and"briggs". Default: “briggs”.weight_gridsize (float, optional) – Grid oversampling factor for density estimation. Default: 2.0.
weight_robustness (float, optional) – Briggs robustness parameter. Default: 0.0.
- Returns:
Imaging weights with shape
(1, 1, N).- Return type:
- Raises:
NotImplementedError – If
weight_typeis unsupported.
Note
Coordinates are mirrored to the upper half-plane before gridding to exploit conjugate symmetry.
natural_weightmay be scalar-like or per-visibility; a scalar-like input is broadcast to all samples.Examples
Generate Briggs weights for torch tensors:
>>> imaging_weight = gen_imaging_weights( ... torch.tensor([0.0, 0.1]), ... torch.tensor([0.0, -0.1]), ... torch.tensor([1.0, 1.0]), ... (512, 512), ... ) >>> imaging_weight.shape torch.Size([1, 1, 2])