tests
Set of helpful test functions.
is_quadratic(matrix)
¶
Check if matrix is quadratic.
Parameters:
-
matrix
(ndarray, list of lists
) –Matrix which is checked if is 2d array.
Returns:
-
is_quadratic
(bool
) –
Source code in src/msmhelper/utils/tests.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
is_state_traj(trajs)
¶
Check if state trajectory is correct formatted.
Parameters:
-
trajs
(list of ndarray
) –State trajectory/trajectories need to be lists of ndarrays of integers.
Returns:
-
is_state_traj
(bool
) –
Source code in src/msmhelper/utils/tests.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
is_index_traj(trajs)
¶
Check if states can be used as indices.
Parameters:
-
trajs
(list of ndarray
) –State trajectory/trajectories need to be lists of ndarrays of integers.
Returns:
-
is_index
(bool
) –
Source code in src/msmhelper/utils/tests.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
is_transition_matrix(matrix, atol=1e-08)
¶
Check if transition matrix.
Rows and cols of zeros (non-visited states) are accepted.
Parameters:
-
matrix
(ndarray
) –Transition matrix.
-
atol
(float
, default:1e-08
) –Absolute tolerance.
Returns:
-
is_tmat
(bool
) –
Source code in src/msmhelper/utils/tests.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
is_ergodic(matrix, atol=1e-08)
¶
Check if matrix is ergodic.
Parameters:
-
matrix
(ndarray
) –Transition matrix.
-
atol
(float
, default:1e-08
) –Absolute tolerance.
Returns:
-
is_ergodic
(bool
) –
References
Wielandt, Unzerlegbare, Nicht Negativen Matrizen. Mathematische Zeitschrift Vol. 52, 1950, pp. 642–648.
Source code in src/msmhelper/utils/tests.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
is_fuzzy_ergodic(matrix, atol=1e-08)
¶
Check if matrix is ergodic, up to missing states or trap states.
If there are two or more disjoint
Parameters:
-
matrix
(ndarray
) –Transition matrix.
-
atol
(float
, default:1e-08
) –Absolute tolerance.
Returns:
-
is_fuzzy_ergodic
(bool
) –
Source code in src/msmhelper/utils/tests.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
ergodic_mask(matrix, atol=1e-08)
¶
Create mask for filtering ergodic submatrix.
Parameters:
-
matrix
(ndarray
) –Transition matrix.
-
atol
(float
, default:1e-08
) –Absolute tolerance.
Returns:
-
mask
(bool ndarray
) –
Source code in src/msmhelper/utils/tests.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|