-
Notifications
You must be signed in to change notification settings - Fork 2
Add shape decorators #194
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
Open
ndaelman-hu
wants to merge
18
commits into
develop
Choose a base branch
from
shape_decorators
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add shape decorators #194
Conversation
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
…ator `same_shape`
- Clarify the behavior of shape validation along inheritance
Contributor
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
Adds a class-decorator mechanism to consolidate shape validation across PhysicalProperty subclasses, replacing ad-hoc n_ length checks with a reusable system and enabling selective removal of checks.
- Introduces
accumulate_class_attributes,extract_shapes, andvalidate_shape_consistencyutilities - Adds
@same_shapesdecorator for automatic post-normalization shape checks - Adds
@remove_shape_checksdecorator to override or disable inherited shape requirements
Comments suppressed due to low confidence (1)
src/nomad_simulations/schema_packages/physical_property.py:108
- [nitpick] Add unit tests for
same_shapes(and the complementaryremove_shape_checks) to verify that shape requirements are correctly accumulated, validated, and removed across inheritance hierarchies.
cls._shape_requirements = accumulate_class_attributes(cls, '_shape_requirements', quantities)
Co-authored-by: Copilot <[email protected]>
Pull Request Test Coverage Report for Build 15376478072Details
💛 - Coveralls |
Co-authored-by: Copilot <[email protected]>
…ions into shape_decorators
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.
While the rank / dimensionality is checked by
nomad, the actual length along a specific axis typically isn't.Atm, any length checks typically consist of the population of a
n_quantity and specific checks for some quantities.Given the frequency of these checks, it would be better to off-load them to a specialized mechanism. The mechanism should still trigger during normalization (at the end?). It also makes most
n_quantities irrelevant, as they don't have any purpose in querying.The PR takes a class decorator approach, for ease of collection and overview. While decorators are more modular, a compound behavior along inheritance will likely come across as most natural and less repetitive. In that case, a "removal" option is also necessary.