Skip to content

test(jax): add scripts/jax_assertions/ with assertions moved from PyAutoArray#68

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/jax-assertions-move
May 1, 2026
Merged

test(jax): add scripts/jax_assertions/ with assertions moved from PyAutoArray#68
Jammy2211 merged 1 commit into
mainfrom
feature/jax-assertions-move

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Five new scripts in scripts/jax_assertions/ holding cross-xp parity and jax-only behavior assertions that previously lived as pytest tests in PyAutoArray/test_autoarray/ but pulled jax imports into the library unit test run.

Script What it asserts
sparse_operators.py data_vector_via_psf_weighted_data_from (segment_sum) ≈ blurred mapping matrix; ImagingSparseOperator.from_noise_map_and_psf ≈ dense curvature; InterferometerSparseOperator.from_nufft_precision_operator ≈ psf-weighted-noise curvature
knn_interpolator.py KNN mapper pix_indexes_for_sub_slim_index / pix_weights_for_sub_slim_index and resulting inversion regularization (default + AdaptSplit)
nnls.py Jacobi-preconditioned reconstruction_positive_only_from produces finite gradients on ill-conditioned Q; matches raw jaxnnls.solve_nnls_primal on well-conditioned Q
pytree.py AbstractNDArray pytree registration: numpy path doesn't register, jax path registers once, jax.jit round-trips through _LeafArray
grid_irregular.py Grid2DIrregular.grid_2d_via_deflection_grid_from propagates xp=jnp through to result

Why

See the companion PR on PyAutoArray: PyAutoArray#feature/jax-assertions-move.

In short: keep test_autoarray/ numpy-only so the no-jax CI matrix stays green and local dev runs don't pay the jax import tax.

Style

Each script follows the established workspace_test convention:

  • Module docstring + __Section__ headers
  • npt.assert_allclose instead of pytest.approx
  • Inline construction (no pytest fixtures or parameterize)
  • Final print("<name>: all assertions passed") so run_all_scripts.sh produces visible success markers

Test plan

  • Each script exits 0 individually under python scripts/jax_assertions/<name>.py (locally verified)
  • run_all_scripts.sh passes after merge

…utoArray

Five new scripts holding cross-xp parity and jax-only behavior assertions
that previously lived as pytest tests in test_autoarray/ but pulled jax
imports into the library unit test run. Subjects: sparse_operators (3),
knn_interpolator, nnls, pytree, grid_irregular.

Each script follows the established workspace_test style: module docstring,
__Section__ headers, npt.assert_allclose, inline fixture construction (no
pytest fixtures or parameterize). Script bodies are line-for-line ports of
the original tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit 9aebb65 into main May 1, 2026
0 of 4 checks passed
@Jammy2211 Jammy2211 deleted the feature/jax-assertions-move branch May 1, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant