Easy inverse index array #3387#3433
Easy inverse index array #3387#3433SanjanaSogimatt wants to merge 4 commits intoMDAnalysis:developfrom
Conversation
|
Hello @SanjanaSogimatt! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2021-10-10 13:21:51 UTC |
Codecov Report
@@ Coverage Diff @@
## develop #3433 +/- ##
===========================================
- Coverage 92.92% 89.79% -3.14%
===========================================
Files 172 167 -5
Lines 22380 21786 -594
Branches 3302 0 -3302
===========================================
- Hits 20797 19563 -1234
- Misses 1030 2223 +1193
+ Partials 553 0 -553
Continue to review full report at Codecov.
|
Fixed errors.
|
Hello, I wanted to know how to improve my code. |
tylerjereddy
left a comment
There was a problem hiding this comment.
This doesn't reference any MDAnalysis issue, or adjust any MDAnalysis source code, so I'm going to close it and suggest browsing our issues/docs if you'd like to contribute.
If you'd like feedback on improving your generic Python code you might try something like StackOverflow.
|
Hi @SanjanaSogimatt, Thanks for having a look at this issue and for linking it in the title. As Tyler points out, it would have been more beneficial to add the issue number after the Issue #3387 describes how PR #3368 adds this code to the library: mdanalysis/package/MDAnalysis/core/groups.py Lines 811 to 815 in 149eb50 What this code does is create an inverse array, akin to what you get below (where
What this
This is not the same thing as reversing an array. The reason I couldn't use the easy mdanalysis/package/MDAnalysis/core/groups.py Line 809 in 149eb50 So for example: [ 1, 5, 3, 3, 6,] is unsorted and not unique So what the original code in #3387 does is create an inverse array for the third scenario there, i.e.
However, I think that the original code in #3387 is clumsy and slow. The goal is to rewrite it in Cython to make it faster. An example of a similar function would be here: mdanalysis/package/MDAnalysis/lib/_cutil.pyx Lines 51 to 91 in 149eb50 To fix Issue #3387, the solution would need to:
If you're happy to do this then please reopen this PR, or open another one, when you're ready! |

Fixes #
Changes made in this Pull Request:
PR Checklist