fix: fill mock sample placeholders from prior medians, not a blanket 1.0 - #1471
Merged
Merged
Conversation
MockSamplesSummary and MockSamples.default_sample_list filled every parameter with 1.0. That is invalid for any parameter its prior constrains -- notably an elliptical profile's ell_comps, which must have a magnitude below 1, so (1.0, 1.0) raises on construction. MockResult builds its own MockSamplesSummary when the caller passes a model but no samples_summary, so reading Result.instance on such a result raised. This surfaced as seven aggregator integration scripts failing in autogalaxy_workspace_test and autolens_workspace_test, from inside MockSearch._fit_fast rather than from the aggregator. Fill from each prior's median instead, via a shared prior_median_kwargs helper that _make_samples in mock_search.py now also uses -- the same idiom it already applied, in one place rather than three. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqpBSWF2JDx4L9g1YCQk67
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.
Problem
MockSamplesSummary.__init__andMockSamples.default_sample_listboth filled every parameter with a blanket1.0. That value is invalid for any parameter its prior constrains — notably an elliptical profile'sell_comps, which must have a magnitude below 1, so(1.0, 1.0)raises on construction.MockResultbuilds its ownMockSamplesSummarywhenever a caller passes amodelbut nosamples_summary:So reading
Result.instanceon such a result raised. This surfaced as seven aggregator integration scripts failing acrossautogalaxy_workspace_testandautolens_workspace_test, with:The failure is raised from inside
MockSearch._fit_fast(mock_search.py:82,if self.result.instance is None), duringsearch.fit(...)— not from the aggregator, and with no database round-trip involved.Change
Adds a shared
prior_median_kwargs(model)helper inmock_samples.pythat fills from each prior's median, and routes all three copies of the old idiom through it:MockSamplesSummary.__init__MockSamples.default_sample_list_make_samplesinmock_search.py, which already used exactly this expressionPrior medians are always in range, so they are safe for every model. Consolidating leaves the idiom in one place rather than three, which is what allowed the copies to drift apart in the first place.
Tests
New
test_autofit/non_linear/samples/test_mock_placeholders.py— 4 tests built on a guard class mirroring theell_compsconstraint, so the regression is covered inside PyAutoFit with noautogalaxydependency. Verified to fail 3/4 against unpatched code.test_autofittest_autogalaxytest_autolensThe two residual failures are pre-existing and unrelated (
graphical/functionality/test_messages.py::test_beta,potential_correction/test_iterative_interferometer.py::test__solve_joint_optimization__identity_damping_finite); both reproduce without this change.Controlled check that the fix is load-bearing: with physically-valid fixture values but no
samples_summarypassed, the scripts still failed at(1.0, 1.0)before this change and pass after it.Related
Pairs with a one-line PyAutoGalaxy change letting
ag.m.MockResultaccept and forwardsamples_summary. Merge this one first.Generated by Claude Code