Skip to content

fix: stabilize border relocation for degenerate PCA axes #445

Description

@Jammy2211

Overview

The profiling chain in autolens_profiling#113/#115 proved that NumPy FNNLS and JAX PDIP agree when given the same system, then isolated the native backend gap to ellipse_params_via_border_pca_from. For a near-isotropic traced border, the covariance eigenvalues differ only at floating-point scale, so NumPy and JAX choose different valid PCA eigenvectors. The helper then derives maximum ellipse extents along that arbitrary angle, turning eigenvector non-uniqueness into different relocated grids.

Measured on the full FitImaging pixelization fixture:

  • raw traced source-grid error: exactly zero
  • relocated source-grid error: up to 2.835e-1
  • mapping-matrix error: up to 1.492e-1
  • curvature-system error: up to 8.690e-3
  • reconstruction error: up to 8.989e-3
  • with border relocation disabled: curvature error 1.595e-16
  • with a deterministic near-isotropic PCA axis: relocated-grid error exactly zero

Plan

  • In ellipse_params_via_border_pca_from, compute the covariance eigenvalue gap relative to its scale.
  • When that gap is no larger than sqrt(machine epsilon), select a deterministic axis-aligned frame before deriving ellipse extents.
  • Retain the ordinary PCA major axis for non-degenerate covariance.
  • Add NumPy unit coverage for the near-isotropic branch and the anisotropic control.
  • Validate the JAX xp path through the downstream full-likelihood parity reproducer.

Boundary

Do not change NNLS algorithms, solver tolerances, public APIs, configuration, or behavior for non-degenerate PCA borders.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions