carto_flow.flow_cartogram.errors¶
Error metrics for morphing computation.
Classes:
-
MorphErrors–Structured error metrics from morphing computation.
Functions:
-
compute_error_metrics–Compute error metrics based on log2 ratio of current to target areas.
MorphErrors
dataclass
¶
MorphErrors(
log_errors: ndarray,
mean_log_error: float,
max_log_error: float,
errors_pct: ndarray,
mean_error_pct: float,
max_error_pct: float,
)
Structured error metrics from morphing computation.
Attributes:
-
log_errors(ndarray) –Array of log2 area errors for each geometry. Computed as log2(current_area / target_area). Positive values indicate oversized regions, negative values indicate undersized regions. This representation is symmetric: a value of +1 means 2x too large, -1 means 2x too small.
-
mean_log_error(float) –Mean of absolute log2 errors across all geometries.
-
max_log_error(float) –Maximum of absolute log2 errors across all geometries.
-
errors_pct(ndarray) –Approximate percentage error for each geometry. Computed as sign(log_error) * (2^|log_error| - 1) * 100.
-
mean_error_pct(float) –Mean approximate percentage error across all geometries.
-
max_error_pct(float) –Maximum approximate percentage error across all geometries.
Methods:
-
__repr__–Concise string representation for terminal display.
compute_error_metrics
¶
Compute error metrics based on log2 ratio of current to target areas.
Parameters:
-
current_areas(ndarray) –Current areas of geometries
-
target_areas(ndarray) –Target areas
Returns:
-
MorphErrors–Structured error metrics object containing all error fields.