argosim.metrics_utils module#
Metrics utils.
This module contains utility functions to compute metrics between images.
- Authors:
Ezequiel Centofanti <ezequiel.centofanti@cea.fr>
- argosim.metrics_utils.beam_isl(beam)[source]#
Compute ISL.
Compute the integrated Sidelobe level (ISL) of a beam using watershed segmentation.
- Parameters:
beam (np.ndarray) – The beam image (2D).
- Returns:
Integrated sidelobe level (ISL) in dB.
- Return type:
- argosim.metrics_utils.beam_psl(beam)[source]#
Compute PSL.
Compute the peak sidelobe level (PSL) of a beam using watershed segmentation.
- Parameters:
beam (np.ndarray) – The beam image (2D).
- Returns:
Peak sidelobe level (PSL) in dB.
- Return type:
- argosim.metrics_utils.compute_beam_metrics(beam)[source]#
Compute beam metrics.
Compute main beam metrics: peak and integrated sidelobe level (PSL / ISL), FWHM, and eccentricity.
- Parameters:
beam (np.ndarray) – The beam image (2D).
- Returns:
Dictionary containing PSL (dB), ISL (dB), FWHM (x, y), and eccentricity.
- Return type:
- argosim.metrics_utils.compute_eccentricity(beam, fit_result=None)[source]#
Compute eccentricity.
Compute the eccentricity of the beam main lobe.
- Parameters:
beam (np.ndarray) – The beam image (2D).
fit_result (dict) – Dictionary containing the ellipse parameters (center, width, height, angle_deg, eccentricity). If None, it is computed from the beam.
- Returns:
Eccentricity of the beam. Ranges from 0 to 1, where 0 indicates a perfectly circular beam and 1 a completely degenerated beam.
- Return type:
- argosim.metrics_utils.compute_fwhm(beam, fit_result=None)[source]#
Compute fwhm.
Compute FWHM from beam.
- argosim.metrics_utils.compute_metrics(img1, img2)[source]#
Compute metrics.
Function to compute the metrics between two images.
- Parameters:
img1 (np.ndarray) – The first image.
img2 (np.ndarray) – The second image.
- Returns:
metrics – The metrics between the two images.
- Return type:
- argosim.metrics_utils.fit_elliptical_beam(beam, threshold_ratio=0.5)[source]#
Fit elliptical beam.
Fit an ellipse to the main lobe of the dirty beam using intensity thresholding.
- Parameters:
beam (np.ndarray) – 2D beam image.
threshold_ratio (float) – Threshold fraction of the maximum intensity to define the bright region.
- Returns:
dict – Ellipse parameters: center, width, height, angle_deg, eccentricity.
widthandheightare the full widths at half maximum (FWHM), in pixels, along the semi-major and semi-minor axes respectively.- Return type:
dictionary
- argosim.metrics_utils.mse(img1, img2)[source]#
Mean squared error.
Function to compute the mean squared error between two images.
- Parameters:
img1 (np.ndarray) – The first image.
img2 (np.ndarray) – The second image.
- Returns:
mse – The mean squared error between the two images.
- Return type:
- argosim.metrics_utils.residuals(img1, img2, absolute=True)[source]#
Residuals.
Function to compute the residuals between two images.
- Parameters:
img1 (np.ndarray) – The first image.
img2 (np.ndarray) – The second image.
- Returns:
residual – The residuals between the two images.
- Return type:
np.ndarray