fix: consolidate guides/results tutorials onto one _quick_fit.py (aggregator IndexError)#275
Merged
Merged
Conversation
start_here.py, aggregator/galaxies_fits.py and aggregator/samples.py each ran their own capped n_like_max=300 Nautilus fit, but only _quick_fit.py disables samples_weight_threshold. The others pruned to 2 samples on disk, so their deep sample indexing (from_sample_index(-10), parameter_lists[9]) raised IndexError once the release profile ran the real sampler (guides/results/ unsets PYAUTO_TEST_MODE, so is_test_mode() is False and PyAutoFit#1368 does not apply). Order-dependent: start_here.py runs first and plants the 2-sample fit the aggregator readers then choke on. Consolidate onto a single fit source, _quick_fit.py: give it a suffix-free primary unique_tag (simple__no_lens_light) plus one more (_1) for the aggregator's multi-result iteration, and make the three self-fitting scripts' inline model match it (Isothermal + external shear, MGE source). search.fit() then genuinely resumes the 300-sample fit instead of running a divergent shallow one, making the scripts' "resumes from the cached fit" docstrings true. The fit identifier is [search, model, unique_tag] only, so a plain AnalysisImaging inline still resumes _quick_fit's AnalysisLatent fit. samples.py's source changes Sersic -> MGE to match, and its two source.bulge.sersic_index filter examples move to lens.shear.gamma_1. Also fixes queries.py, whose unique_tag == "simple__no_lens_light" query previously matched nothing. Validated: ordered guides/results run under env_vars_release.yaml passes 14/14 (was 2 IndexError failures); both fits retain 300 samples on disk, no 2-sample fit. Notebooks regenerated. Resolves the aggregator portion (cluster E) of the release-validation tail, PyAutoHeart#72. Co-Authored-By: Claude Opus 4.8 <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.
Overview
Fixes the
IndexError: list index out of rangecrashes in theguides/resultsaggregator tutorials (release-validation tail cluster E, PyAutoHeart#72). Closes the diagnosis in #274.Three results tutorials each ran their own capped
n_like_max=300Nautilus fit, but only_quick_fit.pydisablessamples_weight_threshold. The others pruned to 2 samples on disk, so their deep sample indexing (from_sample_index(-10),parameter_lists[9]) raisedIndexErroronce the release profile ran the real sampler (guides/results/unsetsPYAUTO_TEST_MODE, sois_test_mode()isFalseand PyAutoFit#1368 does not apply). It is order-dependent:start_here.pyruns first and plants the 2-sample fit that the aggregator readers then choke on. The scripts' docstrings claimed to resume_quick_fit's fit, but the model configs had diverged.This consolidates onto a single fit source,
_quick_fit.py: it gets a suffix-free primaryunique_tag(simple__no_lens_light) plus one more (_1) for the aggregator's multi-result iteration, and the three self-fitting scripts' inline model is made to match it (Isothermal + external shear, MGE source).search.fit()then genuinely resumes the 300-sample fit. The identifier is[search, model, unique_tag]only, so a plainAnalysisImaginginline still resumes_quick_fit'sAnalysisLatentfit — no shared "builder" imports, the model stays written out inline in each teaching script.Scripts Changed
scripts/guides/results/_quick_fit.py— primary fitunique_tagmade suffix-free (simple__no_lens_light) + one more (_1) for aggregator iteration; keepssamples_weight_threshold = None, shear + MGE model,AnalysisLatent.scripts/guides/results/start_here.py— addedshear=al.mp.ExternalShearso the inline model matches_quick_fit;search.fit()now resumes the 300-sample fit (docstring now accurate).scripts/guides/results/aggregator/galaxies_fits.py— same shear addition;from_sample_index(-10)now valid.scripts/guides/results/aggregator/samples.py— sourceSersic → MGEbulge + shear; the twosource.bulge.sersic_indexfilter examples retargeted tolens.shear.gamma_1;parameter_lists[9]now valid.notebooks/guides/results/{_quick_fit,start_here,aggregator/galaxies_fits,aggregator/samples}.ipynb.Bonus: fixes
aggregator/queries.py, whoseunique_tag == "simple__no_lens_light"query previously matched nothing (only_0/_1existed).Validation checklist (--auto)
guides/resultsrun underconfig/build/env_vars_release.yaml(the release profile that reproduced the bug): 14/14 pass (previouslyaggregator/galaxies_fits.pyandaggregator/samples_via_aggregator.pyfailed withIndexError). On disk both fits retain 300 samples; no 2-sample fit is created. Identifier check: the inline tutorial config computesaceb0b5a8cddadad1a489ab941e694cb, identical to_quick_fit's primary fit → resume confirmed.Corrective-PR exception for Heart RED
release validation FAILED (stage integrate)(the aggregatorIndexErrors = cluster E of PyAutoHeart#72)._quick_fit's 300-sample fit → this PR.pending-releasePR only; no merge, no issue close, no release, no rehearsal. Merge stays a separate human act.PyAutoLens/PyAutoGalaxybehind origin,workspace validation not passing (3 failed),58 stale parked scripts,PyAutoMind open PR 14d old,install verification not run. This PR clears only the aggregator/cluster-E portion of the stage-integrate reason, so Heart stays RED and release stays blocked until every reason is cleared by its own corrective PR.Recovery
After a human merges this: build fresh post-merge wheels, re-run release-integration validation on
main, and obtain a new Heart verdict before any release decision.🤖 Generated with Claude Code
Refs #274 (kept open — corrective validation pending; the exception forbids issue close)