Skip to content
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

fix label handling during flatten #1208

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

CalCraven
Copy link
Contributor

PR Summary: This code fixes a bug raised in #1206. This seems to be caused by the multiple hierarchies in this structure, which results in labels for each molecule. Then, after flattening, these compound labels refer to compounds not in the tree structure anymore, which get picked up after mb.clone is used on them, and causes errors in the particles themselves.

Need some feedback to suggest if just clearing out the labels is the correct approach for the flatten_hierarchy function. As you can see, that effects what you can access from the compound, but may be a limitation we're forced to accept.

PR Checklist


  • Includes appropriate unit test(s)
  • Appropriate docstring(s) are added/updated
  • Code is (approximately) PEP8 compliant
  • Issue(s) raised/addressed?

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.29%. Comparing base (a4c41c5) to head (62f7af2).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1208      +/-   ##
==========================================
- Coverage   85.73%   83.29%   -2.45%     
==========================================
  Files          53       53              
  Lines        4802     4806       +4     
==========================================
- Hits         4117     4003     -114     
- Misses        685      803     +118     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@chrisjonesBSU
Copy link
Contributor

Need some feedback to suggest if just clearing out the labels is the correct approach for the flatten_hierarchy function. As you can see, that effects what you can access from the compound, but may be a limitation we're forced to accept.

I think this is the correct approach, and is what I would expect after flattening the hierarchy.

Copy link
Contributor

@chrisjonesBSU chrisjonesBSU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I tried this out with some similar applications discussed in the issue..I think the behavior now is what I would expect after calling flatten() on compound with children that had their own distinct labels.

CalCraven and others added 4 commits November 21, 2024 15:55
… lists with the format 'all-{name}s' for clarity
* update CI and precommit files

* add ruff changes

* remove gmso lines

* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci

* change error type in test

* raise the error that is created

* remove duplicate windows 3.12 test

* fix precommit errors

* fix import error

* fix CI error

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants