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:
dtrj (
array_like) – The discrete trajectory for which to get all frame indices where its elements change.axis (
int) – Seemdtools.dtrj.locate_trans().pin (
{"end", "start", "both"}) – Seemdtools.dtrj.locate_trans().discard_neg (
{None, "start", "end", "both"}, optional) – Seemdtools.dtrj.locate_trans().trans_type (
{None, "higher", "lower", "both"}orintoriterableofints, optional) – Seemdtools.dtrj.locate_trans().wrap (
bool, optional) – Seemdtools.dtrj.locate_trans().tfft (
bool, optional) – Seemdtools.dtrj.locate_trans().tlft (
bool, optional) – Seemdtools.dtrj.locate_trans().mic (
bool, optional) – Seemdtools.dtrj.locate_trans().min_state, max_state (
scalarorarray_like, optional) – Seemdtools.dtrj.locate_trans().
- Returns:
ix_start (
tupleofnumpy.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 (
tupleofnumpy.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 callsmdtools.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]))