refactor: simplify decorator type-dispatch system#277
Merged
Conversation
- Remove dead Grid1D/Array1D code path from all makers (never used in practice) - Replace try/except with getattr for over-sampling metadata in GridMaker - Add ndarray passthrough tests for all three decorators - Add transform decorator tests (applied, skipped, rotate_back) - Add MockTransformProfile for testing - Export aa.decorators alongside deprecated aa.grid_dec alias - Reduce decorator system from 648 to 365 lines (44% reduction) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Smoke tests revealed that workspace scripts (e.g. galaxies.py) pass Grid1D to decorated methods. The Grid1D→2D projection in evaluate_func and the via_grid_1d result handlers are needed for this path to work. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… scripts" This reverts commit 8f22034.
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
Simplifies the decorator type-dispatch system by removing dead Grid1D/Array1D code paths, cleaning up over-sampling metadata handling, adding comprehensive tests, and introducing
aa.decoratorsas the canonical public name (replacingaa.grid_dec).Reduces the decorator system from 648 to 365 lines (44% reduction) while maintaining identical runtime behaviour.
API Changes
aa.decoratorsis now the canonical way to access decorators (to_array,to_grid,to_vector_yx,transform). The oldaa.grid_decalias is preserved for backwards compatibility. See full details below.Test Plan
Full API Changes (for automation & release notes)
Added
aa.decorators— canonical alias foraa.grid_dec(same module, new name)aa.m.MockTransformProfile— test mock for transform decoratorRenamed
aa.grid_dec→aa.decorators(old name still works as deprecated alias)Removed (internal only — not public API)
AbstractMaker.via_grid_1d()— dead code, Grid1D was never passed to decorated methodsArrayMaker.via_grid_1d()— dead code path producing Array1DGridMaker.via_grid_1d()— dead code pathAbstractMaker.resultandAbstractMaker.evaluate_funcMask1Dimport from abstract makerMigration
@aa.grid_dec.to_array@aa.decorators.to_array(old form still works)🤖 Generated with Claude Code