def test_cycle_blackbox(): tpm = sbn2sbs( np.array([[0, 0, 0], [0, 1, 0], [0, 0, 1], [0, 1, 1], [1, 0, 0], [1, 1, 0], [1, 0, 1], [1, 1, 1]])) # TPM over 2 timesteps tpm2 = sbn2sbs( np.array([[0, 0, 0], [0, 0, 1], [1, 0, 0], [1, 0, 1], [0, 1, 0], [0, 1, 1], [1, 1, 0], [1, 1, 1]])) # TPM over 3 timesteps tpm3 = sbn2sbs( np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 1], [1, 0, 1], [0, 1, 1], [1, 1, 1]])) assert np.array_equal(timescale.sparse_time(tpm, 2), tpm2) assert np.array_equal(timescale.sparse_time(tpm, 3), tpm3) assert np.array_equal(timescale.dense_time(tpm, 2), tpm2) assert np.array_equal(timescale.dense_time(tpm, 3), tpm3)
def test_sparse_blackbox(): tpm_huge = np.array([ [ 1 if i == j + 1 else 0 for i in range(1000) ] for j in range(1000) ]) tpm_huge[999, 0] = 1 assert np.array_equal(timescale.sparse_time(tpm_huge, 1001), tpm_huge)
def test_cycle_blackbox(): tpm = sbn2sbs(np.array([ [0, 0, 0], [0, 1, 0], [0, 0, 1], [0, 1, 1], [1, 0, 0], [1, 1, 0], [1, 0, 1], [1, 1, 1] ])) # TPM over 2 timesteps tpm2 = sbn2sbs(np.array([ [0, 0, 0], [0, 0, 1], [1, 0, 0], [1, 0, 1], [0, 1, 0], [0, 1, 1], [1, 1, 0], [1, 1, 1] ])) # TPM over 3 timesteps tpm3 = sbn2sbs(np.array([ [0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 1], [1, 0, 1], [0, 1, 1], [1, 1, 1] ])) assert np.array_equal(timescale.sparse_time(tpm, 2), tpm2) assert np.array_equal(timescale.sparse_time(tpm, 3), tpm3) assert np.array_equal(timescale.dense_time(tpm, 2), tpm2) assert np.array_equal(timescale.dense_time(tpm, 3), tpm3)