Encode structure viewer representation styles - #768
Open
cpignedoli wants to merge 4 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/structure-viewer-representation-style-id #768 +/- ##
================================================================================
+ Coverage 85.03% 85.40% +0.37%
================================================================================
Files 18 18
Lines 3335 3379 +44
================================================================================
+ Hits 2836 2886 +50
+ Misses 499 493 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Jun 25, 2026
cpignedoli
marked this pull request as ready for review
June 25, 2026 08:38
cpignedoli
marked this pull request as draft
June 25, 2026 08:45
cpignedoli
marked this pull request as ready for review
June 25, 2026 09:08
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
This PR adds an extxyz-safe naming convention for structure-viewer representation arrays.
New representation arrays now encode their display style in the array name, for example:
The existing per-atom membership values remain unchanged (
1for included atoms,-1for excluded atoms).Backward compatibility
Old opaque representation names, such as
_aiidalab_viewer_representation_nQ34..., are still accepted. If a name cannot be parsed, the viewer keeps the historical default style settings and does not rename it just by loading the structure.Details
encode_representation_style_id()for generating safe, style-aware representation array names.parse_representation_style_id()for restoring type, size, and color from encoded names.This PR is stacked on #766, which fixes importing representation arrays that are present in loaded structures.
Representation PR chain
Validation
python -m pytest tests/test_viewers.py::test_structure_data_viewer_representation tests/test_viewers.py::test_structure_data_viewer_imports_unknown_representation_array tests/test_viewers.py::test_structure_data_viewer_imports_encoded_representation_array tests/test_viewers.py::test_structure_data_viewer_imports_multiple_encoded_representation_arrays tests/test_viewers.py::test_structure_data_viewer_updates_encoded_representation_array_namepython -m pytest tests/test_viewers.pyImplemented with Codex.