-
Notifications
You must be signed in to change notification settings - Fork 18
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
Contact trajectories #81
Conversation
Quick comments on the codeclimate complaints:
I'll silence those issues for now: |
start tests for MutableContactTrajectory
This is ready for review. Once this one is in, I'll cut 0.6.0. |
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 codewise, some doc changes and leftover debug code in the tests
Co-authored-by: sroet <[email protected]>
Co-authored-by: sroet <[email protected]>
Co-authored-by: sroet <[email protected]>
Co-authored-by: sroet <[email protected]>
Co-authored-by: sroet <[email protected]>
Co-authored-by: sroet <[email protected]>
Made changes as suggested, @sroet. Thanks for the quick review! |
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, feel free to merge on green
The main purpose of this is to introduce a
ContactTrajectory
subclass ofContactObject
. It also comes with a few related additions and tools. Major step toward #53.ContactTrajectory
This is essentially a list of single-frame
ContactFrequency
instances. A contact map for a specific frame can be obtained by either:The normal
ContactTrajectory
is aSequence
; there is also aMutableContactTrajectory
which is aMutableSequence
.This PR will not include the movie making aspects suggested in #53 -- that will be left for future work.
ContactObject.from_contacts
For efficiency, the easiest way to calculate the contact trajectory is to have a loop that calculates the contacts for each frame, and then to create a
ContactFrequency
fromatom_contacts
andresidue_contacts
. We did not have a method to create aContactFrequency
from contacts before, so I added it. Like many things, it isn't allowed forContactDifference
, where it is overridden with aNotImplementedError
.The input to
ContactObject.from_contacts
can be eitherContactCount
instances, or the underlyingcollections.Counter
s (as well as, of course, the necessary information forContactObject.__init__
).WindowedIterator
andContactTrajectory
-specific implementationThe basic idea here is to facilitate rolling-average type behavior (perhaps in our case, rolling-frequency). By iterating over an underlying sequence, the idea is to return sequence indices that should be added to/subtracted from the rolling average. There's a general implementation (perhaps useful in other code!) and a specific use of it to get rolling contact frequencies.
Tasks
ContactObject.from_contacts
ContactTrajectory
ContactTrajectory
ContactTrajectory
, with testsMutableContactTrajectory
, with testsWindowedIterator
and testsRollingContactFrequency
and tests