Repository navigation
feat: setup="auto" (opt-in), setup.json and setup banner in the analyses (5C-1) - #752
Merged
Merged
Conversation
…et analyses (5C-1) AnalysisImaging / AnalysisInterferometer accept setup=None|"auto"|aa.Setup| "<setup_id>". modify_before_fit resolves it from the dataset and model (pixelization mesh or MGE), sets the backend, applies it to the dataset, runs the operator/backend consistency check outside the likelihood, pins threads, logs a banner and writes files/setup.json. Without setup= nothing changes beyond one "auto would choose" log line (ruling R6). Part of PyAutoLabs/PyAutoLens#881 (likelihood-lifecycle phase 5C-1). Co-Authored-By: Claude Opus 5.5 <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
Likelihood-lifecycle phase 5C-1, the first of two PRs under PyAutoLabs/PyAutoLens#881. The PyAutoGalaxy dataset analyses accept
setup=None | "auto" | aa.Setup | "<setup_id>". At fit start (modify_before_fit) the setup is resolved from the dataset and model, which sets the analysis backend. It is then applied to the dataset (apply_setup), checked for an operator/backend mismatch outside the likelihood, pins the thread pools, is logged as a banner line and is written tofiles/setup.json. Following ruling R6 it is opt-in: withoutsetup=, nothing changes except one "auto would choose …" log line.API Changes
ag.AnalysisImaging(..., setup=None)/ag.AnalysisInterferometer(..., setup=None)andAnalysisDataset(..., setup=None):"auto"picks the Pulse-designated setup viaaa.Setup.auto(PYAUTO_SETUP=<setup_id>overrides it). Anaa.Setupor setup_id string is used as given.use_jax=is honoured as before whensetupis None.AnalysisDataset.resolve_setup(model), called first inmodify_before_fit. With a setup,_use_jaxfollows the setup's backend, falling back to numpy when JAX is disabled or missing.files/setup.json(setup fields pluschosen_by: auto / explicit / PYAUTO_SETUP).autogalaxy.analysis.setup_util(rule-key mapping, banner,setup.jsondict, consistency check).See full details below.
Test Plan
pytest test_autogalaxy: 1641 passedpyauto-heart readiness --dev --repos PyAutoGalaxy): GREEN. Non-blocking shown reasons: manifest drift (1 workspace checkout mismatch vs repos.yaml); release validation has no rehearsal for current source.pyauto-heart smoke --affected-by PyAutoGalaxy --jobs 3: 5/5 workspaces PASS (autogalaxy, autolens, autolens_test, euclid, howtolens), run against this branch via PYAUTO_ROOTFull API Changes (for automation & release notes)
Added
setupkeyword onAnalysisDataset,AnalysisImagingandAnalysisInterferometer.AnalysisDataset.resolve_setup(model), plus the attributessetup_input,setup(the resolvedaa.Setupor None) andsetup_chosen_by.autogalaxy.analysis.setup_util:setup_input_from,dataset_type_from,mesh_variant_from,mesh_classes_from,setup_key_from/setup_key_and_note_from,use_jax_from,check_setup_consistency,chosen_by_from,setup_banner_from,setup_dict_from.files/setup.jsonis written bysave_attributeswhen a setup was resolved.Changed
AnalysisDataset.modify_before_fitresolves the setup before preloading grids, so the grids belong to the dataset the likelihood uses. Without a setup it only logs the "auto would choose …" line, and also runs hardware detection (Environment.detect(), about 1.4 s on the first call in a process whennvidia-smiis present).Migration
Notes:
DelaunayNN→ delaunay_nn;Delaunayand its subclasses → delaunay; rectangular meshes → rectangular; no mesh → mge. With several meshes the most expensive wins. A missing row (e.g.interferometer/delaunay_nn) falls back to the nearest variant, and the banner says so.log_fit_startcan be stale when a setup flips the backend. The banner is the authoritative report (approved design call 1).check_setup_consistencycalls PyAutoArray's privatefactory._check_imaging_setup_consistency/_check_interferometer_setup_consistency. A rename there would break it.FactorGraphModeldoes not forwardmodify_before_fit, sosetup="auto"inside anAnalysisFactoris not applied yet. The guard that raises lands in 5C-2, and setup agreement in 5D.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code