refactor(model_util): replace simulator_start_here_model_from with direct random_galaxy_for_simulation_from#438
Merged
Conversation
…rect random_galaxy_for_simulation_from The old helper built an af.Model around lp_snr.Sersic and exposed signal_to_noise_ratio as a UniformPrior — making model.info print look like the reader was fitting SNR (they were not, the model was only used for .random_instance()). Replace with random_galaxy_for_simulation_from, which returns a concrete Galaxy by sampling each parameter directly from a numpy.random.Generator and constructing lp_snr.Sersic as a profile *instance*. SNR is a property of the data, not a fit parameter; this removes the misleading prior surface. Also exports SIMULATOR_RANDOM_GALAXY_SUMMARY as a one-line replacement for the verbose model.info print used by the start_here scripts. Co-Authored-By: Claude Opus 4.7 (1M context) <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
simulator_start_here_model_from()— it built anaf.Model(lp_snr.Sersic)withsignal_to_noise_ratio = af.UniformPrior(20, 60), makingmodel.infoprint look like the user was fitting SNR.random_galaxy_for_simulation_from(rng=None)— returns a concreteag.Galaxywhose bulge is anlp_snr.Sersicinstance sampled directly from anumpy.random.Generator. SNR appears only as a profile attribute on the instance, never as a fitting parameter.SIMULATOR_RANDOM_GALAXY_SUMMARY(one-line replacement for the verbosemodel.infoprint used by start_here scripts).Test plan
pytest test_autogalaxy/ -x -q— 908 passedsignal_to_noise_ratio.*Priorreturns zero hits acrossautogalaxy/python -c "import autogalaxy as ag; assert not hasattr(ag.model_util, 'simulator_start_here_model_from')"passesCoordinated PRs
feature/fix-snr-model-smell-and-ci(sibling change foral.model_util)feature/fix-snr-model-smell-and-ci(callers + CI fix)feature/fix-snr-model-smell-and-ci(callers)Library-first merge gate per CLAUDE.md: this PR + the PyAutoLens PR should merge before the workspace PRs.
🤖 Generated with Claude Code