コード例 #1
0
def test_no_inactive():
    inlinks = sgrid.setup_active_inlink_matrix((4, 5), return_count=False)
    assert_array_equal(
        inlinks,
        np.array([
            [
                -1, -1, -1, -1, -1, -1, 0, 1, 2, -1, -1, 3, 4, 5, -1, -1, 6, 7,
                8, -1
            ],
            [
                -1,
                -1,
                -1,
                -1,
                -1,
                -1,
                9,
                10,
                11,
                12,
                -1,
                13,
                14,
                15,
                16,
                -1,
                -1,
                -1,
                -1,
                -1,
            ],
        ]),
    )
コード例 #2
0
def test_no_inactive():
    inlinks = sgrid.setup_active_inlink_matrix((4, 5), return_count=False)
    assert_array_equal(
        inlinks,
        np.array(
            [
                [-1, -1, -1, -1, -1, -1, 0, 1, 2, -1, -1, 3, 4, 5, -1, -1, 6, 7, 8, -1],
                [
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    9,
                    10,
                    11,
                    12,
                    -1,
                    13,
                    14,
                    15,
                    16,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                ],
            ]
        ),
    )
コード例 #3
0
def test_inactive():
    status = np.ones((4, 5))
    status[1, 1] = 0
    inlinks = sgrid.setup_active_inlink_matrix(
        (4, 5), return_count=False, node_status=status
    )
    assert_array_equal(
        inlinks,
        np.array(
            [
                [
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    0,
                    1,
                    -1,
                    -1,
                    -1,
                    2,
                    3,
                    -1,
                    -1,
                    4,
                    5,
                    6,
                    -1,
                ],
                [
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    7,
                    8,
                    -1,
                    9,
                    10,
                    11,
                    12,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                ],
            ]
        ),
    )
コード例 #4
0
def test_inactive():
    status = np.ones((4, 5))
    status[1, 1] = 0
    inlinks = sgrid.setup_active_inlink_matrix(
        (4, 5), return_count=False, node_status=status
    )
    assert_array_equal(
        inlinks,
        np.array(
            [
                [
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    0,
                    1,
                    -1,
                    -1,
                    -1,
                    2,
                    3,
                    -1,
                    -1,
                    4,
                    5,
                    6,
                    -1,
                ],
                [
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                    7,
                    8,
                    -1,
                    9,
                    10,
                    11,
                    12,
                    -1,
                    -1,
                    -1,
                    -1,
                    -1,
                ],
            ]
        ),
    )
コード例 #5
0
 def test_no_inactive(self):
     inlinks = sgrid.setup_active_inlink_matrix((4, 5), return_count=False)
     self.assertArrayEqual(inlinks,
                        np.array([[-1, -1, -1, -1, -1,
                                   -1,  0,  1,  2, -1,
                                   -1,  3,  4,  5, -1,
                                   -1,  6,  7,  8, -1],
                                  [-1, -1, -1, -1, -1,
                                   -1,  9, 10, 11, 12,
                                   -1, 13, 14, 15, 16,
                                   -1, -1, -1, -1, -1]]))