-
Notifications
You must be signed in to change notification settings - Fork 1
Subgrid shift #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subgrid shift #33
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements subgrid shift functionality for Grid objects, allowing selective shifting of columns and rows while preserving grid integrity. The implementation adds methods to shift specific column or row indices by a given amount while automatically adjusting spacing to maintain grid structure.
- Adds
shift_subgrid_xandshift_subgrid_ymethods with support for bothilist.IListandsliceinputs - Implements validation to prevent invalid shifts that would change column/row ordering
- Includes comprehensive test coverage for various scenarios including edge cases
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/bloqade/geometry/dialects/grid/types.py | Core implementation of subgrid shift methods with spacing adjustment logic |
| src/bloqade/geometry/dialects/grid/stmts.py | Statement definitions for the new shift operations |
| src/bloqade/geometry/dialects/grid/concrete.py | Concrete interpreter implementations for subgrid shift statements |
| src/bloqade/geometry/dialects/grid/_interface.py | Public API interface definitions with documentation |
| src/bloqade/geometry/dialects/grid/init.py | Module exports for new shift operations |
| test/grid/test_types.py | Comprehensive test cases covering various input types and edge cases |
| test/grid/test_concrete.py | Integration tests for concrete interpreter functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
weinbe58
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just make sure to run pre-commit install and pre-commit run --all-files to get the linting CI to pass
|
closes #33 |
…ry into subgrid_shift
| assert all( | ||
| x >= 0 for x in new_spacing | ||
| ), "Invalid shift: column order changes after shift." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a user input we should make this an exception instead of an assertion. Generally Assertions are used to enforce internal logic inside a code to catch potential bugs while exceptions are indicating invalid inputs from a user.
* add test cases for sub grid shift * add test in test_concrete * add implementation for shift_subgrid_x and shift_subgrid_y * add test for shift_sub_grid_x/y with slice * add implementation for shift_sub_grid_x/y with slice * fix format * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> * fix format --------- Co-authored-by: Phillip Weinberg <[email protected]> Co-authored-by: Copilot <[email protected]>
subgrid_shift_xandsubgrid_shift_yas described in Shift subset of positions defined by a list of indices. #31ilist.IListandsliceas input for column/row indices