pyissm.inversion.metrics
Inversion metrics for pyISSM.
This module contains various functions for computing metrics related to inversion processes in ISSM models.
Functions
Compute ratios between all inversion cost functions. |
|
Extract final inversion cost-function values. |
|
Extract convergence history of cost functions. |
|
|
Compute field smoothness metrics. |
Compute positive/negative residual area metrics. |
- pyissm.inversion.metrics.cost_function_ratios(md)
Compute ratios between all inversion cost functions.
These ratios can provide insight into the relative contributions of different cost functions to the total cost and help identify which cost functions are dominating the inversion results.
- Parameters:
md (
pyissm.Model) – ISSM model object containing inversion results.- Returns:
Dictionary of pairwise cost-function ratios.
- Return type:
dict
Example
: code-block:: python
>>> cost_ratios = pyissm.inversion.metrics.cost_function_ratios(md)
- pyissm.inversion.metrics.cost_function_values(md)
Extract final inversion cost-function values.
Extracts the final cost-function values for each cost function and the total cost from the model results.
- Parameters:
md – ISSM model object containing inversion results.
- Returns:
Dictionary containing final cost-function values for each cost function and total cost.
- Return type:
dict
Example
: code-block:: python
>>> final_costs = pyissm.inversion.metrics.cost_function_values(md)
- pyissm.inversion.metrics.extract_convergence_history(md)
Extract convergence history of cost functions.
Extracts the history of cost-function values across iterations from the modelresults and organizes it into a pandas DataFrame for easier analysis and visualization of convergence behavior.
- Parameters:
md (
pyissm.Model)- Returns:
DataFrame containing cost function history.
- Return type:
pandas.DataFrame
Example
: code-block:: python
>>> convergence_history = pyissm.inversion.metrics.extract_convergence_history(md)
- pyissm.inversion.metrics.field_smoothness_metrics(md, field=None)
Compute field smoothness metrics.
Calculates the area-weighted mean and RMSE of the gradient magnitude (slope) of a specified field. This provides insight into the spatial variability and smoothness of the control parameter field, which can be important for understanding inversion results and regularization effects.
- Parameters:
md (
pyissm.Model) – ISSM model object containing mesh and (optionally) solution data.field (
numpy.ndarray) – Field values, defined on vertices. If None, will attempt to extract from model results based on control parameter.
- Returns:
Dictionary containing smoothness metrics.
- Return type:
dict
Example
: code-block:: python
>>> smoothness_metrics = pyissm.inversion.metrics.field_smoothness_metrics(md)
- pyissm.inversion.metrics.velocity_residual_area_metrics(md)
Compute positive/negative residual area metrics.
Calculates the total area of elements with positive and negative velocity residuals, as well as their fractions relative to the total area. This provides insight into the spatial distribution of model-data misfit in terms of velocity residuals.
- Parameters:
md (
pyissm.Model) – ISSM model object containing mesh and solution data.- Returns:
Dictionary containing the computed metrics.
- Return type:
dict
Example
: code-block:: python
>>> area_metrics = pyissm.inversion.metrics.velocity_residual_area_metrics(md)