hyri.interface.sim_hs_img_cube#

Simulate hyperspectral image cubes from a reference intensity image.

This module provides Gaussian-field helpers and a power-law spectral model used to generate synthetic hyperspectral radio images for package-level tutorials and simulation experiments.

Functions

gauss_2d_func

Return a callable unnormalised rotated 2D Gaussian.

gauss_2d_kernel

Generate a normalised rotated 2D Gaussian kernel.

gen_curvature_map

Generate a spectral-curvature map from a Gaussian random field.

gen_img_cube

Simulate a hyperspectral image cube from a reference image.

gen_spectral_idx

Generate a spectral-index map from image structure and a random field.

log_blur

Blur an image and map it to base-10 logarithmic scale.

stationary_gaussian_process

Draw stationary Gaussian fields on an image grid.

hyri.interface.sim_hs_img_cube.gauss_2d_func(sig_x, sig_y, theta)#

Return a callable unnormalised rotated 2D Gaussian.

Parameters:
  • sig_x (float) – Standard deviation along the local x-axis.

  • sig_y (float) – Standard deviation along the local y-axis.

  • theta (float) – Anticlockwise rotation angle in radians.

Returns:

Function that evaluates the Gaussian on an array of coordinates with shape (N, 2).

Return type:

Callable[[np.ndarray], np.ndarray]

hyri.interface.sim_hs_img_cube.gauss_2d_kernel(sig_x, sig_y, theta, kernel_size)#

Generate a normalised rotated 2D Gaussian kernel.

Parameters:
  • sig_x (float) – Standard deviation along the local x-axis.

  • sig_y (float) – Standard deviation along the local y-axis.

  • theta (float) – Anticlockwise rotation angle in radians.

  • kernel_size (int) – Width and height of the square output kernel.

Returns:

Normalised Gaussian kernel with shape (kernel_size, kernel_size).

Return type:

np.ndarray

hyri.interface.sim_hs_img_cube.stationary_gaussian_process(im_size, rho)#

Draw stationary Gaussian fields on an image grid.

Parameters:
  • im_size (Tuple[int, int]) – Output image size as (height, width).

  • rho (Callable[[np.ndarray], np.ndarray]) – Covariance function evaluated on coordinate offsets with shape (N, 2).

Returns:

Two independent Gaussian fields followed by the x and y grid coordinates.

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]

Raises:

ValueError – If the circulant embedding has negative eigenvalues below the numerical tolerance.

Note

This implementation follows the block-circulant embedding used in the Faceted-HyperSARA MATLAB code.

hyri.interface.sim_hs_img_cube.log_blur(img, kernel)#

Blur an image and map it to base-10 logarithmic scale.

Parameters:
  • img (np.ndarray) – Two-dimensional reference image.

  • kernel (np.ndarray) – Convolution kernel.

Returns:

Log-scaled blurred image.

Return type:

np.ndarray

hyri.interface.sim_hs_img_cube.gen_spectral_idx(im_log_blur, gauss_field)#

Generate a spectral-index map from image structure and a random field.

Parameters:
  • im_log_blur (np.ndarray) – Log-scaled blurred reference image.

  • gauss_field (np.ndarray) – Gaussian random field with the same spatial shape as im_log_blur.

Returns:

Spectral-index map with weak-region values set to zero.

Return type:

np.ndarray

hyri.interface.sim_hs_img_cube.gen_curvature_map(gauss_field, curv_scale)#

Generate a spectral-curvature map from a Gaussian random field.

Parameters:
  • gauss_field (np.ndarray) – Gaussian random field.

  • curv_scale (float) – Maximum absolute curvature scale.

Returns:

Curvature map with negative outliers clipped to zero.

Return type:

np.ndarray

hyri.interface.sim_hs_img_cube.gen_img_cube(img: ndarray, freqs: ndarray, sig_blur: float = 10, sig_gauss_field: float = 10, curv_scale: float = 0.5)#

Simulate a hyperspectral image cube from a reference image.

The cube follows a spatially varying power-law model with curvature,

\[I_\nu = I_{\nu_0} \left(\frac{\nu}{\nu_0}\right)^{ \alpha + \beta \log(\nu / \nu_0) },\]

where the first frequency in freqs is used as the reference frequency \(\nu_0\).

Parameters:
  • img (np.ndarray) – Two-dimensional reference image.

  • freqs (np.ndarray) – Frequency samples in Hz.

  • sig_blur (float, optional) – Standard deviation of the Gaussian kernel used to blur img before spectral-index generation. Default: 10.

  • sig_gauss_field (float, optional) – Standard deviation of the Gaussian covariance used for the random spectral fields. Default: 10.

  • curv_scale (float, optional) – Curvature-map amplitude scale. Default: 0.5.

Returns:

Simulated image cube with frequency as the first axis, spectral-index map, and curvature map.

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray]

References

Thouvenin, P.-A., Abdulaziz, A., Dabbech, A., Repetti, A., & Wiaux, Y. (2023). Parallel faceted imaging in radio interferometry via proximal splitting (Faceted HyperSARA): I. Algorithm and simulations. MNRAS, 521(1), 1-19.