contact_map
contact_map copied to clipboard
Enhancement: ContactTrajectory class (with movies!)
It might be nice to add a ContactTrajectory
class. This would store a separate (single frame) contact map for each time slice. Then you could do interesting things like create a ContactFrequency
based on a set of frames determined after the fact. You could also create movies of how the contact map evolves in time (these should be based on some windowing into ContactFrequency
instances; the window can be 1 if the user wants).
Relevant matplotlib docs on animation:
- https://matplotlib.org/api/animation_api.html
- https://matplotlib.org/gallery/animation/dynamic_image.html
Animations that could be generated in real time would be impressive, but I'd be just as happy with something that pre-generates the images and makes a movie out of them, like ArtistAnimation
does.
Note that, to use a rolling window to generate the contact frequency plots for each movie frame, we already have add_contact_frequency
and subtract_contact_frequency
methods. These affect the absolute histogram count, unlike ContactDifference
, which compares the after-normalization (to number of frames) contact frequencies. We'd still output a separate plot at each time step, but the underlying data would be cheaper to calculate.
+1 for the idea.
We'd still output a separate plot at each time step, but the underlying data would be cheaper to calculate.
Which one do you expect to be cheaper, using the methods or the ContactDifference
?
Which one do you expect to be cheaper, using the methods or the
ContactDifference
?
Not sure what you mean here... these calculate different things.
If you have freq_1
where a given contact is present 20/25 frames (80%), and freq_2
where that contact is present 1/2 frames (50%), then ContactDifference(freq_1, freq_2)
gives a result of 30% for that contact (80% - 50%). On the other hand, freq_1.subtract_contact_frequency(freq_2)
results in a ContactFrequency
where the contact is present in 19/23 frames (~83%). Of course, this only makes sense if you know that the trajectory that makes freq_2
is a subtrajectory of the one that made freq_1
.
Those methods were designed specifically for doing this sort of windowing of a contact frequency, so those are the things to use.
Those methods were designed specifically for doing this sort of windowing of a contact frequency, so those are the things to use.
Ah I understand now :) thanks for the explanation
@dwhswenson was there any issue left here after #81 ?
#81 doesn't include movies, just the ContactTrajectory
itself.
Good to know, was just checking in on the current state of things