chore(jax_assertions): assert sentinel default for use_jax_for_visualization#28
Merged
Merged
Conversation
…ization Phase 2 of the JAX visualization roadmap. PyAutoFit PR #1278 flipped the default of Analysis(use_jax_for_visualization) from False to None (sentinel that follows use_jax). This workspace_test follow-up adds the JAX-conditional sentinel-resolution assertions to scripts/jax_assertions/ fitness_dispatch.py, in line with the rule that library unit tests stay numpy-only and JAX-needing assertions live here. Four new assertions: - assert_use_jax_true_implicitly_turns_on_visualization - assert_explicit_false_opts_out_when_use_jax_true - assert_explicit_none_resolves_to_use_jax - assert_use_jax_true_jit_dispatch_via_sentinel_default Linked to PyAutoFit PR #1278 and issue #1275.
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
Phase 2 of the JAX visualization roadmap. PyAutoFit PR #1278 changes
Analysis(use_jax_for_visualization)frombool = FalsetoOptional[bool] = None— a sentinel that resolves touse_jax. The newdefault-on behaviour for
use_jax=Truecallers requires JAX at runtime toexercise, so per the library convention (numpy-only unit tests; JAX-needing
assertions in
autofit_workspace_test/scripts/jax_assertions/) thesentinel-resolution checks live here, not in
test_autofit/.Scripts Changed
scripts/jax_assertions/fitness_dispatch.py— four new assertion functions(and the
__main__block) covering:assert_use_jax_true_implicitly_turns_on_visualization— bareAnalysis(use_jax=True)resolves_use_jax_for_visualizationtoTrueassert_explicit_false_opts_out_when_use_jax_true— explicituse_jax_for_visualization=Falseoverrides the sentinelassert_explicit_none_resolves_to_use_jax— passingNoneisidentical to omitting the argument
assert_use_jax_true_jit_dispatch_via_sentinel_default— end-to-end:Analysis(use_jax=True)with sentinel default actually wires_jitted_fit_fromon firstfit_for_visualizationcallUpstream PR
PyAutoLabs/PyAutoFit#1278
Test Plan
python scripts/jax_assertions/fitness_dispatch.py— all 9assertions (5 pre-existing + 4 new) pass; the closing Dynesty
af.Arrayfit completes and returns the expected shape.autofit_workspace_test.🤖 Generated with Claude Code