hyri.regulariser.prox_hyperusara#
Implement the Hyper-uSARA positivity-constrained proximal operator.
This file provides a dual forward-backward proximal step combining weighted
joint-channel \(\ell_{2,1}\) wavelet sparsity with positivity projection.
Wavelet transforms are evaluated with ptwt.
Class
Apply the Hyper-uSARA proximal operator with positivity constraint. |
- class hyri.regulariser.prox_hyperusara.ProxHyperSARAPos(img_size: tuple[int, int], rank_num_ch: int = 1, rank_ch_start: int = 0, wl_dict: tuple[str, ...] = ('dirac', 'db1', 'db2', 'db3', 'db4', 'db5', 'db6', 'db7', 'db8'), dec_lev: int = 4, mode: str = 'zero', sfth_val: Tensor = tensor(1.0000e-04), wl_noise_floor: Tensor = tensor(1.0000e-04), max_iter: int = 20, obj_tol: float = 0.0001, device: device = device(type='cpu'), dtype: dtype = torch.float32, verbose: bool | int = True)#
Bases:
RegulariserApply the Hyper-uSARA proximal operator with positivity constraint.
This class implements the proximal operator of the positivity-constrained weighted joint-channel wavelet prior used by Hyper-uSARA. It extends
Regulariser. For an input image cube \(\mathbf{x}\), it computes\[\operatorname{prox}_{g}(\mathbf{x}),\]where
\[g(\mathbf{z}) = \iota_{\mathbb{R}_{+}}(\mathbf{z}) + \left\| \mathbf{\Psi}^{\dagger}\mathbf{z} \right\|_{2,1, \mathbf{w}},\]with \(\iota_{\mathbb{R}_{+}}\) the indicator function of the non-negative orthant, \(\mathbf{\Psi}^{\dagger}\) the concatenated wavelet analysis transform, and \(\mathbf{w}\) the weighting coefficients. In this implementation, the weighted \(\ell_{2,1}\) term is handled by a dual forward-backward iteration, while the primal update enforces positivity.
The wavelet dictionary may include several orthogonal wavelet bases and an optional Dirac basis. The transforms are evaluated with
ptwt. The \(\ell_{2,1}\)-norm is computed jointly across channels, and when distributed execution is enabled, the required channel norms are aggregated across ranks.- Shape:
Input –
(1, C, H, W)whereCequalsrank_num_chfor the current rank.Output –
(1, C, H, W)with the same shape as input.
- _dual#
Packed dual wavelet coefficients.
- Type:
- _weights#
Packed reweighting coefficients.
- Type:
Example
>>> prox = ProxHyperSARAPos( ... img_size=(32, 32), ... rank_num_ch=2, ... sfth_val=torch.tensor(1e-3), ... wl_noise_floor=torch.tensor(1e-4), ... ) >>> x = torch.zeros(1, 2, 32, 32) >>> prox.update(x) >>> y = prox(x) >>> y.shape torch.Size([1, 2, 32, 32])
References
Tang, C., Dabbech, A., Jackson, A., & Wiaux, Y. (2026). HyperAIRI: a plug-and-play algorithm for precise hyperspectral image reconstruction in radio interferometry. ApJS, 283(1), 9.
Combettes, P. L., & Pesquet, J.-C. (2011). Proximal splitting methods in signal processing. In H. H. Bauschke, R. S. Burachik, P. L. Combettes, V. Elser, D. R. Luke, & H. Wolkowicz (Eds.), Fixed-point algorithms for inverse problems in science and engineering (pp. 185-212). Springer.
Wolter, M., Blanke, F., Garcke, J., & Hoyt, C. T. (2024). ptwt - The PyTorch Wavelet Toolbox. J. Mach. Learn. Res., 25(80), 1-7.
Initialise Hyper-uSARA proximal-operator state.
- Parameters:
rank_num_ch (int, optional) – Number of channels handled by this rank. Default: 1.
rank_ch_start (int, optional) – Global start index of local channels. Default: 0.
wl_dict (Tuple[str, ...], optional) – Wavelet dictionary including optional
"dirac". Default: (“dirac”, “db1”, “db2”, “db3”, “db4”, “db5”, “db6”, “db7”, “db8”).dec_lev (int, optional) – Wavelet decomposition depth. Default: 4.
mode (str, optional) – Boundary mode for wavelet transforms. Default: “zero”.
sfth_val (torch.Tensor, optional) – Soft-thresholding velue in the \(\ell_{2}\)-norm wavelet domain. Default: torch.tensor(1e-4).
wl_noise_floor (torch.Tensor, optional) – Noise floor level in the \(\ell_{2}\)-norm wavelet domain. Default: torch.tensor(1e-4).
max_iter (int, optional) – Maximum dual forward-backward iterations. Default: 20.
obj_tol (float, optional) – Relative objective tolerance used for stopping. Default: 1e-4.
device (torch.device, optional) – Execution device. Default: torch.device(“cpu”).
dtype (torch.dtype, optional) – Tensor dtype for computation. Default: torch.float.
verbose (Union[bool, int], optional) – Verbosity level. Default: True.
- Raises:
AssertionError – If the wavelet dictionary is empty or contains unsupported bases.
AssertionError – If the soft-thresholding value is not a scalar.
AssertionError – If the noise floor level is not a scalar.
- _wavedec2_dict(x: Tensor) Tensor#
Pack wavelet coefficients from all bases into one tensor.
- Parameters:
x (torch.Tensor) – Input tensor with shape
(1, C, H, W).- Returns:
Packed coefficient tensor with shape
(1, C, N).- Return type:
- _waverec2_dict(y: Tensor) Tensor#
Reconstruct tensors from packed wavelet coefficients.
- Parameters:
y (torch.Tensor) – Packed coefficient tensor with shape
(1, C, N).- Returns:
Reconstructed tensor with shape
(1, C, H, W).- Return type:
- _prox_l21_adj(z: Tensor, sfth: Tensor) Tensor#
Apply the proximal map of the adjoint \(\ell_{2,1}\) norm.
- Parameters:
z (torch.Tensor) – Input packed coefficients.
sfth (torch.Tensor) – Soft-thresholding levels.
- Returns:
Thresholded packed coefficients.
- Return type:
- __call__(x: Tensor) Tensor#
Run the Hyper-uSARA proximal step.
- Parameters:
x (torch.Tensor) – Input tensor with shape
(1, C, H, W).- Returns:
Positivity-constrained proximal output.
- Return type:
Note
This method uses a dual forward-backward loop with joint-channel \(\ell_{2,1}\) shrinkage, and synchronises channel-norm terms across distributed ranks when needed.
- update(x: Tensor) None#
Update joint-channel reweighting factors.
- Parameters:
x (torch.Tensor) – Input tensor used to recompute Hyper-uSARA weights.
Note
The \(\ell_2\) coefficient norms are aggregated across ranks in distributed execution before updating the shared weights.
- get_l21_norm() float#
Return the latest weighted \(\ell_{2,1}\) norm value.
- Returns:
Last objective regularisation term.
- Return type:
- set_noise_floor_level(wl_noise_floor: Tensor) None#
Set the scalar wavelet reweighting noise floor.
- Parameters:
wl_noise_floor (torch.Tensor) – Scalar noise-floor tensor.
- Raises:
AssertionError – If the noise floor level is not a scalar.
- set_soft_thresholding_value(sfth_val: Tensor) None#
Set the scalar wavelet soft-thresholding level.
- Parameters:
sfth_val (torch.Tensor) – Scalar threshold tensor.
- Raises:
AssertionError – If the soft-thresholding value is not a scalar.