function indices_by_state

deeptime.markov.sample.indices_by_state(indices, nsample, subset=None, replace=True)

Samples trajectory/time indices according to the given sequence of states

Parameters:
  • indices (List[np.ndarray]) – For each state, all trajectory and time indices where this state occurs. Each matrix has a number of rows equal to the number of occurrences of the corresponding state, with rows consisting of a tuple (i, t), where i is the index of the trajectory and t is the time index within the trajectory.

  • nsample (int) – Number of samples per state. If replace = False, the number of returned samples per state could be smaller if less than nsample indices are available for a state.

  • subset (ndarray((n)), optional, default = None) – array of states to be indexed. By default all states in dtrajs will be used

  • replace (boolean, optional) – Whether the sample is with or without replacement

Returns:

indices – List of the sampled indices by state, each state corresponding to an ndarray of shape (N, 2). Each element is an index array with a number of rows equal to N=len(sequence), with rows consisting of a tuple (i, t), where i is the index of the trajectory and t is the time index within the trajectory.

Return type:

List[np.ndarray]