Repository navigation
feat: AnalysisSetupMixin.adopt_backend; restore the dataset when a default setup is undone - #761
Merged
Jammy2211 merged 1 commit intoNov 26, 2026
Conversation
…fault setup is undone Part of PyAutoLabs/PyAutoLens#895. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jammy2211
deleted the
feature/likelihood-lifecycle-r6d-prerelease-fixes
branch
November 26, 2026 12:39
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
Part of PyAutoLabs/PyAutoLens#895 (likelihood-lifecycle R6 pre-release fixes; must merge before the release carrying R6 phase A). Same branch
feature/likelihood-lifecycle-r6d-prerelease-fixesin PyAutoFit, PyAutoGalaxy and PyAutoLens. Merge order: Fit → Galaxy → Lens.AnalysisSetupMixinimplements the new PyAutoFit hooks:setup_is_defaultreadssetup_defaulted(and staysTrueafter adoption);adopt_backend(use_jax)returns early for explicit setups, otherwise switches the analysis to the no-setup path on the graph's backend (clearssetup_input/setup/setup_chosen_by, so nosetup.json;_use_jax = use_jax_from(use_jax)) and logs one line saying the graph chose the backend and whatsetup="auto"had chosen for that factor alone.AnalysisDatasetkeeps the dataset as given (_dataset_before_setup) and_undo_resolved_setuprestores it, undoing any operator the auto setup attached, re-runscheck_setup_consistencyon the new backend and re-preloads grids (preloading factored into_preload_grids();modify_before_fitunchanged). The kept reference shares the data arrays (pickle 186013 → 186276 bytes).API Changes
AnalysisImaging/AnalysisInterferometer(viaAnalysisSetupMixin/AnalysisDataset) implementsetup_is_defaultandadopt_backend.See full details below.
Test Plan
[optional]extras, jax family uninstalled): PyAutoFit 4072, PyAutoGalaxy 1601, PyAutoLens 1114 passed, 0 failedweak/modeling.pyon the default (JAX) setup, andmulti_dataset/features/imaging_and_interferometer/modeling.py+imaging_and_point_source/modeling.pywith everyuse_jax=Trueremoved — all exit 0pyauto-heart smoke --affected-by PyAutoFitagainst the task worktree: 8/8 workspaces passedtest_analysis_factor_graph_setup.py(6; 3 failed on control): a default imaging (rectangular, numba sparse) + interferometer (MGE, JAX NUFFT) graph adopts one backend, the imaging dataset is restored, the graph likelihood is finite;use_jax=Falsepush-down; following an explicit setup; explicit disagreement raises; agreeing defaults keep the sparse operatorFull API Changes (for automation & release notes)
Added
AnalysisSetupMixin.setup_is_default,AnalysisSetupMixin.adopt_backend(use_jax),AnalysisDataset._undo_resolved_setup(),AnalysisDataset._preload_grids().Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code