decorate Selection.apply to ignore empty atomgroups#2767
decorate Selection.apply to ignore empty atomgroups#2767richardjgowers merged 4 commits intoMDAnalysis:developfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2767 +/- ##
===========================================
- Coverage 91.14% 91.08% -0.07%
===========================================
Files 177 177
Lines 23767 23668 -99
Branches 3122 3123 +1
===========================================
- Hits 21663 21558 -105
- Misses 1484 1490 +6
Partials 620 620
Continue to review full report at Codecov.
|
richardjgowers
left a comment
There was a problem hiding this comment.
In [4]: u = mda.Universe(GRO)
In [5]: ag = u.atoms[[]]
In [6]: ag.select_atoms('global name C')
Out[6]: <AtomGroup with 214 atoms>
I think this breaks this fix right?
|
I like the fix but it's a little hacky to put the decorator application in the |
|
I added the decorator to the apply methods the geometric and string selection classes instead. |
|
This PR did not include a CHANGELOG comment. Further discussion in #2765 (comment) |
* decorate Selection.apply to ignore empty atomgroups * added test for global selection off empty AG * fix for global selections and empty AG * decorate functions instead * update CHANGELOG Co-authored-by: richard <richard@nextmovesoftware.com> (cherry picked from commit 016f2c6)
|
Yes, sorry, we forgot; the CHANGELOG entry was updated in the next merge to develop (by @IAlibay iirc) |
* decorate Selection.apply to ignore empty atomgroups * added test for global selection off empty AG * fix for global selections and empty AG * decorate functions instead * update CHANGELOG Co-authored-by: richard <richard@nextmovesoftware.com> (cherry picked from commit 016f2c6)
* decorate Selection.apply to ignore empty atomgroups * added test for global selection off empty AG * fix for global selections and empty AG * decorate functions instead Co-authored-by: richard <richard@nextmovesoftware.com>
Fixes #2765
Changes made in this Pull Request:
I decorated
Selection.applyin_Selectionmeta.__init__, which I baselessly feel is a bit iffy. Any opinions on if I should move it somewhere else?Edit: alternately it could be expensive to have so many ifs, I could just do the
StringSelectionand sphzone/layer ones individuallyPR Checklist