id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
47,900
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.import_family
def import_family(self, rfa_file): """Append a import family entry to the journal. This instructs Revit to import a family into the opened model. Args: rfa_file (str): full path of the family file """ self._add_entry(templates.IMPORT_FAMILY ...
python
def import_family(self, rfa_file): """Append a import family entry to the journal. This instructs Revit to import a family into the opened model. Args: rfa_file (str): full path of the family file """ self._add_entry(templates.IMPORT_FAMILY ...
[ "def", "import_family", "(", "self", ",", "rfa_file", ")", ":", "self", ".", "_add_entry", "(", "templates", ".", "IMPORT_FAMILY", ".", "format", "(", "family_file", "=", "rfa_file", ")", ")" ]
Append a import family entry to the journal. This instructs Revit to import a family into the opened model. Args: rfa_file (str): full path of the family file
[ "Append", "a", "import", "family", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L326-L335
47,901
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.export_warnings
def export_warnings(self, export_file): """Append an export warnings entry to the journal. This instructs Revit to export warnings from the opened model. Currently Revit will stop journal execution if the model does not have any warnings and the export warnings UI button is disabled. ...
python
def export_warnings(self, export_file): """Append an export warnings entry to the journal. This instructs Revit to export warnings from the opened model. Currently Revit will stop journal execution if the model does not have any warnings and the export warnings UI button is disabled. ...
[ "def", "export_warnings", "(", "self", ",", "export_file", ")", ":", "warn_filepath", "=", "op", ".", "dirname", "(", "export_file", ")", "warn_filename", "=", "op", ".", "splitext", "(", "op", ".", "basename", "(", "export_file", ")", ")", "[", "0", "]"...
Append an export warnings entry to the journal. This instructs Revit to export warnings from the opened model. Currently Revit will stop journal execution if the model does not have any warnings and the export warnings UI button is disabled. Args: export_file (str): full pa...
[ "Append", "an", "export", "warnings", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L345-L359
47,902
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.purge_unused
def purge_unused(self, pass_count=3): """Append an purge model entry to the journal. This instructs Revit to purge the open model. Args: pass_count (int): number of times to execute the purge. default is 3 """ for purge_count in range(0...
python
def purge_unused(self, pass_count=3): """Append an purge model entry to the journal. This instructs Revit to purge the open model. Args: pass_count (int): number of times to execute the purge. default is 3 """ for purge_count in range(0...
[ "def", "purge_unused", "(", "self", ",", "pass_count", "=", "3", ")", ":", "for", "purge_count", "in", "range", "(", "0", ",", "pass_count", ")", ":", "self", ".", "_add_entry", "(", "templates", ".", "PROJECT_PURGE", ")" ]
Append an purge model entry to the journal. This instructs Revit to purge the open model. Args: pass_count (int): number of times to execute the purge. default is 3
[ "Append", "an", "purge", "model", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L361-L371
47,903
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.sync_model
def sync_model(self, comment='', compact_central=False, release_borrowed=True, release_workset=True, save_local=False): """Append a sync model entry to the journal. This instructs Revit to sync the currently open workshared model. Args: comment...
python
def sync_model(self, comment='', compact_central=False, release_borrowed=True, release_workset=True, save_local=False): """Append a sync model entry to the journal. This instructs Revit to sync the currently open workshared model. Args: comment...
[ "def", "sync_model", "(", "self", ",", "comment", "=", "''", ",", "compact_central", "=", "False", ",", "release_borrowed", "=", "True", ",", "release_workset", "=", "True", ",", "save_local", "=", "False", ")", ":", "self", ".", "_add_entry", "(", "templa...
Append a sync model entry to the journal. This instructs Revit to sync the currently open workshared model. Args: comment (str): comment to be provided for the sync step compact_central (bool): if True compacts the central file release_borrowed (bool): if True relea...
[ "Append", "a", "sync", "model", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L394-L420
47,904
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.write_journal
def write_journal(self, journal_file_path): """Write the constructed journal in to the provided file. Args: journal_file_path (str): full path to output journal file """ # TODO: assert the extension is txt and not other with open(journal_file_path, "w") as jrn_file: ...
python
def write_journal(self, journal_file_path): """Write the constructed journal in to the provided file. Args: journal_file_path (str): full path to output journal file """ # TODO: assert the extension is txt and not other with open(journal_file_path, "w") as jrn_file: ...
[ "def", "write_journal", "(", "self", ",", "journal_file_path", ")", ":", "# TODO: assert the extension is txt and not other", "with", "open", "(", "journal_file_path", ",", "\"w\"", ")", "as", "jrn_file", ":", "jrn_file", ".", "write", "(", "self", ".", "_journal_co...
Write the constructed journal in to the provided file. Args: journal_file_path (str): full path to output journal file
[ "Write", "the", "constructed", "journal", "in", "to", "the", "provided", "file", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L422-L430
47,905
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalReader.endswith
def endswith(self, search_str): """Check whether the provided string exists in Journal file. Only checks the last 5 lines of the journal file. This method is usually used when tracking a journal from an active Revit session. Args: search_str (str): string to search for ...
python
def endswith(self, search_str): """Check whether the provided string exists in Journal file. Only checks the last 5 lines of the journal file. This method is usually used when tracking a journal from an active Revit session. Args: search_str (str): string to search for ...
[ "def", "endswith", "(", "self", ",", "search_str", ")", ":", "for", "entry", "in", "reversed", "(", "list", "(", "open", "(", "self", ".", "_jrnl_file", ",", "'r'", ")", ")", "[", "-", "5", ":", "]", ")", ":", "if", "search_str", "in", "entry", "...
Check whether the provided string exists in Journal file. Only checks the last 5 lines of the journal file. This method is usually used when tracking a journal from an active Revit session. Args: search_str (str): string to search for Returns: bool: if True the...
[ "Check", "whether", "the", "provided", "string", "exists", "in", "Journal", "file", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L453-L469
47,906
markovmodel/msmtools
msmtools/estimation/sparse/prior.py
prior_neighbor
def prior_neighbor(C, alpha=0.001): r"""Neighbor prior of strength alpha for the given count matrix. Prior is defined by b_ij = alpha if Z_ij+Z_ji > 0 b_ij = 0 else Parameters ---------- C : (M, M) scipy.sparse matrix Count matrix alpha : float (optional) ...
python
def prior_neighbor(C, alpha=0.001): r"""Neighbor prior of strength alpha for the given count matrix. Prior is defined by b_ij = alpha if Z_ij+Z_ji > 0 b_ij = 0 else Parameters ---------- C : (M, M) scipy.sparse matrix Count matrix alpha : float (optional) ...
[ "def", "prior_neighbor", "(", "C", ",", "alpha", "=", "0.001", ")", ":", "C_sym", "=", "C", "+", "C", ".", "transpose", "(", ")", "C_sym", "=", "C_sym", ".", "tocoo", "(", ")", "data", "=", "C_sym", ".", "data", "row", "=", "C_sym", ".", "row", ...
r"""Neighbor prior of strength alpha for the given count matrix. Prior is defined by b_ij = alpha if Z_ij+Z_ji > 0 b_ij = 0 else Parameters ---------- C : (M, M) scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns -...
[ "r", "Neighbor", "prior", "of", "strength", "alpha", "for", "the", "given", "count", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/prior.py#L31-L59
47,907
markovmodel/msmtools
msmtools/estimation/sparse/prior.py
prior_const
def prior_const(C, alpha=0.001): """Constant prior of strength alpha. Prior is defined via b_ij=alpha for all i,j Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B ...
python
def prior_const(C, alpha=0.001): """Constant prior of strength alpha. Prior is defined via b_ij=alpha for all i,j Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B ...
[ "def", "prior_const", "(", "C", ",", "alpha", "=", "0.001", ")", ":", "B", "=", "alpha", "*", "np", ".", "ones", "(", "C", ".", "shape", ")", "return", "B" ]
Constant prior of strength alpha. Prior is defined via b_ij=alpha for all i,j Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B : (M, M) ndarray Prior count mat...
[ "Constant", "prior", "of", "strength", "alpha", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/prior.py#L62-L83
47,908
markovmodel/msmtools
msmtools/analysis/dense/assessment.py
is_transition_matrix
def is_transition_matrix(T, tol=1e-10): """ Tests whether T is a transition matrix Parameters ---------- T : ndarray shape=(n, n) matrix to test tol : float tolerance to check with Returns ------- Truth value : bool True, if all elements are in interval [0, ...
python
def is_transition_matrix(T, tol=1e-10): """ Tests whether T is a transition matrix Parameters ---------- T : ndarray shape=(n, n) matrix to test tol : float tolerance to check with Returns ------- Truth value : bool True, if all elements are in interval [0, ...
[ "def", "is_transition_matrix", "(", "T", ",", "tol", "=", "1e-10", ")", ":", "if", "T", ".", "ndim", "!=", "2", ":", "return", "False", "if", "T", ".", "shape", "[", "0", "]", "!=", "T", ".", "shape", "[", "1", "]", ":", "return", "False", "dim...
Tests whether T is a transition matrix Parameters ---------- T : ndarray shape=(n, n) matrix to test tol : float tolerance to check with Returns ------- Truth value : bool True, if all elements are in interval [0, 1] and each row of T sums up to 1. ...
[ "Tests", "whether", "T", "is", "a", "transition", "matrix" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/assessment.py#L25-L50
47,909
markovmodel/msmtools
msmtools/estimation/sparse/count_matrix.py
count_matrix_coo2_mult
def count_matrix_coo2_mult(dtrajs, lag, sliding=True, sparse=True, nstates=None): r"""Generate a count matrix from a given list discrete trajectories. The generated count matrix is a sparse matrix in compressed sparse row (CSR) or numpy ndarray format. Parameters ---------- dtraj : list of nda...
python
def count_matrix_coo2_mult(dtrajs, lag, sliding=True, sparse=True, nstates=None): r"""Generate a count matrix from a given list discrete trajectories. The generated count matrix is a sparse matrix in compressed sparse row (CSR) or numpy ndarray format. Parameters ---------- dtraj : list of nda...
[ "def", "count_matrix_coo2_mult", "(", "dtrajs", ",", "lag", ",", "sliding", "=", "True", ",", "sparse", "=", "True", ",", "nstates", "=", "None", ")", ":", "# Determine number of states", "if", "nstates", "is", "None", ":", "from", "msmtools", ".", "dtraj", ...
r"""Generate a count matrix from a given list discrete trajectories. The generated count matrix is a sparse matrix in compressed sparse row (CSR) or numpy ndarray format. Parameters ---------- dtraj : list of ndarrays discrete trajectories lag : int Lagtime in trajectory steps ...
[ "r", "Generate", "a", "count", "matrix", "from", "a", "given", "list", "discrete", "trajectories", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/count_matrix.py#L33-L88
47,910
markovmodel/msmtools
msmtools/analysis/sparse/assessment.py
is_transition_matrix
def is_transition_matrix(T, tol): """ True if T is a transition matrix Parameters ---------- T : scipy.sparse matrix Matrix to check tol : float tolerance to check with Returns ------- Truth value: bool True, if T is positive and normed False, otherw...
python
def is_transition_matrix(T, tol): """ True if T is a transition matrix Parameters ---------- T : scipy.sparse matrix Matrix to check tol : float tolerance to check with Returns ------- Truth value: bool True, if T is positive and normed False, otherw...
[ "def", "is_transition_matrix", "(", "T", ",", "tol", ")", ":", "T", "=", "T", ".", "tocsr", "(", ")", "# compressed sparse row for fast row slicing", "values", "=", "T", ".", "data", "# non-zero entries of T", "\"\"\"Check entry-wise positivity\"\"\"", "is_positive", ...
True if T is a transition matrix Parameters ---------- T : scipy.sparse matrix Matrix to check tol : float tolerance to check with Returns ------- Truth value: bool True, if T is positive and normed False, otherwise
[ "True", "if", "T", "is", "a", "transition", "matrix" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/assessment.py#L33-L60
47,911
markovmodel/msmtools
msmtools/analysis/sparse/assessment.py
is_connected
def is_connected(T, directed=True): r"""Check connectivity of the transition matrix. Return true, if the input matrix is completely connected, effectively checking if the number of connected components equals one. Parameters ---------- T : scipy.sparse matrix Transition matrix dire...
python
def is_connected(T, directed=True): r"""Check connectivity of the transition matrix. Return true, if the input matrix is completely connected, effectively checking if the number of connected components equals one. Parameters ---------- T : scipy.sparse matrix Transition matrix dire...
[ "def", "is_connected", "(", "T", ",", "directed", "=", "True", ")", ":", "nc", "=", "connected_components", "(", "T", ",", "directed", "=", "directed", ",", "connection", "=", "'strong'", ",", "return_labels", "=", "False", ")", "return", "nc", "==", "1"...
r"""Check connectivity of the transition matrix. Return true, if the input matrix is completely connected, effectively checking if the number of connected components equals one. Parameters ---------- T : scipy.sparse matrix Transition matrix directed : bool, optional Whether to ...
[ "r", "Check", "connectivity", "of", "the", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/assessment.py#L138-L160
47,912
markovmodel/msmtools
msmtools/analysis/sparse/assessment.py
is_ergodic
def is_ergodic(T, tol): """ checks if T is 'ergodic' Parameters ---------- T : scipy.sparse matrix Transition matrix tol : float tolerance Returns ------- Truth value : bool True, if # strongly connected components = 1 False, otherwise """ if isdense...
python
def is_ergodic(T, tol): """ checks if T is 'ergodic' Parameters ---------- T : scipy.sparse matrix Transition matrix tol : float tolerance Returns ------- Truth value : bool True, if # strongly connected components = 1 False, otherwise """ if isdense...
[ "def", "is_ergodic", "(", "T", ",", "tol", ")", ":", "if", "isdense", "(", "T", ")", ":", "T", "=", "T", ".", "tocsr", "(", ")", "if", "not", "is_transition_matrix", "(", "T", ",", "tol", ")", ":", "raise", "ValueError", "(", "\"given matrix is not a...
checks if T is 'ergodic' Parameters ---------- T : scipy.sparse matrix Transition matrix tol : float tolerance Returns ------- Truth value : bool True, if # strongly connected components = 1 False, otherwise
[ "checks", "if", "T", "is", "ergodic" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/assessment.py#L163-L189
47,913
yaybu/callsign
callsign/scripts/daemon.py
spawn
def spawn(opts, conf): """ Acts like twistd """ if opts.config is not None: os.environ["CALLSIGN_CONFIG_FILE"] = opts.config sys.argv[1:] = [ "-noy", sibpath(__file__, "callsign.tac"), "--pidfile", conf['pidfile'], "--logfile", conf['logfile'], ] twistd.run()
python
def spawn(opts, conf): """ Acts like twistd """ if opts.config is not None: os.environ["CALLSIGN_CONFIG_FILE"] = opts.config sys.argv[1:] = [ "-noy", sibpath(__file__, "callsign.tac"), "--pidfile", conf['pidfile'], "--logfile", conf['logfile'], ] twistd.run()
[ "def", "spawn", "(", "opts", ",", "conf", ")", ":", "if", "opts", ".", "config", "is", "not", "None", ":", "os", ".", "environ", "[", "\"CALLSIGN_CONFIG_FILE\"", "]", "=", "opts", ".", "config", "sys", ".", "argv", "[", "1", ":", "]", "=", "[", "...
Acts like twistd
[ "Acts", "like", "twistd" ]
e70e5368bfe4fd3ae3fdd1ed43944b53ffa1e100
https://github.com/yaybu/callsign/blob/e70e5368bfe4fd3ae3fdd1ed43944b53ffa1e100/callsign/scripts/daemon.py#L13-L22
47,914
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
find_bottleneck
def find_bottleneck(F, A, B): r"""Find dynamic bottleneck of flux network. Parameters ---------- F : scipy.sparse matrix The flux network A : array_like The set of starting states B : array_like The set of end states Returns ------- e : tuple of int The ...
python
def find_bottleneck(F, A, B): r"""Find dynamic bottleneck of flux network. Parameters ---------- F : scipy.sparse matrix The flux network A : array_like The set of starting states B : array_like The set of end states Returns ------- e : tuple of int The ...
[ "def", "find_bottleneck", "(", "F", ",", "A", ",", "B", ")", ":", "if", "F", ".", "nnz", "==", "0", ":", "raise", "PathwayError", "(", "'no more pathways left: Flux matrix does not contain any positive entries'", ")", "F", "=", "F", ".", "tocoo", "(", ")", "...
r"""Find dynamic bottleneck of flux network. Parameters ---------- F : scipy.sparse matrix The flux network A : array_like The set of starting states B : array_like The set of end states Returns ------- e : tuple of int The edge corresponding to the dynamic ...
[ "r", "Find", "dynamic", "bottleneck", "of", "flux", "network", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L39-L98
47,915
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
has_connection
def has_connection(graph, A, B): r"""Check if the given graph contains a path connecting A and B. Parameters ---------- graph : scipy.sparse matrix Adjacency matrix of the graph A : array_like The set of starting states B : array_like The set of end states Returns ...
python
def has_connection(graph, A, B): r"""Check if the given graph contains a path connecting A and B. Parameters ---------- graph : scipy.sparse matrix Adjacency matrix of the graph A : array_like The set of starting states B : array_like The set of end states Returns ...
[ "def", "has_connection", "(", "graph", ",", "A", ",", "B", ")", ":", "for", "istart", "in", "A", ":", "nodes", "=", "csgraph", ".", "breadth_first_order", "(", "graph", ",", "istart", ",", "directed", "=", "True", ",", "return_predecessors", "=", "False"...
r"""Check if the given graph contains a path connecting A and B. Parameters ---------- graph : scipy.sparse matrix Adjacency matrix of the graph A : array_like The set of starting states B : array_like The set of end states Returns ------- hc : bool True ...
[ "r", "Check", "if", "the", "given", "graph", "contains", "a", "path", "connecting", "A", "and", "B", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L101-L124
47,916
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
has_path
def has_path(nodes, A, B): r"""Test if nodes from a breadth_first_order search lead from A to B. Parameters ---------- nodes : array_like Nodes from breadth_first_oder_seatch A : array_like The set of educt states B : array_like The set of product states Returns...
python
def has_path(nodes, A, B): r"""Test if nodes from a breadth_first_order search lead from A to B. Parameters ---------- nodes : array_like Nodes from breadth_first_oder_seatch A : array_like The set of educt states B : array_like The set of product states Returns...
[ "def", "has_path", "(", "nodes", ",", "A", ",", "B", ")", ":", "x1", "=", "np", ".", "intersect1d", "(", "nodes", ",", "A", ")", ".", "size", ">", "0", "x2", "=", "np", ".", "intersect1d", "(", "nodes", ",", "B", ")", ".", "size", ">", "0", ...
r"""Test if nodes from a breadth_first_order search lead from A to B. Parameters ---------- nodes : array_like Nodes from breadth_first_oder_seatch A : array_like The set of educt states B : array_like The set of product states Returns ------- has_path : boo...
[ "r", "Test", "if", "nodes", "from", "a", "breadth_first_order", "search", "lead", "from", "A", "to", "B", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L127-L148
47,917
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
pathway
def pathway(F, A, B): r"""Compute the dominant reaction-pathway. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states Returns ------- w...
python
def pathway(F, A, B): r"""Compute the dominant reaction-pathway. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states Returns ------- w...
[ "def", "pathway", "(", "F", ",", "A", ",", "B", ")", ":", "if", "F", ".", "nnz", "==", "0", ":", "raise", "PathwayError", "(", "'no more pathways left: Flux matrix does not contain any positive entries'", ")", "b1", ",", "b2", ",", "F", "=", "find_bottleneck",...
r"""Compute the dominant reaction-pathway. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states Returns ------- w : list The domina...
[ "r", "Compute", "the", "dominant", "reaction", "-", "pathway", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L151-L188
47,918
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
remove_path
def remove_path(F, path): r"""Remove capacity along a path from flux network. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) path : list Reaction path Returns ------- F : (M, M) scipy.sparse matrix The updated fl...
python
def remove_path(F, path): r"""Remove capacity along a path from flux network. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) path : list Reaction path Returns ------- F : (M, M) scipy.sparse matrix The updated fl...
[ "def", "remove_path", "(", "F", ",", "path", ")", ":", "c", "=", "capacity", "(", "F", ",", "path", ")", "F", "=", "F", ".", "todok", "(", ")", "L", "=", "len", "(", "path", ")", "for", "l", "in", "range", "(", "L", "-", "1", ")", ":", "i...
r"""Remove capacity along a path from flux network. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) path : list Reaction path Returns ------- F : (M, M) scipy.sparse matrix The updated flux network
[ "r", "Remove", "capacity", "along", "a", "path", "from", "flux", "network", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L218-L241
47,919
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
add_endstates
def add_endstates(F, A, B): r"""Adds artifical end states replacing source and sink sets. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states ...
python
def add_endstates(F, A, B): r"""Adds artifical end states replacing source and sink sets. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states ...
[ "def", "add_endstates", "(", "F", ",", "A", ",", "B", ")", ":", "\"\"\"Outgoing currents from A\"\"\"", "F", "=", "F", ".", "tocsr", "(", ")", "outA", "=", "(", "F", "[", "A", ",", ":", "]", ".", "sum", "(", "axis", "=", "1", ")", ")", ".", "ge...
r"""Adds artifical end states replacing source and sink sets. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states Returns ------- F_new : ...
[ "r", "Adds", "artifical", "end", "states", "replacing", "source", "and", "sink", "sets", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L322-L380
47,920
nitely/v8-cffi
v8cffi/context.py
_is_utf_8
def _is_utf_8(txt): """ Check a string is utf-8 encoded :param bytes txt: utf-8 string :return: Whether the string\ is utf-8 encoded or not :rtype: bool """ assert isinstance(txt, six.binary_type) try: _ = six.text_type(txt, 'utf-8') except (TypeError, UnicodeEncodeErro...
python
def _is_utf_8(txt): """ Check a string is utf-8 encoded :param bytes txt: utf-8 string :return: Whether the string\ is utf-8 encoded or not :rtype: bool """ assert isinstance(txt, six.binary_type) try: _ = six.text_type(txt, 'utf-8') except (TypeError, UnicodeEncodeErro...
[ "def", "_is_utf_8", "(", "txt", ")", ":", "assert", "isinstance", "(", "txt", ",", "six", ".", "binary_type", ")", "try", ":", "_", "=", "six", ".", "text_type", "(", "txt", ",", "'utf-8'", ")", "except", "(", "TypeError", ",", "UnicodeEncodeError", ")...
Check a string is utf-8 encoded :param bytes txt: utf-8 string :return: Whether the string\ is utf-8 encoded or not :rtype: bool
[ "Check", "a", "string", "is", "utf", "-", "8", "encoded" ]
e3492e7eaacb30be75999c24413aa15eeab57a5d
https://github.com/nitely/v8-cffi/blob/e3492e7eaacb30be75999c24413aa15eeab57a5d/v8cffi/context.py#L22-L38
47,921
nitely/v8-cffi
v8cffi/context.py
Context.load_libs
def load_libs(self, scripts_paths): """ Load script files into the context.\ This can be thought as the HTML script tag.\ The files content must be utf-8 encoded. This is a shortcut for reading the files\ and pass the content to :py:func:`run_script` :param list...
python
def load_libs(self, scripts_paths): """ Load script files into the context.\ This can be thought as the HTML script tag.\ The files content must be utf-8 encoded. This is a shortcut for reading the files\ and pass the content to :py:func:`run_script` :param list...
[ "def", "load_libs", "(", "self", ",", "scripts_paths", ")", ":", "for", "path", "in", "scripts_paths", ":", "self", ".", "run_script", "(", "_read_file", "(", "path", ")", ",", "identifier", "=", "path", ")" ]
Load script files into the context.\ This can be thought as the HTML script tag.\ The files content must be utf-8 encoded. This is a shortcut for reading the files\ and pass the content to :py:func:`run_script` :param list scripts_paths: Script file paths. :raises OSErr...
[ "Load", "script", "files", "into", "the", "context", ".", "\\", "This", "can", "be", "thought", "as", "the", "HTML", "script", "tag", ".", "\\", "The", "files", "content", "must", "be", "utf", "-", "8", "encoded", "." ]
e3492e7eaacb30be75999c24413aa15eeab57a5d
https://github.com/nitely/v8-cffi/blob/e3492e7eaacb30be75999c24413aa15eeab57a5d/v8cffi/context.py#L168-L185
47,922
nitely/v8-cffi
v8cffi/context.py
Context.run_script
def run_script(self, script, identifier=_DEFAULT_SCRIPT_NAME): """ Run a JS script within the context.\ All code is ran synchronously,\ there is no event loop. It's thread-safe :param script: utf-8 encoded or unicode string :type script: bytes or str :param ident...
python
def run_script(self, script, identifier=_DEFAULT_SCRIPT_NAME): """ Run a JS script within the context.\ All code is ran synchronously,\ there is no event loop. It's thread-safe :param script: utf-8 encoded or unicode string :type script: bytes or str :param ident...
[ "def", "run_script", "(", "self", ",", "script", ",", "identifier", "=", "_DEFAULT_SCRIPT_NAME", ")", ":", "assert", "isinstance", "(", "script", ",", "six", ".", "text_type", ")", "or", "_is_utf_8", "(", "script", ")", "assert", "isinstance", "(", "identifi...
Run a JS script within the context.\ All code is ran synchronously,\ there is no event loop. It's thread-safe :param script: utf-8 encoded or unicode string :type script: bytes or str :param identifier: utf-8 encoded or unicode string.\ This is used as the name of the sc...
[ "Run", "a", "JS", "script", "within", "the", "context", ".", "\\", "All", "code", "is", "ran", "synchronously", "\\", "there", "is", "no", "event", "loop", ".", "It", "s", "thread", "-", "safe" ]
e3492e7eaacb30be75999c24413aa15eeab57a5d
https://github.com/nitely/v8-cffi/blob/e3492e7eaacb30be75999c24413aa15eeab57a5d/v8cffi/context.py#L187-L229
47,923
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
eigenvalues
def eigenvalues(T, k=None, reversible=False, mu=None): r"""Compute eigenvalues of given transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T reversible : bool, op...
python
def eigenvalues(T, k=None, reversible=False, mu=None): r"""Compute eigenvalues of given transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T reversible : bool, op...
[ "def", "eigenvalues", "(", "T", ",", "k", "=", "None", ",", "reversible", "=", "False", ",", "mu", "=", "None", ")", ":", "if", "reversible", ":", "try", ":", "evals", "=", "eigenvalues_rev", "(", "T", ",", "k", "=", "k", ",", "mu", "=", "mu", ...
r"""Compute eigenvalues of given transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T reversible : bool, optional Indicate that transition matrix is reversibl...
[ "r", "Compute", "eigenvalues", "of", "given", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L43-L96
47,924
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
eigenvalues_rev
def eigenvalues_rev(T, k=None, mu=None): r"""Compute eigenvalues of reversible transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T mu : (d,) ndarray, optional ...
python
def eigenvalues_rev(T, k=None, mu=None): r"""Compute eigenvalues of reversible transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T mu : (d,) ndarray, optional ...
[ "def", "eigenvalues_rev", "(", "T", ",", "k", "=", "None", ",", "mu", "=", "None", ")", ":", "\"\"\"compute stationary distribution if not given\"\"\"", "if", "mu", "is", "None", ":", "mu", "=", "stationary_distribution", "(", "T", ")", "if", "np", ".", "any...
r"""Compute eigenvalues of reversible transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T mu : (d,) ndarray, optional Stationary distribution of T Retur...
[ "r", "Compute", "eigenvalues", "of", "reversible", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L98-L134
47,925
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
rdl_decomposition_nrev
def rdl_decomposition_nrev(T, norm='standard'): r"""Decomposition into left and right eigenvectors. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probability distribution, the stationary dist...
python
def rdl_decomposition_nrev(T, norm='standard'): r"""Decomposition into left and right eigenvectors. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probability distribution, the stationary dist...
[ "def", "rdl_decomposition_nrev", "(", "T", ",", "norm", "=", "'standard'", ")", ":", "d", "=", "T", ".", "shape", "[", "0", "]", "w", ",", "R", "=", "eig", "(", "T", ")", "\"\"\"Sort by decreasing magnitude of eigenvalue\"\"\"", "ind", "=", "np", ".", "a...
r"""Decomposition into left and right eigenvectors. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probability distribution, the stationary distribution mu of T. Right eigenvectors R h...
[ "r", "Decomposition", "into", "left", "and", "right", "eigenvectors", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L319-L394
47,926
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
rdl_decomposition_rev
def rdl_decomposition_rev(T, norm='reversible', mu=None): r"""Decomposition into left and right eigenvectors for reversible transition matrices. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probabil...
python
def rdl_decomposition_rev(T, norm='reversible', mu=None): r"""Decomposition into left and right eigenvectors for reversible transition matrices. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probabil...
[ "def", "rdl_decomposition_rev", "(", "T", ",", "norm", "=", "'reversible'", ",", "mu", "=", "None", ")", ":", "if", "mu", "is", "None", ":", "mu", "=", "stationary_distribution", "(", "T", ")", "\"\"\" symmetrize T \"\"\"", "smu", "=", "np", ".", "sqrt", ...
r"""Decomposition into left and right eigenvectors for reversible transition matrices. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probability distribution, the stationary distribution mu o...
[ "r", "Decomposition", "into", "left", "and", "right", "eigenvectors", "for", "reversible", "transition", "matrices", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L396-L474
47,927
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
timescales_from_eigenvalues
def timescales_from_eigenvalues(evals, tau=1): r"""Compute implied time scales from given eigenvalues Parameters ---------- evals : eigenvalues tau : lag time Returns ------- ts : ndarray The implied time scales to the given eigenvalues, in the same order. """ """Chec...
python
def timescales_from_eigenvalues(evals, tau=1): r"""Compute implied time scales from given eigenvalues Parameters ---------- evals : eigenvalues tau : lag time Returns ------- ts : ndarray The implied time scales to the given eigenvalues, in the same order. """ """Chec...
[ "def", "timescales_from_eigenvalues", "(", "evals", ",", "tau", "=", "1", ")", ":", "\"\"\"Check for dominant eigenvalues with large imaginary part\"\"\"", "if", "not", "np", ".", "allclose", "(", "evals", ".", "imag", ",", "0.0", ")", ":", "warnings", ".", "warn"...
r"""Compute implied time scales from given eigenvalues Parameters ---------- evals : eigenvalues tau : lag time Returns ------- ts : ndarray The implied time scales to the given eigenvalues, in the same order.
[ "r", "Compute", "implied", "time", "scales", "from", "given", "eigenvalues" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L522-L556
47,928
markovmodel/msmtools
msmtools/util/matrix/matrix.py
is_sparse_file
def is_sparse_file(filename): """Determine if the given filename indicates a dense or a sparse matrix If pathname is xxx.coo.yyy return True otherwise False. """ dirname, basename = os.path.split(filename) name, ext = os.path.splitext(basename) matrix_name, matrix_ext = os.path.splitext(nam...
python
def is_sparse_file(filename): """Determine if the given filename indicates a dense or a sparse matrix If pathname is xxx.coo.yyy return True otherwise False. """ dirname, basename = os.path.split(filename) name, ext = os.path.splitext(basename) matrix_name, matrix_ext = os.path.splitext(nam...
[ "def", "is_sparse_file", "(", "filename", ")", ":", "dirname", ",", "basename", "=", "os", ".", "path", ".", "split", "(", "filename", ")", "name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "basename", ")", "matrix_name", ",", "matrix_e...
Determine if the given filename indicates a dense or a sparse matrix If pathname is xxx.coo.yyy return True otherwise False.
[ "Determine", "if", "the", "given", "filename", "indicates", "a", "dense", "or", "a", "sparse", "matrix" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/util/matrix/matrix.py#L44-L56
47,929
markovmodel/msmtools
msmtools/analysis/sparse/stationary_vector.py
stationary_distribution_from_backward_iteration
def stationary_distribution_from_backward_iteration(P, eps=1e-15): r"""Fast computation of the stationary vector using backward iteration. Parameters ---------- P : (M, M) scipy.sparse matrix Transition matrix eps : float (optional) Perturbation parameter for the true eigenvalue...
python
def stationary_distribution_from_backward_iteration(P, eps=1e-15): r"""Fast computation of the stationary vector using backward iteration. Parameters ---------- P : (M, M) scipy.sparse matrix Transition matrix eps : float (optional) Perturbation parameter for the true eigenvalue...
[ "def", "stationary_distribution_from_backward_iteration", "(", "P", ",", "eps", "=", "1e-15", ")", ":", "A", "=", "P", ".", "transpose", "(", ")", "mu", "=", "1.0", "-", "eps", "x0", "=", "np", ".", "ones", "(", "P", ".", "shape", "[", "0", "]", ")...
r"""Fast computation of the stationary vector using backward iteration. Parameters ---------- P : (M, M) scipy.sparse matrix Transition matrix eps : float (optional) Perturbation parameter for the true eigenvalue. Returns ------- pi : (M,) ndarray Stationary vec...
[ "r", "Fast", "computation", "of", "the", "stationary", "vector", "using", "backward", "iteration", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/stationary_vector.py#L77-L99
47,930
markovmodel/msmtools
msmtools/analysis/sparse/decomposition.py
eigenvalues
def eigenvalues(T, k=None, ncv=None, reversible=False, mu=None): r"""Compute the eigenvalues of a sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int, optional Number of eigenvalues to compute. ncv : int, optional The ...
python
def eigenvalues(T, k=None, ncv=None, reversible=False, mu=None): r"""Compute the eigenvalues of a sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int, optional Number of eigenvalues to compute. ncv : int, optional The ...
[ "def", "eigenvalues", "(", "T", ",", "k", "=", "None", ",", "ncv", "=", "None", ",", "reversible", "=", "False", ",", "mu", "=", "None", ")", ":", "if", "k", "is", "None", ":", "raise", "ValueError", "(", "\"Number of eigenvalues required for decomposition...
r"""Compute the eigenvalues of a sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int, optional Number of eigenvalues to compute. ncv : int, optional The number of Lanczos vectors generated, `ncv` must be greater than k; ...
[ "r", "Compute", "the", "eigenvalues", "of", "a", "sparse", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/decomposition.py#L41-L86
47,931
markovmodel/msmtools
msmtools/analysis/sparse/decomposition.py
eigenvalues_rev
def eigenvalues_rev(T, k, ncv=None, mu=None): r"""Compute the eigenvalues of a reversible, sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int Number of eigenvalues to compute. ncv : int, optional The number of Lanczos...
python
def eigenvalues_rev(T, k, ncv=None, mu=None): r"""Compute the eigenvalues of a reversible, sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int Number of eigenvalues to compute. ncv : int, optional The number of Lanczos...
[ "def", "eigenvalues_rev", "(", "T", ",", "k", ",", "ncv", "=", "None", ",", "mu", "=", "None", ")", ":", "\"\"\"compute stationary distribution if not given\"\"\"", "if", "mu", "is", "None", ":", "mu", "=", "stationary_distribution", "(", "T", ")", "if", "np...
r"""Compute the eigenvalues of a reversible, sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int Number of eigenvalues to compute. ncv : int, optional The number of Lanczos vectors generated, `ncv` must be greater than k; ...
[ "r", "Compute", "the", "eigenvalues", "of", "a", "reversible", "sparse", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/decomposition.py#L88-L131
47,932
markovmodel/msmtools
msmtools/estimation/dense/bootstrapping.py
number_of_states
def number_of_states(dtrajs): r""" Determine the number of states from a set of discrete trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories """ # determine number of states n nmax = 0 for dtraj in dtrajs: nmax = max(nmax, np.max(dtra...
python
def number_of_states(dtrajs): r""" Determine the number of states from a set of discrete trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories """ # determine number of states n nmax = 0 for dtraj in dtrajs: nmax = max(nmax, np.max(dtra...
[ "def", "number_of_states", "(", "dtrajs", ")", ":", "# determine number of states n", "nmax", "=", "0", "for", "dtraj", "in", "dtrajs", ":", "nmax", "=", "max", "(", "nmax", ",", "np", ".", "max", "(", "dtraj", ")", ")", "# return number of states", "return"...
r""" Determine the number of states from a set of discrete trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories
[ "r", "Determine", "the", "number", "of", "states", "from", "a", "set", "of", "discrete", "trajectories" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/bootstrapping.py#L35-L49
47,933
markovmodel/msmtools
msmtools/estimation/dense/bootstrapping.py
determine_lengths
def determine_lengths(dtrajs): r""" Determines the lengths of all trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories """ if (isinstance(dtrajs[0], (int))): return len(dtrajs) * np.ones((1)) lengths = np.zeros((len(dtrajs))) for i in ...
python
def determine_lengths(dtrajs): r""" Determines the lengths of all trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories """ if (isinstance(dtrajs[0], (int))): return len(dtrajs) * np.ones((1)) lengths = np.zeros((len(dtrajs))) for i in ...
[ "def", "determine_lengths", "(", "dtrajs", ")", ":", "if", "(", "isinstance", "(", "dtrajs", "[", "0", "]", ",", "(", "int", ")", ")", ")", ":", "return", "len", "(", "dtrajs", ")", "*", "np", ".", "ones", "(", "(", "1", ")", ")", "lengths", "=...
r""" Determines the lengths of all trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories
[ "r", "Determines", "the", "lengths", "of", "all", "trajectories" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/bootstrapping.py#L52-L66
47,934
markovmodel/msmtools
msmtools/estimation/dense/bootstrapping.py
bootstrap_counts_singletraj
def bootstrap_counts_singletraj(dtraj, lagtime, n): """ Samples n counts at the given lagtime from the given trajectory """ # check if length is sufficient L = len(dtraj) if (lagtime > L): raise ValueError( 'Cannot sample counts with lagtime ' + str(lagtime) + ' from a trajec...
python
def bootstrap_counts_singletraj(dtraj, lagtime, n): """ Samples n counts at the given lagtime from the given trajectory """ # check if length is sufficient L = len(dtraj) if (lagtime > L): raise ValueError( 'Cannot sample counts with lagtime ' + str(lagtime) + ' from a trajec...
[ "def", "bootstrap_counts_singletraj", "(", "dtraj", ",", "lagtime", ",", "n", ")", ":", "# check if length is sufficient", "L", "=", "len", "(", "dtraj", ")", "if", "(", "lagtime", ">", "L", ")", ":", "raise", "ValueError", "(", "'Cannot sample counts with lagti...
Samples n counts at the given lagtime from the given trajectory
[ "Samples", "n", "counts", "at", "the", "given", "lagtime", "from", "the", "given", "trajectory" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/bootstrapping.py#L113-L127
47,935
markovmodel/msmtools
msmtools/estimation/sparse/connectivity.py
connected_sets
def connected_sets(C, directed=True): r"""Compute connected components for a directed graph with weights represented by the given count matrix. Parameters ---------- C : scipy.sparse matrix or numpy ndarray square matrix specifying edge weights. directed : bool, optional Whether ...
python
def connected_sets(C, directed=True): r"""Compute connected components for a directed graph with weights represented by the given count matrix. Parameters ---------- C : scipy.sparse matrix or numpy ndarray square matrix specifying edge weights. directed : bool, optional Whether ...
[ "def", "connected_sets", "(", "C", ",", "directed", "=", "True", ")", ":", "M", "=", "C", ".", "shape", "[", "0", "]", "\"\"\" Compute connected components of C. nc is the number of\n components, indices contain the component labels of the states\n \"\"\"", "nc", ",", ...
r"""Compute connected components for a directed graph with weights represented by the given count matrix. Parameters ---------- C : scipy.sparse matrix or numpy ndarray square matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a dire...
[ "r", "Compute", "connected", "components", "for", "a", "directed", "graph", "with", "weights", "represented", "by", "the", "given", "count", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/connectivity.py#L32-L86
47,936
markovmodel/msmtools
msmtools/estimation/sparse/connectivity.py
largest_connected_submatrix
def largest_connected_submatrix(C, directed=True, lcc=None): r"""Compute the count matrix of the largest connected set. The input count matrix is used as a weight matrix for the construction of a directed graph. The largest connected set of the constructed graph is computed. Vertices belonging to the l...
python
def largest_connected_submatrix(C, directed=True, lcc=None): r"""Compute the count matrix of the largest connected set. The input count matrix is used as a weight matrix for the construction of a directed graph. The largest connected set of the constructed graph is computed. Vertices belonging to the l...
[ "def", "largest_connected_submatrix", "(", "C", ",", "directed", "=", "True", ",", "lcc", "=", "None", ")", ":", "if", "lcc", "is", "None", ":", "lcc", "=", "largest_connected_set", "(", "C", ",", "directed", "=", "directed", ")", "\"\"\"Row slicing\"\"\"", ...
r"""Compute the count matrix of the largest connected set. The input count matrix is used as a weight matrix for the construction of a directed graph. The largest connected set of the constructed graph is computed. Vertices belonging to the largest connected component are used to generate a completely ...
[ "r", "Compute", "the", "count", "matrix", "of", "the", "largest", "connected", "set", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/connectivity.py#L107-L152
47,937
markovmodel/msmtools
msmtools/estimation/sparse/connectivity.py
is_connected
def is_connected(C, directed=True): r"""Return true, if the input count matrix is completely connected. Effectively checking if the number of connected components equals one. Parameters ---------- C : scipy.sparse matrix or numpy ndarray Count matrix specifying edge weights. directed : ...
python
def is_connected(C, directed=True): r"""Return true, if the input count matrix is completely connected. Effectively checking if the number of connected components equals one. Parameters ---------- C : scipy.sparse matrix or numpy ndarray Count matrix specifying edge weights. directed : ...
[ "def", "is_connected", "(", "C", ",", "directed", "=", "True", ")", ":", "nc", "=", "csgraph", ".", "connected_components", "(", "C", ",", "directed", "=", "directed", ",", "connection", "=", "'strong'", ",", "return_labels", "=", "False", ")", "return", ...
r"""Return true, if the input count matrix is completely connected. Effectively checking if the number of connected components equals one. Parameters ---------- C : scipy.sparse matrix or numpy ndarray Count matrix specifying edge weights. directed : bool, optional Whether to compute...
[ "r", "Return", "true", "if", "the", "input", "count", "matrix", "is", "completely", "connected", ".", "Effectively", "checking", "if", "the", "number", "of", "connected", "components", "equals", "one", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/connectivity.py#L155-L175
47,938
markovmodel/msmtools
msmtools/flux/api.py
coarsegrain
def coarsegrain(F, sets): r"""Coarse-grains the flux to the given sets. Parameters ---------- F : (n, n) ndarray or scipy.sparse matrix Matrix of flux values between pairs of states. sets : list of array-like of ints The sets of states onto which the flux is coarse-grained. Not...
python
def coarsegrain(F, sets): r"""Coarse-grains the flux to the given sets. Parameters ---------- F : (n, n) ndarray or scipy.sparse matrix Matrix of flux values between pairs of states. sets : list of array-like of ints The sets of states onto which the flux is coarse-grained. Not...
[ "def", "coarsegrain", "(", "F", ",", "sets", ")", ":", "if", "issparse", "(", "F", ")", ":", "return", "sparse", ".", "tpt", ".", "coarsegrain", "(", "F", ",", "sets", ")", "elif", "isdense", "(", "F", ")", ":", "return", "dense", ".", "tpt", "."...
r"""Coarse-grains the flux to the given sets. Parameters ---------- F : (n, n) ndarray or scipy.sparse matrix Matrix of flux values between pairs of states. sets : list of array-like of ints The sets of states onto which the flux is coarse-grained. Notes ----- The coarse gr...
[ "r", "Coarse", "-", "grains", "the", "flux", "to", "the", "given", "sets", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/api.py#L334-L367
47,939
markovmodel/msmtools
msmtools/flux/api.py
total_flux
def total_flux(F, A=None): r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks. Parameters ---------- F : (M, M) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer sta...
python
def total_flux(F, A=None): r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks. Parameters ---------- F : (M, M) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer sta...
[ "def", "total_flux", "(", "F", ",", "A", "=", "None", ")", ":", "if", "issparse", "(", "F", ")", ":", "return", "sparse", ".", "tpt", ".", "total_flux", "(", "F", ",", "A", "=", "A", ")", "elif", "isdense", "(", "F", ")", ":", "return", "dense"...
r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks. Parameters ---------- F : (M, M) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer state labels for set A (reactant) ...
[ "r", "Compute", "the", "total", "flux", "or", "turnover", "flux", "that", "is", "produced", "by", "the", "flux", "sources", "and", "consumed", "by", "the", "flux", "sinks", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/api.py#L375-L404
47,940
markovmodel/msmtools
msmtools/flux/api.py
mfpt
def mfpt(totflux, pi, qminus): r"""Mean first passage time for reaction A to B. Parameters ---------- totflux : float The total flux between reactant and product pi : (M,) ndarray Stationary distribution qminus : (M,) ndarray Backward comittor Returns ------- ...
python
def mfpt(totflux, pi, qminus): r"""Mean first passage time for reaction A to B. Parameters ---------- totflux : float The total flux between reactant and product pi : (M,) ndarray Stationary distribution qminus : (M,) ndarray Backward comittor Returns ------- ...
[ "def", "mfpt", "(", "totflux", ",", "pi", ",", "qminus", ")", ":", "return", "dense", ".", "tpt", ".", "mfpt", "(", "totflux", ",", "pi", ",", "qminus", ")" ]
r"""Mean first passage time for reaction A to B. Parameters ---------- totflux : float The total flux between reactant and product pi : (M,) ndarray Stationary distribution qminus : (M,) ndarray Backward comittor Returns ------- tAB : float The mean firs...
[ "r", "Mean", "first", "passage", "time", "for", "reaction", "A", "to", "B", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/api.py#L451-L484
47,941
markovmodel/msmtools
msmtools/analysis/dense/pcca.py
_pcca_connected_isa
def _pcca_connected_isa(evec, n_clusters): """ PCCA+ spectral clustering method using the inner simplex algorithm. Clusters the first n_cluster eigenvectors of a transition matrix in order to cluster the states. This function assumes that the state space is fully connected, i.e. the transition matrix w...
python
def _pcca_connected_isa(evec, n_clusters): """ PCCA+ spectral clustering method using the inner simplex algorithm. Clusters the first n_cluster eigenvectors of a transition matrix in order to cluster the states. This function assumes that the state space is fully connected, i.e. the transition matrix w...
[ "def", "_pcca_connected_isa", "(", "evec", ",", "n_clusters", ")", ":", "(", "n", ",", "m", ")", "=", "evec", ".", "shape", "# do we have enough eigenvectors?", "if", "n_clusters", ">", "m", ":", "raise", "ValueError", "(", "\"Cannot cluster the (\"", "+", "st...
PCCA+ spectral clustering method using the inner simplex algorithm. Clusters the first n_cluster eigenvectors of a transition matrix in order to cluster the states. This function assumes that the state space is fully connected, i.e. the transition matrix whose eigenvectors are used is supposed to have only...
[ "PCCA", "+", "spectral", "clustering", "method", "using", "the", "inner", "simplex", "algorithm", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/pcca.py#L35-L128
47,942
markovmodel/msmtools
msmtools/analysis/dense/pcca.py
_opt_soft
def _opt_soft(eigvectors, rot_matrix, n_clusters): """ Optimizes the PCCA+ rotation matrix such that the memberships are exclusively nonnegative. Parameters ---------- eigenvectors : ndarray A matrix with the sorted eigenvectors in the columns. The stationary eigenvector should be f...
python
def _opt_soft(eigvectors, rot_matrix, n_clusters): """ Optimizes the PCCA+ rotation matrix such that the memberships are exclusively nonnegative. Parameters ---------- eigenvectors : ndarray A matrix with the sorted eigenvectors in the columns. The stationary eigenvector should be f...
[ "def", "_opt_soft", "(", "eigvectors", ",", "rot_matrix", ",", "n_clusters", ")", ":", "# only consider first n_clusters eigenvectors", "eigvectors", "=", "eigvectors", "[", ":", ",", ":", "n_clusters", "]", "# crop first row and first column from rot_matrix", "# rot_crop_m...
Optimizes the PCCA+ rotation matrix such that the memberships are exclusively nonnegative. Parameters ---------- eigenvectors : ndarray A matrix with the sorted eigenvectors in the columns. The stationary eigenvector should be first, then the one to the slowest relaxation process, etc. ...
[ "Optimizes", "the", "PCCA", "+", "rotation", "matrix", "such", "that", "the", "memberships", "are", "exclusively", "nonnegative", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/pcca.py#L131-L192
47,943
markovmodel/msmtools
msmtools/analysis/dense/pcca.py
_fill_matrix
def _fill_matrix(rot_crop_matrix, eigvectors): """ Helper function for opt_soft """ (x, y) = rot_crop_matrix.shape row_sums = np.sum(rot_crop_matrix, axis=1) row_sums = np.reshape(row_sums, (x, 1)) # add -row_sums as leftmost column to rot_crop_matrix rot_crop_matrix = np.concatenate...
python
def _fill_matrix(rot_crop_matrix, eigvectors): """ Helper function for opt_soft """ (x, y) = rot_crop_matrix.shape row_sums = np.sum(rot_crop_matrix, axis=1) row_sums = np.reshape(row_sums, (x, 1)) # add -row_sums as leftmost column to rot_crop_matrix rot_crop_matrix = np.concatenate...
[ "def", "_fill_matrix", "(", "rot_crop_matrix", ",", "eigvectors", ")", ":", "(", "x", ",", "y", ")", "=", "rot_crop_matrix", ".", "shape", "row_sums", "=", "np", ".", "sum", "(", "rot_crop_matrix", ",", "axis", "=", "1", ")", "row_sums", "=", "np", "."...
Helper function for opt_soft
[ "Helper", "function", "for", "opt_soft" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/pcca.py#L194-L219
47,944
markovmodel/msmtools
msmtools/analysis/dense/pcca.py
coarsegrain
def coarsegrain(P, n): """ Coarse-grains transition matrix P to n sets using PCCA Coarse-grains transition matrix P such that the dominant eigenvalues are preserved, using: ..math: \tilde{P} = M^T P M (M^T M)^{-1} See [2]_ for the derivation of this form from the coarse-graining method fi...
python
def coarsegrain(P, n): """ Coarse-grains transition matrix P to n sets using PCCA Coarse-grains transition matrix P such that the dominant eigenvalues are preserved, using: ..math: \tilde{P} = M^T P M (M^T M)^{-1} See [2]_ for the derivation of this form from the coarse-graining method fi...
[ "def", "coarsegrain", "(", "P", ",", "n", ")", ":", "M", "=", "pcca", "(", "P", ",", "n", ")", "# coarse-grained transition matrix", "W", "=", "np", ".", "linalg", ".", "inv", "(", "np", ".", "dot", "(", "M", ".", "T", ",", "M", ")", ")", "A", ...
Coarse-grains transition matrix P to n sets using PCCA Coarse-grains transition matrix P such that the dominant eigenvalues are preserved, using: ..math: \tilde{P} = M^T P M (M^T M)^{-1} See [2]_ for the derivation of this form from the coarse-graining method first derived in [1]_. Reference...
[ "Coarse", "-", "grains", "transition", "matrix", "P", "to", "n", "sets", "using", "PCCA" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/pcca.py#L460-L492
47,945
markovmodel/msmtools
msmtools/analysis/api.py
is_transition_matrix
def is_transition_matrix(T, tol=1e-12): r"""Check if the given matrix is a transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_transition_matr...
python
def is_transition_matrix(T, tol=1e-12): r"""Check if the given matrix is a transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_transition_matr...
[ "def", "is_transition_matrix", "(", "T", ",", "tol", "=", "1e-12", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", ...
r"""Check if the given matrix is a transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_transition_matrix : bool True, if T is a valid tran...
[ "r", "Check", "if", "the", "given", "matrix", "is", "a", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L93-L133
47,946
markovmodel/msmtools
msmtools/analysis/api.py
is_rate_matrix
def is_rate_matrix(K, tol=1e-12): r"""Check if the given matrix is a rate matrix. Parameters ---------- K : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_rate_matrix : bool ...
python
def is_rate_matrix(K, tol=1e-12): r"""Check if the given matrix is a rate matrix. Parameters ---------- K : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_rate_matrix : bool ...
[ "def", "is_rate_matrix", "(", "K", ",", "tol", "=", "1e-12", ")", ":", "K", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "K", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", "K",...
r"""Check if the given matrix is a rate matrix. Parameters ---------- K : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_rate_matrix : bool True, if K is a valid rate matrix, Fal...
[ "r", "Check", "if", "the", "given", "matrix", "is", "a", "rate", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L136-L176
47,947
markovmodel/msmtools
msmtools/analysis/api.py
is_connected
def is_connected(T, directed=True): r"""Check connectivity of the given matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check directed : bool (optional) If True respect direction of transitions, if False do not distinguish between forward and ...
python
def is_connected(T, directed=True): r"""Check connectivity of the given matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check directed : bool (optional) If True respect direction of transitions, if False do not distinguish between forward and ...
[ "def", "is_connected", "(", "T", ",", "directed", "=", "True", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", "T...
r"""Check connectivity of the given matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check directed : bool (optional) If True respect direction of transitions, if False do not distinguish between forward and backward transitions Returns --...
[ "r", "Check", "connectivity", "of", "the", "given", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L179-L241
47,948
markovmodel/msmtools
msmtools/analysis/api.py
is_reversible
def is_reversible(T, mu=None, tol=1e-12): r"""Check reversibility of the given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix mu : (M,) ndarray (optional) Test reversibility with respect to this vector tol : float (optional)...
python
def is_reversible(T, mu=None, tol=1e-12): r"""Check reversibility of the given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix mu : (M,) ndarray (optional) Test reversibility with respect to this vector tol : float (optional)...
[ "def", "is_reversible", "(", "T", ",", "mu", "=", "None", ",", "tol", "=", "1e-12", ")", ":", "# check input", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'nume...
r"""Check reversibility of the given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix mu : (M,) ndarray (optional) Test reversibility with respect to this vector tol : float (optional) Floating point tolerance to check wit...
[ "r", "Check", "reversibility", "of", "the", "given", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L244-L300
47,949
markovmodel/msmtools
msmtools/analysis/api.py
timescales
def timescales(T, tau=1, k=None, ncv=None, reversible=False, mu=None): r"""Compute implied time scales of given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix tau : int (optional) The time-lag (in elementary time steps of the mic...
python
def timescales(T, tau=1, k=None, ncv=None, reversible=False, mu=None): r"""Compute implied time scales of given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix tau : int (optional) The time-lag (in elementary time steps of the mic...
[ "def", "timescales", "(", "T", ",", "tau", "=", "1", ",", "k", "=", "None", ",", "ncv", "=", "None", ",", "reversible", "=", "False", ",", "mu", "=", "None", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=...
r"""Compute implied time scales of given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix tau : int (optional) The time-lag (in elementary time steps of the microstate trajectory) at which the given transition matrix was ...
[ "r", "Compute", "implied", "time", "scales", "of", "given", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L410-L466
47,950
markovmodel/msmtools
msmtools/analysis/api.py
committor
def committor(T, A, B, forward=True, mu=None): r"""Compute the committor between sets of microstates. The committor assigns to each microstate a probability that being at this state, the set B will be hit next, rather than set A (forward committor), or that the set A has been hit previously rather ...
python
def committor(T, A, B, forward=True, mu=None): r"""Compute the committor between sets of microstates. The committor assigns to each microstate a probability that being at this state, the set B will be hit next, rather than set A (forward committor), or that the set A has been hit previously rather ...
[ "def", "committor", "(", "T", ",", "A", ",", "B", ",", "forward", "=", "True", ",", "mu", "=", "None", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", ...
r"""Compute the committor between sets of microstates. The committor assigns to each microstate a probability that being at this state, the set B will be hit next, rather than set A (forward committor), or that the set A has been hit previously rather than set B (backward committor). See [1] for a ...
[ "r", "Compute", "the", "committor", "between", "sets", "of", "microstates", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L758-L885
47,951
markovmodel/msmtools
msmtools/analysis/api.py
expected_counts
def expected_counts(T, p0, N): r"""Compute expected transition counts for Markov chain with n steps. Parameters ---------- T : (M, M) ndarray or sparse matrix Transition matrix p0 : (M,) ndarray Initial (probability) vector N : int Number of steps to take Returns ...
python
def expected_counts(T, p0, N): r"""Compute expected transition counts for Markov chain with n steps. Parameters ---------- T : (M, M) ndarray or sparse matrix Transition matrix p0 : (M,) ndarray Initial (probability) vector N : int Number of steps to take Returns ...
[ "def", "expected_counts", "(", "T", ",", "p0", ",", "N", ")", ":", "# check input", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "p0", "=", "_ty...
r"""Compute expected transition counts for Markov chain with n steps. Parameters ---------- T : (M, M) ndarray or sparse matrix Transition matrix p0 : (M,) ndarray Initial (probability) vector N : int Number of steps to take Returns -------- EC : (M, M) ndarray ...
[ "r", "Compute", "expected", "transition", "counts", "for", "Markov", "chain", "with", "n", "steps", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L892-L941
47,952
markovmodel/msmtools
msmtools/analysis/api.py
fingerprint_correlation
def fingerprint_correlation(T, obs1, obs2=None, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for equilibrium correlation experiment. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observable, represented as vector on stat...
python
def fingerprint_correlation(T, obs1, obs2=None, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for equilibrium correlation experiment. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observable, represented as vector on stat...
[ "def", "fingerprint_correlation", "(", "T", ",", "obs1", ",", "obs2", "=", "None", ",", "tau", "=", "1", ",", "k", "=", "None", ",", "ncv", "=", "None", ")", ":", "# check if square matrix and remember size", "T", "=", "_types", ".", "ensure_ndarray_or_spars...
r"""Dynamical fingerprint for equilibrium correlation experiment. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observable, represented as vector on state space obs2 : (M,) ndarray (optional) Second observable, for cros...
[ "r", "Dynamical", "fingerprint", "for", "equilibrium", "correlation", "experiment", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1003-L1111
47,953
markovmodel/msmtools
msmtools/analysis/api.py
fingerprint_relaxation
def fingerprint_relaxation(T, p0, obs, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for relaxation experiment. The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- T : (M, M) ndarray or scipy.sparse matri...
python
def fingerprint_relaxation(T, p0, obs, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for relaxation experiment. The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- T : (M, M) ndarray or scipy.sparse matri...
[ "def", "fingerprint_relaxation", "(", "T", ",", "p0", ",", "obs", ",", "tau", "=", "1", ",", "k", "=", "None", ",", "ncv", "=", "None", ")", ":", "# check if square matrix and remember size", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", "...
r"""Dynamical fingerprint for relaxation experiment. The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observabl...
[ "r", "Dynamical", "fingerprint", "for", "relaxation", "experiment", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1114-L1204
47,954
markovmodel/msmtools
msmtools/analysis/api.py
expectation
def expectation(T, a, mu=None): r"""Equilibrium expectation value of a given observable. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix a : (M,) ndarray Observable vector mu : (M,) ndarray (optional) The stationary distribution of T. I...
python
def expectation(T, a, mu=None): r"""Equilibrium expectation value of a given observable. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix a : (M,) ndarray Observable vector mu : (M,) ndarray (optional) The stationary distribution of T. I...
[ "def", "expectation", "(", "T", ",", "a", ",", "mu", "=", "None", ")", ":", "# check if square matrix and remember size", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", ...
r"""Equilibrium expectation value of a given observable. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix a : (M,) ndarray Observable vector mu : (M,) ndarray (optional) The stationary distribution of T. If given, the stationary dist...
[ "r", "Equilibrium", "expectation", "value", "of", "a", "given", "observable", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1207-L1256
47,955
markovmodel/msmtools
msmtools/analysis/api.py
_pcca_object
def _pcca_object(T, m): """ Constructs the pcca object from dense or sparse Parameters ---------- T : (n, n) ndarray or scipy.sparse matrix Transition matrix m : int Number of metastable sets Returns ------- pcca : PCCA PCCA object """ if _issparse(T...
python
def _pcca_object(T, m): """ Constructs the pcca object from dense or sparse Parameters ---------- T : (n, n) ndarray or scipy.sparse matrix Transition matrix m : int Number of metastable sets Returns ------- pcca : PCCA PCCA object """ if _issparse(T...
[ "def", "_pcca_object", "(", "T", ",", "m", ")", ":", "if", "_issparse", "(", "T", ")", ":", "_showSparseConversionWarning", "(", ")", "T", "=", "T", ".", "toarray", "(", ")", "T", "=", "_types", ".", "ensure_ndarray", "(", "T", ",", "ndim", "=", "2...
Constructs the pcca object from dense or sparse Parameters ---------- T : (n, n) ndarray or scipy.sparse matrix Transition matrix m : int Number of metastable sets Returns ------- pcca : PCCA PCCA object
[ "Constructs", "the", "pcca", "object", "from", "dense", "or", "sparse" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1430-L1450
47,956
markovmodel/msmtools
msmtools/analysis/api.py
eigenvalue_sensitivity
def eigenvalue_sensitivity(T, k): r"""Sensitivity matrix of a specified eigenvalue. Parameters ---------- T : (M, M) ndarray Transition matrix k : int Compute sensitivity matrix for k-th eigenvalue Returns ------- S : (M, M) ndarray Sensitivity matrix for k-th e...
python
def eigenvalue_sensitivity(T, k): r"""Sensitivity matrix of a specified eigenvalue. Parameters ---------- T : (M, M) ndarray Transition matrix k : int Compute sensitivity matrix for k-th eigenvalue Returns ------- S : (M, M) ndarray Sensitivity matrix for k-th e...
[ "def", "eigenvalue_sensitivity", "(", "T", ",", "k", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", "T", ")", ":...
r"""Sensitivity matrix of a specified eigenvalue. Parameters ---------- T : (M, M) ndarray Transition matrix k : int Compute sensitivity matrix for k-th eigenvalue Returns ------- S : (M, M) ndarray Sensitivity matrix for k-th eigenvalue.
[ "r", "Sensitivity", "matrix", "of", "a", "specified", "eigenvalue", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1654-L1675
47,957
markovmodel/msmtools
msmtools/analysis/api.py
eigenvector_sensitivity
def eigenvector_sensitivity(T, k, j, right=True): r"""Sensitivity matrix of a selected eigenvector element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). k : int Eigenvector index j : int Element index right : bool If True co...
python
def eigenvector_sensitivity(T, k, j, right=True): r"""Sensitivity matrix of a selected eigenvector element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). k : int Eigenvector index j : int Element index right : bool If True co...
[ "def", "eigenvector_sensitivity", "(", "T", ",", "k", ",", "j", ",", "right", "=", "True", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")"...
r"""Sensitivity matrix of a selected eigenvector element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). k : int Eigenvector index j : int Element index right : bool If True compute for right eigenvector, otherwise compute for lef...
[ "r", "Sensitivity", "matrix", "of", "a", "selected", "eigenvector", "element", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1702-L1727
47,958
markovmodel/msmtools
msmtools/analysis/api.py
stationary_distribution_sensitivity
def stationary_distribution_sensitivity(T, j): r"""Sensitivity matrix of a stationary distribution element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). j : int Index of stationary distribution element for which sensitivity matrix is compute...
python
def stationary_distribution_sensitivity(T, j): r"""Sensitivity matrix of a stationary distribution element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). j : int Index of stationary distribution element for which sensitivity matrix is compute...
[ "def", "stationary_distribution_sensitivity", "(", "T", ",", "j", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", "T"...
r"""Sensitivity matrix of a stationary distribution element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). j : int Index of stationary distribution element for which sensitivity matrix is computed. Returns ------- S : (M, M) ndarray...
[ "r", "Sensitivity", "matrix", "of", "a", "stationary", "distribution", "element", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1731-L1755
47,959
markovmodel/msmtools
msmtools/analysis/api.py
mfpt_sensitivity
def mfpt_sensitivity(T, target, i): r"""Sensitivity matrix of the mean first-passage time from specified state. Parameters ---------- T : (M, M) ndarray Transition matrix target : int or list Target state or set for mfpt computation i : int Compute the sensitivity for st...
python
def mfpt_sensitivity(T, target, i): r"""Sensitivity matrix of the mean first-passage time from specified state. Parameters ---------- T : (M, M) ndarray Transition matrix target : int or list Target state or set for mfpt computation i : int Compute the sensitivity for st...
[ "def", "mfpt_sensitivity", "(", "T", ",", "target", ",", "i", ")", ":", "# check input", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "target", "=...
r"""Sensitivity matrix of the mean first-passage time from specified state. Parameters ---------- T : (M, M) ndarray Transition matrix target : int or list Target state or set for mfpt computation i : int Compute the sensitivity for state `i` Returns ------- S :...
[ "r", "Sensitivity", "matrix", "of", "the", "mean", "first", "-", "passage", "time", "from", "specified", "state", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1758-L1784
47,960
markovmodel/msmtools
msmtools/analysis/api.py
committor_sensitivity
def committor_sensitivity(T, A, B, i, forward=True): r"""Sensitivity matrix of a specified committor entry. Parameters ---------- T : (M, M) ndarray Transition matrix A : array_like List of integer state labels for set A B : array_like List of integer state labels for s...
python
def committor_sensitivity(T, A, B, i, forward=True): r"""Sensitivity matrix of a specified committor entry. Parameters ---------- T : (M, M) ndarray Transition matrix A : array_like List of integer state labels for set A B : array_like List of integer state labels for s...
[ "def", "committor_sensitivity", "(", "T", ",", "A", ",", "B", ",", "i", ",", "forward", "=", "True", ")", ":", "# check inputs", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "...
r"""Sensitivity matrix of a specified committor entry. Parameters ---------- T : (M, M) ndarray Transition matrix A : array_like List of integer state labels for set A B : array_like List of integer state labels for set B i : int Compute the sensitivity for comm...
[ "r", "Sensitivity", "matrix", "of", "a", "specified", "committor", "entry", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1787-L1822
47,961
markovmodel/msmtools
msmtools/estimation/dense/covariance.py
tmatrix_cov
def tmatrix_cov(C, row=None): r"""Covariance tensor for the non-reversible transition matrix ensemble Normally the covariance tensor cov(p_ij, p_kl) would carry four indices (i,j,k,l). In the non-reversible case rows are independent so that cov(p_ij, p_kl)=0 for i not equal to k. Therefore the function...
python
def tmatrix_cov(C, row=None): r"""Covariance tensor for the non-reversible transition matrix ensemble Normally the covariance tensor cov(p_ij, p_kl) would carry four indices (i,j,k,l). In the non-reversible case rows are independent so that cov(p_ij, p_kl)=0 for i not equal to k. Therefore the function...
[ "def", "tmatrix_cov", "(", "C", ",", "row", "=", "None", ")", ":", "if", "row", "is", "None", ":", "alpha", "=", "C", "+", "1.0", "# Dirichlet parameters", "alpha0", "=", "alpha", ".", "sum", "(", "axis", "=", "1", ")", "# Sum of paramters (per row)", ...
r"""Covariance tensor for the non-reversible transition matrix ensemble Normally the covariance tensor cov(p_ij, p_kl) would carry four indices (i,j,k,l). In the non-reversible case rows are independent so that cov(p_ij, p_kl)=0 for i not equal to k. Therefore the function will only return cov(p_ij, p_...
[ "r", "Covariance", "tensor", "for", "the", "non", "-", "reversible", "transition", "matrix", "ensemble" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/covariance.py#L31-L73
47,962
markovmodel/msmtools
msmtools/estimation/dense/covariance.py
dirichlet_covariance
def dirichlet_covariance(alpha): r"""Covariance matrix for Dirichlet distribution. Parameters ---------- alpha : (M, ) ndarray Parameters of Dirichlet distribution Returns ------- cov : (M, M) ndarray Covariance matrix """ alpha0 = alpha.sum() norm = alpha0 ** ...
python
def dirichlet_covariance(alpha): r"""Covariance matrix for Dirichlet distribution. Parameters ---------- alpha : (M, ) ndarray Parameters of Dirichlet distribution Returns ------- cov : (M, M) ndarray Covariance matrix """ alpha0 = alpha.sum() norm = alpha0 ** ...
[ "def", "dirichlet_covariance", "(", "alpha", ")", ":", "alpha0", "=", "alpha", ".", "sum", "(", ")", "norm", "=", "alpha0", "**", "2", "*", "(", "alpha0", "+", "1.0", ")", "\"\"\"Non normalized covariance\"\"\"", "Z", "=", "-", "alpha", "[", ":", ",", ...
r"""Covariance matrix for Dirichlet distribution. Parameters ---------- alpha : (M, ) ndarray Parameters of Dirichlet distribution Returns ------- cov : (M, M) ndarray Covariance matrix
[ "r", "Covariance", "matrix", "for", "Dirichlet", "distribution", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/covariance.py#L76-L103
47,963
markovmodel/msmtools
msmtools/analysis/sparse/mean_first_passage_time.py
mfpt_between_sets
def mfpt_between_sets(T, target, origin, mu=None): """Compute mean-first-passage time between subsets of state space. Parameters ---------- T : scipy.sparse matrix Transition matrix. target : int or list of int Set of target states. origin : int or list of int Set of sta...
python
def mfpt_between_sets(T, target, origin, mu=None): """Compute mean-first-passage time between subsets of state space. Parameters ---------- T : scipy.sparse matrix Transition matrix. target : int or list of int Set of target states. origin : int or list of int Set of sta...
[ "def", "mfpt_between_sets", "(", "T", ",", "target", ",", "origin", ",", "mu", "=", "None", ")", ":", "if", "mu", "is", "None", ":", "mu", "=", "stationary_distribution", "(", "T", ")", "\"\"\"Stationary distribution restriced on starting set X\"\"\"", "nuX", "=...
Compute mean-first-passage time between subsets of state space. Parameters ---------- T : scipy.sparse matrix Transition matrix. target : int or list of int Set of target states. origin : int or list of int Set of starting states. mu : (M,) ndarray (optional) The...
[ "Compute", "mean", "-", "first", "-", "passage", "time", "between", "subsets", "of", "state", "space", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/mean_first_passage_time.py#L101-L142
47,964
markovmodel/msmtools
msmtools/estimation/sparse/newton/linsolve.py
mydot
def mydot(A, B): r"""Dot-product that can handle dense and sparse arrays Parameters ---------- A : numpy ndarray or scipy sparse matrix The first factor B : numpy ndarray or scipy sparse matrix The second factor Returns C : numpy ndarray or scipy sparse matrix The d...
python
def mydot(A, B): r"""Dot-product that can handle dense and sparse arrays Parameters ---------- A : numpy ndarray or scipy sparse matrix The first factor B : numpy ndarray or scipy sparse matrix The second factor Returns C : numpy ndarray or scipy sparse matrix The d...
[ "def", "mydot", "(", "A", ",", "B", ")", ":", "if", "issparse", "(", "A", ")", ":", "return", "A", ".", "dot", "(", "B", ")", "elif", "issparse", "(", "B", ")", ":", "return", "(", "B", ".", "T", ".", "dot", "(", "A", ".", "T", ")", ")", ...
r"""Dot-product that can handle dense and sparse arrays Parameters ---------- A : numpy ndarray or scipy sparse matrix The first factor B : numpy ndarray or scipy sparse matrix The second factor Returns C : numpy ndarray or scipy sparse matrix The dot-product of A and B
[ "r", "Dot", "-", "product", "that", "can", "handle", "dense", "and", "sparse", "arrays" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/newton/linsolve.py#L33-L53
47,965
markovmodel/msmtools
msmtools/analysis/sparse/expectations.py
expected_counts
def expected_counts(p0, T, N): r"""Compute expected transition counts for Markov chain after N steps. Expected counts are computed according to ..math:: E[C_{ij}^{(n)}]=\sum_{k=0}^{N-1} (p_0^T T^{k})_{i} p_{ij} Parameters ---------- p0 : (M,) ndarray Starting (probability) vector of t...
python
def expected_counts(p0, T, N): r"""Compute expected transition counts for Markov chain after N steps. Expected counts are computed according to ..math:: E[C_{ij}^{(n)}]=\sum_{k=0}^{N-1} (p_0^T T^{k})_{i} p_{ij} Parameters ---------- p0 : (M,) ndarray Starting (probability) vector of t...
[ "def", "expected_counts", "(", "p0", ",", "T", ",", "N", ")", ":", "if", "(", "N", "<=", "0", ")", ":", "EC", "=", "coo_matrix", "(", "T", ".", "shape", ",", "dtype", "=", "float", ")", "return", "EC", "else", ":", "\"\"\"Probability vector after (k=...
r"""Compute expected transition counts for Markov chain after N steps. Expected counts are computed according to ..math:: E[C_{ij}^{(n)}]=\sum_{k=0}^{N-1} (p_0^T T^{k})_{i} p_{ij} Parameters ---------- p0 : (M,) ndarray Starting (probability) vector of the chain. T : (M, M) sparse mat...
[ "r", "Compute", "expected", "transition", "counts", "for", "Markov", "chain", "after", "N", "steps", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/expectations.py#L35-L74
47,966
markovmodel/msmtools
msmtools/analysis/sparse/fingerprints.py
fingerprint
def fingerprint(P, obs1, obs2=None, p0=None, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for equilibrium or relaxation experiment The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- P : (M, M) scipy.spa...
python
def fingerprint(P, obs1, obs2=None, p0=None, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for equilibrium or relaxation experiment The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- P : (M, M) scipy.spa...
[ "def", "fingerprint", "(", "P", ",", "obs1", ",", "obs2", "=", "None", ",", "p0", "=", "None", ",", "tau", "=", "1", ",", "k", "=", "None", ",", "ncv", "=", "None", ")", ":", "if", "obs2", "is", "None", ":", "obs2", "=", "obs1", "R", ",", "...
r"""Dynamical fingerprint for equilibrium or relaxation experiment The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- P : (M, M) scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observ...
[ "r", "Dynamical", "fingerprint", "for", "equilibrium", "or", "relaxation", "experiment" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/fingerprints.py#L109-L158
47,967
markovmodel/msmtools
msmtools/analysis/sparse/fingerprints.py
correlation_matvec
def correlation_matvec(P, obs1, obs2=None, times=[1]): r"""Time-correlation for equilibrium experiment - via matrix vector products. Parameters ---------- P : (M, M) ndarray Transition matrix obs1 : (M,) ndarray Observable, represented as vector on state space obs2 : (M,) ndarra...
python
def correlation_matvec(P, obs1, obs2=None, times=[1]): r"""Time-correlation for equilibrium experiment - via matrix vector products. Parameters ---------- P : (M, M) ndarray Transition matrix obs1 : (M,) ndarray Observable, represented as vector on state space obs2 : (M,) ndarra...
[ "def", "correlation_matvec", "(", "P", ",", "obs1", ",", "obs2", "=", "None", ",", "times", "=", "[", "1", "]", ")", ":", "if", "obs2", "is", "None", ":", "obs2", "=", "obs1", "\"\"\"Compute stationary vector\"\"\"", "mu", "=", "statdist", "(", "P", ")...
r"""Time-correlation for equilibrium experiment - via matrix vector products. Parameters ---------- P : (M, M) ndarray Transition matrix obs1 : (M,) ndarray Observable, represented as vector on state space obs2 : (M,) ndarray (optional) Second observable, for cross-correlati...
[ "r", "Time", "-", "correlation", "for", "equilibrium", "experiment", "-", "via", "matrix", "vector", "products", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/fingerprints.py#L242-L293
47,968
markovmodel/msmtools
msmtools/analysis/sparse/fingerprints.py
propagate
def propagate(A, x, N): r"""Use matrix A to propagate vector x. Parameters ---------- A : (M, M) scipy.sparse matrix Matrix of propagator x : (M, ) ndarray or scipy.sparse matrix Vector to propagate N : int Number of steps to propagate Returns ------- y : (M...
python
def propagate(A, x, N): r"""Use matrix A to propagate vector x. Parameters ---------- A : (M, M) scipy.sparse matrix Matrix of propagator x : (M, ) ndarray or scipy.sparse matrix Vector to propagate N : int Number of steps to propagate Returns ------- y : (M...
[ "def", "propagate", "(", "A", ",", "x", ",", "N", ")", ":", "y", "=", "1.0", "*", "x", "for", "i", "in", "range", "(", "N", ")", ":", "y", "=", "A", ".", "dot", "(", "y", ")", "return", "y" ]
r"""Use matrix A to propagate vector x. Parameters ---------- A : (M, M) scipy.sparse matrix Matrix of propagator x : (M, ) ndarray or scipy.sparse matrix Vector to propagate N : int Number of steps to propagate Returns ------- y : (M, ) ndarray or scipy.sparse ...
[ "r", "Use", "matrix", "A", "to", "propagate", "vector", "x", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/fingerprints.py#L438-L459
47,969
markovmodel/msmtools
msmtools/generation/api.py
generate_traj
def generate_traj(P, N, start=None, stop=None, dt=1): """ Generates a realization of the Markov chain with transition matrix P. Parameters ---------- P : (n, n) ndarray transition matrix N : int trajectory length start : int, optional, default = None starting state. ...
python
def generate_traj(P, N, start=None, stop=None, dt=1): """ Generates a realization of the Markov chain with transition matrix P. Parameters ---------- P : (n, n) ndarray transition matrix N : int trajectory length start : int, optional, default = None starting state. ...
[ "def", "generate_traj", "(", "P", ",", "N", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "dt", "=", "1", ")", ":", "sampler", "=", "MarkovChainSampler", "(", "P", ",", "dt", "=", "dt", ")", "return", "sampler", ".", "trajectory", "(", ...
Generates a realization of the Markov chain with transition matrix P. Parameters ---------- P : (n, n) ndarray transition matrix N : int trajectory length start : int, optional, default = None starting state. If not given, will sample from the stationary distribution of P ...
[ "Generates", "a", "realization", "of", "the", "Markov", "chain", "with", "transition", "matrix", "P", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/generation/api.py#L154-L180
47,970
markovmodel/msmtools
msmtools/generation/api.py
generate_trajs
def generate_trajs(P, M, N, start=None, stop=None, dt=1): """ Generates multiple realizations of the Markov chain with transition matrix P. Parameters ---------- P : (n, n) ndarray transition matrix M : int number of trajectories N : int trajectory length start :...
python
def generate_trajs(P, M, N, start=None, stop=None, dt=1): """ Generates multiple realizations of the Markov chain with transition matrix P. Parameters ---------- P : (n, n) ndarray transition matrix M : int number of trajectories N : int trajectory length start :...
[ "def", "generate_trajs", "(", "P", ",", "M", ",", "N", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "dt", "=", "1", ")", ":", "sampler", "=", "MarkovChainSampler", "(", "P", ",", "dt", "=", "dt", ")", "return", "sampler", ".", "traje...
Generates multiple realizations of the Markov chain with transition matrix P. Parameters ---------- P : (n, n) ndarray transition matrix M : int number of trajectories N : int trajectory length start : int, optional, default = None starting state. If not given, w...
[ "Generates", "multiple", "realizations", "of", "the", "Markov", "chain", "with", "transition", "matrix", "P", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/generation/api.py#L183-L211
47,971
markovmodel/msmtools
msmtools/generation/api.py
transition_matrix_metropolis_1d
def transition_matrix_metropolis_1d(E, d=1.0): r"""Transition matrix describing the Metropolis chain jumping between neighbors in a discrete 1D energy landscape. Parameters ---------- E : (M,) ndarray Energies in units of kT d : float (optional) Diffusivity of the chain, d in (0...
python
def transition_matrix_metropolis_1d(E, d=1.0): r"""Transition matrix describing the Metropolis chain jumping between neighbors in a discrete 1D energy landscape. Parameters ---------- E : (M,) ndarray Energies in units of kT d : float (optional) Diffusivity of the chain, d in (0...
[ "def", "transition_matrix_metropolis_1d", "(", "E", ",", "d", "=", "1.0", ")", ":", "# check input", "if", "(", "d", "<=", "0", "or", "d", ">", "1", ")", ":", "raise", "ValueError", "(", "'Diffusivity must be in (0,1]. Trying to set the invalid value'", ",", "st...
r"""Transition matrix describing the Metropolis chain jumping between neighbors in a discrete 1D energy landscape. Parameters ---------- E : (M,) ndarray Energies in units of kT d : float (optional) Diffusivity of the chain, d in (0, 1] Returns ------- P : (M, M) ndarra...
[ "r", "Transition", "matrix", "describing", "the", "Metropolis", "chain", "jumping", "between", "neighbors", "in", "a", "discrete", "1D", "energy", "landscape", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/generation/api.py#L214-L254
47,972
markovmodel/msmtools
msmtools/generation/api.py
MarkovChainSampler.trajectory
def trajectory(self, N, start=None, stop=None): """ Generates a trajectory realization of length N, starting from state s Parameters ---------- N : int trajectory length start : int, optional, default = None starting state. If not given, will samp...
python
def trajectory(self, N, start=None, stop=None): """ Generates a trajectory realization of length N, starting from state s Parameters ---------- N : int trajectory length start : int, optional, default = None starting state. If not given, will samp...
[ "def", "trajectory", "(", "self", ",", "N", ",", "start", "=", "None", ",", "stop", "=", "None", ")", ":", "# check input", "stop", "=", "types", ".", "ensure_int_vector_or_None", "(", "stop", ",", "require_order", "=", "False", ")", "if", "start", "is",...
Generates a trajectory realization of length N, starting from state s Parameters ---------- N : int trajectory length start : int, optional, default = None starting state. If not given, will sample from the stationary distribution of P stop : int or int-a...
[ "Generates", "a", "trajectory", "realization", "of", "length", "N", "starting", "from", "state", "s" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/generation/api.py#L83-L131
47,973
markovmodel/msmtools
msmtools/generation/api.py
MarkovChainSampler.trajectories
def trajectories(self, M, N, start=None, stop=None): """ Generates M trajectories, each of length N, starting from state s Parameters ---------- M : int number of trajectories N : int trajectory length start : int, optional, default = None...
python
def trajectories(self, M, N, start=None, stop=None): """ Generates M trajectories, each of length N, starting from state s Parameters ---------- M : int number of trajectories N : int trajectory length start : int, optional, default = None...
[ "def", "trajectories", "(", "self", ",", "M", ",", "N", ",", "start", "=", "None", ",", "stop", "=", "None", ")", ":", "trajs", "=", "[", "self", ".", "trajectory", "(", "N", ",", "start", "=", "start", ",", "stop", "=", "stop", ")", "for", "_"...
Generates M trajectories, each of length N, starting from state s Parameters ---------- M : int number of trajectories N : int trajectory length start : int, optional, default = None starting state. If not given, will sample from the stationar...
[ "Generates", "M", "trajectories", "each", "of", "length", "N", "starting", "from", "state", "s" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/generation/api.py#L133-L151
47,974
markovmodel/msmtools
msmtools/estimation/sparse/effective_counts.py
_split_sequences_singletraj
def _split_sequences_singletraj(dtraj, nstates, lag): """ splits the discrete trajectory into conditional sequences by starting state Parameters ---------- dtraj : int-iterable discrete trajectory nstates : int total number of discrete states lag : int lag time """ ...
python
def _split_sequences_singletraj(dtraj, nstates, lag): """ splits the discrete trajectory into conditional sequences by starting state Parameters ---------- dtraj : int-iterable discrete trajectory nstates : int total number of discrete states lag : int lag time """ ...
[ "def", "_split_sequences_singletraj", "(", "dtraj", ",", "nstates", ",", "lag", ")", ":", "sall", "=", "[", "[", "]", "for", "_", "in", "range", "(", "nstates", ")", "]", "res_states", "=", "[", "]", "res_seqs", "=", "[", "]", "for", "t", "in", "ra...
splits the discrete trajectory into conditional sequences by starting state Parameters ---------- dtraj : int-iterable discrete trajectory nstates : int total number of discrete states lag : int lag time
[ "splits", "the", "discrete", "trajectory", "into", "conditional", "sequences", "by", "starting", "state" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/effective_counts.py#L38-L62
47,975
markovmodel/msmtools
msmtools/estimation/sparse/effective_counts.py
_split_sequences_multitraj
def _split_sequences_multitraj(dtrajs, lag): """ splits the discrete trajectories into conditional sequences by starting state Parameters ---------- dtrajs : list of int-iterables discrete trajectories nstates : int total number of discrete states lag : int lag time ...
python
def _split_sequences_multitraj(dtrajs, lag): """ splits the discrete trajectories into conditional sequences by starting state Parameters ---------- dtrajs : list of int-iterables discrete trajectories nstates : int total number of discrete states lag : int lag time ...
[ "def", "_split_sequences_multitraj", "(", "dtrajs", ",", "lag", ")", ":", "n", "=", "number_of_states", "(", "dtrajs", ")", "res", "=", "[", "]", "for", "i", "in", "range", "(", "n", ")", ":", "res", ".", "append", "(", "[", "]", ")", "for", "dtraj...
splits the discrete trajectories into conditional sequences by starting state Parameters ---------- dtrajs : list of int-iterables discrete trajectories nstates : int total number of discrete states lag : int lag time
[ "splits", "the", "discrete", "trajectories", "into", "conditional", "sequences", "by", "starting", "state" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/effective_counts.py#L65-L86
47,976
markovmodel/msmtools
msmtools/estimation/sparse/effective_counts.py
_indicator_multitraj
def _indicator_multitraj(ss, i, j): """ Returns conditional sequence for transition i -> j given all conditional sequences """ iseqs = ss[i] res = [] for iseq in iseqs: x = np.zeros(len(iseq)) I = np.where(iseq == j) x[I] = 1.0 res.append(x) return res
python
def _indicator_multitraj(ss, i, j): """ Returns conditional sequence for transition i -> j given all conditional sequences """ iseqs = ss[i] res = [] for iseq in iseqs: x = np.zeros(len(iseq)) I = np.where(iseq == j) x[I] = 1.0 res.append(x) return res
[ "def", "_indicator_multitraj", "(", "ss", ",", "i", ",", "j", ")", ":", "iseqs", "=", "ss", "[", "i", "]", "res", "=", "[", "]", "for", "iseq", "in", "iseqs", ":", "x", "=", "np", ".", "zeros", "(", "len", "(", "iseq", ")", ")", "I", "=", "...
Returns conditional sequence for transition i -> j given all conditional sequences
[ "Returns", "conditional", "sequence", "for", "transition", "i", "-", ">", "j", "given", "all", "conditional", "sequences" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/effective_counts.py#L89-L98
47,977
markovmodel/msmtools
msmtools/estimation/sparse/effective_counts.py
statistical_inefficiencies
def statistical_inefficiencies(dtrajs, lag, C=None, truncate_acf=True, mact=2.0, n_jobs=1, callback=None): r""" Computes statistical inefficiencies of sliding-window transition counts at given lag Consider a discrete trajectory :math`{ x_t }` with :math:`x_t \in {1, ..., n}`. For each starting state :math:`i`,...
python
def statistical_inefficiencies(dtrajs, lag, C=None, truncate_acf=True, mact=2.0, n_jobs=1, callback=None): r""" Computes statistical inefficiencies of sliding-window transition counts at given lag Consider a discrete trajectory :math`{ x_t }` with :math:`x_t \in {1, ..., n}`. For each starting state :math:`i`,...
[ "def", "statistical_inefficiencies", "(", "dtrajs", ",", "lag", ",", "C", "=", "None", ",", "truncate_acf", "=", "True", ",", "mact", "=", "2.0", ",", "n_jobs", "=", "1", ",", "callback", "=", "None", ")", ":", "# count matrix", "if", "C", "is", "None"...
r""" Computes statistical inefficiencies of sliding-window transition counts at given lag Consider a discrete trajectory :math`{ x_t }` with :math:`x_t \in {1, ..., n}`. For each starting state :math:`i`, we collect the target sequence .. mathh: Y^(i) = {x_{t+\tau} | x_{t}=i} which contains t...
[ "r", "Computes", "statistical", "inefficiencies", "of", "sliding", "-", "window", "transition", "counts", "at", "given", "lag" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/effective_counts.py#L143-L234
47,978
markovmodel/msmtools
msmtools/estimation/dense/transition_matrix.py
transition_matrix_non_reversible
def transition_matrix_non_reversible(C): r""" Estimates a non-reversible transition matrix from count matrix C T_ij = c_ij / c_i where c_i = sum_j c_ij Parameters ---------- C: ndarray, shape (n,n) count matrix Returns ------- T: Estimated transition matrix """ # ...
python
def transition_matrix_non_reversible(C): r""" Estimates a non-reversible transition matrix from count matrix C T_ij = c_ij / c_i where c_i = sum_j c_ij Parameters ---------- C: ndarray, shape (n,n) count matrix Returns ------- T: Estimated transition matrix """ # ...
[ "def", "transition_matrix_non_reversible", "(", "C", ")", ":", "# multiply by 1.0 to make sure we're not doing integer division", "rowsums", "=", "1.0", "*", "np", ".", "sum", "(", "C", ",", "axis", "=", "1", ")", "if", "np", ".", "min", "(", "rowsums", ")", "...
r""" Estimates a non-reversible transition matrix from count matrix C T_ij = c_ij / c_i where c_i = sum_j c_ij Parameters ---------- C: ndarray, shape (n,n) count matrix Returns ------- T: Estimated transition matrix
[ "r", "Estimates", "a", "non", "-", "reversible", "transition", "matrix", "from", "count", "matrix", "C" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/transition_matrix.py#L30-L51
47,979
markovmodel/msmtools
msmtools/analysis/dense/correlations.py
time_correlation_direct_by_mtx_vec_prod
def time_correlation_direct_by_mtx_vec_prod(P, mu, obs1, obs2=None, time=1, start_values=None, return_P_k_obs=False): r"""Compute time-correlation of obs1, or time-cross-correlation with obs2. The time-correlation at time=k is computed by the matrix-vector expression: cor(k) = obs1' diag(pi) P^k obs2 ...
python
def time_correlation_direct_by_mtx_vec_prod(P, mu, obs1, obs2=None, time=1, start_values=None, return_P_k_obs=False): r"""Compute time-correlation of obs1, or time-cross-correlation with obs2. The time-correlation at time=k is computed by the matrix-vector expression: cor(k) = obs1' diag(pi) P^k obs2 ...
[ "def", "time_correlation_direct_by_mtx_vec_prod", "(", "P", ",", "mu", ",", "obs1", ",", "obs2", "=", "None", ",", "time", "=", "1", ",", "start_values", "=", "None", ",", "return_P_k_obs", "=", "False", ")", ":", "# input checks", "if", "not", "(", "type"...
r"""Compute time-correlation of obs1, or time-cross-correlation with obs2. The time-correlation at time=k is computed by the matrix-vector expression: cor(k) = obs1' diag(pi) P^k obs2 Parameters ---------- P : ndarray, shape=(n, n) or scipy.sparse matrix Transition matrix obs1 : ndarr...
[ "r", "Compute", "time", "-", "correlation", "of", "obs1", "or", "time", "-", "cross", "-", "correlation", "with", "obs2", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/correlations.py#L55-L124
47,980
markovmodel/msmtools
msmtools/analysis/dense/correlations.py
time_correlations_direct
def time_correlations_direct(P, pi, obs1, obs2=None, times=[1]): r"""Compute time-correlations of obs1, or time-cross-correlation with obs2. The time-correlation at time=k is computed by the matrix-vector expression: cor(k) = obs1' diag(pi) P^k obs2 Parameters ---------- P : ndarray, shape=(n...
python
def time_correlations_direct(P, pi, obs1, obs2=None, times=[1]): r"""Compute time-correlations of obs1, or time-cross-correlation with obs2. The time-correlation at time=k is computed by the matrix-vector expression: cor(k) = obs1' diag(pi) P^k obs2 Parameters ---------- P : ndarray, shape=(n...
[ "def", "time_correlations_direct", "(", "P", ",", "pi", ",", "obs1", ",", "obs2", "=", "None", ",", "times", "=", "[", "1", "]", ")", ":", "n_t", "=", "len", "(", "times", ")", "times", "=", "np", ".", "sort", "(", "times", ")", "# sort it to use c...
r"""Compute time-correlations of obs1, or time-cross-correlation with obs2. The time-correlation at time=k is computed by the matrix-vector expression: cor(k) = obs1' diag(pi) P^k obs2 Parameters ---------- P : ndarray, shape=(n, n) or scipy.sparse matrix Transition matrix obs1 : ndar...
[ "r", "Compute", "time", "-", "correlations", "of", "obs1", "or", "time", "-", "cross", "-", "correlation", "with", "obs2", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/correlations.py#L127-L178
47,981
markovmodel/msmtools
msmtools/estimation/sparse/newton/linsolve_sparse.py
factor_aug
def factor_aug(z, DPhival, G, A): r"""Set up augmented system and return. Parameters ---------- z : (N+P+M+M,) ndarray Current iterate, z = (x, nu, l, s) DPhival : LinearOperator Jacobian of the variational inequality mapping G : (M, N) ndarray or sparse matrix Inequalit...
python
def factor_aug(z, DPhival, G, A): r"""Set up augmented system and return. Parameters ---------- z : (N+P+M+M,) ndarray Current iterate, z = (x, nu, l, s) DPhival : LinearOperator Jacobian of the variational inequality mapping G : (M, N) ndarray or sparse matrix Inequalit...
[ "def", "factor_aug", "(", "z", ",", "DPhival", ",", "G", ",", "A", ")", ":", "M", ",", "N", "=", "G", ".", "shape", "P", ",", "N", "=", "A", ".", "shape", "\"\"\"Multiplier for inequality constraints\"\"\"", "l", "=", "z", "[", "N", "+", "P", ":", ...
r"""Set up augmented system and return. Parameters ---------- z : (N+P+M+M,) ndarray Current iterate, z = (x, nu, l, s) DPhival : LinearOperator Jacobian of the variational inequality mapping G : (M, N) ndarray or sparse matrix Inequality constraints A : (P, N) ndarray o...
[ "r", "Set", "up", "augmented", "system", "and", "return", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/newton/linsolve_sparse.py#L81-L130
47,982
markovmodel/msmtools
msmtools/flux/reactive_flux.py
ReactiveFlux.I
def I(self): r"""Returns the set of intermediate states """ return list(set(range(self.nstates)) - set(self._A) - set(self._B))
python
def I(self): r"""Returns the set of intermediate states """ return list(set(range(self.nstates)) - set(self._A) - set(self._B))
[ "def", "I", "(", "self", ")", ":", "return", "list", "(", "set", "(", "range", "(", "self", ".", "nstates", ")", ")", "-", "set", "(", "self", ".", "_A", ")", "-", "set", "(", "self", ".", "_B", ")", ")" ]
r"""Returns the set of intermediate states
[ "r", "Returns", "the", "set", "of", "intermediate", "states" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/reactive_flux.py#L111-L115
47,983
markovmodel/msmtools
msmtools/flux/reactive_flux.py
ReactiveFlux._pathways_to_flux
def _pathways_to_flux(self, paths, pathfluxes, n=None): r"""Sums up the flux from the pathways given Parameters ----------- paths : list of int-arrays list of pathways pathfluxes : double-array array with path fluxes n : int number of st...
python
def _pathways_to_flux(self, paths, pathfluxes, n=None): r"""Sums up the flux from the pathways given Parameters ----------- paths : list of int-arrays list of pathways pathfluxes : double-array array with path fluxes n : int number of st...
[ "def", "_pathways_to_flux", "(", "self", ",", "paths", ",", "pathfluxes", ",", "n", "=", "None", ")", ":", "if", "(", "n", "is", "None", ")", ":", "n", "=", "0", "for", "p", "in", "paths", ":", "n", "=", "max", "(", "n", ",", "np", ".", "max"...
r"""Sums up the flux from the pathways given Parameters ----------- paths : list of int-arrays list of pathways pathfluxes : double-array array with path fluxes n : int number of states. If not set, will be automatically determined. Ret...
[ "r", "Sums", "up", "the", "flux", "from", "the", "pathways", "given" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/reactive_flux.py#L204-L236
47,984
markovmodel/msmtools
msmtools/flux/reactive_flux.py
ReactiveFlux.major_flux
def major_flux(self, fraction=0.9): r"""Returns the main pathway part of the net flux comprising at most the requested fraction of the full flux. """ (paths, pathfluxes) = self.pathways(fraction=fraction) return self._pathways_to_flux(paths, pathfluxes, n=self.nstates)
python
def major_flux(self, fraction=0.9): r"""Returns the main pathway part of the net flux comprising at most the requested fraction of the full flux. """ (paths, pathfluxes) = self.pathways(fraction=fraction) return self._pathways_to_flux(paths, pathfluxes, n=self.nstates)
[ "def", "major_flux", "(", "self", ",", "fraction", "=", "0.9", ")", ":", "(", "paths", ",", "pathfluxes", ")", "=", "self", ".", "pathways", "(", "fraction", "=", "fraction", ")", "return", "self", ".", "_pathways_to_flux", "(", "paths", ",", "pathfluxes...
r"""Returns the main pathway part of the net flux comprising at most the requested fraction of the full flux.
[ "r", "Returns", "the", "main", "pathway", "part", "of", "the", "net", "flux", "comprising", "at", "most", "the", "requested", "fraction", "of", "the", "full", "flux", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/reactive_flux.py#L238-L244
47,985
markovmodel/msmtools
msmtools/flux/reactive_flux.py
ReactiveFlux._compute_coarse_sets
def _compute_coarse_sets(self, user_sets): r"""Computes the sets to coarse-grain the tpt flux to. Parameters ---------- (tpt_sets, A, B) with tpt_sets : list of int-iterables sets of states that shall be distinguished in the coarse-grained flux. ...
python
def _compute_coarse_sets(self, user_sets): r"""Computes the sets to coarse-grain the tpt flux to. Parameters ---------- (tpt_sets, A, B) with tpt_sets : list of int-iterables sets of states that shall be distinguished in the coarse-grained flux. ...
[ "def", "_compute_coarse_sets", "(", "self", ",", "user_sets", ")", ":", "# set-ify everything", "setA", "=", "set", "(", "self", ".", "A", ")", "setB", "=", "set", "(", "self", ".", "B", ")", "setI", "=", "set", "(", "self", ".", "I", ")", "raw_sets"...
r"""Computes the sets to coarse-grain the tpt flux to. Parameters ---------- (tpt_sets, A, B) with tpt_sets : list of int-iterables sets of states that shall be distinguished in the coarse-grained flux. A : int-iterable set indexes...
[ "r", "Computes", "the", "sets", "to", "coarse", "-", "grain", "the", "tpt", "flux", "to", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/reactive_flux.py#L247-L314
47,986
markovmodel/msmtools
msmtools/flux/reactive_flux.py
ReactiveFlux.coarse_grain
def coarse_grain(self, user_sets): r"""Coarse-grains the flux onto user-defined sets. Parameters ---------- user_sets : list of int-iterables sets of states that shall be distinguished in the coarse-grained flux. Returns ------- (sets, tpt) : (list o...
python
def coarse_grain(self, user_sets): r"""Coarse-grains the flux onto user-defined sets. Parameters ---------- user_sets : list of int-iterables sets of states that shall be distinguished in the coarse-grained flux. Returns ------- (sets, tpt) : (list o...
[ "def", "coarse_grain", "(", "self", ",", "user_sets", ")", ":", "# coarse-grain sets", "(", "tpt_sets", ",", "Aindexes", ",", "Bindexes", ")", "=", "self", ".", "_compute_coarse_sets", "(", "user_sets", ")", "nnew", "=", "len", "(", "tpt_sets", ")", "# coars...
r"""Coarse-grains the flux onto user-defined sets. Parameters ---------- user_sets : list of int-iterables sets of states that shall be distinguished in the coarse-grained flux. Returns ------- (sets, tpt) : (list of int-iterables, tpt-object) se...
[ "r", "Coarse", "-", "grains", "the", "flux", "onto", "user", "-", "defined", "sets", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/reactive_flux.py#L316-L367
47,987
markovmodel/msmtools
msmtools/util/birth_death_chain.py
BirthDeathChain.committor_forward
def committor_forward(self, a, b): r"""Forward committor for birth-and-death-chain. The forward committor is the probability to hit state b before hitting state a starting in state x, u_x=P_x(T_b<T_a) T_i is the first arrival time of the chain to state i, T_i ...
python
def committor_forward(self, a, b): r"""Forward committor for birth-and-death-chain. The forward committor is the probability to hit state b before hitting state a starting in state x, u_x=P_x(T_b<T_a) T_i is the first arrival time of the chain to state i, T_i ...
[ "def", "committor_forward", "(", "self", ",", "a", ",", "b", ")", ":", "u", "=", "np", ".", "zeros", "(", "self", ".", "dim", ")", "g", "=", "np", ".", "zeros", "(", "self", ".", "dim", "-", "1", ")", "g", "[", "0", "]", "=", "1.0", "g", ...
r"""Forward committor for birth-and-death-chain. The forward committor is the probability to hit state b before hitting state a starting in state x, u_x=P_x(T_b<T_a) T_i is the first arrival time of the chain to state i, T_i = inf( t>0 | X_t=i ) Parameters ...
[ "r", "Forward", "committor", "for", "birth", "-", "and", "-", "death", "-", "chain", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/util/birth_death_chain.py#L103-L150
47,988
markovmodel/msmtools
msmtools/estimation/sparse/transition_matrix.py
transition_matrix_non_reversible
def transition_matrix_non_reversible(C): """implementation of transition_matrix""" if not scipy.sparse.issparse(C): C = scipy.sparse.csr_matrix(C) rowsum = C.tocsr().sum(axis=1) # catch div by zero if np.min(rowsum) == 0.0: raise ValueError("matrix C contains rows with sum zero.") ...
python
def transition_matrix_non_reversible(C): """implementation of transition_matrix""" if not scipy.sparse.issparse(C): C = scipy.sparse.csr_matrix(C) rowsum = C.tocsr().sum(axis=1) # catch div by zero if np.min(rowsum) == 0.0: raise ValueError("matrix C contains rows with sum zero.") ...
[ "def", "transition_matrix_non_reversible", "(", "C", ")", ":", "if", "not", "scipy", ".", "sparse", ".", "issparse", "(", "C", ")", ":", "C", "=", "scipy", ".", "sparse", ".", "csr_matrix", "(", "C", ")", "rowsum", "=", "C", ".", "tocsr", "(", ")", ...
implementation of transition_matrix
[ "implementation", "of", "transition_matrix" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/transition_matrix.py#L27-L37
47,989
markovmodel/msmtools
msmtools/estimation/sparse/transition_matrix.py
correct_transition_matrix
def correct_transition_matrix(T, reversible=None): r"""Normalize transition matrix Fixes a the row normalization of a transition matrix. To be used with the reversible estimators to fix an almost coverged transition matrix. Parameters ---------- T : (M, M) ndarray matrix to correct...
python
def correct_transition_matrix(T, reversible=None): r"""Normalize transition matrix Fixes a the row normalization of a transition matrix. To be used with the reversible estimators to fix an almost coverged transition matrix. Parameters ---------- T : (M, M) ndarray matrix to correct...
[ "def", "correct_transition_matrix", "(", "T", ",", "reversible", "=", "None", ")", ":", "row_sums", "=", "T", ".", "sum", "(", "axis", "=", "1", ")", ".", "A1", "max_sum", "=", "np", ".", "max", "(", "row_sums", ")", "if", "max_sum", "==", "0.0", "...
r"""Normalize transition matrix Fixes a the row normalization of a transition matrix. To be used with the reversible estimators to fix an almost coverged transition matrix. Parameters ---------- T : (M, M) ndarray matrix to correct reversible : boolean for future use R...
[ "r", "Normalize", "transition", "matrix" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/transition_matrix.py#L39-L62
47,990
markovmodel/msmtools
msmtools/analysis/dense/fingerprints.py
expectation
def expectation(P, obs): r"""Equilibrium expectation of given observable. Parameters ---------- P : (M, M) ndarray Transition matrix obs : (M,) ndarray Observable, represented as vector on state space Returns ------- x : float Expectation value """ pi =...
python
def expectation(P, obs): r"""Equilibrium expectation of given observable. Parameters ---------- P : (M, M) ndarray Transition matrix obs : (M,) ndarray Observable, represented as vector on state space Returns ------- x : float Expectation value """ pi =...
[ "def", "expectation", "(", "P", ",", "obs", ")", ":", "pi", "=", "statdist", "(", "P", ")", "return", "np", ".", "dot", "(", "pi", ",", "obs", ")" ]
r"""Equilibrium expectation of given observable. Parameters ---------- P : (M, M) ndarray Transition matrix obs : (M,) ndarray Observable, represented as vector on state space Returns ------- x : float Expectation value
[ "r", "Equilibrium", "expectation", "of", "given", "observable", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/fingerprints.py#L151-L168
47,991
markovmodel/msmtools
msmtools/analysis/dense/fingerprints.py
correlation_decomp
def correlation_decomp(P, obs1, obs2=None, times=[1], k=None): r"""Time-correlation for equilibrium experiment - via decomposition. Parameters ---------- P : (M, M) ndarray Transition matrix obs1 : (M,) ndarray Observable, represented as vector on state space obs2 : (M,) ndarray...
python
def correlation_decomp(P, obs1, obs2=None, times=[1], k=None): r"""Time-correlation for equilibrium experiment - via decomposition. Parameters ---------- P : (M, M) ndarray Transition matrix obs1 : (M,) ndarray Observable, represented as vector on state space obs2 : (M,) ndarray...
[ "def", "correlation_decomp", "(", "P", ",", "obs1", ",", "obs2", "=", "None", ",", "times", "=", "[", "1", "]", ",", "k", "=", "None", ")", ":", "if", "obs2", "is", "None", ":", "obs2", "=", "obs1", "R", ",", "D", ",", "L", "=", "rdl_decomposit...
r"""Time-correlation for equilibrium experiment - via decomposition. Parameters ---------- P : (M, M) ndarray Transition matrix obs1 : (M,) ndarray Observable, represented as vector on state space obs2 : (M,) ndarray (optional) Second observable, for cross-correlations t...
[ "r", "Time", "-", "correlation", "for", "equilibrium", "experiment", "-", "via", "decomposition", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/fingerprints.py#L205-L243
47,992
markovmodel/msmtools
msmtools/estimation/sparse/likelihood.py
log_likelihood
def log_likelihood(C, T): """ implementation of likelihood of C given T """ C = C.tocsr() T = T.tocsr() ind = scipy.nonzero(C) relT = np.array(T[ind])[0, :] relT = np.log(relT) relC = np.array(C[ind])[0, :] return relT.dot(relC)
python
def log_likelihood(C, T): """ implementation of likelihood of C given T """ C = C.tocsr() T = T.tocsr() ind = scipy.nonzero(C) relT = np.array(T[ind])[0, :] relT = np.log(relT) relC = np.array(C[ind])[0, :] return relT.dot(relC)
[ "def", "log_likelihood", "(", "C", ",", "T", ")", ":", "C", "=", "C", ".", "tocsr", "(", ")", "T", "=", "T", ".", "tocsr", "(", ")", "ind", "=", "scipy", ".", "nonzero", "(", "C", ")", "relT", "=", "np", ".", "array", "(", "T", "[", "ind", ...
implementation of likelihood of C given T
[ "implementation", "of", "likelihood", "of", "C", "given", "T" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/likelihood.py#L26-L37
47,993
juanpabloaj/slacker-cli
slacker_cli/__init__.py
upload_file
def upload_file(token, channel_name, file_name): """ upload file to a channel """ slack = Slacker(token) slack.files.upload(file_name, channels=channel_name)
python
def upload_file(token, channel_name, file_name): """ upload file to a channel """ slack = Slacker(token) slack.files.upload(file_name, channels=channel_name)
[ "def", "upload_file", "(", "token", ",", "channel_name", ",", "file_name", ")", ":", "slack", "=", "Slacker", "(", "token", ")", "slack", ".", "files", ".", "upload", "(", "file_name", ",", "channels", "=", "channel_name", ")" ]
upload file to a channel
[ "upload", "file", "to", "a", "channel" ]
e5011cf13ce5f2b5e5c09aee589be880de39e523
https://github.com/juanpabloaj/slacker-cli/blob/e5011cf13ce5f2b5e5c09aee589be880de39e523/slacker_cli/__init__.py#L67-L72
47,994
markovmodel/msmtools
msmtools/estimation/dense/ratematrix.py
_ReversibleRateMatrixEstimator.run
def run(self): """Run the minimization. Returns ------- K : (N,N) ndarray the optimal rate matrix """ if self.verbose: self.selftest() self.count = 0 if self.verbose: logging.info('initial value of the objective functio...
python
def run(self): """Run the minimization. Returns ------- K : (N,N) ndarray the optimal rate matrix """ if self.verbose: self.selftest() self.count = 0 if self.verbose: logging.info('initial value of the objective functio...
[ "def", "run", "(", "self", ")", ":", "if", "self", ".", "verbose", ":", "self", ".", "selftest", "(", ")", "self", ".", "count", "=", "0", "if", "self", ".", "verbose", ":", "logging", ".", "info", "(", "'initial value of the objective function is %f'", ...
Run the minimization. Returns ------- K : (N,N) ndarray the optimal rate matrix
[ "Run", "the", "minimization", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/ratematrix.py#L201-L230
47,995
myint/unify
unify.py
unify_quotes
def unify_quotes(token_string, preferred_quote): """Return string with quotes changed to preferred_quote if possible.""" bad_quote = {'"': "'", "'": '"'}[preferred_quote] allowed_starts = { '': bad_quote, 'f': 'f' + bad_quote, 'b': 'b' + bad_quote } if not ...
python
def unify_quotes(token_string, preferred_quote): """Return string with quotes changed to preferred_quote if possible.""" bad_quote = {'"': "'", "'": '"'}[preferred_quote] allowed_starts = { '': bad_quote, 'f': 'f' + bad_quote, 'b': 'b' + bad_quote } if not ...
[ "def", "unify_quotes", "(", "token_string", ",", "preferred_quote", ")", ":", "bad_quote", "=", "{", "'\"'", ":", "\"'\"", ",", "\"'\"", ":", "'\"'", "}", "[", "preferred_quote", "]", "allowed_starts", "=", "{", "''", ":", "bad_quote", ",", "'f'", ":", "...
Return string with quotes changed to preferred_quote if possible.
[ "Return", "string", "with", "quotes", "changed", "to", "preferred_quote", "if", "possible", "." ]
ae699f5980a715cadc4a2f07bf16d11083c59401
https://github.com/myint/unify/blob/ae699f5980a715cadc4a2f07bf16d11083c59401/unify.py#L80-L110
47,996
myint/unify
unify.py
detect_encoding
def detect_encoding(filename): """Return file encoding.""" try: with open(filename, 'rb') as input_file: from lib2to3.pgen2 import tokenize as lib2to3_tokenize encoding = lib2to3_tokenize.detect_encoding(input_file.readline)[0] # Check for correctness of encoding. ...
python
def detect_encoding(filename): """Return file encoding.""" try: with open(filename, 'rb') as input_file: from lib2to3.pgen2 import tokenize as lib2to3_tokenize encoding = lib2to3_tokenize.detect_encoding(input_file.readline)[0] # Check for correctness of encoding. ...
[ "def", "detect_encoding", "(", "filename", ")", ":", "try", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "input_file", ":", "from", "lib2to3", ".", "pgen2", "import", "tokenize", "as", "lib2to3_tokenize", "encoding", "=", "lib2to3_tokenize", ...
Return file encoding.
[ "Return", "file", "encoding", "." ]
ae699f5980a715cadc4a2f07bf16d11083c59401
https://github.com/myint/unify/blob/ae699f5980a715cadc4a2f07bf16d11083c59401/unify.py#L119-L132
47,997
myint/unify
unify.py
_main
def _main(argv, standard_out, standard_error): """Run quotes unifying on files. Returns `1` if any quoting changes are still needed, otherwise `None`. """ import argparse parser = argparse.ArgumentParser(description=__doc__, prog='unify') parser.add_argument('-i', '--in-place', action='sto...
python
def _main(argv, standard_out, standard_error): """Run quotes unifying on files. Returns `1` if any quoting changes are still needed, otherwise `None`. """ import argparse parser = argparse.ArgumentParser(description=__doc__, prog='unify') parser.add_argument('-i', '--in-place', action='sto...
[ "def", "_main", "(", "argv", ",", "standard_out", ",", "standard_error", ")", ":", "import", "argparse", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ",", "prog", "=", "'unify'", ")", "parser", ".", "add_argument", "(...
Run quotes unifying on files. Returns `1` if any quoting changes are still needed, otherwise `None`.
[ "Run", "quotes", "unifying", "on", "files", "." ]
ae699f5980a715cadc4a2f07bf16d11083c59401
https://github.com/myint/unify/blob/ae699f5980a715cadc4a2f07bf16d11083c59401/unify.py#L167-L213
47,998
markovmodel/msmtools
msmtools/estimation/api.py
count_matrix
def count_matrix(dtraj, lag, sliding=True, sparse_return=True, nstates=None): r"""Generate a count matrix from given microstate trajectory. Parameters ---------- dtraj : array_like or list of array_like Discretized trajectory or list of discretized trajectories lag : int Lagtime in ...
python
def count_matrix(dtraj, lag, sliding=True, sparse_return=True, nstates=None): r"""Generate a count matrix from given microstate trajectory. Parameters ---------- dtraj : array_like or list of array_like Discretized trajectory or list of discretized trajectories lag : int Lagtime in ...
[ "def", "count_matrix", "(", "dtraj", ",", "lag", ",", "sliding", "=", "True", ",", "sparse_return", "=", "True", ",", "nstates", "=", "None", ")", ":", "# convert dtraj input, if it contains out of nested python lists to", "# a list of int ndarrays.", "dtraj", "=", "_...
r"""Generate a count matrix from given microstate trajectory. Parameters ---------- dtraj : array_like or list of array_like Discretized trajectory or list of discretized trajectories lag : int Lagtime in trajectory steps sliding : bool, optional If true the sliding window a...
[ "r", "Generate", "a", "count", "matrix", "from", "given", "microstate", "trajectory", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L128-L219
47,999
markovmodel/msmtools
msmtools/estimation/api.py
bootstrap_counts
def bootstrap_counts(dtrajs, lagtime, corrlength=None): r"""Generates a randomly resampled count matrix given the input coordinates. Parameters ---------- dtrajs : array-like or array-like of array-like single or multiple discrete trajectories. Every trajectory is assumed to be a statis...
python
def bootstrap_counts(dtrajs, lagtime, corrlength=None): r"""Generates a randomly resampled count matrix given the input coordinates. Parameters ---------- dtrajs : array-like or array-like of array-like single or multiple discrete trajectories. Every trajectory is assumed to be a statis...
[ "def", "bootstrap_counts", "(", "dtrajs", ",", "lagtime", ",", "corrlength", "=", "None", ")", ":", "dtrajs", "=", "_ensure_dtraj_list", "(", "dtrajs", ")", "return", "dense", ".", "bootstrapping", ".", "bootstrap_counts", "(", "dtrajs", ",", "lagtime", ",", ...
r"""Generates a randomly resampled count matrix given the input coordinates. Parameters ---------- dtrajs : array-like or array-like of array-like single or multiple discrete trajectories. Every trajectory is assumed to be a statistically independent realization. Note that this is often not...
[ "r", "Generates", "a", "randomly", "resampled", "count", "matrix", "given", "the", "input", "coordinates", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L360-L395