function indices_by_distribution

deeptime.markov.sample.indices_by_distribution(indices: List[ndarray], distributions, nsample)

Samples trajectory/time indices according to the given probability distributions

Parameters:
  • indices (list of ndarray( (N_i, 2) )) – 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.

  • distributions (list or array of ndarray ( (n) )) – m distributions over states. Each distribution must be of length n and must sum up to 1.0

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

Returns:

indices – List of the sampled indices by distribution. Each element is an index array with a number of rows equal to nsample, 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:

length m list of ndarray( (nsample, 2) )

Notes

When using distributions defined over a subset of states (e.g., PCCA+ metastable distributions which are defined over the MSM active set only), the indices array must cover the same subset. Use the subset parameter in compute_index_states() to restrict it:

indices = compute_index_states(dtrajs, subset=msm.count_model.state_symbols)
samples = indices_by_distribution(indices, pcca.metastable_distributions, nsample=100)

See also

compute_index_states

Compute trajectory/time indices, with optional subset parameter.