test(jax): add scripts/jax_assertions/ with assertions moved from PyAutoArray#68
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five new scripts in
scripts/jax_assertions/holding cross-xp parity and jax-only behavior assertions that previously lived as pytest tests inPyAutoArray/test_autoarray/but pulled jax imports into the library unit test run.sparse_operators.pydata_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 curvatureknn_interpolator.pypix_indexes_for_sub_slim_index/pix_weights_for_sub_slim_indexand resulting inversion regularization (default + AdaptSplit)nnls.pyreconstruction_positive_only_fromproduces finite gradients on ill-conditioned Q; matches rawjaxnnls.solve_nnls_primalon well-conditioned Qpytree.pyAbstractNDArraypytree registration: numpy path doesn't register, jax path registers once, jax.jit round-trips through_LeafArraygrid_irregular.pyGrid2DIrregular.grid_2d_via_deflection_grid_frompropagatesxp=jnpthrough to resultWhy
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:
__Section__headersnpt.assert_allcloseinstead ofpytest.approxparameterize)print("<name>: all assertions passed")sorun_all_scripts.shproduces visible success markersTest plan
python scripts/jax_assertions/<name>.py(locally verified)run_all_scripts.shpasses after merge