refactor: build lens_dict directly and keep source separate in group scripts#58
Merged
Conversation
…scripts
Replace list-then-convert pattern (lens_models=[]/append/comprehension)
with building lens_dict={} directly in the loop. Keep source galaxy
separate from lens_dict, passing it as a keyword in af.Collection().
Co-Authored-By: Claude Opus 4.6 <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
Refactor the group model composition API to (1) build
lens_dictdirectly in the loop instead of building a list and converting with a comprehension, and (2) keep the source galaxy separate fromlens_dict, passing it assource=sourcein theaf.Collection()call. This makes the API clearer for users and more consistent with the imaging scripts.Scripts Changed
scripts/group/start_here.py— replacedlens_models=[]/append/comprehension with directlens_dict={}building; moved source out oflens_dictintoaf.Collection(**lens_dict, source=source)scripts/group/modeling.py— same refactor in both simple Sersic and MGE model composition blocksscripts/group/slam.py— convertedlens_light_modelsandlens_full_modelslists to directlens_dictbuilding insource_lp_0andsource_lp_1; movedlens_dict["source"]intoaf.Collection()calls across all 6 SLaM stagesTest Plan
start_here.py— model composes and fits successfullymodeling.py— model composes and fits successfullyslam.pysyntax verification passesCloses #56
🤖 Generated with Claude Code