wf_psf.metrics.metrics_interface
Metrics Interface.
A module which defines the classes and methods to manage metrics evaluation of the trained psf model.
- Author:
Jennifer Pollack <jennifer.pollack@cea.fr>
Functions
|
Evaluate the trained model on both training and test datasets by computing various metrics. |
Classes
|
Metrics Parameters Handler. |
- class wf_psf.metrics.metrics_interface.MetricsParamsHandler(metrics_params, trained_model)[source]
Bases:
objectMetrics Parameters Handler.
A class to handle metrics-related parameters.
- Parameters:
metrics_params (Recursive Namespace object) – Recursive Namespace object containing metrics input parameters
trained_model (Recursive Namespace object) – Recursive Namespace object containing trained model input parameters
Methods
evaluate_metrics_mono_rmse(psf_model, ...)Evaluate RMSE metrics for Monochromatic PSF.
evaluate_metrics_opd(psf_model, simPSF, ...)Evaluate Optical Path Difference (OPD) metrics.
Evaluate RMSE metrics for low-resolution polychromatic PSF.
evaluate_metrics_shape(psf_model, simPSF, ...)Evaluate PSF Shape Metrics.
- evaluate_metrics_mono_rmse(psf_model: Any, simPSF: Any, data: Any, dataset: dict[str, Any]) dict[str, float][source]
Evaluate RMSE metrics for Monochromatic PSF.
This method computes Root Mean Square Error (RMSE) metrics for a monochromatic Point Spread Function (PSF) model across a range of wavelengths.
- Parameters:
psf_model (object) – An instance of the PSF model selected for metrics evaluation.
simPSF (object) – An instance of the PSFSimulator.
data (object) – A DataConfigHandler object containing training and test datasets.
dataset (dict) –
Dictionary containing dataset details, including: -
positions(Star positions) -C_poly(Tensor or None, optional)The Zernike coefficient matrix used in generating simulations of the PSF model. This matrix defines the Zernike polynomials up to a given order used to simulate the PSF field. It may be present in some datasets or only required for some classes. If not present or required, the model will proceed without it.
- Returns:
A dictionary containing RMSE, relative RMSE, and their corresponding standard deviation values computed over a wavelength range.
rmse_ldafloatRoot Mean Square Error (RMSE) over wavelengths.
rel_rmse_ldafloatRelative RMSE over wavelengths.
std_rmse_ldafloatStandard deviation of RMSE over wavelengths.
std_rel_rmse_ldafloatStandard deviation of relative RMSE over wavelengths.
- Return type:
- evaluate_metrics_opd(psf_model: Any, simPSF: Any, data: Any, dataset: dict[str, Any]) dict[str, float][source]
Evaluate Optical Path Difference (OPD) metrics.
This method computes Root Mean Square Error (RMSE) and relative RMSE for Optical Path Differences (OPD), along with their standard deviations.
- Parameters:
psf_model (object) – An instance of the PSF model selected for metrics evaluation.
simPSF (object) – An instance of the PSFSimulator.
data (object) – A DataConfigHandler object containing training and test datasets.
dataset (dict) –
Dictionary containing dataset details, including: -
positions(Star positions) -C_poly(Tensor or None, optional)The Zernike coefficient matrix used in generating simulations of the PSF model. This matrix defines the Zernike polynomials up to a given order used to simulate the PSF field. It may be present in some datasets or only required for some classes. If not present or required, the model will proceed without it.
- Returns:
A dictionary containing RMSE, relative RMSE, and their corresponding standard deviation values for OPD metrics.
rmse_opdfloatRoot Mean Square Error (RMSE) for OPD.
rel_rmse_opdfloatRelative RMSE for OPD.
rmse_std_opdfloatStandard deviation of RMSE for OPD.
rel_rmse_std_opdfloatStandard deviation of relative RMSE for OPD.
- Return type:
- evaluate_metrics_polychromatic_lowres(psf_model: Any, simPSF: Any, data: Any, dataset: dict[str, Any]) dict[str, float][source]
Evaluate RMSE metrics for low-resolution polychromatic PSF.
This method computes Root Mean Square Error (RMSE) metrics for a low-resolution polychromatic Point Spread Function (PSF) model.
- Parameters:
psf_model (object) – An instance of the PSF model selected for metrics evaluation.
simPSF (object) – An instance of the PSFSimulator.
data (object) – A DataConfigHandler object containing training and test datasets.
dataset (dict) –
Dictionary containing dataset details, including: -
SEDs(Spectral Energy Distributions) -positions(Star positions) -C_polyTensor or None, optionalThe Zernike coefficient matrix used in generating simulations of the PSF model. This matrix defines the Zernike polynomials up to a given order used to simulate the PSF field. It may be present in some datasets or only required for some classes. If not present or required, the model will proceed without it.
- Returns:
A dictionary containing the RMSE, relative RMSE, and their corresponding standard deviation values.
rmsefloatRoot Mean Square Error (RMSE).
rel_rmsefloatRelative RMSE.
std_rmsefloatStandard deviation of RMSE.
std_rel_rmsefloatStandard deviation of relative RMSE.
- Return type:
- evaluate_metrics_shape(psf_model: Any, simPSF: Any, data: Any, dataset: dict[str, Any]) dict[str, float][source]
Evaluate PSF Shape Metrics.
Computes shape-related metrics for the PSF model, including RMSE, relative RMSE, and their standard deviations.
- Parameters:
psf_model (object) – Instance of the PSF model selected for evaluation.
simPSF (object) – Instance of the PSFSimulator.
data (object) – A DataConfigHandler object containing training and test datasets.
dataset (dict) –
Dictionary containing dataset details, including: -
SEDs(Spectral Energy Distributions) -positions(Star positions) -C_poly(Tensor or None, optional)The Zernike coefficient matrix used in generating simulations of the PSF model. This matrix defines the Zernike polynomials up to a given order used to simulate the PSF field. It may be present in some datasets or only required for some classes. If not present or required, the model will proceed without it.
- Returns:
shape_results – Dictionary containing RMSE, Relative RMSE values, and corresponding Standard Deviation values for PSF Shape metrics.
- Return type:
- wf_psf.metrics.metrics_interface.evaluate_model(metrics_params, trained_model_params, data, psf_model, weights_path, metrics_output)[source]
Evaluate the trained model on both training and test datasets by computing various metrics.
The metrics to evaluate are determined by the configuration in metrics_params and metric_evaluation_flags. Metrics are computed for both the training and test datasets, and results are stored in a dictionary.
- Parameters:
metrics_params (Recursive Namespace object) – Recursive Namespace object containing metrics input parameters
trained_model_params (Recursive Namespace object) – Recursive Namespace object containing trained model input parameters
data (DataHandler object) – DataHandler object containing training and test data
psf_model (object) – PSF model object
weights_path (str) – Directory location of model weights
metrics_output (str) – Directory location of metrics output