-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add option to reset child labels in Compound.remove() #1173
Conversation
Compound.remove() add option to reset labels
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1173 +/- ##
==========================================
+ Coverage 87.28% 87.32% +0.04%
==========================================
Files 62 62
Lines 6502 6525 +23
==========================================
+ Hits 5675 5698 +23
Misses 827 827 ☔ View full report in Codecov by Sentry. |
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.
I left one suggestion, but this looks good to me. Thank you @jaclark5!
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! Found a new bug (unrelated to this PR) that we need to fix though when reset_labels=False
. The gist is if you removed all particle of a specific type (in this example all H
of the ethane6
molecule, there is still the "H"
in ethane6.labels
. If we try to print it out, it will error out, since all the underlying object has been removed. This is bug in the remove
method, basically we need a better of pruning the references to the removed object. This bug was basically fixed with the reset_label=True
, since the new label dict was re-generated with only existing object.
We should potentially add in a future PR a deprecation warning for reset_index |
Two changes are made:
PR Summary:
Resolves #1172
Using the code in the issue where the last line is now,
Molecule.remove(remove_array, reset_labels=True)
, the results are now:After
PR Checklist