msmbuilder.MSMLib.invert_assignments

msmbuilder.MSMLib.invert_assignments(assignments)[source]

Invert an assignments array – that is, produce a mapping from state -> traj/frame

Parameters:

assignments : np.ndarray

2D array of MSMBuilder assignments

Returns:

inverse_mapping : collections.defaultdict

Mapping from state -> traj,frame, such that inverse_mapping[s] gives the conformations assigned to state s.

Notes

The assignments array may have -1’s, which are simply placeholders

we do not add these to the inverted assignments. Therefore, doing the following will raise a KeyError:

>>> inv_assignments = MSMLib.invert_assignments(assignments)
>>> print inv_assignments[-1]
KeyError: -1
Versions