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

MeasOp

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: ABC

Abstract base class for measurement operators.

Subclasses implement forward_op() and adjoint_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).

_img_size#

Target image size (H, W).

Type:

Tuple[int, int]

_real_flag#

Whether adjoint outputs are returned as real-valued when applicable.

Type:

bool

_dtype#

Image-domain dtype.

Type:

torch.dtype

_dtype_meas#

Measurement-domain dtype.

Type:

torch.dtype

_device#

Execution device.

Type:

torch.device

_op_norm#

Cached spectral-norm estimate.

Type:

Optional[float]

Initialise shared measurement-operator state.

Parameters:
  • img_size (tuple[int, int]) – Spatial image size (H, W).

  • 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:

torch.Tensor

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:

torch.Tensor

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:

torch.dtype

get_data_type_meas() → dtype#

Return the measurement-domain tensor dtype.

Returns:

Measurement-domain dtype.

Return type:

torch.dtype

get_img_size() → tuple[int, int]#

Return the configured image size.

Returns:

Image size (H, W).

Return type:

tuple[int, int]

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:

float

get_psf() → Tensor#

Compute the point-spread function (PSF).

Returns:

PSF obtained by applying \(\Phi^\dagger \Phi\) to a centered Dirac impulse.

Return type:

torch.Tensor