trans_ix

mdtools.dtrj.trans_ix(dtrj, axis=-1, pin='end', discard_neg=None, trans_type=None, wrap=False, tfft=False, tlft=False, mic=False, min_state=None, max_state=None)[source]

Get the frame indices of state transitions in a discrete trajectory.

Parameters:
Returns:

  • ix_start (tuple of numpy.ndarray) – Tuple of arrays, one for each dimension of dtrj, containing the frame indices where a state transition will occur. Can be used to index dtrj and get the states right before the state transition. Is not returned if pin is "end".

  • ix_end (tuple of numpy.ndarray) – Tuple of arrays, one for each dimension of dtrj, containing the frame indices where a state transition has occurred. Can be used to index dtrj and get the states right after the state transition. Is not returned if pin is "start".

See also

mdtools.numpy_helper_functions.item_change_ix()

Get the indices of item changes in arbitrary arrays

mdtools.dtrj.locate_trans()

Locate the frames of state transitions inside a discrete trajectory.

Notes

This function only checks if the input array is a discrete trajectory using mdtools.check.dtrj() and then calls mdtools.numpy_helper_functions.item_change_ix().

Examples

>>> dtrj = np.array([[1, 2, 2, 3, 3, 3],
...                  [2, 2, 3, 3, 3, 1],
...                  [3, 3, 3, 1, 2, 2],
...                  [1, 3, 3, 3, 2, 2]])
>>> start, end = mdt.dtrj.trans_ix(dtrj, pin="both")
>>> start
(array([0, 0, 1, 1, 2, 2, 3, 3]), array([0, 2, 1, 4, 2, 3, 0, 3]))
>>> end
(array([0, 0, 1, 1, 2, 2, 3, 3]), array([1, 3, 2, 5, 3, 4, 1, 4]))