Closed schwancr closed 10 years ago
This means, of course, that we should really add a test that uses the continuouscontact metric.
Actually, we should really add tests for all of the metrics ... let's save that for a different PR since it will be a bigger issue, and right now we need a patch for this issue.
@rmcgibbo or @kyleabeauchamp can one of you make sure I didn't do anything really stupid here so we can merge this?
+1
Here is the driver code I just used to test:
import msmbuilder as msmb
import mdtraj as md
t = md.load("/home/kyleb/src/rmcgibbo/mdtraj/MDTraj/testing/reference/frame0.h5")
c = msmb.metrics.contact.BooleanContact(contacts=np.array([[0,1]]))
d = c.prepare_trajectory(t)
d.shape
c = msmb.metrics.contact.ContinuousContact(contacts=np.array([[0,1]]))
d = c.prepare_trajectory(t)
d.shape
The old code raises AttributeErrors, the new code gives (500, 1)...
The contact metric uses mdtraj.compute_contacts, but that method returns both the distances as well as the contacts used. So, prepare_trajectory needs to only select the first element.