hyri.measurement_operator.meas_op#
Define the abstract base class for measurement operators.
This file provides the shared interface and utility methods used by concrete measurement operators (forward operator, adjoint operator, spectral-norm estimation, and PSF evaluation).
Class
Abstract base class for measurement operators. |
- class hyri.measurement_operator.meas_op.MeasOp(img_size: tuple[int, int], real_flag: bool = True, device: device = device(type='cpu'), dtype: dtype = torch.float32)#
Bases:
ABCAbstract base class for measurement operators.
Subclasses implement
forward_op()andadjoint_op()for a specific measurement model. The base class also provides utility methods for operator-norm estimation and PSF evaluation.- Shape:
Image tensor –
(B, C, H, W).Visibility tensor –
(B, C, N).
- _dtype#
Image-domain dtype.
- Type:
- _dtype_meas#
Measurement-domain dtype.
- Type:
- _device#
Execution device.
- Type:
Initialise shared measurement-operator state.
- Parameters:
real_flag (bool, optional) – Whether the adjoint output is treated as real-valued when applicable. Default: True.
device (torch.device, optional) – Execution device. Default: torch.device(“cpu”).
dtype (torch.dtype, optional) – Image-domain tensor dtype. Default: torch.float.
- abstract forward_op(x: Tensor) Tensor#
Apply the forward measurement operator.
- Parameters:
x (torch.Tensor) – Image-domain input tensor.
- Returns:
Measurement-domain output tensor.
- Return type:
- abstract adjoint_op(y: Tensor) Tensor#
Apply the adjoint measurement operator.
- Parameters:
y (torch.Tensor) – Measurement-domain input tensor.
- Returns:
Image-domain output tensor.
- Return type:
- set_real_flag(real_flag: bool) None#
Set whether adjoint outputs are returned as real values.
- Parameters:
real_flag (bool) – Real-output flag.
Note
Updating this flag invalidates any cached operator norm.
- get_device() device#
Return the device used by the measurement operator.
- Returns:
Current execution device.
- Return type:
torch.device | None
- get_data_type() dtype#
Return the image-domain tensor dtype.
- Returns:
Image-domain dtype.
- Return type:
- get_data_type_meas() dtype#
Return the measurement-domain tensor dtype.
- Returns:
Measurement-domain dtype.
- Return type:
- get_op_norm(compute_flag: bool = False, rel_tol: float = 1e-05, max_iter: int = 500, verbose: bool = False) float#
Estimate or return the spectral norm of the normal operator.
- Parameters:
compute_flag (bool, optional) – Force recomputation even if a cached value exists. Default: False.
rel_tol (float, optional) – Relative tolerance for the power-method stopping criterion. Default: 1e-5.
max_iter (int, optional) – Maximum number of power iterations. Default: 500.
verbose (bool, optional) – Print iteration progress. Default: False.
- Returns:
Estimated spectral norm.
- Return type: